| 27 | { } |
| 28 | |
| 29 | VectorType model(const VectorType& uv, VectorType& x) |
| 30 | { |
| 31 | VectorType y; //Change this to use expression template |
| 32 | int m = Base::values(); |
| 33 | int n = Base::inputs(); |
| 34 | eigen_assert(uv.size()%2 == 0); |
| 35 | eigen_assert(uv.size() == n); |
| 36 | eigen_assert(x.size() == m); |
| 37 | y.setZero(m); |
| 38 | int half = n/2; |
| 39 | VectorBlock<const VectorType> u(uv, 0, half); |
| 40 | VectorBlock<const VectorType> v(uv, half, half); |
| 41 | Scalar coeff; |
| 42 | for (int j = 0; j < m; j++) |
| 43 | { |
| 44 | for (int i = 0; i < half; i++) |
| 45 | { |
| 46 | coeff = (x(j)-i)/v(i); |
| 47 | coeff *= coeff; |
| 48 | if (coeff < 1. && coeff > 0.) |
| 49 | y(j) += u(i)*std::pow((1-coeff), 2); |
| 50 | } |
| 51 | } |
| 52 | return y; |
| 53 | } |
| 54 | void initPoints(VectorType& uv_ref, VectorType& x) |
| 55 | { |
| 56 | m_x = x; |