| 4348 | } |
| 4349 | |
| 4350 | shared_ptr<CoefficientFunction> TransposeCF (shared_ptr<CoefficientFunction> coef) |
| 4351 | { |
| 4352 | if (coef->IsZeroCF()) |
| 4353 | { |
| 4354 | auto dims = coef->Dimensions(); |
| 4355 | if (dims.Size() == 2) |
| 4356 | coef->SetDimensions( Array( {dims[1], dims[0]}) ); |
| 4357 | else |
| 4358 | throw Exception("Transpose of non-matrix called"); |
| 4359 | return coef; |
| 4360 | } |
| 4361 | |
| 4362 | // if (coef.use_count() == 1) |
| 4363 | if (dynamic_pointer_cast<IdentityCoefficientFunction> (coef) && !coef->IsVariable()) |
| 4364 | return coef; |
| 4365 | |
| 4366 | return make_shared<TransposeCoefficientFunction> (coef); |
| 4367 | } |
| 4368 | |
| 4369 | |
| 4370 |
no test coverage detected