Hi,
I'm trying to work with matrices converted from series/lists that
contain missings, in order to vectorize and hopefully speed up code.
I'm working around the fact that misszero() doesn't work for matrices by
using the ternary operator to only apply formulas selectively to the
non-missings. (I vaguely remember a discussion about matrices and
misszero(), but don't recall the details anymore. Probably I should go
and dig it up in the archives.)
One thing I'm puzzled about is that I get "domain error" warnings about
the exp() function, even though I only apply it to the non-missings.
Example:
<hansl>
a = exp(NA) # memo: no "domain error" for the scalar case
matrix m = I(4)
matrix m2 = !m ? NA : m # create some "nan" in a matrix
print m2 # look at the nan, they're there!
matrix check = exp(m2) # "domain error" ok, expected
matrix m3 = isnan(m2) ? 0 : exp(m2) # but why here?
</hansl>
After the last line m3 doesn't contain missings/nan, and so the code
works, but then why the warning message? I could imagine that both
branches of the ternary operation are executed and then afterwards the
needed results are collected and combined, but that would seem quite
inefficient computationally, no?
thanks,
sven