Создать случайный симметричный тензор в PythonPython

Программы на Python
Anonymous
Создать случайный симметричный тензор в Python

Сообщение Anonymous »


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

Вернуться в «Python»