Full_Name: John Peters Version: 1.5.1 OS: Windows 2000 Submission from: (NULL) (130.155.2.3) solve(a,b) with two arguments gives an error if a is complex and b is a vector:> a_matrix(c(1,2+3i,3,2),ncol=2) > a[,1] [,2] [1,] 1+0i 3+0i [2,] 2+3i 2+0i> b_c(2,2+1i)> solve(a,b)Error in solve.default(a, b) : A must be a complex matrix> is.complex(a)[1] TRUE> is.matrix(a)[1] TRUE> solve(a,diag(b))[,1] [,2] [1,] -0.1649485+0.3711340i 0.5257732-0.4329897i [2,] 0.7216495-0.1237113i -0.1752577+0.1443299i> > solve(a) %*% b[,1] [1,] 0.3608247-0.06185567i [2,] 0.5463918+0.02061856i>Running R1.5.1 under Windows 2000. Many thanks. ----------------------------------------------------------------- John Peters CSIRO National Measurement Laboratory PO Box 218 Phone: +61 2 9413 7503 Lindfield NSW 2070 Fax: +61 2 9413 7202 Australia Email: John.Peters@csiro.au ----------------------------------------------------------------- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
john.peters@csiro.au writes:> > solve(a,b) > Error in solve.default(a, b) : A must be a complex matrixTwo bugs here, one trivial: The error message should say B, not A. The (slightly) less trivial one is that b needs conversion to matrix for the underlying Lapack routine to work:> solve(a,matrix(b))[,1] [1,] 0.3608247-0.06185567i [2,] 0.5463918+0.02061856i -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
john.peters@csiro.au wrote:> > Full_Name: John Peters > Version: 1.5.1 > OS: Windows 2000 > Submission from: (NULL) (130.155.2.3) > > solve(a,b) with two arguments gives an error if a is complex and b is a vector: > > > a_matrix(c(1,2+3i,3,2),ncol=2) > > a > [,1] [,2] > [1,] 1+0i 3+0i > [2,] 2+3i 2+0i > > > b_c(2,2+1i) > > > solve(a,b) > Error in solve.default(a, b) : A must be a complex matrix > > > is.complex(a) > [1] TRUE > > > is.matrix(a) > [1] TRUE > > > solve(a,diag(b)) > [,1] [,2] > [1,] -0.1649485+0.3711340i 0.5257732-0.4329897i > [2,] 0.7216495-0.1237113i -0.1752577+0.1443299i > > > > solve(a) %*% b > [,1] > [1,] 0.3608247-0.06185567i > [2,] 0.5463918+0.02061856iConfirmed. The Problem is the wrong error message in the underlying C code, file .../src/modules/lapack/Lapack.c, line 303: error("A must be a complex matrix"); must be changed to error("B must be a complex matrix"); Uwe Ligges -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Thanks, I can live with that, but for conformance with the man page and with splus (3.4) it would be nice if B could be a (complex) vector. Many thanks ----------------------------------------------------------------- John Peters CSIRO National Measurement Laboratory PO Box 218 Phone: +61 2 9413 7503 Lindfield NSW 2070 Fax: +61 2 9413 7202 Australia Email: John.Peters@csiro.au ----------------------------------------------------------------- -----Original Message----- From: Uwe Ligges [mailto:ligges@statistik.uni-dortmund.de] Sent: Thursday, 26 September 2002 5:23 PM To: john.peters@csiro.au Cc: R-bugs@biostat.ku.dk Subject: Re: error with complex solve (PR#2068) Confirmed. The Problem is the wrong error message in the underlying C code, file .../src/modules/lapack/Lapack.c, line 303: error("A must be a complex matrix"); must be changed to error("B must be a complex matrix"); Uwe Ligges -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._