Cytnx icon indicating copy to clipboard operation
Cytnx copied to clipboard

rowrank is modified after slicing

Open pcchen opened this issue 2 years ago • 0 comments

Example code

UT = cytnx.UniTensor.ones([2,3,4]).set_rowrank(2)
UT.print_diagram()
print(UT.rowrank())
UT[:,:,2:4].print_diagram()
print(UT[1,:,:].rowrank())

-----------------------
tensor Name : 
tensor Rank : 3
block_form  : False
is_diag     : False
on device   : cytnx device: CPU
          ---------     
         /         \    
   0 ____| 2     4 |____ 2
         |         |    
   1 ____| 3       |        
         \         /    
          ---------     
2
-----------------------
tensor Name : 
tensor Rank : 3
block_form  : False
is_diag     : False
on device   : cytnx device: CPU
         --------     
        /        \    
        |      2 |____ 0
        |        |    
        |      3 |____ 1
        |        |    
        |      2 |____ 2
        \        /    
         --------     
0

We need to have a consistent way to do this.

One possibility is

  • Don't modify rank.
  • Reduce the dim in shape, but dim>=1.
  • (D1, D2, D3) -->slcing--> (Dp1, Dp2, Dp3) where Di >= Dpi >=1.

pcchen avatar Dec 02 '23 07:12 pcchen