Создать случайный симметричный тензор в Python ⇐ Python
Создать случайный симметричный тензор в Python
I want to generate a random (gaussian) tensor symmetric with respect to all the permutations of the axes. In the end I want all the entries with the same distribution, so tricks like summing over all the permutation and rescaling by sqrt(k!), where k is the order of my tensor, don't work. eg:
import numpy as np from itertools import permutations noise_buffer = np.random.normal(size=n*n*n).reshape(n,n,n)/np.sqrt(6); noise = np.zeros([n,n,n]); for i in permutations([0,1,2]): noise += np.transpose(noise_buffer,axes=list(i)) I could loop over all the coordinates (-1) and rescale opportunely, but this is time consuming.
Do you know any library where this is implemented? or do you know any fast implementation?
Источник: https://stackoverflow.com/questions/488 ... -in-python
I want to generate a random (gaussian) tensor symmetric with respect to all the permutations of the axes. In the end I want all the entries with the same distribution, so tricks like summing over all the permutation and rescaling by sqrt(k!), where k is the order of my tensor, don't work. eg:
import numpy as np from itertools import permutations noise_buffer = np.random.normal(size=n*n*n).reshape(n,n,n)/np.sqrt(6); noise = np.zeros([n,n,n]); for i in permutations([0,1,2]): noise += np.transpose(noise_buffer,axes=list(i)) I could loop over all the coordinates (-1) and rescale opportunely, but this is time consuming.
Do you know any library where this is implemented? or do you know any fast implementation?
Источник: https://stackoverflow.com/questions/488 ... -in-python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Изменить противоположный тензор на коварительный тензор в пакете Einsteinpy
Anonymous » » в форуме Python - 0 Ответы
- 1 Просмотры
-
Последнее сообщение Anonymous
-