4 Created on Tue Jun 30 15:44:26 2020 5 Copyright 2020 Peter Rakyta, Ph.D. 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 11 http://www.apache.org/licenses/LICENSE-2.0 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 19 You should have received a copy of the GNU General Public License 20 along with this program. If not, see http://www.gnu.org/licenses/. 22 @author: Peter Rakyta, Ph.D. 36 def __init__( self, State, level_limit_max=8, level_limit_min=0, topology=None, config={} ):
40 if type(State) != np.ndarray:
41 raise Exception(
"Initial state should be a numpy array")
44 if State.dtype != np.complex128:
45 raise Exception(
"Initial state should be made of complex values")
48 if not State.data.c_contiguous :
49 raise Exception(
"Initial state should be contiguous in memory")
51 if len(State.shape) == 1:
52 State = State.reshape( (State.size, 1,) )
55 if len(State.shape) == 2
and State.shape[1]==1:
56 super().
__init__( State, level_limit_max, level_limit_min, topology=topology, config=config )
58 raise Exception(
"Initial state not properly formatted. Input state must be a column vector")
67 from squander
import Qiskit_IO
69 squander_circuit = self.get_Circuit()
70 parameters = self.get_Optimized_Parameters()
72 return Qiskit_IO.get_Qiskit_Circuit_inverse( squander_circuit, parameters )
A QGD Python interface class for the decomposition of N-qubit state into U3 and CNOT gates...
def get_Qiskit_Circuit(self)
Export the unitary decomposition into Qiskit format.
def __init__(self, State, level_limit_max=8, level_limit_min=0, topology=None, config={})
A QGD Python interface class for the decomposition of N-qubit unitaries into U3 and CNOT gates...