| 4589 | |
| 4590 | |
| 4591 | shared_ptr<CoefficientFunction> |
| 4592 | MakeComponentCoefficientFunction (shared_ptr<CoefficientFunction> c1, int comp) |
| 4593 | { |
| 4594 | if (c1->IsZeroCF()) |
| 4595 | return ZeroCF( Array<int>({}) ); |
| 4596 | |
| 4597 | if (c1->GetDescription() == "unary operation ' '" && !c1->IsVariable()) |
| 4598 | return MakeComponentCoefficientFunction(c1->InputCoefficientFunctions()[0], comp); |
| 4599 | |
| 4600 | if (c1->GetDescription() == "VectorialCoefficientFunction") |
| 4601 | { |
| 4602 | int ci = 0; |
| 4603 | int dim = 0; |
| 4604 | auto coefs = c1->InputCoefficientFunctions(); |
| 4605 | while(dim<=comp) |
| 4606 | { |
| 4607 | int dim_last = dim; |
| 4608 | if(dim == comp && coefs[ci]->Dimension() == 1) |
| 4609 | return coefs[ci]; |
| 4610 | dim += coefs[ci]->Dimension(); |
| 4611 | if(dim>comp) |
| 4612 | return MakeComponentCoefficientFunction( coefs[ci], comp-dim_last ); |
| 4613 | ci++; |
| 4614 | } |
| 4615 | } |
| 4616 | return make_shared<ComponentCoefficientFunction> (c1, comp); |
| 4617 | } |
| 4618 | |
| 4619 | |
| 4620 | // ********************** SubTensorCoefficientFunction ********************** |
no test coverage detected