The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Type: Package
Title: Sparse Matrix C++ Classes Including Sparse Cholesky LDL Decomposition of Symmetric Matrices
Version: 0.3.2
Date: 2024-12-07
Description: 'C++' classes for sparse matrix methods including implementation of sparse LDL decomposition of symmetric matrices and solvers described by Timothy A. Davis (2016) https://fossies.org/linux/SuiteSparse/LDL/Doc/ldl_userguide.pdf. Provides a set of C++ classes for basic sparse matrix specification and linear algebra, and a class to implement sparse LDL decomposition and solvers. See https://github.com/samuel-watson/SparseChol for details.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
Imports: Rcpp (≥ 1.0.7)
LinkingTo: Rcpp (≥ 1.0.7), RcppEigen
RoxygenNote: 7.2.3
NeedsCompilation: yes
Author: Sam Watson [aut, cre], Timothy A. Davis [aut, ctb]
URL: https://github.com/samuel-watson/SparseChol
BugReports: https://github.com/samuel-watson/SparseChol/issues
Suggests: testthat
Biarch: true
Depends: R (≥ 3.4.0), Matrix (≥ 1.3-4)
SystemRequirements: GNU make
Encoding: UTF-8
Packaged: 2024-12-08 18:41:54 UTC; WatsonSI
Maintainer: Sam Watson <S.I.Watson@bham.ac.uk>
Repository: CRAN
Date/Publication: 2024-12-08 19:30:02 UTC

Sparse Matrix C++ Classes Including Sparse Cholesky LDL Decomposition of Symmetric Matrices

Description

'C++' classes for sparse matrix methods including implementation of sparse LDL decomposition of symmetric matrices and solvers described by Timothy A. Davis (2016) <https://fossies.org/linux/SuiteSparse/LDL/Doc/ldl_userguide.pdf>. Provides a set of C++ classes for basic sparse matrix specification and linear algebra, and a class to implement sparse LDL decomposition and solvers. See <https://github.com/samuel-watson/SparseChol> for details.

Package Content

Index of help topics:

LDL_Cholesky            Generate LDL decomposition from Matrix class
                        'dsCMatrix'
LL_Cholesky             Generate Cholesky decomposition from Matrix
                        class 'dsCMatrix'
SparseChol-package      Sparse Matrix C++ Classes Including Sparse
                        Cholesky LDL Decomposition of Symmetric
                        Matrices
amd_order               AMD ordering
dense_to_sparse         Generate sparse matrix representation of a
                        matrix
sparse_D                Generate matrix D from 'sparse_chol' output
sparse_L                Generate matrix L from 'sparse_chol' output
sparse_chol             Sparse Cholesky decomposition
sparse_chol_crs         Sparse Cholesky decomposition with sparse
                        representation

Maintainer

Sam Watson <S.I.Watson@bham.ac.uk>

Author(s)

Sam Watson [aut, cre], Timothy A. Davis [aut, ctb]


Generate LDL decomposition from Matrix class 'dsCMatrix'

Description

Generates the Cholesky decomposition L as A == LL^T from a sparse matrix

Usage

LDL_Cholesky(mat)

Arguments

mat

A matrix of class 'dsCMatrix'

Value

A list of matrices L and D


Generate Cholesky decomposition from Matrix class 'dsCMatrix'

Description

Generates the Cholesky decomposition L as A == LL^T from a sparse matrix

Usage

LL_Cholesky(mat)

Arguments

mat

A matrix of class 'dsCMatrix'

Value

A matrix of class 'ddiMatrix'


AMD ordering

Description

AMD ordering

Usage

amd_order(mat)

Arguments

mat

A matrix

Details

Generates the approximate minimum degree ordering of the matrix for use in efficient Cholesky decomposition of PAP^T.

Value

A list with the permutation vector and it's inverse.


Generate sparse matrix representation of a matrix

Description

Generate sparse matrix representation of a matrix

Usage

dense_to_sparse(mat)

Arguments

mat

A matrix

Value

A list with the matrix in compressed row storage format.

Examples

M <- diag(10)
#put a few random values in
M[lower.tri(M)][seq(1,45,by=5)] <- c(0.1,0.5,0.9,0.6,0.8,0.9,0.2,0.3,0.1)
M[upper.tri(M)][seq(1,45,by=5)] <- c(0.1,0.5,0.9,0.6,0.8,0.9,0.2,0.3,0.1)
L <- dense_to_sparse(M)

Generate matrix D from 'sparse_chol' output

Description

Generates the D matrix of the LDL decomposition from the output of the 'sparse_chol' function

Usage

sparse_D(mat)

Arguments

mat

List returned by 'sparse_chol'

Value

A matrix of class 'ddiMatrix'


Generate matrix L from 'sparse_chol' output

Description

Generates the L matrix of the LDL decomposition from the output of the 'sparse_chol' function

Usage

sparse_L(mat)

Arguments

mat

List returned by 'sparse_chol'

Value

A matrix of class 'dsCMatrix'


Sparse Cholesky decomposition

Description

Sparse Cholesky decomposition

Usage

sparse_chol(mat)

Arguments

mat

A matrix

Details

Generates the LDL decomposition of a symmetric, sparse matrix using the method described by Timothy Davis (see references). This function accepts a standard matrix, converts to sparse format, generates the LDL decomposition and returns the Cholesky decomposition LD^0.5.

Value

A lower-triangular matrix.

Examples

M <- diag(10)
#put a few random values in
M[lower.tri(M)][seq(1,45,by=5)] <- c(0.1,0.5,0.9,0.6,0.8,0.9,0.2,0.3,0.1)
M[upper.tri(M)][seq(1,45,by=5)] <- c(0.1,0.5,0.9,0.6,0.8,0.9,0.2,0.3,0.1)
L <- sparse_chol(M)

Sparse Cholesky decomposition with sparse representation

Description

Sparse Cholesky decomposition with sparse representation

Usage

sparse_chol_crs(n, Ap, Ai, Ax)

Arguments

n

Integer specifying the dimension of the matrix

Ap

numeric (integer valued) vector of pointers, one for each column (or row), to the initial (zero-based) index of elements in the column (or row).

Ai

Integer vector specifying the row positions of the non-zero values of the matrix

Ax

values of the non-zero matrix entries

Details

Generates the LDL decomposition of a symmetric, sparse matrix using the method described by Timothy Davis (see references). Required input is a matrix in sparse format from the matrix package, see sparseMatrix, or the package function dense_to_sparse. To instead use a matrix directly, see sparse_chol.

Value

A list with elements n, Ai, Ap, Ax (corresponding to above arguments) for matrix L, and element D, which contains the diagonal values of matrix D.

Examples

n <- 10
Ap <- c(0, 1, 2, 3, 4, 6, 7, 9, 11, 15, 19)
Ai <- c(1, 2, 3, 4, 2,5, 6, 5,7, 5,8, 1,5,8,9, 2,5,7,10)
Ax <- c(1.7, 1., 1.5, 1.1, .02,2.6, 1.2, .16,1.3, .09,1.6,
          .13,.52,.11,1.4, .01,.53,.56,3.1)
out <-sparse_chol_crs(n,Ap,Ai,Ax)
sparse_L(out)
sparse_D(out)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.