Skip to content

Same random number seed in each block #679

@manuschneider

Description

@manuschneider

When I randomize a symmetric tensor, the random number seed seems to be the same for each block. This leads to the same entries in blocks of similar dimensions. This is typically not what one wants. Example:

Bond Bin = Bond(BD_IN, {Qs(0) >> 2, Qs(1) >> 2}, {Symmetry::U1()});
Bond Bout = Bin.redirect();
UniTensor uT = UniTensor({Bin,Bout}, {"in", "out"}).set_name("uT");
uT.normal_(0.,1.);
cout << uT;
-------- start of print ---------
Tensor name: uT
Tensor type: Block
braket_form : True
is_diag    : False
[OVERALL] contiguous : True
========================
BLOCK [#0]
 |- []   : Qn index 
 |- Sym(): Qnum of correspond symmetry
                 -----------
                 |         |
   [0] U1(0)  -->| 2     2 |-->  [0] U1(0)
                 |         |
                 -----------

Total elem: 4
type  : Double (Float64)
cytnx device: CPU
Shape : (2,2)
[[1.72312e-01 2.18939e-01 ]
 [-9.26945e-01 -6.54154e-01 ]]

========================
BLOCK [#1]
 |- []   : Qn index 
 |- Sym(): Qnum of correspond symmetry
                 -----------
                 |         |
   [1] U1(1)  -->| 2     2 |-->  [1] U1(1)
                 |         |
                 -----------

Total elem: 4
type  : Double (Float64)
cytnx device: CPU
Shape : (2,2)
[[1.72312e-01 2.18939e-01 ]
 [-9.26945e-01 -6.54154e-01 ]]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions