From ligges@statistik.uni-dortmund.de  Thu Sep 26 08:22:57 2002
From: ligges@statistik.uni-dortmund.de (ligges@statistik.uni-dortmund.de)
Date: Thu, 26 Sep 2002 09:22:57 +0200 (MET DST)
Subject: error with complex solve (PR#2068)
Message-ID: <200209260722.JAA12966@pubhealth.ku.dk>


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.02061856i

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


error with complex solve (PR#2068)
ligges@statistik.uni-dortmund.de