<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
----- Message d'origine ----- <br>
De : Julien Colmars <br>
Date : 19/05/2010 19:41:
<blockquote
cite="mid:AANLkTikwXGn1amcY5kYSOzB_9u3iE9Lh5faB_TspkSBb@mail.gmail.com"
type="cite">Hi,<br>
<br>
I've a SciLab problem dealing with<b> linear algebra / tensor
multiplication.</b><br>
<br>
Let's say I have <b>a matrix A wich size is i * j * k</b> ( is it
called a matrix in SciLab ? a 3rd order tensor ? a table ?...) <br>
</blockquote>
A hypermatrix<br>
<blockquote
cite="mid:AANLkTikwXGn1amcY5kYSOzB_9u3iE9Lh5faB_TspkSBb@mail.gmail.com"
type="cite"><b>.../...</b><br>
<ul>
<li><b>Is it possible to simply make a permutation of two subscript</b><span
class="POS2"> : for example from A(i,j,k) I want to get B = A(k,j,i) ?
This way I could make my basic multiplications...</span></li>
</ul>
</blockquote>
you may use permute():<br>
Example:<br>
h=fix(rand(3,3,3)*20-10)<br>
nh=permute(h,[3 2 1]) // reordering dims #1 and #3 (here it is a
commutation)<br>
nh(:,:,1)<br>
<br>
We could also use<br>
s=squeeze(m(1,:,:))<br>
<br>
and then transpose the result. Unfortunately, <br>
<br>
size(s) // => (3,3) is ok BUT<br>
typeof(s) // => "hypermat" instead of "constant" <br>
<br>
This is a bug from squeeze() already reported at<br>
<a class="moz-txt-link-freetext" href="http://bugzilla.scilab.org/show_bug.cgi?id=4042#c1">http://bugzilla.scilab.org/show_bug.cgi?id=4042#c1</a><br>
Since transposition of hypermats is not supported (quite meaningless),<br>
this way is wrong. While, permute() is straightforward.<br>
<br>
Regards<br>
Samuel<br>
<br>
</body>
</html>