| 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) |
no test coverage detected