| 4533 | } |
| 4534 | |
| 4535 | shared_ptr<CoefficientFunction> DiffJacobi (const CoefficientFunction * var, T_DJC & cache) const override |
| 4536 | { |
| 4537 | auto thisptr = const_pointer_cast<CoefficientFunction>(this->shared_from_this()); |
| 4538 | if (cache.find(thisptr) != cache.end()) |
| 4539 | return cache[thisptr]; |
| 4540 | |
| 4541 | if (this == var) return make_shared<ConstantCoefficientFunction>(1); |
| 4542 | auto diffc1 = c1->DiffJacobi (var, cache); |
| 4543 | Array<int> vardims = Array<int> (var->Dimensions()); |
| 4544 | Array<int> dist(vardims.Size()); |
| 4545 | int prod = 1; |
| 4546 | for (int i = dist.Size()-1; i >= 0; i--) |
| 4547 | { |
| 4548 | dist[i] = prod; |
| 4549 | prod *= vardims[i]; |
| 4550 | } |
| 4551 | auto res = MakeSubTensorCoefficientFunction(diffc1, comp*var->Dimension(), std::move(vardims), std::move(dist)); |
| 4552 | cache[thisptr] = res; |
| 4553 | return res; |
| 4554 | } |
| 4555 | |
| 4556 | |
| 4557 | /* |
nothing calls this directly
no test coverage detected