SCM

SCM Repository

[matrix] Diff of /pkg/Matrix/src/Csparse.c
ViewVC logotype

Diff of /pkg/Matrix/src/Csparse.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2174, Wed Apr 23 11:21:37 2008 UTC revision 2175, Wed Apr 23 11:23:50 2008 UTC
# Line 349  Line 349 
349    
350  SEXP Csparse_drop(SEXP x, SEXP tol)  SEXP Csparse_drop(SEXP x, SEXP tol)
351  {  {
352        const char *cl = class_P(x);
353        /* dtCMatrix, etc; [1] = the second character =?= 't' for triangular */
354        int tr = (cl[1] == 't');
355      CHM_SP chx = AS_CHM_SP(x);      CHM_SP chx = AS_CHM_SP(x);
356      CHM_SP ans = cholmod_copy(chx, chx->stype, chx->xtype, &c);      CHM_SP ans = cholmod_copy(chx, chx->stype, chx->xtype, &c);
357      double dtol = asReal(tol);      double dtol = asReal(tol);
# Line 357  Line 360 
360    
361      if(!cholmod_drop(dtol, ans, &c))      if(!cholmod_drop(dtol, ans, &c))
362          error(_("cholmod_drop() failed"));          error(_("cholmod_drop() failed"));
363      return chm_sparse_to_SEXP(ans, 1, 0, Rkind, "",      return chm_sparse_to_SEXP(ans, 1,
364                                  tr ? ((*uplo_P(x) == 'U') ? 1 : -1) : 0,
365                                  Rkind, tr ? diag_P(x) : "",
366                                GET_SLOT(x, Matrix_DimNamesSym));                                GET_SLOT(x, Matrix_DimNamesSym));
367  }  }
368    
# Line 484  Line 489 
489   * @param n  dimension of the matrix.   * @param n  dimension of the matrix.
490   * @param x_p  'p' (column pointer) slot contents   * @param x_p  'p' (column pointer) slot contents
491   * @param x_x  'x' (non-zero entries) slot contents   * @param x_x  'x' (non-zero entries) slot contents
492   * @param perm 'perm' (= permutation vector) slot contents   * @param perm 'perm' (= permutation vector) slot contents; only used for "diagBack"
493   * @param resultKind a (SEXP) string indicating which kind of result is desired.   * @param resultKind a (SEXP) string indicating which kind of result is desired.
494   *   *
495   * @return  a SEXP, either a (double) number or a length n-vector of diagonal entries   * @return  a SEXP, either a (double) number or a length n-vector of diagonal entries
# Line 544  Line 549 
549      case diag_backpermuted:      case diag_backpermuted:
550          for_DIAG(v[i] = x_x[i_from]);          for_DIAG(v[i] = x_x[i_from]);
551    
552          error(_("resultKind = 'diagBack' (back-permuted) is not yet implemented"));          warning(_("resultKind = 'diagBack' (back-permuted) is experimental"));
553          /* now back_permute : */          /* now back_permute : */
554          for(i = 0; i < n; i++) {          for(i = 0; i < n; i++) {
555              double tmp = v[i]; v[i] = v[perm[i]]; v[perm[i]] = tmp;              double tmp = v[i]; v[i] = v[perm[i]]; v[perm[i]] = tmp;
# Line 567  Line 572 
572   *   *
573   * @param pslot  'p' (column pointer)   slot of Csparse matrix/factor   * @param pslot  'p' (column pointer)   slot of Csparse matrix/factor
574   * @param xslot  'x' (non-zero entries) slot of Csparse matrix/factor   * @param xslot  'x' (non-zero entries) slot of Csparse matrix/factor
575   * @param perm_slot  'perm' (= permutation vector) slot of corresponding CHMfactor   * @param perm_slot  'perm' (= permutation vector) slot of corresponding CHMfactor;
576     *                   only used for "diagBack"
577   * @param resultKind a (SEXP) string indicating which kind of result is desired.   * @param resultKind a (SEXP) string indicating which kind of result is desired.
578   *   *
579   * @return  a SEXP, either a (double) number or a length n-vector of diagonal entries   * @return  a SEXP, either a (double) number or a length n-vector of diagonal entries

Legend:
Removed from v.2174  
changed lines
  Added in v.2175

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge