[Scilab-users] Scilab and Matlab integer representation

Samuel Gougeon sgougeon at free.fr
Tue Aug 5 13:59:37 CEST 2014


Hello Mehran,

Le 05/08/2014 08:35, A Khorshidi a écrit :
> Hi;
>
> One reason for using integer type is to save memory space, isn't it?
> However, whos() gives us 24 bytes as storage space for both integer 
> and double data types.

A scalar number is considered as a 1x1 matrix. For any matrix, some room 
is needed to record the number of rows, of columns, the type of the 
matrix, etc.
If you do the same test for a large matrix, the memory used becomes 
asymptotically proportionnal to the matrix size:

-->var1 = int8(rand(1000,1000)*64); // 1 byte integer representation
-->whos -name var1
Name                     Type           Size           Bytes

var1                     int8           1000 by 1000   1000024

The way how Scilab stores variables in memory is described here:
http://wiki.scilab.org/Memory%20representation%20of%20variables

Best regards
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20140805/3d9e0c7f/attachment.htm>


More information about the users mailing list