Sequential Quantum Gate Decomposer  v1.9.6
Powerful decomposition of general unitarias into one- and two-qubit gates gates
NN.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 NN_H
24 #define NN_H
25 
26 #include "matrix.h"
27 #include "matrix_real.h"
28 
29 #include <time.h>
30 #include <stdlib.h>
31 #include <random>
32 
33 #include "Gates_block.h"
34 #include "CZ.h"
35 #include "CH.h"
36 #include "CNOT.h"
37 #include "U3.h"
38 #include "RX.h"
39 #include "X.h"
40 #include "SX.h"
41 #include "RY.h"
42 #include "CRY.h"
43 #include "RZ.h"
44 #include "SYC.h"
45 #include "Adaptive.h"
46 #include <map>
47 #include <cstdlib>
48 #include <time.h>
49 #include <ctime>
50 #include <tbb/cache_aligned_allocator.h>
51 
52 
53 
54 
58 class NN {
59 
60 
61 public:
62 
64  int tt;
65 
66 protected:
67 
68 
70  std::random_device rd;
72  std::mt19937 gen;
74  std::vector<matrix_base<int>> topology;
77 
78 
79 
80 
81 public:
82 
87 NN();
88 
89 
94 NN( std::vector<matrix_base<int>> topology_in );
95 
96 
97 
102 void create_randomized_parameters( int num_of_parameters, int qbit_num, int levels, Matrix_real& parameters, matrix_base<int8_t>& nontrivial_adaptive_layers );
103 
104 
109 void get_nn_chanels_from_kernel( Matrix& kernel_up, Matrix& kernel_down, Matrix_real& chanels);
110 
117 void get_nn_chanels( const Matrix& Umtx, const int& target_qbit, Matrix_real& chanels);
118 
124 void get_nn_chanels( int qbit_num, const Matrix& Umtx, Matrix_real& chanels);
125 
133 void get_nn_chanels(int qbit_num, int levels, Matrix_real& chanels, matrix_base<int8_t>& nontrivial_adaptive_layers);
134 
135 
144 void get_nn_chanels(int qbit_num, int levels, int samples_num, Matrix_real& chanels, matrix_base<int8_t>& nontrivial_adaptive_layers);
145 
146 };
147 
148 #endif //NN
NN()
Nullary constructor of the class.
Definition: NN.cpp:34
std::mt19937 gen
Standard mersenne_twister_engine seeded with rd()
Definition: NN.h:72
Header file for a class representing a controlled rotation gate around the Y axis.
int levels
[creating decomp class]
int num_threads
Store the number of OpenMP threads. (During the calculations OpenMP multithreading is turned off...
Definition: NN.h:76
Header file for a class representing a CH operation.
Header file for a class responsible for grouping gates into subcircuits. (Subcircuits can be nested) ...
std::vector< matrix_base< int > > topology
connectivity between the wubits
Definition: NN.h:74
void get_nn_chanels_from_kernel(Matrix &kernel_up, Matrix &kernel_down, Matrix_real &chanels)
call retrieve the channels for the neural network associated with a single 2x2 kernel ...
Definition: NN.cpp:160
Header file for a class representing a CNOT operation.
void create_randomized_parameters(int num_of_parameters, int qbit_num, int levels, Matrix_real &parameters, matrix_base< int8_t > &nontrivial_adaptive_layers)
Call to construct random parameter, with limited number of non-trivial adaptive layers.
Definition: NN.cpp:82
Umtx
The unitary to be decomposed.
Definition: example.py:53
Header file of complex array storage array with automatic and thread safe reference counting...
Header file for a class representing a CZ operation.
Double-precision complex matrix (float64).
Definition: matrix.h:38
Header file for a class representing a gate used in adaptive decomposition.
A class containing basic methods for the decomposition process.
Definition: NN.h:58
void get_nn_chanels(const Matrix &Umtx, const int &target_qbit, Matrix_real &chanels)
call retrieve the channels for the neural network associated with a single unitary ...
Definition: NN.cpp:222
int tt
number of gate blocks used in one shot of the optimization process
Definition: NN.h:64
std::random_device rd
Will be used to obtain a seed for the random number engine.
Definition: NN.h:70
Class to store data of complex arrays and its properties.
Definition: matrix_real.h:41
Header file for a class representing a Sycamore gate.