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

Methods to calculate the cost function of the final optimization problem (supporting parallel computations). More...

#include "N_Qubit_Decomposition_Cost_Function.h"
#include "QGDTypes.h"
#include <vector>
#include <algorithm>
Include dependency graph for N_Qubit_Decomposition_Cost_Function.cpp:

Go to the source code of this file.

Classes

struct  OSRTriplet< ComplexT >
 

Macros

#define LAPACK_COL_MAJOR   102
 
#define LAPACK_ROW_MAJOR   101
 
#define USE_COL_MAJ
 
#define USE_SDD
 

Functions

template<class MatrixT , class ComplexT >
static void accumulate_grad_for_cut (MatrixT &accum, const std::vector< double > &G, const std::vector< ComplexT > &Umat, const std::vector< ComplexT > &VTmat, int n, const std::vector< int > &A, int rank=-1)
 
double avg_loss_for_rank (const std::vector< std::vector< double >> &cuts_S, int rank)
 
double avg_tail_loss (const std::vector< std::vector< double >> &cuts_S, double rho=0.1)
 
template<class MatrixT , class ComplexT >
static std::vector< ComplexT > build_osr_matrix (const MatrixT &U, int n, const std::vector< int > &A, int &m_rows, int &m_cols)
 
static void combinations_recursive (int n, int r, int start, std::vector< int > &current, std::vector< std::vector< int >> &out)
 
std::vector< std::vector< double > > cuts_avg_rank_grad (const std::vector< std::vector< double >> &cuts_S, int rank, double Fnorm)
 
std::vector< std::vector< double > > cuts_avg_tail_grad (const std::vector< std::vector< double >> &cuts_S, double Fnorm, double rho=0.1)
 
double cuts_softmax_rank_cost (const std::vector< std::vector< double >> &cuts_S, int rank, double tau=1e-2)
 
std::vector< std::vector< double > > cuts_softmax_rank_grad (const std::vector< std::vector< double >> &cuts_S, int rank, double Fnorm, double tau=1e-2)
 
double cuts_softmax_tail_cost (const std::vector< std::vector< double >> &cuts_S, double rho=0.1, double tau=1e-2)
 
std::vector< std::vector< double > > cuts_softmax_tail_grad (const std::vector< std::vector< double >> &cuts_S, double Fnorm, double rho=0.1, double tau=1e-2)
 
static int extract_bits (int x, const std::vector< int > &pos)
 
double get_cost_function (const Matrix &matrix, int trace_offset)
 Call co calculate the cost function during the final optimization process. More...
 
double get_cost_function (const Matrix_float &matrix, int trace_offset)
 
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)
 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)
 
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. More...
 
Matrix_real_float get_cost_function_with_correction2 (const Matrix_float &matrix, int qbit_num, int trace_offset)
 
Matrix get_deriv_osr_entanglement (Matrix &matrix, std::vector< std::vector< int >> &use_cuts, int rank, bool use_softmax)
 
Matrix_float get_deriv_osr_entanglement (Matrix_float &matrix, std::vector< std::vector< int >> &use_cuts, int rank, bool use_softmax)
 
template<class MatrixT , class ComplexT , class RealT >
static MatrixT get_deriv_osr_entanglement_impl (MatrixT &matrix, std::vector< std::vector< int >> &use_cuts, int rank, bool use_softmax)
 
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, bool use_softmax)
 
double get_osr_entanglement_test (Matrix_float &matrix, std::vector< std::vector< int >> &use_cuts, int rank, bool use_softmax)
 
template<class MatrixT , class ComplexT , class RealT >
static double get_osr_entanglement_test_impl (MatrixT &matrix, std::vector< std::vector< int >> &use_cuts, int rank, bool use_softmax)
 
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...
 
static int lapack_gesdd_dispatch (int lapack_layout, char jobz, int m, int n, QGD_Complex16 *a, int lda, double *s, QGD_Complex16 *u, int ldu, QGD_Complex16 *vt, int ldvt)
 
static int lapack_gesdd_dispatch (int lapack_layout, char jobz, int m, int n, QGD_Complex8 *a, int lda, float *s, QGD_Complex8 *u, int ldu, QGD_Complex8 *vt, int ldvt)
 
int LAPACKE_cgesdd (int matrix_order, char jobz, int m, int n, QGD_Complex8 *a, int lda, float *s, QGD_Complex8 *u, int ldu, QGD_Complex8 *vt, int ldvt)
 
