On Tue, 25 Sep 2007, Sven Schreiber wrote:
andreas.rosenblad(a)ltv.se schrieb:
>
> A second bug or missing feature: I want to initiate a matrix
> with missing values, where some cells with missing values will
> later be replaced with non-missing values. I got the following
> result when trying to initiate a matrix with missing values:
>
> ? A = {NA, NA; NA, NA}
> Generated matrix A
> ? A
> A (2 x 2)
>
> 1.7977e+308 1.7977e+308
> 1.7977e+308 1.7977e+308
This may actually be correct, according to floating point
representation of NAs (not 100% sure out of my head). Maybe it
should be printed differently, however.
Sven is right. "NA" in gretl is coded as DBL_MAX, the largest
value representable as a C "double", which equals 1.7977e+308.
There is a bug here, but it's not in the printing, it's in the
fact that Andreas was able to construct a matrix containing NAs in
the first place.
Matrices are not supposed to contain NA, for a fairly obvious
reason. That is: if matrices can contain NA, then every single
matrix arithmetic operation has to be rewritten in a more verbose
and less efficient manner. You can't just multiply, add, subtract
(or whatever) elements of matrices without checking for NAs; you
can't pass data to lapack functions without checking for NA, etc.,
etc.
We _could_ in principle handle NAs in matrices, but it would
sacrifice efficiency and I don't think that is a favourable
trade-off.
I will try to close this issue for the meantime by ensuring that
if a matrix defined by "genr" contains any NAs, you get an error.
Allin.