34 name =
"custom_kernel";
65 name =
"custom_kernel";
67 std::stringstream sstream;
81 sstream <<
"The index of the target qubit is larger than the number of qubits" << std::endl;
84 throw "The index of the target qubit is larger than the number of qubits";
119 std::string err(
"Wrong matrix size in custom_kernel_1qubit_gate gate apply");
141 std::string err(
"Wrong matrix size in U3 apply_from_right");
Header file for a class representing a single qubit gate with custom gate kernel. ...
void print(const std::stringstream &sstream, int verbose_level=1) const
Call to print output messages in the function of the verbosity level.
A class representing a custom_kernel_1qubit_gate gate.
int control_qbit
The index of the qubit which acts as a control qubit (control_qbit >= 0) in controlled operations...
int target_qbit
The index of the qubit on which the operation acts (target_qbit >= 0)
void apply_from_right(Matrix_real ¶meters, Matrix &input)
Call to apply the gate on the input array/matrix by input*U3.
void apply_kernel_from_right(Matrix &u3_1qbit, Matrix &input)
Call to apply the gate kernel on the input state or unitary from right (no AVX support) ...
custom_kernel_1qubit_gate * clone()
Call to create a clone of the present class.
int matrix_size
The size N of the NxN matrix associated with the operations.
custom_kernel_1qubit_gate()
Nullacustom_kernel_1qubit_gate constructor of the class.
gate_type type
The type of the operation (see enumeration gate_type)
int rows
The number of rows.
int cols
The number of columns.
void apply_to(Matrix &input)
Call to apply the gate on the input array/matrix by U3*input.
void set_parameter_start_idx(int start_idx)
Call to set the starting index of the parameters in the parameter array corresponding to the circuit ...
int get_parameter_start_idx()
Call to get the starting index of the parameters in the parameter array corresponding to the circuit ...
int Power_of_2(int n)
Calculates the n-th power of 2.
Class to store data of complex arrays and its properties.
std::string name
A string labeling the gate operation.
void apply_kernel_to(Matrix &u3_1qbit, Matrix &input, bool deriv=false, int parallel=0)
Call to apply the gate kernel on the input state or unitary with optional AVX support.
int parameter_num
the number of free parameters of the operation
int qbit_num
number of qubits spanning the matrix of the operation
~custom_kernel_1qubit_gate()
Destructor of the class.
Class to store data of complex arrays and its properties.