MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / DiffJacobi

Method DiffJacobi

fem/coefficient_matrix.cpp:180–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

IdentityCFFunction · 0.85
findMethod · 0.80
DimensionsMethod · 0.80
shared_from_thisMethod · 0.45
endMethod · 0.45
DiffJacobiMethod · 0.45

Tested by

no test coverage detected