| 433 | } |
| 434 | |
| 435 | shared_ptr<CoefficientFunction> DiffJacobi(const CoefficientFunction *var, |
| 436 | T_DJC &cache) const override |
| 437 | { |
| 438 | auto thisptr = const_pointer_cast<CoefficientFunction>(this->shared_from_this()); |
| 439 | if (cache.find(thisptr) != cache.end()) |
| 440 | return cache[thisptr]; |
| 441 | |
| 442 | if (this == var) |
| 443 | return IdentityCF(this->Dimensions()); |
| 444 | |
| 445 | auto diffc1 = c1->DiffJacobi (var, cache); |
| 446 | auto inv1 = thisptr; |
| 447 | |
| 448 | const int D = c1->Dimensions()[0]; |
| 449 | Array<int> dimres { D, D }; |
| 450 | dimres += var->Dimensions(); |
| 451 | |
| 452 | auto prod1 = -inv1 * diffc1->Reshape( D, -1 ); |
| 453 | auto prod1r = prod1 -> Reshape( Array<int> (dimres) ); |
| 454 | auto trans = prod1r -> TensorTranspose( 0, 1 ); |
| 455 | auto prod2 = inv1->Transpose() * trans -> Reshape( D, -1 ); |
| 456 | auto res = prod2 -> Reshape( Array<int> (dimres) ) -> TensorTranspose( 0, 1); |
| 457 | cache[thisptr] = res; |
| 458 | return res; |
| 459 | } |
| 460 | }; |
| 461 | |
| 462 |
nothing calls this directly
no test coverage detected