def test_combine2(self): x = np.array([0.75, 0, 0.25, 0]) encoder = encode.AngleEncoding() model = EntangledQubit() full_circuit = combine(x, encoder, model) print(full_circuit) self.assertTrue(isinstance(full_circuit, qiskit.QuantumCircuit))
def test_combine1(self): x = np.array([1, 0, 0, 0, 0, 0, 0, 1]) encoder = encode.BasisEncoding() model = TreeTensorNetwork() full_circuit = combine(x, encoder, model) print(full_circuit) self.assertTrue(isinstance(full_circuit, qiskit.QuantumCircuit))
def test_combine3(self): """ BinaryPhase, BinaryPerceptron """ x = np.array([-1, 1, 1, -1]) encoder = encode.BinaryPhaseEncoding() model = BinaryPerceptron() full_circuit = combine(x, encoder, model) print(full_circuit) self.assertTrue(isinstance(full_circuit, qiskit.QuantumCircuit))
def test_combine6(self): """ circuits with differnent number of qubits """ x = np.array([0.5, 0, 0, -0.5]) encoder = encode.DenseAngleEncoding() model = BinaryPerceptron() full_circuit = combine(x, encoder, model) print(full_circuit) self.assertTrue(isinstance(full_circuit, qiskit.QuantumCircuit))
def test_combine5(self): """ With BinaryEncoding and a different model """ x = np.array([-1, 1, 1, -1]) encoder = encode.BinaryPhaseEncoding() model = TreeTensorNetwork() full_circuit = combine(x, encoder, model) print(full_circuit) self.assertTrue(isinstance(full_circuit, qiskit.QuantumCircuit))
def test_combine9(self): """ With measurement argument --- ProbabilityThreshold """ x = np.array([1, 0, 0, 1]) encoder = encode.BasisEncoding() model = TreeTensorNetwork() measure = measurement.ProbabilityThreshold(3) full_circuit = combine(x, encoder, model, measure) print(full_circuit) self.assertTrue(isinstance(full_circuit, qiskit.QuantumCircuit))
def test_combine8(self): """ With measurement argument --- Expecation """ x = np.array([1, 0, 0, 1]) encoder = encode.BasisEncoding() model = TreeTensorNetwork() Y_obs = Observable.Y() measure = measurement.Expectation(0, observable=Y_obs) full_circuit = combine(x, encoder, model, measure) print(full_circuit) self.assertTrue(isinstance(full_circuit, qiskit.QuantumCircuit))