Sequential Quantum Gate Decomposer  v1.9.3
Powerful decomposition of general unitarias into one- and two-qubit gates gates
N_Qubit_Decomposition_Cost_Function.h
Go to the documentation of this file.
1 /*
2 Created on Fri Jun 26 14:13:26 2020
3 Copyright 2020 Peter Rakyta, Ph.D.
4 
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8 
9  http://www.apache.org/licenses/LICENSE-2.0
10 
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 
17 @author: Peter Rakyta, Ph.D.
18 */
23 #ifndef N_Qubit_Decomposition_Cost_Function_H
24 #define N_Qubit_Decomposition_Cost_Function_H
25 
26 #include "common.h"
27 #include "matrix_real.h"
28 #include <tbb/combinable.h>
29 #include "logging.h"
30 
31 
37 double get_cost_function(Matrix matrix, int trace_offset=0);
38 
39 
46 Matrix_real get_cost_function_with_correction(Matrix matrix, int qbit_num, int trace_offset=0);
47 
48 
55 Matrix_real get_cost_function_with_correction2(Matrix matrix, int qbit_num, int trace_offset=0);
56 
58 
65 
66 
73 double get_hilbert_schmidt_test(Matrix& matrix);
74 
81 double get_infidelity(Matrix& matrix);
82 
90 
91 
99 
103 class functor_cost_fnc : public logging {
104 
105 protected:
106 
112  tbb::combinable<double>* partial_cost_functions;
113 
114 public:
115 
122 functor_cost_fnc( Matrix matrix_in, tbb::combinable<double>* partial_cost_functions_in );
123 
128 void operator()( tbb::blocked_range<int> r ) const;
129 
130 };
131 
132 
133 #endif
134 
135 
136 
137 
138 
QGD_Complex16 * data
Pointer to the data stored in the matrix.
Matrix_real get_cost_function_with_correction(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...
Matrix_real get_cost_function_with_correction2(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...
Header file for a class containing basic methods for setting up the verbosity level.
A class containing basic methods for setting up the verbosity level.
Definition: logging.h:43
QGD_Complex16 get_trace(Matrix &matrix)
Call to calculate the real and imaginary parts of the trace.
double get_infidelity(Matrix &matrix)
Call to calculate infidelity.
Function operator class to calculate the partial cost function of the final optimization process...
Matrix matrix
Array stroing the matrix.
functor_cost_fnc(Matrix matrix_in, tbb::combinable< double > *partial_cost_functions_in)
Constructor of the class.
void operator()(tbb::blocked_range< int > r) const
Operator to calculate the partial cost function derived from the row of the matrix labeled by row_idx...
double get_cost_function(Matrix matrix, int trace_offset=0)
Call co calculate the cost function during the final optimization process.
Structure type representing complex numbers in the SQUANDER package.
Definition: QGDTypes.h:38
Class to store data of complex arrays and its properties.
Definition: matrix.h:38
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 th...
double get_cost_function_sum_of_squares(Matrix &matrix)
Header file for commonly used functions and wrappers to CBLAS functions.
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 th...
Class to store data of complex arrays and its properties.
Definition: matrix_real.h:39
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.
tbb::combinable< double > * partial_cost_functions
array storing the partial cost functions