Hi,
maybe this has come up before, but if so then I don't remember the answer:
I just noticed that I can stick together horizontally (as in 'x ~ y') a
100x2 matrix and a 1x100 row vector. However, the result was that the
first element of the row vector was repeated 100 times and formed the
third column of the output.
So effectively I got:
x ~ (y[1] .* ones(rows(x), 1))
What was intended instead was:
x ~ y'
where I simply forgot the transpose.
Try it for yourselves:
<hansl>
matrix x = ones(10,2)
matrix y = seq(0,9)
matrix out1 = x ~ y' # intended
print out1
matrix out2 = x ~ y # what I got
print out2
</hansl>
I guess this comes from gretl *trying* to broadcast the vector y to
match the dimensions of x, but I would not really call the result
broadcasting. Or is there a rationale for this behavior?
thanks,
sven
Show replies by date