SCM

SCM Repository

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

Diff of /pkg/src/CHMfactor.c

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

revision 2298, Fri Oct 17 13:45:12 2008 UTC revision 2299, Fri Oct 17 16:07:38 2008 UTC
# Line 7  Line 7 
7      CHM_SP Lm;      CHM_SP Lm;
8      R_CheckStack();      R_CheckStack();
9    
10      /* cholmod_factor_to_sparse changes its first argument. Make a copy */      /* cholmod_l_factor_to_sparse changes its first argument. Make a copy */
11      Lcp = cholmod_copy_factor(L, &c);      Lcp = cholmod_l_copy_factor(L, &c);
12      if (!(Lcp->is_ll))      if (!(Lcp->is_ll))
13          if (!cholmod_change_factor(Lcp->xtype, 1, 0, 1, 1, Lcp, &c))          if (!cholmod_l_change_factor(Lcp->xtype, 1, 0, 1, 1, Lcp, &c))
14              error(_("cholmod_change_factor failed with status %d"), c.status);              error(_("cholmod_l_change_factor failed with status %d"), c.status);
15      Lm = cholmod_factor_to_sparse(Lcp, &c); cholmod_free_factor(&Lcp, &c);      Lm = cholmod_l_factor_to_sparse(Lcp, &c); cholmod_l_free_factor(&Lcp, &c);
16      return chm_sparse_to_SEXP(Lm, 1/*do_free*/, -1/*uploT*/, 0/*Rkind*/,      return chm_sparse_to_SEXP(Lm, 1/*do_free*/, -1/*uploT*/, 0/*Rkind*/,
17                                "N"/*non_unit*/, R_NilValue/*dimNames*/);                                "N"/*non_unit*/, R_NilValue/*dimNames*/);
18  }  }
# Line 28  Line 28 
28      if (!(sys--))               /* -- align with CHOLMOD defs */      if (!(sys--))               /* -- align with CHOLMOD defs */
29          error(_("system argument is not valid"));          error(_("system argument is not valid"));
30    
31      X = cholmod_solve(sys, L, B, &c);      X = cholmod_l_solve(sys, L, B, &c);
32      UNPROTECT(1);      UNPROTECT(1);
33      return chm_dense_to_SEXP(X, 1/*do_free*/, 0/*Rkind*/,      return chm_dense_to_SEXP(X, 1/*do_free*/, 0/*Rkind*/,
34                               GET_SLOT(bb, Matrix_DimNamesSym));                               GET_SLOT(bb, Matrix_DimNamesSym));
# Line 43  Line 43 
43    
44      if (!(sys--))               /* -- align with CHOLMOD defs */      if (!(sys--))               /* -- align with CHOLMOD defs */
45          error(_("system argument is not valid"));          error(_("system argument is not valid"));
46      return chm_sparse_to_SEXP(cholmod_spsolve(sys, L, B, &c),      return chm_sparse_to_SEXP(cholmod_l_spsolve(sys, L, B, &c),
47                                1/*do_free*/, 0/*uploT*/, 0/*Rkind*/,                                1/*do_free*/, 0/*uploT*/, 0/*Rkind*/,
48                                "", GET_SLOT(b, Matrix_DimNamesSym));                                "", GET_SLOT(b, Matrix_DimNamesSym));
49  }  }
# Line 113  Line 113 
113  {  {
114      double mm[2] = {0, 0};      double mm[2] = {0, 0};
115      mm[0] = mult;      mm[0] = mult;
116      if (!cholmod_factorize_p(A, mm, (int*)NULL, 0 /*fsize*/, f, &c))      if (!cholmod_l_factorize_p(A, mm, (int*)NULL, 0 /*fsize*/, f, &c))
117          error(_("cholmod_factorize_p failed: status %d, minor %d of ncol %d"),          error(_("cholmod_l_factorize_p failed: status %d, minor %d of ncol %d"),
118                c.status, f->minor, f->n);                c.status, f->minor, f->n);
119      return f;      return f;
120  }  }
# Line 125  Line 125 
125      CHM_SP A = AS_CHM_SP__(parent);      CHM_SP A = AS_CHM_SP__(parent);
126      R_CheckStack();      R_CheckStack();
127    
128      Lcp = cholmod_copy_factor(L, &c);      Lcp = cholmod_l_copy_factor(L, &c);
129      return chm_factor_to_SEXP(chm_factor_update(Lcp, A, asReal(mult)), 1);      return chm_factor_to_SEXP(chm_factor_update(Lcp, A, asReal(mult)), 1);
130  }  }
131    
# Line 138  Line 138 
138      CHM_SP A = AS_CHM_SP__(parent);      CHM_SP A = AS_CHM_SP__(parent);
139      R_CheckStack();      R_CheckStack();
140    
141      Lcp = cholmod_copy_factor(L, &c);      Lcp = cholmod_l_copy_factor(L, &c);
142      for (i = 0; i < nmult; i++)      for (i = 0; i < nmult; i++)
143          aa[i] = chm_factor_ldetL2(chm_factor_update(Lcp, A, mm[i]));          aa[i] = chm_factor_ldetL2(chm_factor_update(Lcp, A, mm[i]));
144      cholmod_free_factor(&Lcp, &c);      cholmod_l_free_factor(&Lcp, &c);
145      UNPROTECT(1);      UNPROTECT(1);
146      return ans;      return ans;
147  }  }

Legend:
Removed from v.2298  
changed lines
  Added in v.2299

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