The determinant of a complex matrix in R

Is there a way to calculate the determinant of a complex matrix?

F4<-matrix(c(1,1,1,1,1,1i,-1,-1i,1,-1,1,-1,1,-1i,-1,1i),nrow=4) det(F4) Error in determinant.matrix(x, logarithm = TRUE, ...) : determinant not currently defined for complex matrices library(Matrix) determinant(Matrix(F4)) Error in Matrix(F4) : complex matrices not yet implemented in Matrix package Error in determinant(Matrix(F4)) : error in evaluating the argument 'x' in selecting a method for function 'determinant' 
+6
matrix r linear-algebra complex-numbers
source share
2 answers

If you use prod (eigenvalues ​​(F4) $) I would recommend prod(eigen(F4, only.values=TRUE)$values)
instead of this.

Please note that qr() recommended to use iff , you are only interested in the absolute value or, rather, Mod() :

  prod(abs(Re(diag(qr(x)$qr)))) 

gives Mod(determinant(x))
{In X = QR, | det (Q) | = 1 and the diagonal R is real (at least in R).}

By the way: you marked a reservation

Often calculating a determinant is not what you should do to solve a given problem.

on the help page (qualifier)?

+4
source share

If you know that the characteristic polynomial of the matrix A splits into linear factors, then det (A) is the product of the eigenvalues ​​of A, and you can use functions with an eigenvalue such as this one to get around your problem. I suspect you still want something better, but that might be the beginning.

+3
source share

All Articles