On Mon, Nov 4, 2024 at 6:39 PM Sven Schreiber <sven.schrei...@fu-berlin.de> wrote: > > I have been struggling with this unexpected behavior: > > <hansl> > matrix m = {0.5} > eval typename(m) # matrix > b = _(hu=m) > eval typename(b.hu) # scalar > </hansl> > > So the mere copy of the object changes its type here. (Also happens > outside of a bundle, but there you can force the type more easily.) I > don't think that should happen.
What exactly caused you to struggle? It's expected behavior in gretl that a 1 x 1 matrix "decays" to a scalar outside of "genr" unless you prevent that, but the idea is that a scalar ought to be usable as a 1 x 1 matrix if required. If you wanted to do something with b.hu that was not allowed on account of it not being a matrix I think that would be a bug. (Hmm, maybe trying for m[1,1]?) However, you can ensure that m (1 x 1) maintains its matrix type inside a bundle: matrix m = {0.5} bundle b = _() matrix b.hu = m eval typename(b.hu) # matrix Allin _______________________________________________ Gretl-devel mailing list -- gretl-devel@gretlml.univpm.it To unsubscribe send an email to gretl-devel-le...@gretlml.univpm.it Website: https://gretlml.univpm.it/postorius/lists/gretl-devel.gretlml.univpm.it/