Sequential Quantum Gate Decomposer  v1.9.6
Powerful decomposition of general unitarias into one- and two-qubit gates gates
Classes | Functions
N_Qubit_Decomposition_Cost_Function.h File Reference

Header file for the paralleized calculation of the cost function of the final optimization problem (supporting TBB and OpenMP). More...

#include "common.h"
#include "matrix_real.h"
#include "matrix_real_float.h"
#include "matrix_float.h"
#include <tbb/combinable.h>
#include "logging.h"
Include dependency graph for N_Qubit_Decomposition_Cost_Function.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  functor_cost_fnc
 Function operator class to calculate the partial cost function of the final optimization process. More...
 

Functions

double get_cost_function (const Matrix &matrix, int trace_offset=0)
 Call co calculate the cost function during the final optimization process. More...
 
double get_cost_function (const Matrix_float &matrix, int trace_offset=0)
 
double get_cost_function_sum_of_squares (Matrix &matrix)
 
Matrix_real get_cost_function_with_correction (const Matrix &matrix, int qbit_num, int trace_offset=0)
 Call co calculate the cost function of the optimization process, and the first correction to the cost finction according to https://arxiv.org/pdf/2210.09191.pdf. More...
 
Matrix_real_float get_cost_function_with_correction (const Matrix_float &matrix, int qbit_num, int trace_offset=0)
 
Matrix_real get_cost_function_with_correction2 (const Matrix &matrix, int qbit_num, int trace_offset=0)
 Call co calculate the cost function of the optimization process, and the first correction to the cost finction according to https://arxiv.org/pdf/2210.09191.pdf. More...
 
Matrix_real_float get_cost_function_with_correction2 (const Matrix_float &matrix, int qbit_num, int trace_offset=0)
 
Matrix get_deriv_osr_entanglement (Matrix &matrix, std::vector< std::vector< int >> &use_cuts, int rank=-1, bool use_softmax=false)
 
Matrix_float get_deriv_osr_entanglement (Matrix_float &matrix, std::vector< std::vector< int >> &use_cuts, int rank=-1, bool use_softmax=false)
 
Matrix get_deriv_sum_of_squares (Matrix &matrix)
 
double get_hilbert_schmidt_test (Matrix &matrix)
 Call co calculate the cost function of the optimization process according to https://arxiv.org/pdf/2210.09191.pdf. More...
 
double get_hilbert_schmidt_test (Matrix_float &matrix)
 
double get_infidelity (Matrix &matrix)
 Call to calculate infidelity. More...
 
double get_infidelity (Matrix_float &matrix)
 
double get_osr_entanglement_test (Matrix &matrix, std::vector< std::vector< int >> &use_cuts, int rank=-1, bool use_softmax=false)
 
double get_osr_entanglement_test (Matrix_float &matrix, std::vector< std::vector< int >> &use_cuts, int rank=-1, bool use_softmax=false)
 
QGD_Complex16 get_trace (Matrix &matrix)
 Call to calculate the real and imaginary parts of the trace. More...
 
QGD_Complex16 get_trace (Matrix_float &matrix)
 
Matrix get_trace_with_correction (Matrix &matrix, int qbit_num)
 Call co calculate the Hilbert Schmidt testof the optimization process, and the first correction to the cost finction according to https://arxiv.org/pdf/2210.09191.pdf. More...
 
Matrix get_trace_with_correction2 (Matrix &matrix, int qbit_num)
 Call co calculate the Hilbert Schmidt testof the optimization process, and the first correction to the cost finction according to https://arxiv.org/pdf/2210.09191.pdf. More...
 
std::pair< int, double > operator_schmidt_rank (const Matrix &U, int n, const std::vector< int > &A_qubits, double Fnorm, double tol=1e-10)
 
std::pair< int, double > operator_schmidt_rank (const Matrix_float &U, int n, const std::vector< int > &A_qubits, double Fnorm, double tol=1e-10)
 
double real_trace_conj_dot (Matrix &A, Matrix &B)
 
double real_trace_conj_dot (Matrix_float &A, Matrix_float &B)
 
