MCPcopy Create free account
hub / github.com/Derious/cuMPC / model

Method model

dependence/eigen-3.4.0/test/sparseLM.cpp:29–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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;

Callers 1

initPointsMethod · 0.95

Calls 7

xFunction · 0.50
vFunction · 0.50
yFunction · 0.50
uFunction · 0.50
powFunction · 0.50
sizeMethod · 0.45
setZeroMethod · 0.45

Tested by

no test coverage detected