| 188 | |
| 189 | template <typename T> |
| 190 | T rosen ( const matrix<T,2,1>& m) |
| 191 | { |
| 192 | const T x = m(0); |
| 193 | const T y = m(1); |
| 194 | |
| 195 | using std::pow; |
| 196 | // compute Rosenbrock's function and return the result |
| 197 | return 100.0*pow(y - x*x,2) + pow(1 - x,2); |
| 198 | } |
| 199 | |
| 200 | template <typename T> |
| 201 | T rosen_residual (int i, const matrix<T,2,1>& m) |