128 double* vartheta = parameters.
get_data();
133 Matrix com_matrix = ru.Construct_Unitary_Matrix( vartheta, varphi, varkappa );
136 if (com_matrix.
isnan()) {
137 std::stringstream sstream;
138 sstream <<
"Composite::get_matrix: UN_matrix contains NaN." << std::endl;
157 std::string err(
"Composite::apply_to: Wrong matrix size in Composite gate apply.");
162 std::stringstream sstream;
163 sstream <<
"Not enough parameters given for the Composite gate" << std::endl;
170 Matrix transformed =
dot( com_matrix, input );
187 std::stringstream sstream;
188 sstream <<
"Wrong matrix size in Composite gate apply" << std::endl;
194 std::stringstream sstream;
195 sstream <<
"Not enough parameters given for the Composite gate" << std::endl;
201 Matrix transformed =
dot( input, com_matrix );
219 if ((
int)qbit_list.size() !=
qbit_num ) {
220 std::stringstream sstream;
221 sstream <<
"Wrong number of qubits" << std::endl;
231 for (
int idx=0; idx<
qbit_num; idx++) {
233 target_qbit_new = qbit_num-1-idx;
236 control_qbit_new = qbit_num-1-idx;
std::vector< Gate * > parents
list of parent gates to be applied in the circuit prior to this current gate
bool isnan()
Call to check the array for NaN entries.
void apply_to(Matrix_real ¶meters, Matrix &input, int parallel)
Call to apply the gate on the input array/matrix.
Matrix dot(Matrix &A, Matrix &B)
Call to calculate the product of two complex matrices by calling method zgemm3m from the CBLAS librar...
Base class for the representation of general gate operations.
void print(const std::stringstream &sstream, int verbose_level=1) const
Call to print output messages in the function of the verbosity level.
Header file for a class for a composite gate operation.
virtual Matrix get_matrix()
Call to retrieve the operation matrix.
Composite()
Default constructor of the class.
int control_qbit
The index of the qubit which acts as a control qubit (control_qbit >= 0) in controlled operations...
void set_children(std::vector< Gate *> &children_)
Call to set the children of the current gate.
int target_qbit
The index of the qubit on which the operation acts (target_qbit >= 0)
Composite * clone()
Call to create a clone of the present class.
int matrix_size
The size N of the NxN matrix associated with the operations.
scalar * get_data() const
Call to get the pointer to the stored data.
virtual ~Composite()
Destructor of the class.
void apply_from_right(Matrix_real ¶meters, Matrix &input)
Call to apply the gate on the input array/matrix by input*Gate.
gate_type type
The type of the operation (see enumeration gate_type)
int rows
The number of rows.
virtual void set_qbit_num(int qbit_num_in)
Set the number of qubits spanning the matrix of the operation.
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 ...
gate_type get_type()
Call to get the type of the operation.
Structure type representing complex numbers in the SQUANDER package.
int Power_of_2(int n)
Calculates the n-th power of 2.
Class to store data of complex arrays and its properties.
int size() const
Call to get the number of the allocated elements.
A class to cerate general random unitary matrix according to arXiv:1303:5904v1.
std::string name
A string labeling the gate operation.
std::vector< Gate * > children
list of child gates to be applied after this current gate
int get_parameter_num()
Call to get the number of free parameters.
int parameter_num
the number of free parameters of the operation
Header file for commonly used functions and wrappers to CBLAS functions.
void set_parents(std::vector< Gate *> &parents_)
Call to set the parents of the current gate.
int qbit_num
number of qubits spanning the matrix of the operation
gate_type
Type definition of operation types (also generalized for decomposition classes derived from the class...
int get_qbit_num()
Call to get the number of qubits composing the unitary.
Matrix_real parameters
Parameters theta, phi, lambda of the U3 gate after the decomposition of the unitary is done...
virtual void reorder_qubits(std::vector< int > qbit_list)
Call to reorder the qubits in the matrix of the operation.
Class to store data of complex arrays and its properties.