| 637 | } |
| 638 | |
| 639 | shared_ptr<CoefficientFunction> |
| 640 | DiffJacobi (const CoefficientFunction * var, typename BASE::T_DJC & cache) const override |
| 641 | { |
| 642 | auto thisptr = const_pointer_cast<CoefficientFunction>(this->shared_from_this()); |
| 643 | if (cache.find(thisptr) != cache.end()) |
| 644 | return cache[thisptr]; |
| 645 | |
| 646 | if (this == var) return make_shared<ConstantCoefficientFunction>(1); |
| 647 | if (c1.get() == var) return CofactorCF (c1); |
| 648 | auto input = c1->InputCoefficientFunctions(); |
| 649 | if (input.Size() == 0) return ZeroCF(var->Dimensions()); |
| 650 | |
| 651 | auto cof = CofactorCF(c1) -> Reshape( 1, D*D ); |
| 652 | auto diffc1 = c1->DiffJacobi (var, cache) -> Reshape( D*D, var->Dimension() ); |
| 653 | auto prod = cof * diffc1; |
| 654 | auto res = prod->Reshape(var->Dimensions()); |
| 655 | |
| 656 | /* |
| 657 | auto cof = CofactorCF(c1) -> Reshape( D*D ); |
| 658 | auto diffc1 = c1->DiffJacobi (var, cache) -> Reshape( D*D, var->Dimension() ); |
| 659 | auto res = diffc1->Transpose() * cof; |
| 660 | */ |
| 661 | |
| 662 | cache[thisptr] = res; |
| 663 | return res; |
| 664 | } |
| 665 | |
| 666 | |
| 667 | }; |
nothing calls this directly
no test coverage detected