| 3165 | |
| 3166 | |
| 3167 | shared_ptr<CoefficientFunction> DiffJacobi (const CoefficientFunction * var, T_DJC & cache) const override |
| 3168 | { |
| 3169 | auto thisptr = const_pointer_cast<CoefficientFunction>(this->shared_from_this()); |
| 3170 | if (cache.find(thisptr) != cache.end()) |
| 3171 | return cache[thisptr]; |
| 3172 | |
| 3173 | if (this == var) |
| 3174 | return make_shared<ConstantCoefficientFunction> (1); |
| 3175 | |
| 3176 | shared_ptr<CoefficientFunction> dv1v1; |
| 3177 | int dimip = c1->Dimension(); |
| 3178 | int dimvar = var->Dimension(); |
| 3179 | |
| 3180 | auto vc1 = c1->Reshape( dimip ); |
| 3181 | |
| 3182 | if (c1.get() == var) |
| 3183 | dv1v1 = c1; |
| 3184 | else |
| 3185 | { |
| 3186 | auto dvc1 = c1->DiffJacobi (var, cache); |
| 3187 | dv1v1 = dvc1 -> Reshape(dimip, dimvar) -> Transpose() * vc1; |
| 3188 | dv1v1 = dv1v1 -> Reshape (var->Dimensions()); |
| 3189 | } |
| 3190 | auto res = (1.0 / const_cast<CoefficientFunction*>((CoefficientFunction*)this)->shared_from_this()) * dv1v1; |
| 3191 | cache[thisptr] = res; |
| 3192 | return res; |
| 3193 | } |
| 3194 | |
| 3195 | |
| 3196 |
nothing calls this directly
no test coverage detected