int LAPACKE_cgesvd (int matrix_order, char jobu, char jobvt, int m, int n, QGD_Complex8 *a, int lda, float *s, QGD_Complex8 *u, int ldu, QGD_Complex8 *vt, int ldvt, float *superb)
 
int LAPACKE_zgesdd (int matrix_order, char jobz, int m, int n, QGD_Complex16 *a, int lda, double *s, QGD_Complex16 *u, int ldu, QGD_Complex16 *vt, int ldvt)
 
int LAPACKE_zgesvd (int matrix_order, char jobu, char jobvt, int m, int n, QGD_Complex16 *a, int lda, double *s, QGD_Complex16 *u, int ldu, QGD_Complex16 *vt, int ldvt, double *superb)
 
static uint32_t lg_down (uint32_t v)
 
static uint32_t lg_up (uint32_t x)
 
double logsumexp_smoothmax (const std::vector< double > &Lc, double tau=1e-2)
 
double loss_for_rank (const std::vector< double > &S, int rank)
 
std::vector< double > loss_for_rank_grad_diag (const std::vector< double > &S, int rank, double Fnorm)
 
static size_t mat_idx (int row, int col, int nrows, int ncols)
 
static int numerical_rank_osr (std::vector< double > S, double tol)
 
std::pair< int, double > operator_schmidt_rank (const Matrix &U, int n, const std::vector< int > &A_qubits, double Fnorm, double tol)
 
std::pair< int, double > operator_schmidt_rank (const Matrix_float &U, int n, const std::vector< int > &A_qubits, double Fnorm, double tol)
 
template<class ComplexT , class RealT >
static std::vector< double > osr (std::vector< ComplexT > &A, int m_rows, int m_cols, double Fnorm)
 
double real_trace_conj_dot (Matrix &A, Matrix &B)
 
double real_trace_conj_dot (Matrix_float &A, Matrix_float &B)
 
double tail_loss (const std::vector< double > &S, int max_dyadic, double rho=0.1, double tol=1e-4)
 
std::vector< double > tail_loss_grad_diag (const std::vector< double > &S, int max_dyadic, double Fnorm, double rho=0.1, double tol=1e-4)
 
template<class MatrixT , class ComplexT , class RealT >
static OSRTriplet< ComplexT > top_k_triplet_for_cut (const MatrixT &U, int q, const std::vector< int > &A, double Fnorm, int &m_rows, int &m_cols)
 
std::vector< std::vector< int > > unique_cuts (int n)
 
double weighted_loss_for_rank (const std::vector< double > &S, int rank, double rho=0.1, double tol=1e-4)
 

Detailed Description

Methods to calculate the cost function of the final optimization problem (supporting parallel computations).

Definition in file N_Qubit_Decomposition_Cost_Function.cpp.

Macro Definition Documentation

◆ LAPACK_COL_MAJOR

#define LAPACK_COL_MAJOR   102

Definition at line 30 of file N_Qubit_Decomposition_Cost_Function.cpp.

◆ LAPACK_ROW_MAJOR

#define LAPACK_ROW_MAJOR   101

Definition at line 29 of file N_Qubit_Decomposition_Cost_Function.cpp.

◆ USE_COL_MAJ

#define USE_COL_MAJ

Definition at line 59 of file N_Qubit_Decomposition_Cost_Function.cpp.

◆ USE_SDD

#define USE_SDD

Definition at line 58 of file N_Qubit_Decomposition_Cost_Function.cpp.

Function Documentation

◆ accumulate_grad_for_cut()

template<class MatrixT , class ComplexT >
static void accumulate_grad_for_cut ( MatrixT &  accum,
const std::vector< double > &  G,
const std::vector< ComplexT > &  Umat,
const std::vector< ComplexT > &  VTmat,
int  n,
const std::vector< int > &  A,
int  rank = -1 
)
static

Definition at line 810 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:

◆ avg_loss_for_rank()

double avg_loss_for_rank ( const std::vector< std::vector< double >> &  cuts_S,
int  rank 
)

Definition at line 1037 of file N_Qubit_Decomposition_Cost_Function.cpp.

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

◆ avg_tail_loss()

double avg_tail_loss ( const std::vector< std::vector< double >> &  cuts_S,
double  rho = 0.1 
)

Definition at line 1155 of file N_Qubit_Decomposition_Cost_Function.cpp.

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

