This function computes the Hessian matrix for the rosen() function. This is the matrix of second derivatives.
| 70 | // This function computes the Hessian matrix for the rosen() function. This is |
| 71 | // the matrix of second derivatives. |
| 72 | matrix<double> rosen_hessian (const column_vector& m) |
| 73 | { |
| 74 | const double x = m(0); |
| 75 | const double y = m(1); |
| 76 | |
| 77 | matrix<double> res(2,2); |
| 78 | |
| 79 | // now compute the second derivatives |
| 80 | res(0,0) = 1200*x*x - 400*y + 2; // second derivative with respect to x |
| 81 | res(1,0) = res(0,1) = -400*x; // derivative with respect to x and y |
| 82 | res(1,1) = 200; // second derivative with respect to y |
| 83 | return res; |
| 84 | } |
| 85 | |
| 86 | // ---------------------------------------------------------------------------------------- |
| 87 |
no outgoing calls
no test coverage detected