On Sun, 4 Nov 2012, Allin Cottrell wrote:
On Sun, 4 Nov 2012, Pindar wrote:
> matrix mtestm = (ytestm.>0) ? 10 : 2 #this works not
Yes, it is guaranteed by hansl syntax that it "works not".
Second thoughts about this. We want to support as many uses of the
various operators in hansl as make good sense (in the context of a
variety of types). And I can see that your statement could make good
sense -- on condition that ytestm is an (m x n) matrix and that
mtestm should be a matrix of the same dimensions.
In gretl CVS we now support a matrix condition for the ternary "?"
operator. Here's an example that now works:
<hansl>
matrix M = I(3)
matrix A = M .> 0 ? 10 : -2
print A
</hansl>
which gives
? print A
A (3 x 3)
10 -2 -2
-2 10 -2
-2 -2 10
This is not yet in the snapshots for Windows and OS X, but it will
be before long.
Allin Cottrell