The Quantum Exact Simulation Toolkit v4.0.0
Loading...
Searching...
No Matches

Functions for applying the one-qubit S, T and Hadamard gates. More...

Functions

void applyControlledHadamard (Qureg qureg, int control, int target)
 
void applyControlledS (Qureg qureg, int control, int target)
 
void applyControlledT (Qureg qureg, int control, int target)
 
void applyHadamard (Qureg qureg, int target)
 
void applyMultiControlledHadamard (Qureg qureg, int *controls, int numControls, int target)
 
void applyMultiControlledHadamard (Qureg qureg, std::vector< int > controls, int target)
 
void applyMultiControlledS (Qureg qureg, int *controls, int numControls, int target)
 
void applyMultiControlledS (Qureg qureg, std::vector< int > controls, int target)
 
void applyMultiControlledT (Qureg qureg, int *controls, int numControls, int target)
 
void applyMultiControlledT (Qureg qureg, std::vector< int > controls, int target)
 
void applyMultiStateControlledHadamard (Qureg qureg, int *controls, int *states, int numControls, int target)
 
void applyMultiStateControlledHadamard (Qureg qureg, std::vector< int > controls, std::vector< int > states, int target)
 
void applyMultiStateControlledS (Qureg qureg, int *controls, int *states, int numControls, int target)
 
void applyMultiStateControlledS (Qureg qureg, std::vector< int > controls, std::vector< int > states, int target)
 
void applyMultiStateControlledT (Qureg qureg, int *controls, int *states, int numControls, int target)
 
void applyMultiStateControlledT (Qureg qureg, std::vector< int > controls, std::vector< int > states, int target)
 
void applyS (Qureg qureg, int target)
 
void applyT (Qureg qureg, int target)
 

Detailed Description

Functions for applying the one-qubit S, T and Hadamard gates.

Function Documentation

◆ applyControlledHadamard()

void applyControlledHadamard ( Qureg qureg,
int control,
int target )
Note
Documentation for this function or struct is under construction!

Definition at line 699 of file operations.cpp.

699 {
700 validate_quregFields(qureg, __func__);
701 validate_controlAndTarget(qureg, control, target, __func__);
702
703 // harmlessly re-validates
704 applyMultiStateControlledHadamard(qureg, &control, nullptr, 1, target);
705}
void applyMultiStateControlledHadamard(Qureg qureg, int *controls, int *states, int numControls, int target)

◆ applyControlledS()

void applyControlledS ( Qureg qureg,
int control,
int target )
Note
Documentation for this function or struct is under construction!

Definition at line 597 of file operations.cpp.

597 {
598 validate_quregFields(qureg, __func__);
599 validate_controlAndTarget(qureg, control, target, __func__);
600
601 // harmlessly re-validates
602 applyMultiStateControlledS(qureg, &control, nullptr, 1, target);
603}
void applyMultiStateControlledS(Qureg qureg, int *controls, int *states, int numControls, int target)

◆ applyControlledT()

void applyControlledT ( Qureg qureg,
int control,
int target )
Note
Documentation for this function or struct is under construction!

Definition at line 648 of file operations.cpp.

648 {
649 validate_quregFields(qureg, __func__);
650 validate_controlAndTarget(qureg, control, target, __func__);
651
652 // harmlessly re-validates
653 applyMultiStateControlledT(qureg, &control, nullptr, 1, target);
654}
void applyMultiStateControlledT(Qureg qureg, int *controls, int *states, int numControls, int target)

◆ applyHadamard()

void applyHadamard ( Qureg qureg,
int target )
Note
Documentation for this function or struct is under construction!

Definition at line 691 of file operations.cpp.

691 {
692 validate_quregFields(qureg, __func__);
693 validate_target(qureg, target, __func__);
694
695 // harmlessly re-validates
696 applyMultiStateControlledHadamard(qureg, nullptr, nullptr, 0, target);
697}

Referenced by applyQuantumFourierTransform().

◆ applyMultiControlledHadamard() [1/2]

void applyMultiControlledHadamard ( Qureg qureg,
int * controls,
int numControls,
int target )
Note
Documentation for this function or struct is under construction!

Definition at line 707 of file operations.cpp.

