[scilab-Users] problem with clause "double" of sum function ?

CRETE Denis denis.crete at thalesgroup.com
Thu Aug 11 17:23:38 CEST 2011


Hello again,
I can add bits of information:
I modified (to only change presentation of results) the code you provided :
M=100;N=100;
R=ones(M,N);
for m=1:M;
  for n=1:N;
    A=floor(256*rand(n,m));
    B=uint8(A);
    R(m,n)=max(abs(sum(B,2,"double")-sum(A,2)));
  end
end
Map=R<>0;
size(find(Map),'c')

On all the 3 PC/XP that I tried (with Scilab 5.3.2 or 5.3.3 + Blas,Lapak library), I get the same strange result: 417 cells where Map is TRUE, more or less lying in a triangular zone as indicated in my previous mail (N<7*M-7,M>=4). This zone contains a few cells for which R=0.

Changing the line
    R(m,n)=max(abs(sum(B,2,"double")-sum(A,2)));
to  R(m,n)=max(abs(sum(B,1,"double")-sum(A,1)));
results in the transposition of the results (symmetry with respect to the matrix diagonal).

I keep investigating on this problem.
Regards
Denis
 
-----Message d'origine-----
De : Serge Steer [mailto:Serge.Steer at inria.fr] 
Envoyé : jeudi 11 août 2011 15:06
À : users at lists.scilab.org
Objet : Re: [scilab-Users] problem with clause "double" of sum function ?

Le 11/08/2011 12:14, CRETE Denis a écrit :
> Hello,
> I am puzzled by the behaviour of this piece of code: 
>
> N=21;M=4;
> A=floor(256*rand(N,M)); 	// Build random matrix 
> B=uint8(A);				// Conversion to integer 
> max(abs(sum(B,2,"double")-sum(A,2)))	// Should return 0
>
> It returns 0 for specific values of (N,M), e.g. when (N<14,M<4) and when (N<7*M-7,M>=4) !?!
>   
Strange...

I made the following test on my Linux box with Scilab-5.3.2 and
encountered no problem:
M=100;N=100;
R=ones(M,N);
for m=1:M;
  for n=1:N;
    A=floor(256*rand(n,m));
    B=uint8(A);
    R(m,n)=max(abs(sum(B,2,"double")-sum(A,2)));
  end
end
find(R<>0)

Should it be a windows specific problem?
> (I am using Scilab 5.3.2 on PC/Windows XP)
>
> The manual says that the first argument of "sum" is an array of real, complex, boolean, polynoms or rational fractions: does it mean that integers are excluded ? 
It is a bug in the manual
> Why ?
> Thanks for any explanation
> Denis
>
>   




More information about the users mailing list