1
$\begingroup$

I am quite confused with the MatrixOp.to_pauli_op() API.

I have a hamiltonian, and it is given as input to a API MatrixOp.

import numpy as np
from qiskit.opflow import MatrixOp
from qiskit.circuit.library import EfficientSU2
from qiskit.algorithms.optimizers import COBYLA
from qiskit.utils import QuantumInstance 
from qiskit import IBMQ, transpile
from qiskit import Aer

from qiskit.algorithms import VQE
    
# This Hamiltonian is not unitary.It is generated from matrix A and B (AX =B)
Hamiltonian =  np.array([[ 4.07981221, -3.6713615,   1.3943662,  -1.05164319], 
 [-3.6713615,   5.88262911, -4.14084507,  1.37558685],
 [ 1.3943662,  -4.14084507,  5.83098592, -3.54929577],
 [-1.05164319,  1.37558685, -3.54929577,  3.79812207]])
    

H_op = MatrixOp(Hamiltonian).to_pauli_op()
print(H_op)
print(type(H_op)) 

How can a non-unitary matrix be given as input to a qiskit API?

$\endgroup$
3
  • $\begingroup$ Hi! It's preferable if you limit yourself to a single question per post. Concerning the ansatz and why VQE needs one, you can find details here. It's better if you leave a single question in your post and then ask one question after the other in new posts. That way, it's easier to answer your question and to find it if someone has the same misunderstandings as you. $\endgroup$
    – Tristan Nemoz
    Mar 15 at 12:51
  • 1
    $\begingroup$ Thank you @TristanNemoz for the response. I will today modify each of my questions as a separate question. $\endgroup$
    – Manu
    Mar 15 at 16:36
  • $\begingroup$ I have modified the question. $\endgroup$
    – Manu
    Mar 15 at 16:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.