◆ build_osr_matrix()

template<class MatrixT , class ComplexT >
static std::vector<ComplexT> build_osr_matrix ( const MatrixT &  U,
int  n,
const std::vector< int > &  A,
int m_rows,
int m_cols 
)
static

Definition at line 773 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:

◆ combinations_recursive()

static void combinations_recursive ( int  n,
int  r,
int  start,
std::vector< int > &  current,
std::vector< std::vector< int >> &  out 
)
static

Definition at line 959 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the caller graph for this function:

◆ cuts_avg_rank_grad()

std::vector<std::vector<double> > cuts_avg_rank_grad ( const std::vector< std::vector< double >> &  cuts_S,
int  rank,
double  Fnorm 
)

Definition at line 1076 of file N_Qubit_Decomposition_Cost_Function.cpp.

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

◆ cuts_avg_tail_grad()

std::vector<std::vector<double> > cuts_avg_tail_grad ( const std::vector< std::vector< double >> &  cuts_S,
double  Fnorm,
double  rho = 0.1 
)

Definition at line 1201 of file N_Qubit_Decomposition_Cost_Function.cpp.

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

◆ cuts_softmax_rank_cost()

double cuts_softmax_rank_cost ( const std::vector< std::vector< double >> &  cuts_S,
int  rank,
double  tau = 1e-2 
)

Definition at line 1047 of file N_Qubit_Decomposition_Cost_Function.cpp.

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

◆ cuts_softmax_rank_grad()

std::vector<std::vector<double> > cuts_softmax_rank_grad ( const std::vector< std::vector< double >> &  cuts_S,
int  rank,
double  Fnorm,
double  tau = 1e-2 
)

Definition at line 1097 of file N_Qubit_Decomposition_Cost_Function.cpp.

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

◆ cuts_softmax_tail_cost()

double cuts_softmax_tail_cost ( const std::vector< std::vector< double >> &  cuts_S,
double  rho = 0.1,
double  tau = 1e-2 
)

Definition at line 1168 of file N_Qubit_Decomposition_Cost_Function.cpp.

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

◆ cuts_softmax_tail_grad()

std::vector<std::vector<double> > cuts_softmax_tail_grad ( const std::vector< std::vector< double >> &  cuts_S,
double  Fnorm,
double  rho = 0.1,
double  tau = 1e-2 
)

Definition at line 1219 of file N_Qubit_Decomposition_Cost_Function.cpp.

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

◆ extract_bits()

static int extract_bits ( int  x,
const std::vector< int > &  pos 
)
inlinestatic

Definition at line 751 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the caller graph for this function:

◆ 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.
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 
)

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 
)

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 
)

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,
bool  use_softmax 
)

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,
bool  use_softmax 
)

Definition at line 1445 of file N_Qubit_Decomposition_Cost_Function.cpp.

◆ get_deriv_osr_entanglement_impl()

template<class MatrixT , class ComplexT , class RealT >
static MatrixT get_deriv_osr_entanglement_impl ( MatrixT &  matrix,
std::vector< std::vector< int >> &  use_cuts,
int  rank,
bool  use_softmax 
)
static

Definition at line 1399 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:

◆ 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,
bool  use_softmax 
)

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,
bool  use_softmax 
)

Definition at line 1312 of file N_Qubit_Decomposition_Cost_Function.cpp.

◆ get_osr_entanglement_test_impl()

template<class MatrixT , class ComplexT , class RealT >
static double get_osr_entanglement_test_impl ( MatrixT &  matrix,
std::vector< std::vector< int >> &  use_cuts,
int  rank,
bool  use_softmax 
)
static

Definition at line 1284 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:

◆ 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.

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-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-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:

◆ lapack_gesdd_dispatch() [1/2]

static int lapack_gesdd_dispatch ( int  lapack_layout,
char  jobz,
int  m,
int  n,
QGD_Complex16 a,
int  lda,
double *  s,
QGD_Complex16 u,
int  ldu,
QGD_Complex16 vt,
int  ldvt 
)
static

Definition at line 878 of file N_Qubit_Decomposition_Cost_Function.cpp.

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

◆ lapack_gesdd_dispatch() [2/2]

static int lapack_gesdd_dispatch ( int  lapack_layout,
char  jobz,
int  m,
int  n,
QGD_Complex8 a,
int  lda,
float *  s,
QGD_Complex8 u,
int  ldu,
QGD_Complex8 vt,
int  ldvt 
)
static

