On Sat, 16 May 2015, Sven Schreiber wrote:
Hi,
further trying to use arrays, it seems that gretl sometimes is confused
about the '+=' operator:
<hansl>
matrices mc
mc += ones(3,2) # += refers to whole array
mc[1] += ones(3,2) # += should refer to 1st array element
</hansl>
Gretl is not so much confused as just incompetent ;-) It kinda
"knows" what you're trying to do, but doesn't support it, yet.
Somewhat related perhaps, it is currently impossible to write
something
like:
"matrix mc[1] = ones(3,2)"
because gretl complains that "variable mc is of type array, not
acceptable here". Not a big deal per se, but having to write "matrices"
instead feels awkward, since the operation really is just about one
element, not about the whole array.
If (something like) the above is legal, that means that mc must
already be defined as an array of matrices, so there's no call to
prefix the assignment with a type-word;
mc[1] = ones(3,2)
will do the job fine.
I guess there is a logical connection to my complaint from a couple
of
days back about a matrix inside a bundle (like mybundle.mymatrix) not
being 100% usable in hansl code as a standard matrix syntactically.
Allin answered that filling this gap would not be trivial. Here the
problem is about a matrix inside an array. I can imagine this is not
trivial, either. But somehow these limitations are starting to feel
restrictive.
They'll be relaxed sooner or later (I know, preferably sooner!).
Allin