707 {
708 validate_quregFields(qureg, __func__);
709 validate_controlsAndTarget(qureg, controls, numControls, target, __func__);
710
711 // harmlessly re-validates
712 applyMultiStateControlledHadamard(qureg, controls, nullptr, numControls, target);
713}

Referenced by applyMultiControlledHadamard().

◆ applyMultiControlledHadamard() [2/2]

void applyMultiControlledHadamard ( Qureg qureg,
std::vector< int > controls,
int target )
Warning
This function has not yet been unit tested and may contain bugs. Please use with caution!
Attention
This function's input validation has not yet been unit tested, so erroneous usage may produce unexpected output. Please use with caution!
Note
Documentation for this function or struct is under construction!
Remarks
This function is only available in C++.

Definition at line 727 of file operations.cpp.

727 {
728
729 applyMultiControlledHadamard(qureg, controls.data(), controls.size(), target);
730}
void applyMultiControlledHadamard(Qureg qureg, int *controls, int numControls, int target)

◆ applyMultiControlledS() [1/2]

void applyMultiControlledS ( Qureg qureg,
int * controls,
int numControls,
int target )
Note
Documentation for this function or struct is under construction!

Definition at line 605 of file operations.cpp.

605 {
606 validate_quregFields(qureg, __func__);
607 validate_controlsAndTarget(qureg, controls, numControls, target, __func__);
608
609 // harmlessly re-validates
610 applyMultiStateControlledS(qureg, controls, nullptr, numControls, target);
611}

Referenced by applyMultiControlledS().

◆ applyMultiControlledS() [2/2]

void applyMultiControlledS ( Qureg qureg,
std::vector< int > controls,
int target )
Warning
This function has not yet been unit tested and may contain bugs. Please use with caution!
Attention
This function's input validation has not yet been unit tested, so erroneous usage may produce unexpected output. Please use with caution!
Note
Documentation for this function or struct is under construction!
Remarks
This function is only available in C++.

Definition at line 621 of file operations.cpp.

621 {
622
623 applyMultiControlledS(qureg, controls.data(), controls.size(), target);
624}
void applyMultiControlledS(Qureg qureg, int *controls, int numControls, int target)

◆ applyMultiControlledT() [1/2]

void applyMultiControlledT ( Qureg qureg,
int * controls,
int numControls,
int target )
Note
Documentation for this function or struct is under construction!

Definition at line 656 of file operations.cpp.

656 {
657 validate_quregFields(qureg, __func__);
658 validate_controlsAndTarget(qureg, controls, numControls, target, __func__);
659
660 // harmlessly re-validates
661 applyMultiStateControlledT(qureg, controls, nullptr, numControls, target);
662}

Referenced by applyMultiControlledT().

◆ applyMultiControlledT() [2/2]

void applyMultiControlledT ( Qureg qureg,
std::vector< int > controls,
int target )
Warning
This function has not yet been unit tested and may contain bugs. Please use with caution!
Attention
This function's input validation has not yet been unit tested, so erroneous usage may produce unexpected output. Please use with caution!
Note
Documentation for this function or struct is under construction!
Remarks
This function is only available in C++.

Definition at line 672 of file operations.cpp.

672 {
673
674 applyMultiControlledT(qureg, controls.data(), controls.size(), target);
675}
void applyMultiControlledT(Qureg qureg, int *controls, int numControls, int target)

◆ applyMultiStateControlledHadamard() [1/2]

void applyMultiStateControlledHadamard ( Qureg qureg,
int * controls,
int * states,
int numControls,
int target )
Note
Documentation for this function or struct is under construction!

Definition at line 715 of file operations.cpp.

715 {
716
717 qcomp a = 1/std::sqrt(2);
718 CompMatr1 matr = getCompMatr1({
719 {a, a},
720 {a,-a}});
721
722 validateAndApplyAnyCtrlAnyTargUnitaryMatrix(qureg, controls, states, numControls, &target, 1, matr, __func__);
723}
static CompMatr1 getCompMatr1(qcomp **in)
Definition matrices.h:311

Referenced by applyControlledHadamard(), applyHadamard(), applyMultiControlledHadamard(), and applyMultiStateControlledHadamard().

◆ applyMultiStateControlledHadamard() [2/2]

void applyMultiStateControlledHadamard ( Qureg qureg,
std::vector< int > controls,
std::vector< int > states,
int target )
Warning
This function has not yet been unit tested and may contain bugs. Please use with caution!
Attention
This function's input validation has not yet been unit tested, so erroneous usage may produce unexpected output. Please use with caution!
Note
Documentation for this function or struct is under construction!
Remarks
This function is only available in C++.

Definition at line 732 of file operations.cpp.

732 {
733 validate_controlsMatchStates(controls.size(), states.size(), __func__);
734
735 applyMultiStateControlledHadamard(qureg, controls.data(), states.data(), controls.size(), target);
736}

◆ applyMultiStateControlledS() [1/2]

void applyMultiStateControlledS ( Qureg qureg,
int * controls,
int * states,
int numControls,
int target )
Note
Documentation for this function or struct is under construction!

Definition at line 613 of file operations.cpp.

613 {
614
615 DiagMatr1 matr = getDiagMatr1({1, 1_i});
616 validateAndApplyAnyCtrlAnyTargUnitaryMatrix(qureg, controls, states, numControls, &target, 1, matr, __func__);
617}
static DiagMatr1 getDiagMatr1(qcomp *in)
Definition matrices.h:345

Referenced by applyControlledS(), applyMultiControlledS(), applyMultiStateControlledS(), and applyS().

◆ applyMultiStateControlledS() [2/2]

void applyMultiStateControlledS ( Qureg qureg,
std::vector< int > controls,
std::vector< int > states,
int target )
Warning
This function has not yet been unit tested and may contain bugs. Please use with caution!
Attention
This function's input validation has not yet been unit tested, so erroneous usage may produce unexpected output. Please use with caution!
Note
Documentation for this function or struct is under construction!
Remarks
This function is only available in C++.

Definition at line 626 of file operations.cpp.

626 {
627 validate_controlsMatchStates(controls.size(), states.size(), __func__);
628
629 applyMultiStateControlledS(qureg, controls.data(), states.data(), controls.size(), target);
630}

◆ applyMultiStateControlledT() [1/2]

void applyMultiStateControlledT ( Qureg qureg,
int * controls,
int * states,
int numControls,
int target )
Note
Documentation for this function or struct is under construction!

Definition at line 664 of file operations.cpp.

664 {
665
666 DiagMatr1 matr = getDiagMatr1({1, 1/std::sqrt(2) + 1_i/std::sqrt(2)});
667 validateAndApplyAnyCtrlAnyTargUnitaryMatrix(qureg, controls, states, numControls, &target, 1, matr, __func__);
668}

Referenced by applyControlledT(), applyMultiControlledT(), applyMultiStateControlledT(), and applyT().

◆ applyMultiStateControlledT() [2/2]

void applyMultiStateControlledT ( Qureg qureg,
std::vector< int > controls,
std::vector< int > states,
int target )
Warning
This function has not yet been unit tested and may contain bugs. Please use with caution!
Attention
This function's input validation has not yet been unit tested, so erroneous usage may produce unexpected output. Please use with caution!
Note
Documentation for this function or struct is under construction!
Remarks
This function is only available in C++.

Definition at line 677 of file operations.cpp.

677 {
678 validate_controlsMatchStates(controls.size(), states.size(), __func__);
679
680 applyMultiStateControlledT(qureg, controls.data(), states.data(), controls.size(), target);
681}

◆ applyS()

void applyS ( Qureg qureg,
int target )
Note
Documentation for this function or struct is under construction!

Definition at line 589 of file operations.cpp.

589 {
590 validate_quregFields(qureg, __func__);
591 validate_target(qureg, target, __func__);
592
593 // harmlessly re-validates
594 applyMultiStateControlledS(qureg, nullptr, nullptr, 0, target);
595}

◆ applyT()

void applyT ( Qureg qureg,
int target )
Note
Documentation for this function or struct is under construction!

Definition at line 640 of file operations.cpp.

640 {
641 validate_quregFields(qureg, __func__);
642 validate_target(qureg, target, __func__);
643
644 // harmlessly re-validates
645 applyMultiStateControlledT(qureg, nullptr, nullptr, 0, target);
646}