| 543 | |
| 544 | template <NumQubitsFlag Targs, ArgsFlag Args> |
| 545 | qmatrix getReferenceMatrix(auto matrixRefGen, vector<int> targs, auto additionalArgs) { |
| 546 | |
| 547 | if constexpr (Args == none && Targs != any) |
| 548 | return matrixRefGen; |
| 549 | |
| 550 | if constexpr (Args == none && Targs == any) |
| 551 | return matrixRefGen(targs.size()); |
| 552 | |
| 553 | if constexpr (Args == scalar && Targs != any) { |
| 554 | qreal angle = std::get<0>(additionalArgs); |
| 555 | return matrixRefGen(angle); |
| 556 | } |
| 557 | |
| 558 | if constexpr (Args == scalar && Targs == any) { |
| 559 | qreal angle = std::get<0>(additionalArgs); |
| 560 | return matrixRefGen(angle, targs.size()); |
| 561 | } |
| 562 | |
| 563 | if constexpr (Args == axisrots) { |
| 564 | qreal angle = std::get<0>(additionalArgs); |
| 565 | qreal x = std::get<1>(additionalArgs); |
| 566 | qreal y = std::get<2>(additionalArgs); |
| 567 | qreal z = std::get<3>(additionalArgs); |
| 568 | return getExponentialOfNormalisedPauliVector(angle, x, y, z); |
| 569 | } |
| 570 | |
| 571 | if constexpr (Args == compmatr || Args == diagmatr) { |
| 572 | auto apiMatrix = std::get<0>(additionalArgs); |
| 573 | return getMatrix(apiMatrix); |
| 574 | } |
| 575 | |
| 576 | if constexpr (Args == diagpower) { |
| 577 | auto apiMatrix = std::get<0>(additionalArgs); |
| 578 | qmatrix diag = getMatrix(apiMatrix); |
| 579 | qcomp power = std::get<1>(additionalArgs); |
| 580 | return getPowerOfDiagonalMatrix(diag, power); |
| 581 | } |
| 582 | |
| 583 | if constexpr (Args == paulistr) { |
| 584 | PauliStr str = std::get<0>(additionalArgs); |
| 585 | return getMatrix(str, targs); |
| 586 | } |
| 587 | |
| 588 | if constexpr (Args == pauligad) { |
| 589 | PauliStr str = std::get<0>(additionalArgs); |
| 590 | qreal angle = std::get<1>(additionalArgs); |
| 591 | qmatrix matr = getMatrix(str, targs); |
| 592 | return getExponentialOfPauliMatrix(angle, matr); |
| 593 | } |
| 594 | } |
| 595 | |
| 596 | |
| 597 | /* |
nothing calls this directly
no test coverage detected