[scilab-Users] SciLab question dealing with linear algebra / tensor multiplication.
vincent.lejeune at scilab.org
vincent.lejeune at scilab.org
Wed May 19 21:00:28 CEST 2010
A(1,:,:) is considered as a 1*j*k matrix, which is not the same as a j*k
matrix, in Scilab 5.2.2.
I don't know the underlying reason of this behaviour, but it may be due to
storage constraint in memory : a j*k matrix is stored as a contigous array
of double. A i*j*1 matrix is stored as a contigous array of double, too.
whereas a 1*j*k is stored as a sequence of padded array (with pad = i).
You can use the matrix() function :
B=matrix(A(1,:,:),j,k);
B is the j*k matrix that is equivalent to A(1,:,:). There is a memory copy
but the performance should stay OK.
Vincent
On Wed, 19 May 2010 19:41:51 +0200, Julien Colmars
<julien.colmars at imelavi.fr> wrote:
> 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 ?...)
>
> SciLab knows that *A(:,:,1) is a matrix*, and SciLab is able to multiply
it
> with another matrix...
> But it is *not the case of A(1,:,:)* for example.... which seems to be a
> table of 2 1x2 vectors. [at least in SciLab 4.2.1]
>
> I'm looking for an elegant solution to avoid many loops... my
calculation
> is
> becoming too slow :
>
> *So these are my questions :*
>
> - why it is not implemented in SciLab ? (sorry for this naive
> question)*Is there a specific reason not to authorize to build a
> matrix from table
> values ?*
> - *How could it be done* (call to external C/Fortran routine or
specific
> linear algebra libraries) ?
> - *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...
>
> I hope it is clear enough...
> Thank you in advance for your help.
>
>
>
> *Julien Colmars*
>
> PhD student,
> Équipe Mécanique de l'Arbre et du Bois
> Laboratoire de Mécanique et Génie Civil
> Adresse : LMGC - UMR5508
> Université Montpellier 2
> CC 048 Place Eugène Bataillon
> 34090 Montpellier, France
> Tel. : +33 (0)4 67 14 96 42
> Fax. : +33 (0)4 67 14 47 92
More information about the users
mailing list