249 |
SEXP dense_to_Csparse(SEXP x) |
SEXP dense_to_Csparse(SEXP x) |
250 |
{ |
{ |
251 |
CHM_DN chxd = AS_CHM_DN(PROTECT(mMatrix_as_geMatrix(x))); |
CHM_DN chxd = AS_CHM_DN(PROTECT(mMatrix_as_geMatrix(x))); |
252 |
/* cholmod_l_dense_to_sparse() in CHOLMOD/Core/ below does only work for |
/* cholmod_dense_to_sparse() in CHOLMOD/Core/ below does only work for |
253 |
"REAL" 'xtypes', i.e. *not* for "nMatrix". |
"REAL" 'xtypes', i.e. *not* for "nMatrix". |
254 |
===> need "_x" in above call. |
===> need "_x" in above call. |
255 |
|
|
256 |
Also it cannot keep symmetric / triangular, hence the |
Also it cannot keep symmetric / triangular, hence the |
257 |
as_geMatrix() above. Note that this is already a *waste* for |
as_geMatrix() above. Note that this is already a *waste* for |
258 |
symmetric matrices; However, we could conceivably use an |
symmetric matrices; However, we could conceivably use an |
259 |
enhanced cholmod_l_dense_to_sparse(), with an extra boolean |
enhanced cholmod_dense_to_sparse(), with an extra boolean |
260 |
argument for symmetry. |
argument for symmetry. |
261 |
*/ |
*/ |
262 |
CHM_SP chxs = cholmod_l_dense_to_sparse(chxd, 1, &c); |
CHM_SP chxs = cholmod_dense_to_sparse(chxd, 1, &c); |
263 |
int Rkind = (chxd->xtype == CHOLMOD_REAL) ? Real_KIND2(x) : 0; |
int Rkind = (chxd->xtype == CHOLMOD_REAL) ? Real_KIND2(x) : 0; |
264 |
/* Note: when 'x' was integer Matrix, Real_KIND(x) = -1, but *_KIND2(.) = 0 */ |
/* Note: when 'x' was integer Matrix, Real_KIND(x) = -1, but *_KIND2(.) = 0 */ |
265 |
R_CheckStack(); |
R_CheckStack(); |