Skip to content

rowrank is modified after slicing #397

@pcchen

Description

@pcchen

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions