qat.pylinalg.simulator.mat2nparray

qat.pylinalg.simulator.mat2nparray(matrix)

Converts serialized matrix format into numpy array.

When extracted from the quantum circuit, gate matrices are not directly numpy arrays. They are instances of Matrix, an internally-defined structure.

Parameters

matrix (qat.comm.datamodel.ttypes.Matrix) – The matrix, as extracted from circuit operation, to convert to numpy.ndarray

Returns

a numpy.ndarray of shape (2*arity,2*arity) containing the matrix data.

Return type

numpy.ndarray