[scilab-Users] SciLab question dealing with linear algebra / tensor multiplication.

Samuel Gougeon Samuel.Gougeon at univ-lemans.fr
Wed May 19 21:12:44 CEST 2010


----- Message d'origine -----
De : Julien Colmars
Date : 19/05/2010 19:41:
> Hi,
>
> I've a SciLab problem dealing with* linear algebra / tensor 
> multiplication.*
>
> Let's say I have *a matrix A wich size is i * j * k* ( is it called a 
> matrix in SciLab ? a 3rd order tensor ? a table ?...)
A hypermatrix
> *.../...*
>
>     * *Is it possible to simply make a permutation of two subscript* :
>       for example from A(i,j,k) I want to get B = A(k,j,i) ? This way
>       I could make my basic multiplications...
>
you may use permute():
Example:
h=fix(rand(3,3,3)*20-10)
nh=permute(h,[3 2 1]) // reordering dims #1 and #3 (here it is a 
commutation)
nh(:,:,1)

We could also use
s=squeeze(m(1,:,:))

and then transpose the result. Unfortunately,

size(s)  // => (3,3)   is ok  BUT
typeof(s)  // => "hypermat" instead of "constant"

This is a bug from squeeze() already reported at
http://bugzilla.scilab.org/show_bug.cgi?id=4042#c1
Since transposition of hypermats is not supported (quite meaningless),
this way is wrong. While, permute() is straightforward.

Regards
Samuel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20100519/7a4883e9/attachment.htm>


More information about the users mailing list