help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: comparison operators


From: Ted Harding
Subject: RE: comparison operators
Date: Wed, 20 Mar 2002 14:58:48 -0000 (GMT)

On 20-Mar-02 Fabian Alvarez wrote:
> octave:1> a = rand (1,5)
> a =
>  
>   0.14714  0.46226  0.85053  0.59390  0.47820
>  
> octave:2> a ( a < 0.8 )
> ans =
>  
>   0.14714  0.46226  0.59390  0.47820
> 
> octave:3> a ( a < 0.9 )
> ans =
>  
>   0.14714  0.14714  0.14714  0.14714  0.14714
>                                                                       
> octave:4> a ( a > 0.1 )
> ans =
>  
>   0.14714  0.14714  0.14714  0.14714  0.14714                         
> I checked for several examples, and it always results in the first 
> value of  'a' repeated along the whole vector.
> 
> nevertheless, I think that the correct result should be the original 
> vector 'a' with its five different components.

This is a disaster (which I had not suspected).
It was OK (and as you expect above) on octave 2.0.13,
but I have tried it on 2.0.16 and 2.1.33 and get
the same as Fabian above.

In fact, all you need is to ask for a([1 1 1 1 1])
and you get the first element repeated.

This can only be a bug ; and by its nature will
invalidate all simulations of random processes
which involve such a step.

Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 167 1972
Date: 20-Mar-02                                       Time: 14:58:48
------------------------------ XFMail ------------------------------



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]