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

MatrixOperator.atol

return atol

MatrixOperator.basis

returns basis

MatrixOperator.dense_matrix

Getter of matrix in dense matrix form.

MatrixOperator.dia_matrix

diagonal matrix

MatrixOperator.matrix

Getter of matrix.

MatrixOperator.name

returns name

MatrixOperator.num_qubits

number of qubits required for the operator.

MatrixOperator.z2_symmetries

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.

MatrixOperator.construct_evaluation_circuit(…)

Construct the circuits for evaluation.

MatrixOperator.copy()

Get a copy of self.

MatrixOperator.evaluate_with_result(result)

Use the executed result with operator to get the evaluated value.

MatrixOperator.evaluate_with_statevector(…)

param quantum_state

quantum state

MatrixOperator.evolve(state_in[, evo_time, …])

Carry out the eoh evolution for the operator under supplied specifications.

MatrixOperator.is_empty()

Check Operator is empty or not.

MatrixOperator.print_details()

returns

a formatted operator.

MatrixOperator.sub(other[, copy])

MatrixOperator.to_opflow()

to op flow