MatrixOperator¶

class MatrixOperator(matrix, basis=None, z2_symmetries=None, atol=1e-12, name=None)[Quellcode]

Bases: qiskit.aqua.operators.legacy.base_operator.LegacyBaseOperator

Operators relevant for quantum applications

Bemerkung

For grouped paulis representation, all operations will always convert it to paulis and then convert it back. (It might be a performance issue.)

Parameter
• 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

Methods

 add chop Eliminate the real and imagine part of coeff in each pauli by threshold. construct_evaluation_circuit Construct the circuits for evaluation. copy Get a copy of self. evaluate_with_result Use the executed result with operator to get the evaluated value. evaluate_with_statevector param quantum_state quantum state evolve Carry out the eoh evolution for the operator under supplied specifications. is_empty Check Operator is empty or not. print_details returns a formatted operator. sub to_opflow to op flow

Attributes

atol

return atol

basis

returns basis

dense_matrix

Getter of matrix in dense matrix form.

dia_matrix

diagonal matrix

matrix

Getter of matrix.

name

returns name

num_qubits

number of qubits required for the operator.

Rückgabe

number of qubits

Rückgabetyp

int

z2_symmetries

returns z2 symmetries