831be1dc40528bf85d45995a9ba0acaf25c0c1aa,test/test_vqe.py,TestVQE,test_vqe_direct,#TestVQE#,93

Before Change


        init_state.init_args(num_qbits)
        var_form = get_variational_form_instance("RY")
        var_form.init_args(num_qbits, 3, initial_state=init_state)
        optimizer = get_optimizer_instance("L_BFGS_B")
        optimizer.init_args()
        algo = get_algorithm_instance("VQE")
        algo.setup_quantum_backend(backend="statevector_simulator")
        algo.init_args(self.algo_input.qubit_op, "matrix", var_form, optimizer)

After Change



    def test_vqe_direct(self):
        num_qbits = self.algo_input.qubit_op.num_qubits
        init_state = get_pluggable_instance(PluggableType.INITIAL_STATE,"ZERO")
        init_state.init_args(num_qbits)
        var_form = get_pluggable_instance(PluggableType.VARIATIONAL_FORM,"RY")
        var_form.init_args(num_qbits, 3, initial_state=init_state)
        optimizer = get_pluggable_instance(PluggableType.OPTIMIZER,"L_BFGS_B")
        optimizer.init_args()
        algo = get_pluggable_instance(PluggableType.ALGORITHM,"VQE")
        algo.setup_quantum_backend(backend="statevector_simulator")
        algo.init_args(self.algo_input.qubit_op, "matrix", var_form, optimizer)
        result = algo.run()
        self.assertAlmostEqual(result["energy"], -1.85727503)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: Qiskit/qiskit-aqua
Commit Name: 831be1dc40528bf85d45995a9ba0acaf25c0c1aa
Time: 2018-11-19
Author: manoel@us.ibm.com
File Name: test/test_vqe.py
Class Name: TestVQE
Method Name: test_vqe_direct


Project Name: Qiskit/qiskit-aqua
Commit Name: 831be1dc40528bf85d45995a9ba0acaf25c0c1aa
Time: 2018-11-19
Author: manoel@us.ibm.com
File Name: test/test_vqe.py
Class Name: TestVQE
Method Name: test_vqe_direct


Project Name: Qiskit/qiskit-aqua
Commit Name: 831be1dc40528bf85d45995a9ba0acaf25c0c1aa
Time: 2018-11-19
Author: manoel@us.ibm.com
File Name: test/test_vqe2iqpe.py
Class Name: TestVQE2IQPE
Method Name: test_vqe_2_iqpe


Project Name: Qiskit/qiskit-aqua
Commit Name: 831be1dc40528bf85d45995a9ba0acaf25c0c1aa
Time: 2018-11-19
Author: manoel@us.ibm.com
File Name: test/test_qsvm_variational.py
Class Name: TestQSVMVariational
Method Name: test_qsvm_variational_directly