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

Method Diff

fem/tensorcoefficient.cpp:1370–1397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1368 }
1369
1370 shared_ptr<CoefficientFunction>
1371 EinsumCoefficientFunction::Diff(
1372 const CoefficientFunction *var,
1373 shared_ptr<CoefficientFunction> dir) const
1374 {
1375 if (this == var)
1376 return dir;
1377
1378 // IMPORTANT NOTE:
1379 // use "original_index_signature" and "original_inputs" as only
1380 // these protect variables etc, i.e. they do not carry any
1381 // optimization!
1382
1383 auto dres = ZeroCF(Array<int>{Dimensions()});
1384
1385 for (size_t i: Range(original_inputs.Size()))
1386 {
1387 auto new_inputs{original_inputs};
1388 new_inputs[i] = original_inputs[i]->Diff(var, dir);
1389 if (new_inputs[i]->IsZeroCF())
1390 continue;
1391
1392 dres = dres + EinsumCF(original_index_signature, new_inputs, options);
1393 }
1394 // TODO: great potential for optimization when equivalent objects are
1395 // identified in Compile
1396 return dres;
1397 }
1398
1399 shared_ptr<CoefficientFunction>
1400 EinsumCoefficientFunction::DiffJacobi(

Callers

nothing calls this directly

Calls 6

ZeroCFFunction · 0.85
DimensionsFunction · 0.85
EinsumCFFunction · 0.85
RangeFunction · 0.50
SizeMethod · 0.45
IsZeroCFMethod · 0.45

Tested by

no test coverage detected