Calculate the determinant using GPU and multi-core CPU

Description

Estimate the determinant of a matrix using the MAGMA library for GPU or PLASMA library for multi-core CPUs.

Usage

1
2
3
4
## S4 method for signature 'dgeMatrix'
determinant(x, logarithm, ...)
## S4 method for signature 'dgeMatrix'
determinant(x, logarithm, ...)

Arguments

x

an R object of type dgeMatrix.

logarithm

logical; if TRUE (default) return the logarithm of the modulus of the determinant.

...

No further arguments at present.

Details

Uses the LU decomposition using magma_dgetrf or PLASMA_dgetrf.For further details and methods see the Matrix package documentation or indeed the base package.

Methods

determinant

signature(x = "Matrix", logarithm = "missing"): and

determinant

signature(x = "Matrix", logarithm = "logical"):compute the (\log) determinant of x. The method chosen depends on the actual Matrix class of x. Note that base::det also works for all our matrices, calling the appropriate determinant() method. The Matrix::det is an exact copy of base::det, but in the correct namespace, and hence calling the S4-aware version of determinant().

References

Martin Maechler, Douglas Bates (Matrix package)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
	slotNames("Matrix")

	cl <- getClass("Matrix")
	names(cl@subclasses) # more than 40 ..

	showClass("Matrix")#> output with slots and all subclasses

	(M <- Matrix(c(0,1,0,0), 6, 4))
	dim(M)
	diag(M)
	cm <- M[1:4,] + 10*Diagonal(4)
	diff(M)
## can reshape it even :
	dim(M) <- c(2, 12)
	M
	stopifnot(identical(M, Matrix(c(0,1,0,0), 2,12)),all.equal(det(cm),
	determinant(as(cm,"matrix"), log=FALSE)$modulus, check.attr=FALSE))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.