[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tensor multiplication



Hi,

ok, thanks for the various answers.
In case anybody should be interested in the future, 
I'll leave here a little program which I have now written  
to perform a general multiplication of a 
[ N_1, N_2, ...., N_n]-array with a N_n -vector.
The result is a [N_1, N_2, ... , N_(n-1)]-array:



function tensor_product,a,b

sa = size(a)
a_matrix = reform(a,total_product(sa[1:sa[0]-1]),sa[sa[0]])
result = a_matrix # b
result = reform(temporary(result),sa[1:sa[0]-1])

return,result
end



Daniel
------------------------------------------------------------------------
 Daniel Luebbert
 Stanford Synchrotron Radiation Laboratory (SSRL)
 luebbert@slac.stanford.edu