Learn R Programming

HiPLARM (version 0.1)

determinant: 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

"determinant"(x, logarithm, ...) "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.

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().

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.

References

Martin Maechler, Douglas Bates (Matrix package)

Examples

Run this code
	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))

Run the code above in your browser using DataLab