[R] Rmpfr question

Michel michelgomez at free.fr
Tue Sep 24 12:22:10 CEST 2013


Hello,
Thanks for your answer
The file does not contains numbers in high precision but all the calculation
applied to these data will be 

In attachment a text file containing some lines
And her few values:
11111.0054014388224326026488598,-68239.4114845811819662912967033,10053.18245
84878233990181684021
3.05363891777017837760380136736,-1.40443175474415104684797195311,1.367669608
77453817890022497172

Many thanks in advance
Michel

-----Message d'origine-----
De : Martin Maechler [mailto:maechler at lynne.ethz.ch] 
Envoyé : mardi 24 septembre 2013 11:55
À : Michel
Cc : r-help at r-project.org
Objet : Re: [R] Rmpfr question

>>>>> "M" == Michel  <michelgomez at free.fr>
>>>>>     on Fri, 20 Sep 2013 17:56:58 +0200 writes:

    > Hello everyone, R beginner, I am confronted with the need
    > to use Rmpf.
why ?

    > In my first scripts I made use of
    > X=read.table(file.choose(), header=FALSE, sep=",",dec=".")  
    > X=as.matrix(X)

well, the above is not at all reproducible {we don't see *nor* have the file
you chose with file.choose() !} so that's maybe why nobody helped ...

Does the file have numbers in high precision, i.e. more than about 15-16
digits?
I'm assuming "no" for the moment.
If "yes" was the answer, then you really need to read the data quite
differently.
In that case please, show us the first few lines  of your file.


    > to load into a matrix data from file before matrix use.

    > How can I do to load the same data in a "mpfrMatrix".

As you already have the regular numeric matrix X, you can either use

    M <- as(X, "mpfr") # uses default precision of 128 bits or
    M <- mpfr(X, precBits = 200)

where you choose the precision of the numbers via 'precBits'


    > Is it possible to use with "mpfrMatrix" the same as
    > operations

    > M1 %*% M2

yes, matrix multiplications all work ... though a bit slowly.
matrix factorizations (eigen, svd, qr, solve,..) all do not (yet; patches
are welcome; I'm currently working at an LU decomposition).

    >  scale(M1,TRUE,FALSE)

not directly, in the current version of Rmpfr.
But you can use the following trick:

    scale.mpfrMatrix <- scale.default
    environment(scale.mpfrMatrix) <- asNamespace("Rmpfr")

and then it will work.


    > Sorry but I'm a newbe

let's hope, not for too long ;-) ;-)

    > Thanks in advance
    > Michel

You're welcome,
Martin Maechler, ETH Zurich

(maintainer of the 'Rmpfr' package.
 Yes, I know you also sent the question to me privately,  but only several
days *after* asking on R-help; it would have  been nice, if you had
mentioned that you also asked here and  nobody helped you.  ...)



 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sommelines.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130924/918b2aa5/attachment.txt>


More information about the R-help mailing list