MatrixOperator¶
- class MatrixOperator(matrix, basis=None, z2_symmetries=None, atol=1e-12, name=None)[source]¶
Operators relevant for quantum applications
Note
For grouped paulis representation, all operations will always convert it to paulis and then convert it back. (It might be a performance issue.)
- Parameters
matrix (numpy.ndarray or scipy.sparse.csr_matrix) – a 2-D sparse matrix represents operator (using CSR format internally)
basis (list[tuple(object, [int])], optional) – the grouping basis, each element is a tuple composed of the basis and the indices to paulis which are belonged to that group. e.g., if tpb basis is used, the object will be a pauli. by default, the group is equal to non-grouping, each pauli is its own basis.
z2_symmetries (Z2Symmetries) – represent the Z2 symmetries
atol (float) – atol
name (str) – name
Attributes
return atol
returns basis
Getter of matrix in dense matrix form.
diagonal matrix
Getter of matrix.
returns name
number of qubits required for the operator.
returns z2 symmetries
Methods
MatrixOperator.__mul__
(other)Overload * operation.
MatrixOperator.add
(other[, copy])MatrixOperator.chop
([threshold, copy])Eliminate the real and imagine part of coeff in each pauli by threshold.
Construct the circuits for evaluation.
Get a copy of self.
Use the executed result with operator to get the evaluated value.
- param quantum_state
quantum state
MatrixOperator.evolve
(state_in[, evo_time, …])Carry out the eoh evolution for the operator under supplied specifications.
Check Operator is empty or not.
- returns
a formatted operator.
MatrixOperator.sub
(other[, copy])to op flow