[Bugzilla] [Bug 14487] Stéphane MOTTELET has changed cc

bugzilla.admin at scilab.org bugzilla.admin at scilab.org
Thu Mar 22 20:28:14 CET 2018


http://bugzilla.scilab.org/show_bug.cgi?id=14487
--------- Bug Summary -----------
Matrix indexing is not coherent with MATLAB convention

---------- Changed by ------------
stephane.mottelet at utc.fr

---------- What changed ----------
cc


Stéphane MOTTELET <stephane.mottelet at utc.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stephane.mottelet at utc.fr

--- Comment #1 from Stéphane MOTTELET <stephane.mottelet at utc.fr> ---
The problem is specific to the case where the matrix is indexed with a single index. In the actual Scilab implementation, the Matlab behavior is
obtained only *only* when the indexed variable is a scalar :

--> x=1; x(ones(2,2))
 ans  =

   1.   1.
   1.   1.

--> x=[1 2]; x(ones(2,2))
 ans  =

   1.   1.   1.   1.

This is quite easy to see that in scilab/modules/ast/src/cpp/types/arrayof.cpp at lines 1316...1336 because the comments 

//two cases, depends of original matrix/vector
//special case for row vector
//for extraction on scalar 

are very explicit. But the right behavior (i.e. Matlab compliant) should the one used when the variable to be indexed is a scalar i.e.

pOut = createEmpty(pArg[0]->getAs<GenericType>()->getDims(), pArg[0]->getAs<GenericType>()->getDimsArray(), m_pImgData != NULL);

which means that the result should has the size and dimensions of the index variable pArg[0].

-- 
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/bugzilla/attachments/20180322/1cb7d276/attachment.htm>


More information about the Bugzilla mailing list