ScalarOp

class ScalarOp(dims, coeff=1)[source]

Scalar identity operator class.

This is a symbolic representation of an scalar identity operator on multiple subsystems. It may be used to initialize a symbolic scalar multiplication of an identity and then be implicitly converted to other kinds of operator subclasses by using the compose(), dot(), tensor(), expand() methods.

Initialize an operator object.

Parameters
  • dims (int or tuple) – subsystem dimensions.

  • coeff (Number) – scalar coefficient for the identity operator (Default: 1).

Raises

QiskitError – If the optional coefficient is invalid.

Attributes

ScalarOp.atol

The default absolute tolerance parameter for float comparisons.

ScalarOp.coeff

Return the coefficient

ScalarOp.dim

Return tuple (input_shape, output_shape).

ScalarOp.num_qubits

Return the number of qubits if a N-qubit operator or None otherwise.

ScalarOp.qargs

Return the qargs for the operator.

ScalarOp.rtol

The relative tolerance parameter for float comparisons.

Methods

ScalarOp.__call__(qargs)

Return a clone with qargs set

ScalarOp.__mul__(other)

ScalarOp.add(other)

Return the linear operator self + other.

ScalarOp.adjoint()

Return the adjoint of the operator.

ScalarOp.compose(other[, qargs, front])

Return the composed operator.

ScalarOp.conjugate()

Return the conjugate of the operator.

ScalarOp.copy()

Make a deep copy of current operator.

ScalarOp.dot(other[, qargs])

Return the right multiplied operator self * other.

ScalarOp.expand(other)

Return the tensor product operator other ⊗ self.

ScalarOp.input_dims([qargs])

Return tuple of input dimension for specified subsystems.

ScalarOp.is_unitary([atol, rtol])

Return True if operator is a unitary matrix.

ScalarOp.multiply(other)

Return the linear operator other * self.

ScalarOp.output_dims([qargs])

Return tuple of output dimension for specified subsystems.

ScalarOp.power(n)

Return the power of the ScalarOp.

ScalarOp.reshape([input_dims, output_dims])

Return a shallow copy with reshaped input and output subsystem dimensions.

ScalarOp.set_atol(value)

Set the class default absolute tolerance parameter for float comparisons.

ScalarOp.set_rtol(value)

Set the class default relative tolerance parameter for float comparisons.

ScalarOp.subtract(other)

Return the linear operator self - other.

ScalarOp.tensor(other)

Return the tensor product operator self ⊗ other.

ScalarOp.to_matrix()

Convert to a Numpy matrix.

ScalarOp.to_operator()

Convert to an Operator object.

ScalarOp.transpose()

Return the transpose of the operator.

ScalarOp.__call__(qargs)

Return a clone with qargs set

ScalarOp.__mul__(other)