2 Copyright 2020 Peter Rakyta, Ph.D. 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 8 http://www.apache.org/licenses/LICENSE-2.0 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 16 You should have received a copy of the GNU General Public License 17 along with this program. If not, see http://www.gnu.org/licenses/. 30 from qiskit
import QuantumCircuit
35 from squander
import utils
36 from squander
import Circuit
37 from squander
import Qiskit_IO
42 from mpi4py
import MPI
44 except ModuleNotFoundError:
53 qc_orig = QuantumCircuit(5)
101 qc_orig.rx(-np.pi/2,0)
105 qc_orig.rx(-np.pi/2,0)
109 qc_orig.rx(-np.pi/2,0)
110 qc_orig.rx(-np.pi/2,1)
122 """This is a test class of the python iterface to the decompsition classes of the QGD package""" 131 Umtx = utils.get_unitary_from_qiskit_circuit( qc_trial )
133 Circuit_Squander, parameters = Qiskit_IO.convert_Qiskit_to_Squander( qc_trial )
136 input = (Umtx.conj().T).copy()
137 Circuit_Squander.apply_to( parameters, input )
139 input = input * np.conj(input[0,0]) - np.eye( input.shape[0], dtype=np.complex128 )
142 from numpy
import linalg
as LA
143 norm = LA.norm( input )
145 assert( norm < 1e-6 )
148 gates = Circuit_Squander.get_Gates()
152 input = (Umtx.conj().T).copy()
def pauli_exponent(alpha=0.6217 *np.pi)
Function to generate a test Qiskit circuit.
def test_circuit_import(self)
def apply_to(self, parameters_mtx, unitary_mtx, parallel=1)