Equivalent of random.seed() in pymanopt manifold

12 views
Skip to first unread message

Beñat Mencia

unread,
Feb 18, 2019, 9:00:12 AM2/18/19
to Manopt
I want to seed a pseudo-random number generator in the Stiefel manifold. Usually I would do:

import random
random.seed(9001)   
random.randint(1, 10) 

Now, I want to do the equivalent in the Stiefel manifold. I tried:

import pymanopt.manifolds
import random
manifold = pymanopt.manifolds.Stiefel(4,2, k=1)
random.seed(9002)
x0 = manifold.rand()
print(x0)

But this does not generate the same x0 every time. 

Any ideas?

Nicolas Boumal

unread,
Feb 18, 2019, 9:44:25 AM2/18/19
to Manopt
Hello Beñat,

Looking into the code of Stiefel.rand(), the random numbers are generated using:

np.random.randn(self._n, self._p)

where np is NumPy. I recommend you look into the documentation of the random number generator of NumPy, or here for example:


Best,
Nicolas
Reply all
Reply to author
Forward
0 new messages