Tensor module¶
The Tensor Module is used to represent registers or parallel gates in a circuit. The reason is that these structures comprise of tensor products of qubits or gates respectively.
-
class
Tensor.
Tensor
(inputs)¶ Bases:
object
Calculates Tensor Product
- Parameters
inputs – (list) Matrix to calculate the Tensor Product.
-
calculate
()¶ Calculates the outer product of the inputs from right to left, since that is the order of applying them in Linear Algebra, and saves the product in matrix form as its attribute. This method allows for the object to recalculate the outer product, for example when any of the qubits from the register are collapsed.
-
to_gate
(gate_name)¶ Converts the tensor product to a Gate object.
- Parameters
gate_name – (str) Name of the Gate
- Returns
gate as it is constructed
-
to_state
()¶ Converts the tensor product to a State object.
- Returns
state as it is constructed