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 applyMultiControlledS (Qureg qureg, int *controls, int numControls, int target)
 
void applyMultiControlledT (Qureg qureg, int *controls, int numControls, int target)
 
void applyMultiStateControlledHadamard (Qureg qureg, int *controls, int *states, int numControls, int target)
 
void applyMultiStateControlledS (Qureg qureg, int *controls, int *states, int numControls, int target)
 
void applyMultiStateControlledT (Qureg qureg, int *controls, int *states, int numControls, 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 521 of file operations.cpp.

521 {
522 validate_quregFields(qureg, __func__);
523 validate_controlAndTarget(qureg, control, target, __func__);
524
525 // harmlessly re-validates
526 applyMultiStateControlledHadamard(qureg, &control, nullptr, 1, target);
527}
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 449 of file operations.cpp.

449 {
450 validate_quregFields(qureg, __func__);
451 validate_controlAndTarget(qureg, control, target, __func__);
452
453 // harmlessly re-validates
454 applyMultiStateControlledS(qureg, &control, nullptr, 1, target);
455}
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 485 of file operations.cpp.

485 {
486 validate_quregFields(qureg, __func__);
487 validate_controlAndTarget(qureg, control, target, __func__);
488
489 // harmlessly re-validates
490 applyMultiStateControlledT(qureg, &control, nullptr, 1, target);
491}
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 513 of file operations.cpp.

513 {
514 validate_quregFields(qureg, __func__);
515 validate_target(qureg, target, __func__);
516
517 // harmlessly re-validates
518 applyMultiStateControlledHadamard(qureg, nullptr, nullptr, 0, target);
519}

Referenced by applyQuantumFourierTransform().

◆ applyMultiControlledHadamard()

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

Definition at line 529 of file operations.cpp.

529 {
530 validate_quregFields(qureg, __func__);
531 validate_controlsAndTarget(qureg, controls, numControls, target, __func__);
532
533 // harmlessly re-validates
534 applyMultiStateControlledHadamard(qureg, controls, nullptr, numControls, target);
535}

◆ applyMultiControlledS()

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

Definition at line 457 of file operations.cpp.

457 {
458 validate_quregFields(qureg, __func__);
459 validate_controlsAndTarget(qureg, controls, numControls, target, __func__);
460
461 // harmlessly re-validates
462 applyMultiStateControlledS(qureg, controls, nullptr, numControls, target);
463}

◆ applyMultiControlledT()

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

Definition at line 493 of file operations.cpp.

493 {
494 validate_quregFields(qureg, __func__);
495 validate_controlsAndTarget(qureg, controls, numControls, target, __func__);
496
497 // harmlessly re-validates
498 applyMultiStateControlledT(qureg, controls, nullptr, numControls, target);
499}

◆ applyMultiStateControlledHadamard()

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 537 of file operations.cpp.

537 {
538
539 qcomp a = 1/std::sqrt(2);
540 CompMatr1 matr = getCompMatr1({
541 {a, a},
542 {a,-a}});
543
544 validateAndApplyAnyCtrlAnyTargUnitaryMatrix(qureg, controls, states, numControls, &target, 1, matr, __func__);
545}
static CompMatr1 getCompMatr1(qcomp **in)
Definition matrices.h:304

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

◆ applyMultiStateControlledS()

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 465 of file operations.cpp.

465 {
466
467 DiagMatr1 matr = getDiagMatr1({1, 1_i});
468 validateAndApplyAnyCtrlAnyTargUnitaryMatrix(qureg, controls, states, numControls, &target, 1, matr, __func__);
469}
static DiagMatr1 getDiagMatr1(qcomp *in)
Definition matrices.h:338

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

◆ applyMultiStateControlledT()

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 501 of file operations.cpp.

501 {
502
503 DiagMatr1 matr = getDiagMatr1({1, 1/std::sqrt(2) + 1_i/std::sqrt(2)});
504 validateAndApplyAnyCtrlAnyTargUnitaryMatrix(qureg, controls, states, numControls, &target, 1, matr, __func__);
505}

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

◆ applyS()

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

Definition at line 441 of file operations.cpp.

441 {
442 validate_quregFields(qureg, __func__);
443 validate_target(qureg, target, __func__);
444
445 // harmlessly re-validates
446 applyMultiStateControlledS(qureg, nullptr, nullptr, 0, target);
447}

◆ applyT()

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

Definition at line 477 of file operations.cpp.

477 {
478 validate_quregFields(qureg, __func__);
479 validate_target(qureg, target, __func__);
480
481 // harmlessly re-validates
482 applyMultiStateControlledT(qureg, nullptr, nullptr, 0, target);
483}