import numpy as np
from qiskit import BasicAer
from qiskit.transpiler import PassManager
from qiskit.aqua import QuantumInstance
from qiskit.aqua.operators import MatrixOperator, op_converter
from qiskit.aqua.algorithms import EOH
from qiskit.aqua.components.initial_states import Custom

num_qubits = 2
temp = np.random.random((2 ** num_qubits, 2 ** num_qubits))
qubit_op = op_converter.to_weighted_pauli_operator(MatrixOperator(matrix=temp + temp.T))
temp = np.random.random((2 ** num_qubits, 2 ** num_qubits))
evo_op = op_converter.to_weighted_pauli_operator(MatrixOperator(matrix=temp + temp.T))

evo_time = 1
num_time_slices = 1
state_in = Custom(qubit_op.num_qubits, state='uniform')
eoh = EOH(qubit_op, state_in, evo_op, evo_time=evo_time, num_time_slices=num_time_slices)

backend = BasicAer.get_backend('statevector_simulator')
quantum_instance = QuantumInstance(backend)

ret = eoh.run(quantum_instance)
print('The result is\n{}'.format(ret))