[Scilab-Dev] Matrix indexing is not coherent with MATLAB convention (bug #14487)

Stéphane Mottelet stephane.mottelet at utc.fr
Wed Mar 23 09:04:49 CET 2016


Hello,

Matrix indexing is not coherent with Matlab (or Octave, Julia,...) 
conventions. For example, when x is a vector and A a matrix of indices 
of x, x(A)
should be a matrix with the same size as A :

MATLAB:

 >> x=[1 2 3]; A=[1 2;3 3]; x(A)

ans =

      1     2
      3     3

Julia:

julia> x=[1 2 3]; A=[1 2;3 3]; x[A]
2x2 Array{Int64,2}:
  1  2
  3  3

Scilab:

--> x=[1 2 3]; A=[1 2;3 3]; x(A)
  ans  =

    1.   3.   2.   3.

This is really annoying and is a problem for portability. I know that

matrix(x(A),size(A))

gives the correct answer, but having to use such a construct is not 
admissible.

http://bugzilla.scilab.org/show_bug.cgi?id=14487

S.

-- 
Département de Génie Informatique
EA 4297 Transformations Intégrées de la Matière Renouvelable
Université de Technologie de Compiègne -  CS 60319
60203 Compiègne cedex




More information about the dev mailing list