qbraid.interface.to_unitary
- to_unitary(program, ensure_contiguous=False)[source]
Calculates the unitary of any valid input quantum program.
- Parameters
program (
QPROGRAM
) – Any quantum program object supported by qBraid.ensure_contiguous (
Optional
[bool
]) – If True, calculates unitary using contiguous qubit indexing
- Raises
ProgramTypeError – If the input quantum program is not supported.
UnitaryCalculationError – If the programs unitary could not be calculated.
- Return type
ndarray
- Returns
Matrix representation of the input quantum program.