std::vector< std::vector< int > > unique_cuts (int n)
 

Detailed Description

Header file for the paralleized calculation of the cost function of the final optimization problem (supporting TBB and OpenMP).

Definition in file N_Qubit_Decomposition_Cost_Function.h.

Function Documentation

◆ get_cost_function() [1/2]

double get_cost_function ( const Matrix matrix,
int  trace_offset 
)

Call co calculate the cost function during the final optimization process.

Parameters
matrixThe square shaped complex matrix from which the cost function is calculated.
Returns
Returns with the calculated cost function.
Parameters
matrixThe square shaped complex matrix from which the cost function is calculated.
trace_offsetThe offset in the first columns from which the "trace" is calculated. In this case Tr(A) = sum_(i-offset=j) A_{ij}
Returns
Returns with the calculated cost function.

Definition at line 73 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the caller graph for this function:

◆ get_cost_function() [2/2]

double get_cost_function ( const Matrix_float matrix,
int  trace_offset = 0 
)

Definition at line 164 of file N_Qubit_Decomposition_Cost_Function.cpp.

◆ get_cost_function_sum_of_squares()

double get_cost_function_sum_of_squares ( Matrix matrix)

Definition at line 443 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the caller graph for this function:

◆ get_cost_function_with_correction() [1/2]

Matrix_real get_cost_function_with_correction ( const Matrix matrix,
int  qbit_num,
int  trace_offset 
)

Call co calculate the cost function of the optimization process, and the first correction to the cost finction according to https://arxiv.org/pdf/2210.09191.pdf.

Parameters
matrixThe square shaped complex matrix from which the cost function is calculated.
qbit_numThe number of qubits
Returns
Returns with the matrix containing the cost function (index 0) and the first correction (index 1).

Definition at line 191 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_cost_function_with_correction() [2/2]

Matrix_real_float get_cost_function_with_correction ( const Matrix_float matrix,
int  qbit_num,
int  trace_offset = 0 
)

Definition at line 254 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:

◆ get_cost_function_with_correction2() [1/2]

Matrix_real get_cost_function_with_correction2 ( const Matrix matrix,
int  qbit_num,
int  trace_offset 
)

Call co calculate the cost function of the optimization process, and the first correction to the cost finction according to https://arxiv.org/pdf/2210.09191.pdf.

Parameters
matrixThe square shaped complex matrix from which the cost function is calculated.
qbit_numThe number of qubits
Returns
Returns with the matrix containing the cost function (index 0), the first correction (index 1) and the second correction (index 2).

Definition at line 295 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_cost_function_with_correction2() [2/2]

Matrix_real_float get_cost_function_with_correction2 ( const Matrix_float matrix,
int  qbit_num,
int  trace_offset = 0 
)

Definition at line 406 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:

◆ get_deriv_osr_entanglement() [1/2]

Matrix get_deriv_osr_entanglement ( Matrix matrix,
std::vector< std::vector< int >> &  use_cuts,
int  rank = -1,
bool  use_softmax = false 
)

Definition at line 1441 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the caller graph for this function:

◆ get_deriv_osr_entanglement() [2/2]

Matrix_float get_deriv_osr_entanglement ( Matrix_float matrix,
std::vector< std::vector< int >> &  use_cuts,
int  rank = -1,
bool  use_softmax = false 
)

Definition at line 1445 of file N_Qubit_Decomposition_Cost_Function.cpp.

◆ get_deriv_sum_of_squares()

Matrix get_deriv_sum_of_squares ( Matrix matrix)

Definition at line 459 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the caller graph for this function:

◆ get_hilbert_schmidt_test() [1/2]

double get_hilbert_schmidt_test ( Matrix matrix)

Call co calculate the cost function of the optimization process according to https://arxiv.org/pdf/2210.09191.pdf.

Parameters
matrixThe square shaped complex matrix from which the cost function is calculated.
qbit_numThe number of qubits
Returns
Returns the cost function

Definition at line 524 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_hilbert_schmidt_test() [2/2]

double get_hilbert_schmidt_test ( Matrix_float matrix)

Definition at line 534 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:

