unitaria.Tensor¶
- class unitaria.Tensor(A: Node, B: Node)[source]¶
Bases:
NodeNode representing the tensor product of two other nodes
The order of operations is such that
Acorresponds to the more significant digits of the index, i.e.>>> import unitaria as ut >>> import numpy as np >>> ut.Tensor(ut.Identity(ut.Subspace("#")), ut.Increment(bits=1)).toarray().real array([[0., 1., 0., 0.], [1., 0., 0., 0.], [0., 0., 0., 1.], [0., 0., 1., 0.]])
The
&operator forut.Nodeis overloaded to be the tensor product, i.e. you can equivalently write>>> import unitaria as ut >>> import numpy as np >>> (ut.Identity(ut.Subspace("#")) & ut.Increment(bits=1)).toarray().real array([[0., 1., 0., 0.], [1., 0., 0., 0.], [0., 0., 0., 1.], [0., 0., 1., 0.]])
- Parameters:
A – The first factor
B – The second factor