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

Function CofactorCF

fem/coefficient_matrix.cpp:1280–1297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1278 }
1279
1280 shared_ptr<CoefficientFunction> CofactorCF (shared_ptr<CoefficientFunction> coef)
1281 {
1282 if (coef->IsZeroCF())
1283 return coef;
1284
1285 auto dims = coef->Dimensions();
1286 if (dims.Size() != 2) throw Exception("Cofactor of non-matrix");
1287 if (dims[0] != dims[1]) throw Exception("Cofactor of non-quadratic matrix");
1288 switch (dims[0])
1289 {
1290 case 1: return make_shared<CofactorCoefficientFunction<1>> (coef);
1291 case 2: return make_shared<CofactorCoefficientFunction<2>> (coef);
1292 case 3: return make_shared<CofactorCoefficientFunction<3>> (coef);
1293 case 4: return make_shared<CofactorCoefficientFunction<4>> (coef);
1294 default:
1295 throw Exception("Cofactor of matrix of size "+ToString(dims[0]) + " not available");
1296 }
1297 }
1298
1299
1300 shared_ptr<CoefficientFunction> TraceCF (shared_ptr<CoefficientFunction> coef)

Callers 4

DiffMethod · 0.85
DiffJacobiMethod · 0.85
DiffMethod · 0.85

Calls 4

ToStringFunction · 0.85
DimensionsMethod · 0.80
IsZeroCFMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected