[Rd] (PR#4450)

R.P.P.P.Grasman at uva.nl R.P.P.P.Grasman at uva.nl
Tue Oct 7 18:06:37 MEST 2003

This is a multi-part message in MIME format.

Content-Type: text/plain;
Content-Transfer-Encoding: quoted-printable


When I use det() and qr() on complex matrices the result is in some =
cases indeterministic. The documentation speaks of numeric matrices (and =
not of complex matrices) but det() uses qr() which should handle complex =
matrices correctly. I've also tried using only qr() with=20

similar results. det() returns a value that is not the determinant of =
the complex matrix (in accordance with documentations limitation to =
numeric matrices), whereas the product of the eigenvalues obtained with =
eigen() does evaluate to the determinant of the matrix.

To repeat the error in a simple as possible example I did the following:

I freshly started R without loading any previously stored image.

> m =3D matrix(complex(re=3Drnorm(9),im=3Drnorm(9)),3,3)     # multiple =
m's were tried
> m
                       [,1]                   [,2]                  [,3]
[1,] -0.56135706+0.9346292i  0.3626032+0.73012622i -0.6629864+0.9328771i
[2,] -0.05999599-0.6931185i -1.4558785+0.66410894i  0.8503606-1.0104882i
[3,] -1.29420594-1.0878549i  0.7834801+0.01872038i -0.6378357-0.6318547i

> y =3D sapply(1:10000,function(i) det(m)); plot.ts(y)   # may need =
> var(y)
[1] 3.940272

The plot shows that the sign of det alternates indeterministically (at =
least for some m generated this way, like the m attached in the m.RData =

I note that a similar problem was reported in =
http://www.r-project.org/nocvs/mail/r-devel/2002/0139.html but I =
couldn't find a report of this particular problem.

I would suggest to make det compatible with complex matrices, or at =
least give a warning.



--please do not edit the information below--

 platform =3D i386-pc-mingw32
 arch =3D i386
 os =3D mingw32
 system =3D i386, mingw32
 status =3D=20
 major =3D 1
 minor =3D 6.2
 year =3D 2003
 month =3D 01
 day =3D 10
 language =3D R

Windows 2000 Professional (build 2195) Service Pack 4.0

Search Path:
 .GlobalEnv, package:ctest, Autoloads, package:base

Raoul Grasman=20
Dept. Psychology, University of Amsterdam,=20
Roetersstraat 15,=20
NL-1018WB Amsterdam,=20
the Netherlands=20

Content-Type: application/octet-stream;
Content-Transfer-Encoding: base64
Content-Description: m.RData
Content-Disposition: attachment;



More information about the R-devel mailing list