Added optimization function

The fmincg is an implementation of the conjugate gradiente optimization
that came form the Coursera's ML class (ml-class.org).