Matrix
$Rev: 3071 $ at $LastChangedDate: 20150326 15:35:47 +0100 (Thu, 26 Mar 2015) $

#include "cs_utils.h"
Go to the source code of this file.
Functions  
static CSP  csp_eye (int n) 
Create an identity matrix of size n as a cs struct. More...  
static int  is_sym (cs *A) 
cs *  Matrix_as_cs (cs *ans, SEXP x, Rboolean check_Udiag) 
Create a cs object with the contents of x. More...  
SEXP  Matrix_cs_to_SEXP (cs *a, char *cl, int dofree, SEXP dn) 
Copy the contents of a to an appropriate CsparseMatrix object and, optionally, free a or free both a and the pointers to its contents. More...  

static 
Create an identity matrix of size n as a cs struct.
The structure must be freed with cs_free by the caller.
n  size of identity matrix to construct. 
Definition at line 31 of file cs_utils.c.
References _, cs_spalloc(), cs_sparse::i, cs_sparse::nz, cs_sparse::nzmax, cs_sparse::p, and cs_sparse::x.
Referenced by Matrix_as_cs().

static 
Definition at line 5 of file cs_utils.c.
References cs_sparse::i, cs_sparse::m, cs_sparse::n, and cs_sparse::p.
Referenced by Csparse_to_dense(), Csparse_to_matrix(), and Matrix_cs_to_SEXP().
Create a cs object with the contents of x.
Typically called via AS_CSP()
ans  pointer to a cs struct. This is allocated in the caller so it is easier to keep track of where it should be freed  in many applications the memory can be allocated with alloca and automatically freed on exit from the caller. 
x  pointer to an object that inherits from CsparseMatrix 
check_Udiag  boolean  should a check for (and consequent expansion of) a unit diagonal be performed. 
Definition at line 61 of file cs_utils.c.
References _, cs_add(), cs_spfree(), cs_transpose(), csp_eye(), diag_P, cs_sparse::i, cs_sparse::m, Matrix_DimSym, Matrix_iSym, Matrix_pSym, Matrix_xSym, cs_sparse::n, cs_sparse::nz, cs_sparse::nzmax, cs_sparse::p, and cs_sparse::x.
SEXP Matrix_cs_to_SEXP  (  cs *  a, 
char *  cl,  
int  dofree,  
SEXP  dn  
) 
Copy the contents of a to an appropriate CsparseMatrix object and, optionally, free a or free both a and the pointers to its contents.
a  matrix to be converted 
cl  the name of the S4 class of the object to be generated 
dofree  0  don't free a; > 0 cs_free a; < 0 Free a 
dn  either R_NilValue or an SEXP suitable for the Dimnames slot. 
Definition at line 121 of file cs_utils.c.
References _, ALLOC_SLOT(), cs_spfree(), cs_sparse::i, is_sym(), cs_sparse::m, Matrix_check_class(), Matrix_diagSym, Matrix_DimNamesSym, Matrix_DimSym, Matrix_iSym, Matrix_pSym, Matrix_uploSym, Matrix_xSym, cs_sparse::n, cs_sparse::p, and cs_sparse::x.
Referenced by dgCMatrix_QR(), and install_lu().