The R Project SVN R-packages

Rev

Rev 4963 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4963 Rev 5047
Line 247... Line 247...
247
}
247
}
248
 
248
 
249
SEXP dense_to_Csparse(SEXP x)
249
SEXP dense_to_Csparse(SEXP x)
250
{
250
{
251
    CHM_DN chxd = AS_CHM_DN(PROTECT(mMatrix_as_geMatrix(x)));
251
    CHM_DN chxd = AS_CHM_DN(PROTECT(mMatrix_as_geMatrix(x)));
252
    R_CheckStack();
-
 
253
 
-
 
254
    /* cholmod_dense_to_sparse() in CHOLMOD/Core/ below does only work for
252
    /* cholmod_dense_to_sparse() in CHOLMOD/Core/ below does only work for
255
       "REAL" 'xtypes', i.e. *not* for "nMatrix".
253
       "REAL" 'xtypes', i.e. *not* for "nMatrix".
256
       ===> need "_x" in above call.
254
       ===> need "_x" in above call.
257
 
255
 
258
       Also it cannot keep symmetric / triangular, hence the
256
       Also it cannot keep symmetric / triangular, hence the
Line 262... Line 260...
262
       argument for symmetry.
260
       argument for symmetry.
263
    */
261
    */
264
    CHM_SP chxs = cholmod_dense_to_sparse(chxd, 1, &c);
262
    CHM_SP chxs = cholmod_dense_to_sparse(chxd, 1, &c);
265
    int Rkind = (chxd->xtype == CHOLMOD_REAL) ? Real_KIND2(x) : 0;
263
    int Rkind = (chxd->xtype == CHOLMOD_REAL) ? Real_KIND2(x) : 0;
266
    /* Note: when 'x' was integer Matrix, Real_KIND(x) = -1, but *_KIND2(.) = 0 */
264
    /* Note: when 'x' was integer Matrix, Real_KIND(x) = -1, but *_KIND2(.) = 0 */
-
 
265
    R_CheckStack();
267
 
266
 
268
    UNPROTECT(1);
267
    UNPROTECT(1);
269
    /* chm_sparse_to_SEXP() *could* deal with symmetric
268
    /* chm_sparse_to_SEXP() *could* deal with symmetric
270
     * if chxs had such an stype; and we should be able to use uplo below */
269
     * if chxs had such an stype; and we should be able to use uplo below */
271
    return chm_sparse_to_SEXP(chxs, 1, 0/*TODO: uplo_P(x) if x has an uplo slot*/,
270
    return chm_sparse_to_SEXP(chxs, 1, 0/*TODO: uplo_P(x) if x has an uplo slot*/,