ScalarOp#
- class qiskit.quantum_info.ScalarOp(dims=None, coeff=1)[소스]#
기반 클래스:
LinearOp
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.
- 매개변수:
- 예외 발생:
QiskitError – If the optional coefficient is invalid.
Attributes
- atol = 1e-08#
- coeff#
Return the coefficient
- dim#
Return tuple (input_shape, output_shape).
- num_qubits#
Return the number of qubits if a N-qubit operator or None otherwise.
- qargs#
Return the qargs for the operator.
- rtol = 1e-05#
Methods
- adjoint()#
Return the adjoint of the Operator.
- 반환 형식:
Self
- compose(other, qargs=None, front=False)[소스]#
Return the operator composition with another ScalarOp.
- 매개변수:
- 반환:
The composed ScalarOp.
- 반환 형식:
- 예외 발생:
QiskitError – if other cannot be converted to an operator, or has incompatible dimensions for specified subsystems.
참고
Composition (
&
) by default is defined as left matrix multiplication for matrix operators, while@
(equivalent todot()
) is defined as right matrix multiplication. That is thatA & B == A.compose(B)
is equivalent toB @ A == B.dot(A)
whenA
andB
are of the same type.Setting the
front=True
kwarg changes this to right matrix multiplication and is equivalent to thedot()
methodA.dot(B) == A.compose(B, front=True)
.
- copy()#
Make a deep copy of current operator.
- dot(other, qargs=None)#
Return the right multiplied operator self * other.
- 매개변수:
- 반환:
The right matrix multiplied Operator.
- 반환 형식:
참고
The dot product can be obtained using the
@
binary operator. Hencea.dot(b)
is equivalent toa @ b
.
- input_dims(qargs=None)#
Return tuple of input dimension for specified subsystems.
- output_dims(qargs=None)#
Return tuple of output dimension for specified subsystems.
- reshape(input_dims=None, output_dims=None, num_qubits=None)#
Return a shallow copy with reshaped input and output subsystem dimensions.
- 매개변수:
input_dims (None or tuple) – new subsystem input dimensions. If None the original input dims will be preserved [Default: None].
output_dims (None or tuple) – new subsystem output dimensions. If None the original output dims will be preserved [Default: None].
num_qubits (None or int) – reshape to an N-qubit operator [Default: None].
- 반환:
returns self with reshaped input and output dimensions.
- 반환 형식:
BaseOperator
- 예외 발생:
QiskitError – if combined size of all subsystem input dimension or subsystem output dimensions is not constant.
- tensor(other)[소스]#
Return the tensor product with another ScalarOp.
- 매개변수:
other (ScalarOp) – a ScalarOp object.
- 반환:
- the tensor product \(a \otimes b\), where \(a\)
is the current ScalarOp, and \(b\) is the other ScalarOp.
- 반환 형식:
참고
The tensor product can be obtained using the
^
binary operator. Hencea.tensor(b)
is equivalent toa ^ b
.