wy_qcos.transpiler.cmss.circuit.operators package
Submodules
wy_qcos.transpiler.cmss.circuit.operators.op_shape module
- class wy_qcos.transpiler.cmss.circuit.operators.op_shape.OpShape(dims_l=None, dims_r=None, num_qargs_l=None, num_qargs_r=None)
基类:
objectMultipartite matrix and vector shape class.
- dims_r(qargs=None)
Return tuple of input dimension for specified subsystems.
- dims_l(qargs=None)
Return tuple of output dimension for specified subsystems.
- property size
Return the combined dimensions of the object.
- property num_qubits
Get number of qubits.
- Description:
Return number of qubits if shape is N-qubit. If Shape is not N-qubit return None.
- property num_qargs
Return a tuple of the number of left and right wires.
- property shape
Return a tuple of the matrix shape.
- property tensor_shape
Return a tuple of the tensor shape.
- property is_square
Return True if the left and right dimensions are equal.
- compose(other, qargs=None, front=False)
Return composed OpShape.
- 参数:
other (OpShape)
qargs (list | None)
front (bool)
- validate_shape(shape)
Raise an exception if shape is not valid for the OpShape.
- classmethod auto(shape=None, dims_l=None, dims_r=None, dims=None, num_qubits_l=None, num_qubits_r=None, num_qubits=None)
Maxtrix construction.
- Description:
Construct TensorShape with automatic checking of qubit dimensions.
- 返回类型:
wy_qcos.transpiler.cmss.circuit.operators.operator module
- class wy_qcos.transpiler.cmss.circuit.operators.operator.Operator(data, input_dims=None, output_dims=None)
基类:
objectMatrix operator class.
- Description:
This represents a matrix operator. Evaluation the equality of the maxtrix.
- 参数:
data (QuantumCircuit | np.ndarray | Operator | ScalarOp)
input_dims (tuple | None)
output_dims (tuple | None)
- property data
The underlying Numpy array.
- property dim
Return tuple (input_shape, output_shape).
- to_operator()
Convert operator to matrix operator class.
- 返回类型:
- compose(other, qargs=None, front=False)
Compose self operator with other operator.
- Description:
The composition is defined as self * other if front=False or other * self if front=True. If qargs is specified, the composition is performed only on the subsystems specified by qargs.
- equiv(other, rtol=None, atol=None)
Return True if operators are equivalent.
- 参数:
other (Operator) -- an operator object.
rtol (float) -- relative tolerance value for comparison.
atol (float) -- absolute tolerance value for comparison.
- 返回:
True if operators are equivalent up to global phase.
- 返回类型:
bool
- matrix_equal(mat1, mat2, ignore_phase=False, rtol=0, atol=0, props=None)
Test if two arrays are equal.
The final comparison is implemented using Numpy.allclose. See its documentation for additional information on tolerance parameters.
If
ignore_phaseis True both matrices will be multiplied byexp(-1j * theta)where theta is the first nphase for a first non-zero matrix element|a| * exp(1j * theta).- 参数:
mat1 (matrix_like) -- a matrix
mat2 (matrix_like) -- a matrix
ignore_phase (bool) -- ignore complex-phase differences between matrices [Default: False]
rtol (double) -- the relative tolerance parameter [Default {}].
atol (double) -- the absolute tolerance parameter [Default {}].
props (dict | None) -- if not None and ignore_phase is True returns the phase difference between the two matrices under props['phase_difference']
- 返回:
True if the matrices are equal or False otherwise.
- 返回类型:
bool
- class wy_qcos.transpiler.cmss.circuit.operators.operator.ScalarOp(dims=None, coeff=1.0)
基类:
objectScalar identity operator class.
- 参数:
dims (int | tuple | None)
coeff (int | float)
- property dim
Return tuple (input_shape, output_shape).
- property coeff
Return the coefficient.
- input_dims(qargs=None)
Return tuple of input dimension for specified subsystems.
- output_dims(qargs=None)
Return tuple of output dimension for specified subsystems.
- to_matrix()
Convert to a Numpy matrix.
- to_operator()
Convert to an Operator object.
- 返回类型: