Matrix r5059
|
Go to the source code of this file.
Macros | |
#define | errorFree(...) |
#define | MAYBE_FREE |
#define | MAYBE_FREE |
#define | MAYBE_FREE |
#define | MAYBE_FREE |
Functions | |
cholmod_factor * | sexp_as_cholmod_factor (cholmod_factor *L, SEXP from) |
Coerce from sparseCholesky to (cholmod_factor *) | |
cholmod_sparse * | sexp_as_cholmod_sparse (cholmod_sparse *A, SEXP from, Rboolean allocUnit, Rboolean sortInPlace) |
Coerce from [CR]sparseMatrix to (cholmod_sparse *) | |
cholmod_triplet * | sexp_as_cholmod_triplet (cholmod_triplet *A, SEXP from, Rboolean allocUnit) |
Coerce from TsparseMatrix to (cholmod_triplet *) | |
cholmod_dense * | sexp_as_cholmod_dense (cholmod_dense *A, SEXP from) |
Coerce from .geMatrix or vector to (cholmod_dense *) | |
cholmod_dense * | numeric_as_cholmod_dense (cholmod_dense *A, double *data, int nrow, int ncol) |
Coerce from (double *) to (cholmod_dense *) with given dimensions. | |
SEXP | cholmod_factor_as_sexp (cholmod_factor *L, int doFree) |
Coerce from (cholmod_factor *) to sparseCholesky. | |
SEXP | cholmod_sparse_as_sexp (cholmod_sparse *A, int doFree, int ttype, int doLogic, const char *diagString, SEXP dimnames) |
Coerce from (cholmod_sparse *) to CsparseMatrix. | |
SEXP | cholmod_triplet_as_sexp (cholmod_triplet *A, int doFree, int ttype, int doLogic, const char *diagString, SEXP dimnames) |
Coerce from (cholmod_triplet *) to TsparseMatrix. | |
SEXP | cholmod_dense_as_sexp (cholmod_dense *A, int doFree) |
Coerce from (cholmod_dense *) to [dz]geMatrix. | |
double | cholmod_factor_ldetA (cholmod_factor *L) |
Log determinant from Cholesky factorization. | |
cholmod_factor * | cholmod_factor_update (cholmod_factor *L, cholmod_sparse *A, double beta) |
Update a Cholesky factorization. | |
#define errorFree | ( | ... | ) |
Referenced by cholmod_dense_as_sexp(), cholmod_factor_as_sexp(), cholmod_sparse_as_sexp(), and cholmod_triplet_as_sexp().
#define MAYBE_FREE |
Referenced by cholmod_dense_as_sexp(), cholmod_factor_as_sexp(), cholmod_sparse_as_sexp(), and cholmod_triplet_as_sexp().
#define MAYBE_FREE |
#define MAYBE_FREE |
#define MAYBE_FREE |
SEXP cholmod_dense_as_sexp | ( | cholmod_dense * | A, |
int | doFree ) |
Coerce from (cholmod_dense *) to [dz]geMatrix.
Allocates an S4 object of class [dz]geMatrix and copies into the slots from members of a pointed-to cholmod_dense struct. The specific class of the result is determined by struct member xtype.
A | a pointer to a cholmod_dense struct. |
doFree | a flag indicating if and how to free A before returning. (0) don't free, (>0) free with cholmod_free_dense, (<0) free with R_Free. |
Definition at line 851 of file cholmod-api.c.
References _, errorFree, GET_SLOT, Matrix_DimSym, Matrix_xSym, MAYBE_FREE, newObject(), and SET_SLOT.
Referenced by R_init_Matrix().
SEXP cholmod_factor_as_sexp | ( | cholmod_factor * | L, |
int | doFree ) |
Coerce from (cholmod_factor *) to sparseCholesky.
Allocates an S4 object inheriting from virtual class sparseCholesky and copies into the slots from members of a pointed-to cholmod_factor struct. The specific class of the result is determined by struct members xtype and is_super.
L | a pointer to a cholmod_factor struct. |
doFree | a flag indicating if and how to free L before returning. (0) don't free, (>0) free with cholmod_free_factor, (<0) free with R_Free. |
Definition at line 466 of file cholmod-api.c.
References _, errorFree, GET_SLOT, Matrix_colcountSym, Matrix_DimSym, Matrix_isllSym, Matrix_ismtSym, Matrix_iSym, Matrix_maxcsizeSym, Matrix_maxesizeSym, Matrix_minorSym, Matrix_nextSym, Matrix_nzSym, Matrix_orderingSym, Matrix_permSym, Matrix_piSym, Matrix_prevSym, Matrix_pSym, Matrix_pxSym, Matrix_sSym, Matrix_superSym, Matrix_xSym, MAYBE_FREE, newObject(), and SET_SLOT.
Referenced by R_init_Matrix().
double cholmod_factor_ldetA | ( | cholmod_factor * | L | ) |
Log determinant from Cholesky factorization.
Computes log(det(A)) given the Cholesky factorization of A as P1 * A * P1' = L1 * D * L1' = L * L', L = L1 * sqrt(D). The result is computed as sum(log(diag(D))) or 2*sum(log(diag(L))), depending on members is_super and is_ll of the supplied struct. Note that CHOLMOD does not require diag(D) to be positive and that this routine does not check (FIXME).
L | a pointer to a cholmod_factor struct. |
Definition at line 911 of file cholmod-api.c.
References _.
Referenced by R_init_Matrix().
cholmod_factor * cholmod_factor_update | ( | cholmod_factor * | L, |
cholmod_sparse * | A, | ||
double | beta ) |
Update a Cholesky factorization.
Updates in-place the Cholesky factorization of a symmetric matrix X+alpha*I with the Cholesky factorization of (1) A+beta*I, where A is a symmetric matrix sharing the nonzero pattern of X, or (2) A*A'+beta*I, where A is a general matrix sharing the nonzero pattern of Y, assuming that X = Y*Y'.
L | a pointer to a cholmod_factor struct, to be modified in-place. |
A | a pointer to a cholmod_sparse struct. |
beta | a multiplier, typically positive, to guarantee strict diagonal dominance. |
Definition at line 958 of file cholmod-api.c.
Referenced by R_init_Matrix().
SEXP cholmod_sparse_as_sexp | ( | cholmod_sparse * | A, |
int | doFree, | ||
int | ttype, | ||
int | doLogic, | ||
const char * | diagString, | ||
SEXP | dimnames ) |
Coerce from (cholmod_sparse *) to CsparseMatrix.
Allocates an S4 object inheriting from virtual class CsparseMatrix and copies into the slots from members of a pointed-to cholmod_sparse struct. The specific class of the result is determined by struct members xtype and stype and by arguments ttype and doLogic.
A | a pointer to a cholmod_sparse struct. |
doFree | a flag indicating if and how to free A before returning. (0) don't free, (>0) free with cholmod_free_sparse, (<0) free with R_Free. |
ttype | a flag indicating if the result should be a .tCMatrix. (0) not .tCMatrix, (>0) .tCMatrix with uplo="U", (<0) .tCMatrix with uplo="L". If ttype=0, then the result is a .gCMatrix or .sCMatrix depending on stype. (0) .gCMatrix, (>0) .sCMatrix with uplo="U", (<0) .sCMatrix with uplo="L". |
doLogic | a flag indicating if the result should be a l.CMatrix if xtype=CHOLMOD_REAL. |
diagString | a null-terminated string or NULL. The diag slot of a .tCMatrix result is "N" if and only if diagString is NULL or diagString[0] is 'N'. |
dimnames | an R object specifying the Dimnames slot of the result, unused if not a list of length 2. |
Definition at line 625 of file cholmod-api.c.
References _, c, errorFree, GET_SLOT, Matrix_diagSym, Matrix_DimNamesSym, Matrix_DimSym, Matrix_iSym, Matrix_pSym, Matrix_uploSym, Matrix_xSym, MAYBE_FREE, newObject(), SET_SLOT, and TYPEOF.
Referenced by R_init_Matrix().
SEXP cholmod_triplet_as_sexp | ( | cholmod_triplet * | A, |
int | doFree, | ||
int | ttype, | ||
int | doLogic, | ||
const char * | diagString, | ||
SEXP | dimnames ) |
Coerce from (cholmod_triplet *) to TsparseMatrix.
Allocates an S4 object inheriting from virtual class TsparseMatrix and copies into the slots from members of a pointed-to cholmod_triplet struct. The specific class of the result is determined by struct members xtype and stype and by arguments ttype and doLogic.
A | a pointer to a cholmod_triplet struct. |
doFree | a flag indicating if and how to free A before returning. (0) don't free, (>0) free with cholmod_free_triplet, (<0) free with R_Free. |
ttype | a flag indicating if the result should be a .tTMatrix. (0) not .tTMatrix, (>0) .tTMatrix with uplo="U", (<0) .tTMatrix with uplo="L". If ttype=0, then the result is a .gTMatrix or .sTMatrix depending on stype. (0) .gTMatrix, (>0) .sTMatrix with uplo="U", (<0) .sTMatrix with uplo="L". |
doLogic | a flag indicating if the result should be an l.TMatrix if xtype=CHOLMOD_REAL. |
diagString | a null-terminated string or NULL. The diag slot of a .tTMatrix result is "N" if and only if diagString is NULL or diagString[0] is 'N'. |
dimnames | an R object specifying the Dimnames slot of the result, unused if not a list of length 2. |
Definition at line 740 of file cholmod-api.c.
References _, errorFree, GET_SLOT, Matrix_diagSym, Matrix_DimNamesSym, Matrix_DimSym, Matrix_iSym, Matrix_jSym, Matrix_uploSym, Matrix_xSym, MAYBE_FREE, newObject(), SET_SLOT, and TYPEOF.
Referenced by R_init_Matrix().
cholmod_dense * numeric_as_cholmod_dense | ( | cholmod_dense * | A, |
double * | data, | ||
int | nrow, | ||
int | ncol ) |
Coerce from (double *) to (cholmod_dense *) with given dimensions.
An analogue of base::matrix(data, nrow, ncol), where typeof(data)=="double" and length(data)==nrow*ncol.
A | a pointer to a cholmod_dense struct, to be modified in-place. |
data | a pointer to an nrow*ncol*sizeof(double) block of memory. |
nrow | the desired number of rows. |
ncol | the desired number of columns. |
Definition at line 436 of file cholmod-api.c.
Referenced by R_init_Matrix().
cholmod_dense * sexp_as_cholmod_dense | ( | cholmod_dense * | A, |
SEXP | from ) |
Coerce from .geMatrix or vector to (cholmod_dense *)
Sets the members of a pointed-to cholmod_dense struct, using "data" obtained from slots of a .geMatrix. The result should not be freed using cholmod_free_dense, as the resulting members point to memory controlled by R, not by CHOLMOD.
A | a pointer to a cholmod_dense struct, to be modified in-place. |
from | an S4 object inheriting from class .geMatrix or a traditional vector of type "logical", "integer", "double", or "complex" (to be handled as a 1-column matrix if not a matrix). |
Definition at line 356 of file cholmod-api.c.
References ERROR_INVALID_TYPE, GET_SLOT, Matrix_class(), Matrix_DimSym, Matrix_xSym, and TYPEOF.
Referenced by R_init_Matrix().
cholmod_factor * sexp_as_cholmod_factor | ( | cholmod_factor * | L, |
SEXP | from ) |
Coerce from sparseCholesky to (cholmod_factor *)
Sets the members of a pointed-to cholmod_factor struct, using "data" obtained from slots of a sparseCholesky. The result should not be freed using cholmod_free_factor, as the resulting members point to memory controlled by R, not by CHOLMOD.
L | a pointer to a cholmod_factor struct, to be modified in-place. |
from | an S4 object inheriting from virtual class sparseCholesky. |
Definition at line 18 of file cholmod-api.c.
References GET_SLOT, Matrix_class(), Matrix_colcountSym, Matrix_DimSym, Matrix_isllSym, Matrix_ismtSym, Matrix_iSym, Matrix_maxcsizeSym, Matrix_maxesizeSym, Matrix_minorSym, Matrix_nextSym, Matrix_nzSym, Matrix_orderingSym, Matrix_permSym, Matrix_piSym, Matrix_prevSym, Matrix_pSym, Matrix_pxSym, Matrix_sSym, Matrix_superSym, and Matrix_xSym.
Referenced by R_init_Matrix().
cholmod_sparse * sexp_as_cholmod_sparse | ( | cholmod_sparse * | A, |
SEXP | from, | ||
Rboolean | allocUnit, | ||
Rboolean | sortInPlace ) |
Coerce from [CR]sparseMatrix to (cholmod_sparse *)
Sets the members of a pointed-to cholmod_sparse struct, using "data" obtained from slots of a [CR]sparseMatrix. The result should not be freed using cholmod_free_sparse, as the resulting members point to memory controlled by R, not by CHOLMOD.
A | a pointer to a cholmod_sparse struct, to be modified in-place. |
from | an S4 object inheriting from virtual class [CR]sparseMatrix. |
allocUnit | a boolean indicating if the unit diagonal of formally unit triangular [CR]sparseMatrix should be allocated. |
sortInPlace | a boolean indicating if unsorted [CR]sparseMatrix should be sorted in place to avoid an allocation. |
Definition at line 127 of file cholmod-api.c.
References _, allocUnit(), c, checkpi(), GET_SLOT, Matrix_class(), Matrix_diagSym, Matrix_DimSym, Matrix_iSym, Matrix_jSym, Matrix_pSym, Matrix_uploSym, Matrix_xSym, TYPEOF, and valid_sparse_compressed.
Referenced by R_init_Matrix().
cholmod_triplet * sexp_as_cholmod_triplet | ( | cholmod_triplet * | A, |
SEXP | from, | ||
Rboolean | allocUnit ) |
Coerce from TsparseMatrix to (cholmod_triplet *)
Sets the members of a pointed-to cholmod_triplet struct, using "data" obtained from slots of a TsparseMatrix. The result should not be freed using cholmod_free_sparse, as the resulting members point to memory controlled by R, not by CHOLMOD.
A | a pointer to a cholmod_triplet struct, to be modified in-place. |
from | an S4 object inheriting from virtual class TsparseMatrix. |
allocUnit | a boolean indicating if the unit diagonal of formally unit triangular TsparseMatrix should be allocated. |
Definition at line 247 of file cholmod-api.c.
References allocUnit(), GET_SLOT, Matrix_class(), Matrix_diagSym, Matrix_DimSym, Matrix_iSym, Matrix_pSym, Matrix_uploSym, Matrix_xSym, Matrix_zunit, TYPEOF, and valid_sparse_triplet.
Referenced by R_init_Matrix().