◆ get_infidelity() [1/2]

double get_infidelity ( Matrix matrix)

Call to calculate infidelity.

Parameters
matrixThe square shaped complex matrix from which the cost function is calculated.
qbit_numThe number of qubits
Returns
Returns the cost function

Definition at line 541 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_infidelity() [2/2]

double get_infidelity ( Matrix_float matrix)

Definition at line 551 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:

◆ get_osr_entanglement_test() [1/2]

double get_osr_entanglement_test ( Matrix matrix,
std::vector< std::vector< int >> &  use_cuts,
int  rank = -1,
bool  use_softmax = false 
)

Definition at line 1308 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the caller graph for this function:

◆ get_osr_entanglement_test() [2/2]

double get_osr_entanglement_test ( Matrix_float matrix,
std::vector< std::vector< int >> &  use_cuts,
int  rank = -1,
bool  use_softmax = false 
)

Definition at line 1312 of file N_Qubit_Decomposition_Cost_Function.cpp.

◆ get_trace() [1/2]

QGD_Complex16 get_trace ( Matrix matrix)

Call to calculate the real and imaginary parts of the trace.

Parameters
matrixThe square shaped complex matrix from which the trace is calculated.
Returns
Returns with the calculated trace
Parameters
matrixThe square shaped complex matrix from which the trace is calculated.
Returns
Returns with the calculated trace.

Definition at line 482 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the caller graph for this function:

◆ get_trace() [2/2]

QGD_Complex16 get_trace ( Matrix_float matrix)

Definition at line 501 of file N_Qubit_Decomposition_Cost_Function.cpp.

◆ get_trace_with_correction()

Matrix get_trace_with_correction ( Matrix matrix,
int  qbit_num 
)

Call co calculate the Hilbert Schmidt testof the optimization process, and the first correction to the cost finction according to https://arxiv.org/pdf/2210.09191.pdf.

Parameters
matrixThe square shaped complex matrix from which the cost function is calculated.
qbit_numThe number of qubits
Returns
Returns with the matrix containing the cost function (index 0) and the first correction (index 1).
Parameters
matrixThe square shaped complex matrix from which the cost function is calculated.
qbit_numThe number of qubits
Returns
Returns with the matrix containing the cost function (index 0-1) and the first correction (index 2-3).

Definition at line 564 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_trace_with_correction2()

Matrix get_trace_with_correction2 ( Matrix matrix,
int  qbit_num 
)

Call co calculate the Hilbert Schmidt testof the optimization process, and the first correction to the cost finction according to https://arxiv.org/pdf/2210.09191.pdf.

Parameters
matrixThe square shaped complex matrix from which the cost function is calculated.
qbit_numThe number of qubits
Returns
Returns with the matrix containing the cost function (index 0), the first correction (index 1) and the second correction (index 3).
Parameters
matrixThe square shaped complex matrix from which the cost function is calculated.
qbit_numThe number of qubits
Returns
Returns with the matrix containing the cost function (index 0-1), the first correction (index 2-3) and the second correction (index 4-5).

Definition at line 604 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator_schmidt_rank() [1/2]

std::pair<int, double> operator_schmidt_rank ( const Matrix U,
int  n,
const std::vector< int > &  A_qubits,
double  Fnorm,
double  tol = 1e-10 
)

Definition at line 1254 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator_schmidt_rank() [2/2]

std::pair<int, double> operator_schmidt_rank ( const Matrix_float U,
int  n,
const std::vector< int > &  A_qubits,
double  Fnorm,
double  tol = 1e-10 
)

Definition at line 1269 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:

◆ real_trace_conj_dot() [1/2]

double real_trace_conj_dot ( Matrix A,
Matrix B 
)

Definition at line 1451 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the caller graph for this function:

◆ real_trace_conj_dot() [2/2]

double real_trace_conj_dot ( Matrix_float A,
Matrix_float B 
)

Definition at line 1463 of file N_Qubit_Decomposition_Cost_Function.cpp.

◆ unique_cuts()

std::vector<std::vector<int> > unique_cuts ( int  n)

Definition at line 975 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: