Cytnx icon indicating copy to clipboard operation
Cytnx copied to clipboard

Add get_block_unitensor() and get_block_unitensor_()

Open pcchen opened this issue 2 years ago • 3 comments

We need to add get_block_unitensor() and get_block_unitensor_() which return a UniTensor instead of a Tensor.

pcchen avatar Oct 23 '23 02:10 pcchen

Actually, I think there is a better way to do this.

If we just make Tensor has a method Tensor.unitensor(labels)

kaihsin avatar Oct 24 '23 18:10 kaihsin

So the idea is we can do

UT.get_block().unitensor(labels) 

In the user guide, we can say:

``get_block() return the data of a block (as a Tensor, see Appendix.XXX). To get the block as a unitensor, simply chaining with .unitensor(labels) as following:"

UT.get_block().unitensor(labels) 

kaihsin avatar Oct 24 '23 18:10 kaihsin

and for the generator, one can do

cytnx.zeros(100).unitensor(labels) 

kaihsin avatar Oct 24 '23 18:10 kaihsin