2012/9/18 Allin Cottrell <cottrell@wfu.edu>
On Tue, 18 Sep 2012, artur tarassow wrote:

> according to the latest changelog it should be possible to use the
> element-wise matrix operator ".<"

What's new is ".<=" and ".>="; ".<" has been around for a
while. But anyway...

> I tried this using the latest cvs (Windows), but it does not
> seem to work, or at least I didn't get the correct syntax. I
> tried this example
>
> matrix A = { 0.6, 1 ; -0.3 , 2 }
> if A .< 1
>    print "Hello world"
> endif

Since ".<" is an element-wise operator, the expression

  A .< 1

produces a matrix result, as you see by doing

<hansl>
matrix A = { 0.6, 1 ; -0.3 , 2 }
print A
Test = A .< 1
print Test
</hansl>

Of course,  I should have been aware of this.

Such a result cannot be coerced to a boolean value, as
required by "if". Maybe what you want is

<hansl>
matrix A = { 0.6, 1 ; -0.3 , 2 }
if A < 1
     print "Hello world"
endif
</hansl>

(This will not print "Hello world" since the test is for all
elements less than 1.)
 
Indeed, I was looking for exactly this.

Allin Cottrell
_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users

Thanks for helping, Allin.
Best,
Artur