Tuesday, June 20, 2017

Appunti di Informatica Libera [pdf]

Ecco qui il link al PDF di Appunti di Informatica Libera (precedentemente noti come Appunti Linux). L'ultimo aggiornamento รจ del 11.11.2013.
Opera monumentale!

ftp://na.mirror.garr.it/mirrors/appuntilinux/2013.11.11/a2-2013.11.11.pdf

http://a2.pluto.it/a2/a0.pdf


Altri formati:

ftp://na.mirror.garr.it/mirrors/appuntilinux/2013.11.11/


Online

Sunday, May 28, 2017

tic and toc functions in C++ (millisecond resolution)

This is a newer version of my original post about Matlab-like tic/toc functions in C++

These new versions of the TIC/TOC functions have millisecond resolution while the old ones rounded the time difference to the seconds.

Here is the the new  tic_toc.h header:


#ifndef TIC_TOC_H
#define TIC_TOC_H


#include <iostream>
#include <chrono>


typedef std::chrono::high_resolution_clock Clock;
typedef std::chrono::milliseconds milliseconds;


static Clock::time_point t0 = Clock::now();

void tic()
{
t0 = Clock::now();
}


void toc()
{
    Clock::time_point t1 = Clock::now();
    milliseconds ms = std::chrono::duration_cast<milliseconds>(t1 - t0);
    std::cout <<"Elapsed time is "<< ms.count() << " milliseconds\n";
}


#endif

// happy coding and performance testing :)

Thursday, April 13, 2017

Undefined functions while using struct and optim packages in Octave

If you have encountered errors like these in octave:


error: 'cell2fields' undefined near line 939 column 11
error: called from
    __nonlin_residmin__> at line -1 column -1
    __lm_svd__ at line 191 column 9
    __nonlin_residmin__ at line 1128 column 21
    nonlin_curvefit at line 83 column 18
    nlinfit at line 169 column 18



OR these

error: '__collect_constraints__' undefined near line 152 column 7
error: called from
    __nonlin_residmin__ at line 151 column 48
    nonlin_curvefit at line 83 column 18
    nlinfit at line 169 column 18



mean that NOT all the functions in the packages struct or optim have been correctly imported into Octave.


istread of importing the single folders in the Octave's path:


addpath('/home/eddie/octave/struct-1.0.14') % NOT ENOUGH!!!
addpath('/home/eddie/octave/optim-1.5.2')   % NOT ENOUGH!!!


just use the pkg command:


pkg load struct ;
pkg load optim ;

That's it. Happy scientific programming :)