Block encoding for non-unitary matrices

In this link: Block encoding with matrix access oracles | PennyLane Demos, non-unitary matrices can be converted into unitary matrices with a quantum circuit for Block Encoding. matrix A = np.array([[-0.51192128, -0.51192128, 0.6237114 , 0.6237114 ],
[ 0.97041007, 0.97041007, 0.99999329, 0.99999329],
[ 0.82429855, 0.82429855, 0.98175843, 0.98175843],
[ 0.99675093, 0.99675093, 0.83514837, 0.83514837]]) has been used as an example. As you can see all Aij values in matrix A are less than 1, so that the arccos can be calculated without any runtime error. Let’s consider that i have this matrix A = [[-14. 14. -6. 1.]
[ 14. -20. 15. -6.]
[ -6. 15. -20. 14.]
[ 1. -6. 14. -14.]]. How can i extract my matrix (A = [[-14. 14. -6. 1.]
[ 14. -20. 15. -6.]
[ -6. 15. -20. 14.]
[ 1. -6. 14. -14.]]) with Block encoding code from this demo: Block encoding with matrix access oracles | PennyLane Demos

Hi @sassan_moradi ,

You would need to perform a previous step where you map your matrix so that all values are in the range [1 , -1]. You can use something like: A = A/np.max(np.abs(A))

I hope this helps you

Hi @CatalinaAlbornoz,
it helped. Many thanks. :blush:

I’m glad to hear @sassan_moradi!