Arbitrary State preparation

I think there is some confusion between unitary and hermitian in this thread.

All “gates” in quantum computing are “unitary”.

Any “observable” or measurement made must be “hermitian”.

For the VQLS tutorial, both U_b and CA are unitary.

Josh and Antal provided excellent ways to decompose a hermitian matrix as per your question, but U_b and CA do not necessarily fit into that category.

The goal of U_b is to prepare a specific state. Arbitrary state preparation can be done with:

The goal of CA is to apply a specific controlled unitary. Given a unitary matrix, you can apply CA with qml.ControlledQubitUnitary

For smaller unitary matrix sizes, PennyLane can decompose a unitary into standard base gates like rotations using a variety of formulas.