sapplyMpfr {Rmpfr} | R Documentation |
Users may be disappointed to note that sapply()
or
vapply()
typically do not work with "mpfr"
numbers.
This is a simple (but strong) approach to work around the problem,
based on lapply()
.
Note that this is not yet as flexible as sapply()
for
atomic vectors.
sapplyMpfr(X, FUN, ...)
X |
a vector, possibly of class |
FUN |
a function returning an |
... |
further arguments passed to |
an "mpfr"
vector, typically of the same length
as X
.
Another workaround could be to use
res <- lapply(....) sapply(res, asNumeric)
Martin Maechler
## The function is simply defined as function (X, FUN, ...) new("mpfr", unlist(lapply(X, FUN, ...), recursive = FALSE)) if(require("Bessel")) # here X, is simple bImp <- sapplyMpfr(0:4, function(k) besselI.nuAsym(mpfr(1.31e9, 128), 10, expon.scaled=TRUE, k.max=k))