Definition at line 884 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:

◆ LAPACKE_cgesdd()

int LAPACKE_cgesdd ( int  matrix_order,
char  jobz,
int  m,
int  n,
QGD_Complex8 a,
int  lda,
float *  s,
QGD_Complex8 u,
int  ldu,
QGD_Complex8 vt,
int  ldvt 
)
Here is the caller graph for this function:

◆ LAPACKE_cgesvd()

int LAPACKE_cgesvd ( int  matrix_order,
char  jobu,
char  jobvt,
int  m,
int  n,
QGD_Complex8 a,
int  lda,
float *  s,
QGD_Complex8 u,
int  ldu,
QGD_Complex8 vt,
int  ldvt,
float *  superb 
)
Here is the caller graph for this function:

◆ LAPACKE_zgesdd()

int LAPACKE_zgesdd ( int  matrix_order,
char  jobz,
int  m,
int  n,
QGD_Complex16 a,
int  lda,
double *  s,
QGD_Complex16 u,
int  ldu,
QGD_Complex16 vt,
int  ldvt 
)
Here is the caller graph for this function:

◆ LAPACKE_zgesvd()

int LAPACKE_zgesvd ( int  matrix_order,
char  jobu,
char  jobvt,
int  m,
int  n,
QGD_Complex16 a,
int  lda,
double *  s,
QGD_Complex16 u,
int  ldu,
QGD_Complex16 vt,
int  ldvt,
double *  superb 
)
Here is the caller graph for this function:

◆ lg_down()

static uint32_t lg_down ( uint32_t  v)
inlinestatic

Definition at line 733 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the caller graph for this function:

◆ lg_up()

static uint32_t lg_up ( uint32_t  x)
inlinestatic

Definition at line 746 of file N_Qubit_Decomposition_Cost_Function.cpp.

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

◆ logsumexp_smoothmax()

double logsumexp_smoothmax ( const std::vector< double > &  Lc,
double  tau = 1e-2 
)
inline

Definition at line 1002 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the caller graph for this function:

◆ loss_for_rank()

double loss_for_rank ( const std::vector< double > &  S,
int  rank 
)

Definition at line 1026 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the caller graph for this function:

◆ loss_for_rank_grad_diag()

std::vector<double> loss_for_rank_grad_diag ( const std::vector< double > &  S,
int  rank,
double  Fnorm 
)

Definition at line 1062 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the caller graph for this function:

◆ mat_idx()

static size_t mat_idx ( int  row,
int  col,
int  nrows,
int  ncols 
)
inlinestatic

Definition at line 758 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the caller graph for this function:

◆ numerical_rank_osr()

static int numerical_rank_osr ( std::vector< double >  S,
double  tol 
)
static

Definition at line 951 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 
)

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 
)

Definition at line 1269 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:

◆ osr()

template<class ComplexT , class RealT >
static std::vector<double> osr ( std::vector< ComplexT > &  A,
int  m_rows,
int  m_cols,
double  Fnorm 
)
static

Definition at line 905 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.

◆ tail_loss()

double tail_loss ( const std::vector< double > &  S,
int  max_dyadic,
double  rho = 0.1,
double  tol = 1e-4 
)

Definition at line 1141 of file N_Qubit_Decomposition_Cost_Function.cpp.

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

◆ tail_loss_grad_diag()

std::vector<double> tail_loss_grad_diag ( const std::vector< double > &  S,
int  max_dyadic,
double  Fnorm,
double  rho = 0.1,
double  tol = 1e-4 
)

Definition at line 1184 of file N_Qubit_Decomposition_Cost_Function.cpp.

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

◆ top_k_triplet_for_cut()

template<class MatrixT , class ComplexT , class RealT >
static OSRTriplet<ComplexT> top_k_triplet_for_cut ( const MatrixT &  U,
int  q,
const std::vector< int > &  A,
double  Fnorm,
int m_rows,
int m_cols 
)
static

Definition at line 1334 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the call graph for this function:

◆ 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:

◆ weighted_loss_for_rank()

double weighted_loss_for_rank ( const std::vector< double > &  S,
int  rank,
double  rho = 0.1,
double  tol = 1e-4 
)

Definition at line 1010 of file N_Qubit_Decomposition_Cost_Function.cpp.

Here is the caller graph for this function: