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

Method DiffJacobi

fem/coefficient_matrix.cpp:435–459  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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