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 2304, Sun Oct 26 15:27:45 2008 UTC revision 2312, Sat Jan 10 14:01:26 2009 UTC
# Line 32  Line 32 
32      return TRUE;      return TRUE;
33  }  }
34    
35  SEXP Csparse_validate(SEXP x)  SEXP Csparse_validate(SEXP x) {
36        return Csparse_validate_(x, FALSE);
37    }
38    
39    SEXP Csparse_validate2(SEXP x, SEXP maybe_modify) {
40        return Csparse_validate_(x, asLogical(maybe_modify));
41    }
42    
43    SEXP Csparse_validate_(SEXP x, Rboolean maybe_modify)
44  {  {
45      /* NB: we do *NOT* check a potential 'x' slot here, at all */      /* NB: we do *NOT* check a potential 'x' slot here, at all */
46      SEXP pslot = GET_SLOT(x, Matrix_pSym),      SEXP pslot = GET_SLOT(x, Matrix_pSym),
# Line 69  Line 77 
77              }              }
78      }      }
79      if (!sorted) {      if (!sorted) {
80            if(maybe_modify) {
81                CHM_SP chx = (CHM_SP) alloca(sizeof(cholmod_sparse));
82                R_CheckStack();
83                as_cholmod_sparse(chx, x, FALSE, TRUE);/*-> cholmod_l_sort() ! */
84                /* as chx = AS_CHM_SP__(x)  but  ^^^^ sorting x in_place !!! */
85    
86                /* Now re-check that row indices are *strictly* increasing
87                 * (and not just increasing) within each column : */
88                for (j = 0; j < ncol; j++) {
89                    for (k = xp[j] + 1; k < xp[j + 1]; k++)
90                        if (xi[k] == xi[k - 1])
91                            return mkString(_("slot i is not *strictly* increasing inside a column (even after cholmod_l_sort)"));
92                }
93            } else { /* no modifying sorting : */
94          return mkString(_("row indices are not sorted within columns"));          return mkString(_("row indices are not sorted within columns"));
95            }
96      } else if(!strictly) {  /* sorted, but not strictly */      } else if(!strictly) {  /* sorted, but not strictly */
97          return mkString(_("slot i is not *strictly* increasing inside a column"));          return mkString(_("slot i is not *strictly* increasing inside a column"));
98      }      }

Legend:
Removed from v.2304  
changed lines
  Added in v.2312

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