| 1221 | |
| 1222 | |
| 1223 | shared_ptr<CoefficientFunction> InverseCF (shared_ptr<CoefficientFunction> coef) |
| 1224 | { |
| 1225 | auto dims = coef->Dimensions(); |
| 1226 | if (dims.Size() != 2) throw Exception("Inverse of non-matrix"); |
| 1227 | if (dims[0] != dims[1]) throw Exception("Inverse of non-quadratic matrix"); |
| 1228 | switch (dims[0]) |
| 1229 | { |
| 1230 | case 1: return make_shared<InverseCoefficientFunction<1>> (coef); |
| 1231 | case 2: return make_shared<InverseCoefficientFunction<2>> (coef); |
| 1232 | case 3: return make_shared<InverseCoefficientFunction<3>> (coef); |
| 1233 | default: |
| 1234 | return make_shared<InverseCoefficientFunctionAnyDim>(coef); |
| 1235 | } |
| 1236 | } |
| 1237 | |
| 1238 | |
| 1239 |
no test coverage detected