Sequential Quantum Gate Decomposer  v1.9.3
Powerful decomposition of general unitarias into one- and two-qubit gates gates
Sub_Matrix_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 Sub_Matrix_Decomposition_Cost_Function_H
24 #define Sub_Matrix_Decomposition_Cost_Function_H
25 
26 
27 #include "common.h"
28 #include <tbb/combinable.h>
29 #include "logging.h"
30 
31 
38 double get_submatrix_cost_function(Matrix& matrix);
39 
40 
41 
42 
47 
48 protected:
49 
53  std::vector<Matrix, tbb::cache_aligned_allocator<Matrix>>* submatrices;
54 
55 public:
56 
63 functor_extract_submatrices( Matrix& matrix_in, std::vector<Matrix, tbb::cache_aligned_allocator<Matrix>>* submatrices_in );
64 
69 void operator()( tbb::blocked_range<int> r ) const;
70 
71 };
72 
73 
74 
75 
80 
81 protected:
82 
84  int prod_num;
86  std::vector<Matrix, tbb::cache_aligned_allocator<Matrix>>* submatrices;
88  tbb::combinable<double>* prod_cost_functions;
89 
90 public:
91 
99 functor_submtx_cost_fnc( std::vector<Matrix, tbb::cache_aligned_allocator<Matrix>>* submatrices_in, tbb::combinable<double>* prod_cost_functions_in, int prod_num_in );
100 
105 void operator()( int product_idx ) const;
106 
107 };
108 
109 
110 
111 
112 
113 
114 
115 
116 #endif
functor_extract_submatrices(Matrix &matrix_in, std::vector< Matrix, tbb::cache_aligned_allocator< Matrix >> *submatrices_in)
Constructor of the class.
Function operator class to calculate the partial cost function derived from the individual products o...
std::vector< Matrix, tbb::cache_aligned_allocator< Matrix > > * submatrices
container storing the submatrices
Header file for a class containing basic methods for setting up the verbosity level.
double get_submatrix_cost_function(Matrix &matrix)
Call to calculate the cost function of a given matrix during the submatrix decomposition process...
A class containing basic methods for setting up the verbosity level.
Definition: logging.h:43
Function operator class to extract the submatrices from a unitary.
void operator()(tbb::blocked_range< int > r) const
Operator to extract the sumbatrix indexed by submtx_idx.
Class to store data of complex arrays and its properties.
Definition: matrix.h:38
Matrix matrix
The matrix from which submatrices would be extracted.
std::vector< Matrix, tbb::cache_aligned_allocator< Matrix > > * submatrices
preallocated container storing the submatrices
Header file for commonly used functions and wrappers to CBLAS functions.
int prod_num
number of distinct submatix products
tbb::combinable< double > * prod_cost_functions