SCM

SCM Repository

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

Diff of /pkg/src/sscMatrix.c

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

revision 183, Sun May 30 07:36:30 2004 UTC revision 184, Sun May 30 22:38:37 2004 UTC
# Line 197  Line 197 
197      UNPROTECT(lo ? 2 : 1);      UNPROTECT(lo ? 2 : 1);
198      return ans;      return ans;
199  }  }
200    
201    SEXP sscMatrix_metis_perm(SEXP x)
202    {
203        SEXP pSlot = GET_SLOT(x, Matrix_pSym),
204            ans = PROTECT(allocVector(VECSXP, 2));
205        int n = length(pSlot) - 1;
206    
207        SET_VECTOR_ELT(ans, 0, allocVector(INTSXP, n));
208        SET_VECTOR_ELT(ans, 1, allocVector(INTSXP, n));
209        ssc_metis_order(n,
210                        INTEGER(pSlot),
211                        INTEGER(GET_SLOT(x, Matrix_iSym)),
212                        INTEGER(VECTOR_ELT(ans, 0)),
213                        INTEGER(VECTOR_ELT(ans, 1)));
214        UNPROTECT(1);
215        return ans;
216    }
217    
218    SEXP sscMatrix_metis_ldl_symbolic(SEXP x)
219    {
220        SEXP pSlot = GET_SLOT(x, Matrix_pSym),
221            ans = PROTECT(allocVector(VECSXP, 4));
222        int *Ai = INTEGER(GET_SLOT(x, Matrix_iSym)),
223            lo = toupper(CHAR(asChar(GET_SLOT(x, Matrix_uploSym)))[0]) == 'L',
224            n = length(pSlot)-1;
225    
226    
227        if (lo) x = PROTECT(ssc_transpose(x));
228        SET_VECTOR_ELT(ans, 0, allocVector(INTSXP, n));
229        SET_VECTOR_ELT(ans, 1, allocVector(INTSXP, n));
230        SET_VECTOR_ELT(ans, 2, allocVector(INTSXP, n + 1));
231        SET_VECTOR_ELT(ans, 3, allocVector(INTSXP, n));
232        ssc_metis_order(n, INTEGER(pSlot), Ai,
233                        INTEGER(VECTOR_ELT(ans, 0)), /* P */
234                        INTEGER(VECTOR_ELT(ans, 1))); /* Pinv */
235        ldl_symbolic(n, INTEGER(pSlot), Ai,
236                     INTEGER(VECTOR_ELT(ans, 2)), /* Lp */
237                     INTEGER(VECTOR_ELT(ans, 3)), /* Parent */
238                     (int *) R_alloc(n, sizeof(int)), /* Lnz */
239                     (int *) R_alloc(n, sizeof(int)), /* Flag */
240                     INTEGER(VECTOR_ELT(ans, 0)), /* P */
241                     INTEGER(VECTOR_ELT(ans, 1))); /* Pinv */
242        UNPROTECT(lo ? 2 : 1);
243        return ans;
244    }

Legend:
Removed from v.183  
changed lines
  Added in v.184

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