#include <oxstd.h>
#import <maximize>

fRosenbrock(const vP, const adFunc, const avScore,
    const amHess)
{
    adFunc[0] = -100 * (vP[1] - vP[0] .^ 2) .^ 2
        - (1 - vP[0]) .^ 2;              // function value

return 1;                           // 1 indicates success
}

main()
{
    decl vp, dfunc;

    vp = zeros(2, 1);                   // starting values

    MaxBFGS(fRosenbrock, &vp, &dfunc, 0, TRUE);

    print("function value is ", dfunc, 
        " at parameter value:", vp');
}
