| 178 | } |
| 179 | |
| 180 | shared_ptr<CoefficientFunction> DiffJacobi (const CoefficientFunction * var, T_DJC & cache) const override |
| 181 | { |
| 182 | auto thisptr = const_pointer_cast<CoefficientFunction>(this->shared_from_this()); |
| 183 | if (cache.find(thisptr) != cache.end()) |
| 184 | return cache[thisptr]; |
| 185 | |
| 186 | if (this == var) |
| 187 | return IdentityCF(this->Dimensions()); |
| 188 | |
| 189 | auto diffc1 = c1->DiffJacobi (var, cache); |
| 190 | auto inv1 = thisptr; |
| 191 | |
| 192 | Array<int> dimres { D, D }; |
| 193 | dimres += var->Dimensions(); |
| 194 | |
| 195 | auto prod1 = -inv1 * diffc1->Reshape( D, -1 ); |
| 196 | auto prod1r = prod1 -> Reshape( Array<int> (dimres) ); |
| 197 | auto trans = prod1r -> TensorTranspose( 0, 1 ); |
| 198 | auto prod2 = inv1->Transpose() * trans -> Reshape( D, -1 ); |
| 199 | auto res = prod2 -> Reshape( Array<int> (dimres) ) -> TensorTranspose( 0, 1); |
| 200 | cache[thisptr] = res; |
| 201 | return res; |
| 202 | } |
| 203 | }; |
| 204 | |
| 205 |
nothing calls this directly
no test coverage detected