mirror of https://github.com/intel/intel-qs.git
Fix typos in comments (#37)
Commit improve the quality of the comments without changing the code.
This commit is contained in:
parent
d7e757f914
commit
b2944cd2ac
|
@ -47,7 +47,7 @@ template void ConvertToBinary<std::size_t,unsigned> (std::size_t, std::vector<un
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Function to convert a binary number (expressed as vector) into a decimal number.
|
||||
/// The 0-componenet of the vector represents the least significant bit (i.e. associated
|
||||
/// The 0-component of the vector represents the least significant bit (i.e. associated
|
||||
/// to the factor 2^0 in power expension).
|
||||
template<typename T_bit, typename T_decimal>
|
||||
void ConvertToDecimal( std::vector<T_bit> &z , T_decimal &k )
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
// To distinguish between program qubits (used in the algorithm) and data qubits
|
||||
// (used in the representation of the quantum state), we use the term:
|
||||
// - 'position' to refer to data qubits
|
||||
// - 'qubit' ro refer to program qubits
|
||||
// - 'qubit' to refer to program qubits
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <class Type>
|
||||
|
@ -263,7 +263,7 @@ void QubitRegister<Type>::Apply1QubitGate(unsigned qubit, TM2x2<Type> const&m, G
|
|||
/// @param qubit index of the involved qubit
|
||||
/// @param theta rotation angle
|
||||
///
|
||||
/// Explicitely, the gate corresponds to:\n
|
||||
/// Explicitly, the gate corresponds to:\n
|
||||
/// exp( -i X theta/2 )\n
|
||||
/// This convention is based on the fact that the generators
|
||||
/// of rotations for spin-1/2 spins are {X/2, Y/2, Z/2}.
|
||||
|
@ -282,7 +282,7 @@ void QubitRegister<Type>::ApplyRotationX(unsigned const qubit, BaseType theta)
|
|||
/// @param qubit index of the involved qubit
|
||||
/// @param theta rotation angle
|
||||
///
|
||||
/// Explicitely, the gate corresponds to:\n
|
||||
/// Explicitly, the gate corresponds to:\n
|
||||
/// exp( -i Y theta/2 )\n
|
||||
/// This convention is based on the fact that the generators
|
||||
/// of rotations for spin-1/2 spins are {X/2, Y/2, Z/2}.
|
||||
|
@ -302,7 +302,7 @@ void QubitRegister<Type>::ApplyRotationY(unsigned const qubit, BaseType theta)
|
|||
/// @param qubit index of the involved qubit
|
||||
/// @param theta rotation angle
|
||||
///
|
||||
/// Explicitely, the gate corresponds to:\n
|
||||
/// Explicitly, the gate corresponds to:\n
|
||||
/// exp( -i Z theta/2 )\n
|
||||
/// This convention is based on the fact that the generators
|
||||
/// of rotations for spin-1/2 spins are {X/2, Y/2, Z/2}.
|
||||
|
@ -321,7 +321,7 @@ void QubitRegister<Type>::ApplyRotationZ(unsigned const qubit, BaseType theta)
|
|||
/// @brief Apply X Pauli operator
|
||||
/// @param qubit index of the involved qubit
|
||||
///
|
||||
/// Explicitely, the gate corresponds to:\n
|
||||
/// Explicitly, the gate corresponds to:\n
|
||||
/// i * exp( -i X pi/2 ) = X
|
||||
template <class Type>
|
||||
void QubitRegister<Type>::ApplyPauliX(unsigned const qubit)
|
||||
|
@ -339,7 +339,7 @@ void QubitRegister<Type>::ApplyPauliX(unsigned const qubit)
|
|||
/// @brief Apply square root of the X Pauli operator
|
||||
/// @param qubit index of the involved qubit
|
||||
///
|
||||
/// Explicitely, the gate corresponds to:\n
|
||||
/// Explicitly, the gate corresponds to:\n
|
||||
/// sqrt(X)
|
||||
template <class Type>
|
||||
void QubitRegister<Type>::ApplyPauliSqrtX(unsigned const qubit)
|
||||
|
@ -357,7 +357,7 @@ void QubitRegister<Type>::ApplyPauliSqrtX(unsigned const qubit)
|
|||
/// @brief Apply Y Pauli operator
|
||||
/// @param qubit index of the involved qubit
|
||||
///
|
||||
/// Explicitely, the gate corresponds to:\n
|
||||
/// Explicitly, the gate corresponds to:\n
|
||||
/// i * exp( -i Y pi/2 ) = Y
|
||||
template <class Type>
|
||||
void QubitRegister<Type>::ApplyPauliY(unsigned const qubit)
|
||||
|
@ -375,7 +375,7 @@ void QubitRegister<Type>::ApplyPauliY(unsigned const qubit)
|
|||
/// @brief Apply square root of the Y Pauli operator
|
||||
/// @param qubit index of the involved qubit
|
||||
///
|
||||
/// Explicitely, the gate corresponds to:\n
|
||||
/// Explicitly, the gate corresponds to:\n
|
||||
/// sqrt(Y)
|
||||
template <class Type>
|
||||
void QubitRegister<Type>::ApplyPauliSqrtY(unsigned const qubit)
|
||||
|
@ -393,7 +393,7 @@ void QubitRegister<Type>::ApplyPauliSqrtY(unsigned const qubit)
|
|||
/// @brief Apply Z Pauli operator
|
||||
/// @param qubit index of the involved qubit
|
||||
///
|
||||
/// Explicitely, the gate corresponds to:\n
|
||||
/// Explicitly, the gate corresponds to:\n
|
||||
/// i * exp( -i Z pi/2 ) = Z
|
||||
template <class Type>
|
||||
void QubitRegister<Type>::ApplyPauliZ(unsigned const qubit)
|
||||
|
@ -411,7 +411,7 @@ void QubitRegister<Type>::ApplyPauliZ(unsigned const qubit)
|
|||
/// @brief Apply square root of the Z Pauli operator
|
||||
/// @param qubit index of the involved qubit
|
||||
///
|
||||
/// Explicitely, the gate corresponds to:\n
|
||||
/// Explicitly, the gate corresponds to:\n
|
||||
/// sqrt(Z)
|
||||
template <class Type>
|
||||
void QubitRegister<Type>::ApplyPauliSqrtZ(unsigned const qubit)
|
||||
|
@ -430,7 +430,7 @@ void QubitRegister<Type>::ApplyPauliSqrtZ(unsigned const qubit)
|
|||
/// @brief Apply Hadamard gate
|
||||
/// @param qubit index of the involved qubit
|
||||
///
|
||||
/// Explicitely, the gate corresponds to the 2x2 matrix:\n
|
||||
/// Explicitly, the gate corresponds to the 2x2 matrix:\n
|
||||
/// | 1/sqrt(2) 1/sqrt(2) |\n
|
||||
/// | 1/sqrt(2) -1/sqrt(2) |
|
||||
template <class Type>
|
||||
|
@ -448,7 +448,7 @@ void QubitRegister<Type>::ApplyHadamard(unsigned const qubit)
|
|||
/// @brief Apply T gate
|
||||
/// @param qubit index of the involved qubit
|
||||
///
|
||||
/// Explicitely, the gate corresponds to the 2x2 matrix:\n
|
||||
/// Explicitly, the gate corresponds to the 2x2 matrix:\n
|
||||
/// | 1 0 |\n
|
||||
/// | 0 cos(pi/4)+i*sin(pi/4) |
|
||||
template <class Type>
|
||||
|
|
|
@ -421,7 +421,7 @@ void QubitRegister<Type>::ApplyControlled1QubitGate(unsigned control_qubit, unsi
|
|||
/// @param qubit index of the target qubit
|
||||
/// @param theta rotation angle
|
||||
///
|
||||
/// Explicitely, when control qubit is in |1\>, the gate corresponds to:\n
|
||||
/// Explicitly, when control qubit is in |1\>, the gate corresponds to:\n
|
||||
/// exp( -i X theta/2 )\n
|
||||
/// This convention is based on the fact that the generators
|
||||
/// of rotations for spin-1/2 spins are {X/2, Y/2, Z/2}.
|
||||
|
@ -441,7 +441,7 @@ void QubitRegister<Type>::ApplyCRotationX(unsigned const control, unsigned const
|
|||
/// @param qubit index of the target qubit
|
||||
/// @param theta rotation angle
|
||||
///
|
||||
/// Explicitely, when control qubit is in |1\>, the gate corresponds to:\n
|
||||
/// Explicitly, when control qubit is in |1\>, the gate corresponds to:\n
|
||||
/// exp( -i Y theta/2 )\n
|
||||
/// This convention is based on the fact that the generators
|
||||
/// of rotations for spin-1/2 spins are {X/2, Y/2, Z/2}.
|
||||
|
@ -462,7 +462,7 @@ void QubitRegister<Type>::ApplyCRotationY(unsigned const control, unsigned const
|
|||
/// @param qubit index of the target qubit
|
||||
/// @param theta rotation angle
|
||||
///
|
||||
/// Explicitely, when control qubit is in |1\>, the gate corresponds to:\n
|
||||
/// Explicitly, when control qubit is in |1\>, the gate corresponds to:\n
|
||||
/// exp( -i Z theta/2 )\n
|
||||
/// This convention is based on the fact that the generators
|
||||
/// of rotations for spin-1/2 spins are {X/2, Y/2, Z/2}.
|
||||
|
@ -482,7 +482,7 @@ void QubitRegister<Type>::ApplyCRotationZ(unsigned const control, unsigned const
|
|||
/// @param control index of the control qubit
|
||||
/// @param qubit index of the target qubit
|
||||
///
|
||||
/// Explicitely, when control qubit is in |1\>, the gate corresponds to:\n
|
||||
/// Explicitly, when control qubit is in |1\>, the gate corresponds to:\n
|
||||
/// i * exp( -i X pi/2 ) = X
|
||||
template <class Type>
|
||||
void QubitRegister<Type>::ApplyCPauliX(unsigned const control, unsigned const qubit)
|
||||
|
@ -501,7 +501,7 @@ void QubitRegister<Type>::ApplyCPauliX(unsigned const control, unsigned const qu
|
|||
/// @param control index of the control qubit
|
||||
/// @param qubit index of the target qubit
|
||||
///
|
||||
/// Explicitely, when control qubit is in |1\>, the gate corresponds to:\n
|
||||
/// Explicitly, when control qubit is in |1\>, the gate corresponds to:\n
|
||||
/// i * exp( -i Y pi/2 ) = Y
|
||||
template <class Type>
|
||||
void QubitRegister<Type>::ApplyCPauliY(unsigned const control, unsigned const qubit)
|
||||
|
@ -520,7 +520,7 @@ void QubitRegister<Type>::ApplyCPauliY(unsigned const control, unsigned const qu
|
|||
/// @param control index of the control qubit
|
||||
/// @param qubit index of the target qubit
|
||||
///
|
||||
/// Explicitely, when control qubit is in |1\>, the gate corresponds to:\n
|
||||
/// Explicitly, when control qubit is in |1\>, the gate corresponds to:\n
|
||||
/// i * exp( -i Z pi/2 ) = Z
|
||||
template <class Type>
|
||||
void QubitRegister<Type>::ApplyCPauliZ(unsigned const control, unsigned const qubit)
|
||||
|
@ -539,7 +539,7 @@ void QubitRegister<Type>::ApplyCPauliZ(unsigned const control, unsigned const qu
|
|||
/// @param control index of the control qubit
|
||||
/// @param qubit index of the target qubit
|
||||
///
|
||||
/// Explicitely, when control qubit is in |1\>, the gate corresponds to:\n
|
||||
/// Explicitly, when control qubit is in |1\>, the gate corresponds to:\n
|
||||
/// sqrt(Z)
|
||||
template <class Type>
|
||||
void QubitRegister<Type>::ApplyCPauliSqrtZ(unsigned const control, unsigned const qubit)
|
||||
|
@ -558,7 +558,7 @@ void QubitRegister<Type>::ApplyCPauliSqrtZ(unsigned const control, unsigned cons
|
|||
/// @param control index of the control qubit
|
||||
/// @param qubit index of the target qubit
|
||||
///
|
||||
/// Explicitely, when control qubit is in |1\>, the gate corresponds to the 2x2 matrix:\n
|
||||
/// Explicitly, when control qubit is in |1\>, the gate corresponds to the 2x2 matrix:\n
|
||||
/// | 1/sqrt(2) 1/sqrt(2) |\n
|
||||
/// | 1/sqrt(2) -1/sqrt(2) |
|
||||
template <class Type>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
/// @param qubit1 index of the first qubit
|
||||
/// @param qubit2 index of the second qubit
|
||||
///
|
||||
/// Explicitely, the gate corresponds to the matrix:\n
|
||||
/// Explicitly, the gate corresponds to the matrix:\n
|
||||
/// | 1 0 0 0 |\n
|
||||
/// SWAP = | 0 0 1 0 |\n
|
||||
/// | 0 1 0 0 |\n
|
||||
|
@ -42,7 +42,7 @@ void QubitRegister<Type>::ApplySwap(unsigned qubit1, unsigned qubit2)
|
|||
/// @param qubit1 index of the first qubit
|
||||
/// @param qubit2 index of the second qubit
|
||||
///
|
||||
/// Explicitely, the gate corresponds to the matrix:\n
|
||||
/// Explicitly, the gate corresponds to the matrix:\n
|
||||
/// | 1 0 0 0 |\n
|
||||
/// iSWAP = | 0 0 i 0 |\n
|
||||
/// | 0 i 0 0 |\n
|
||||
|
@ -61,7 +61,7 @@ void QubitRegister<Type>::ApplyISwap(unsigned qubit1, unsigned qubit2)
|
|||
/// @param qubit1 index of the first qubit
|
||||
/// @param qubit2 index of the second qubit
|
||||
///
|
||||
/// Explicitely, the gate corresponds to the matrix:\n
|
||||
/// Explicitly, the gate corresponds to the matrix:\n
|
||||
/// | 1 0 0 0 |\n
|
||||
/// sqrt(iSWAP) = 1/sqrt(2) | 0 1 i 0 |\n
|
||||
/// | 0 i 1 0 |\n
|
||||
|
@ -81,7 +81,7 @@ void QubitRegister<Type>::ApplySqrtISwap(unsigned qubit1, unsigned qubit2)
|
|||
/// @param qubit1 index of the first qubit
|
||||
/// @param qubit2 index of the second qubit
|
||||
///
|
||||
/// Explicitely, the gate corresponds to the matrix:\n
|
||||
/// Explicitly, the gate corresponds to the matrix:\n
|
||||
/// | 1 0 0 0 |\n
|
||||
/// iSWAP(m) = | 0 m00 m01 0 |\n
|
||||
/// | 0 m10 m11 0 |\n
|
||||
|
|
|
@ -81,7 +81,7 @@ Type QubitRegister<Type>::GetGlobalAmplitude
|
|||
// Transform the global_index w.r.t. the data qubit order.
|
||||
global_index = qubit_permutation->program2data_(global_index);
|
||||
|
||||
// Determine in what (state) rank is the amplidute and what is its local index.
|
||||
// Determine in what (state) rank is the amplitude and what is its local index.
|
||||
Type amplitude;
|
||||
#ifdef INTELQS_HAS_MPI
|
||||
std::size_t local_index, hosting_rank;
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
"IQS stores a full representation of the quantum state in the computational basis.\n",
|
||||
"In practice, the quantum state of $N$ qubits is represented as a complex vector with $2^N$ components.\n",
|
||||
"\n",
|
||||
"Each componenet corresponds to the probability amplitude of a specific computational basis state:\n",
|
||||
"Each component corresponds to the probability amplitude of a specific computational basis state:\n",
|
||||
"$$\\psi(k) = \\langle k | \\psi \\rangle$$\n",
|
||||
"with the index $k$ corresponding to the $N$-bit integer in decimal representation, and $k\\in\\{0,1,2,\\dots,2^N-1\\}$.\n",
|
||||
"\n",
|
||||
|
@ -123,7 +123,7 @@
|
|||
"### Display the quantum state\n",
|
||||
"\n",
|
||||
"It is important to be able to access and visualize the quantum state.\n",
|
||||
"IQS allows to access the single componenets of the state or to print a comprehensive description.\n",
|
||||
"IQS allows to access the single components of the state or to print a comprehensive description.\n",
|
||||
"\n",
|
||||
"What index is associated to state $|1011\\rangle$?\n",
|
||||
"In decimal representation one has:\n",
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
"IQS stores a full representation of the quantum state in the computational basis.\n",
|
||||
"In practice, the quantum state of $N$ qubits is represented as a complex vector with $2^N$ components.\n",
|
||||
"\n",
|
||||
"Each componenet corresponds to the probability amplitude of a specific computational basis state:\n",
|
||||
"Each component corresponds to the probability amplitude of a specific computational basis state:\n",
|
||||
"$$\\psi(k) = \\langle k | \\psi \\rangle$$\n",
|
||||
"with the index $k$ corresponding to the $N$-bit integer in decimal representation, and $k\\in\\{0,1,2,\\dots,2^N-1\\}$.\n",
|
||||
"\n",
|
||||
|
@ -139,7 +139,7 @@
|
|||
"### Display the quantum state\n",
|
||||
"\n",
|
||||
"It is important to be able to access and visualize the quantum state.\n",
|
||||
"IQS allows to access the single componenets of the state or to print a comprehensive description.\n",
|
||||
"IQS allows to access the single components of the state or to print a comprehensive description.\n",
|
||||
"\n",
|
||||
"What index is associated to state $|1011\\rangle$?\n",
|
||||
"In decimal representation one has:\n",
|
||||
|
|
|
@ -59,7 +59,7 @@ int main(int argc, char **argv)
|
|||
* In practice, the quantum state of N qubits is represented as a complex vector with
|
||||
* 2^N components.
|
||||
*
|
||||
* Each componenet corresponds to the probability amplitude of a specific computational
|
||||
* Each component corresponds to the probability amplitude of a specific computational
|
||||
* basis state:
|
||||
* ψ(k)=⟨k|ψ⟩
|
||||
* with the index k corresponding to the N-bit integer in decimal representation, and
|
||||
|
@ -98,7 +98,7 @@ int main(int argc, char **argv)
|
|||
// Display the quantum state
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
/* It is important to be able to access and visualize the quantum state.
|
||||
* IQS allows to access the single componenets of the state or to print a comprehensive
|
||||
* IQS allows to access the single components of the state or to print a comprehensive
|
||||
* description.
|
||||
* What index is associated to state |1011⟩? In decimal representation one has:
|
||||
* 1011 → 1×2^0 + 0×2^1 + 1×2^2 + 1×2^3 = 1+4+8 = 13
|
||||
|
@ -166,7 +166,7 @@ int main(int argc, char **argv)
|
|||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Two-qubit gates
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
/* To achieve universal quantum computation, it is enought to implement one-qubit
|
||||
/* To achieve universal quantum computation, it is enough to implement one-qubit
|
||||
* gates and a single type of two-qubit gate. The essential requirement is that such
|
||||
* two-qubit gate is able to generate entanglement. Usually the controlled-not gate
|
||||
* (CNOT in the following) is the operation of choice.
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
"IQS stores a full representation of the quantum state in the computational basis.\n",
|
||||
"In practice, the quantum state of $N$ qubits is represented as a complex vector with $2^N$ components.\n",
|
||||
"\n",
|
||||
"Each componenet corresponds to the probability amplitude of a specific computational basis state:\n",
|
||||
"Each component corresponds to the probability amplitude of a specific computational basis state:\n",
|
||||
"$$\\psi(k) = \\langle k | \\psi \\rangle$$\n",
|
||||
"with the index $k$ corresponding to the $N$-bit integer in decimal representation, and $k\\in\\{0,1,2,\\dots,2^N-1\\}$.\n",
|
||||
"\n",
|
||||
|
@ -123,7 +123,7 @@
|
|||
"### Display the quantum state\n",
|
||||
"\n",
|
||||
"It is important to be able to access and visualize the quantum state.\n",
|
||||
"IQS allows to access the single componenets of the state or to print a comprehensive description.\n",
|
||||
"IQS allows to access the single components of the state or to print a comprehensive description.\n",
|
||||
"\n",
|
||||
"What index is associated to state $|1011\\rangle$?\n",
|
||||
"In decimal representation one has:\n",
|
||||
|
|
Loading…
Reference in New Issue