[Rd] non user-friendly error for chol2inv functions

Martin Maechler maechler at stat.math.ethz.ch
Fri Aug 29 15:00:01 CEST 2008


>>>>> "cd" == christophe dutang <dutangc at gmail.com>
>>>>>     on Fri, 29 Aug 2008 14:28:42 +0200 writes:

    cd> Yes, I do not cast the first argument as a matrix with as.matrix function.
    cd> Maybe we could detail the error message if the first argument is a numeric?

    cd> error(_("'a' is a numeric and must be coerced to a numeric matrix"));

Merci, Christophe.   Yes, we *could* do that.
Alternatively, I think I will just make it work in that case,
since I see that 
      qr(), chol(), svd(), solve()  all 
treat a numeric (of length 1) as a  1 x 1 matrix automatically.

    cd> Thanks for your answer
De rien!
Martin

    cd> 2008/8/29 Martin Maechler <maechler at stat.math.ethz.ch>

    >> >>>>> "cd" == christophe dutang <dutangc at gmail.com>
    >> >>>>>     on Fri, 29 Aug 2008 12:44:18 +0200 writes:
    >> 
    cd> Hi,
    cd> In function chol2inv with the option LINPACK set to false (default),
    >> it
    cd> raises an error when the matrix is 1x1 matrix (i.e. just a real)
    >> saying
    >> 
    cd> 'a' must be a numeric matrix
    >> 
    >> It is very helpful, but you have to read and understand it.
    >> I'm pretty sure you did not provide a  1 x 1 matrix.
    >> 
    >> Here's an example showing how things works :
    >> 
    >> > m <- matrix(4,1,1)
    >> > cm <- chol(m)
    >> > cm
    >> [,1]
    >> [1,]    2
    >> > chol2inv(cm)
    >> [,1]
    >> [1,] 0.25
    >> >
    >> 
    >> Martin Maechler, ETH Zurich
    >> 
    >> 
    cd> This error is raised by the underlying C function (modLa_chol2inv in
    cd> function Lapack.c). Everything is normal, but I wonder if we could
    >> have
    cd> another behavior when we pass a 1x1 matrix. I spent time this
    >> morning
    cd> finding where was the error, and it was this "problem".
    >> 
    cd> Thanks in advance
    >> 
    cd> Christophe
    >> 
    cd> [[alternative HTML version deleted]]
    >> 
    cd> ______________________________________________
    cd> R-devel at r-project.org mailing list
    cd> https://stat.ethz.ch/mailman/listinfo/r-devel
    >> 

    cd> [[alternative HTML version deleted]]

    cd> ______________________________________________
    cd> R-devel at r-project.org mailing list
    cd> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list