26 #if defined (__WAT32__) || defined(_MSC_VER)
30 #include <iostream.hpp>
39 extern "C" void onintr(
int k);
43 #include <iostream.hxx>
45 #if defined (_MSC_VER)
51 extern "C" void onintr(
int k);
69 double& f=(
double&) _f;
73 cout <<
"On entry to fmin: " << *
this <<
endl;
77 #if !defined (_MSC_VER)
78 #if defined( __SUN__) && !(defined __GNU__)
87 signal(SIGINT, (SIG_PF)&
onintr);
105 if (disp_inited == 0)
122 cerr <<
"Error -- the number of active parameters"
123 " fmin must be > 0\n";
128 cerr <<
"Error -- minimum valid index"
129 " for independent_variables in fmin must be 1\n"
130 <<
" it is " << x.
indexmin() <<
"\n";
133 if (x.
size() <
static_cast<unsigned int>(
n))
135 cerr <<
"Error -- the size of the independent_variables"
136 " which is " << x.
size() <<
" must be >= " <<
n <<
"\n"
137 <<
" the number of independent variables in fmin\n";
142 cerr <<
"Error -- minimum valid index"
143 " for the gradient vector in fmin must be 1\n"
144 <<
" it is " << g.
indexmin() <<
"\n";
147 if (g.
size() <
static_cast<unsigned int>(
n))
149 cerr <<
"Error -- the size of the gradient vector"
150 " which is " << g.
size() <<
" must be >=\n"
151 <<
" the number of independent variables in fmin\n";
158 for (
i=1;
i< 11;
i++)
189 for (
i=1;
i<=
n;
i++)
202 for (
i=1;
i<=9;
i++)
208 for (
i=1;
i<=
n;
i++)
224 if (
llog)
goto label7010;
225 #if !defined (_MSC_VER) && !defined (__GNUC__)
231 ad_printf(
"%d variables; iteration %ld; function evaluation %ld\n",
233 ad_printf(
"Function value %12.4le; maximum gradient component mag %12.4le\n",
269 cout <<
"Kludge didn't work" <<
endl;
326 #if defined(_MSC_VER)
332 #if defined(__DJGPP__)
333 int c = toupper(getxkey());
335 int c = toupper(
getch());
349 if ( c ==
'Q'|| c ==
'N')
368 ad_printf(
" ic > imax in fminim is answer attained ?\n" );
377 for (
i=1;
i<=
n;
i++)
413 z=1.0-(gys+
zz-
z)/(2.0*
zz+gys-
gs);
414 if (
fabs(
fy-1.e+95) < 1.e-66)
469 if (
link == 1)
goto label60;
470 if (
link == 2)
goto label65;
478 ad_printf(
"Function minimizer not making progress ... is minimum attained?\n");
484 ad_printf(
"*** grad transpose times delta x greater >= 0\n"
485 " --- convergence critera may be too strict\n");
489 # if defined (_MSC_VER) && !defined (__WAT32__)
496 ad_printf(
"Maximum number of function evaluations exceeded");
504 if(iprint == 0)
goto label777;
506 ad_printf(
"%d variables; iteration %ld; function evaluation %ld\n",
508 ad_printf(
"Function value %12.4le; maximum gradient component mag %12.4le\n",
516 if (
ad_printf) (*ad_printf)(
"Final values of h in fmin:\n");
528 # if defined (_MSC_VER) && !defined (__WAT32__)
537 # if defined (_MSC_VER) && !defined (__WAT32__)
547 ad_printf(
"*** hessian not positive definite\n");
587 xrho(k1)=1./(y(k1)*s(k1));
599 alpha(i-lb)=xrho(i1)*(s(i1)*t);
601 t-=alpha(i-lb)*y(i1);
607 r+= (alpha(i-lb)-xrho(i1)*(y(i1)*r)) * s(i1);
void fmmdisp(const dvector &x, const dvector &g, const int &nvar, int scroll_flag, int noprintx)
Description not yet available.
void derch(const double &_f, const dvector &_x, const dvector &_gg, int n, const int &_ireturn)
Description not yet available.
void fmin(const double &f, const dvector &x, const dvector &g)
Description not yet available.
Vector of double precision numbers.
int indexmin() const
Get minimum valid index.
void clrscr()
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
df1_two_variable fabs(const df1_two_variable &x)
dvector update(int nvar, int iter, int m, const dvector &g, const dmatrix &xalpha, dmatrix &y, const dvector &x, const dvector &xold, const dvector &gold, const dvector &xrho)
Description not yet available.
prnstream & endl(prnstream &)
Description not yet available.
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
dvariable beta(const prevariable &a, const prevariable &b)
Beta density function.
Description not yet available.
double norm2(const d3_array &a)
Return sum of squared elements in a.
unsigned int size() const
Get number of elements in array.
double dafsqrt(double x)
Robust square root.
int ad_printf(FILE *stream, const char *format, Args...args)