SCM

SCM Repository

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

Diff of /pkg/src/ssclme.c

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

revision 70, Mon Apr 12 12:10:01 2004 UTC revision 73, Tue Apr 13 15:53:38 2004 UTC
# Line 188  Line 188 
188      }      }
189  }  }
190    
 static  
191  void ssclme_fill_LIp(int n, const int Parent[], int LIp[])  void ssclme_fill_LIp(int n, const int Parent[], int LIp[])
192  {  {
193      int *sz = Calloc(n, int), i;      int *sz = Calloc(n, int), i;
# Line 1285  Line 1284 
1284      UNPROTECT(2);      UNPROTECT(2);
1285      return val;      return val;
1286  }  }
   
 SEXP ssclme_L_LI_sizes(SEXP facs)  
 {  
     SEXP ans = PROTECT(allocVector(INTSXP, 4)),  
         ctab;  
     int *Ai, *Ap, *Lp, *Parent, *aa = INTEGER(ans), *dims, *perm,  
         nzcol;  
                                 /* Pairwise cross-tabulation */  
     ctab = PROTECT(sscCrosstab(facs, ScalarLogical(1)));  
     Ai = INTEGER(GET_SLOT(ctab, Matrix_iSym));  
     Ap = INTEGER(GET_SLOT(ctab, Matrix_pSym));  
     dims = INTEGER(GET_SLOT(ctab, Matrix_DimSym));  
     nzcol = dims[1];  
     Lp = Calloc(nzcol + 1, int);  
     Parent = Calloc(nzcol, int);  
     ldl_symbolic(nzcol, Ap, Ai, Lp, Parent,  
                  (int *) R_alloc(nzcol, sizeof(int)), /* Lnz */  
                  (int *) R_alloc(nzcol, sizeof(int)), /* Flag */  
                  (int *) NULL, (int *) NULL); /* P & Pinv */  
     aa[0] = Lp[nzcol];  
     ssclme_fill_LIp(nzcol, Parent, Lp);  
     aa[1] = Lp[nzcol];  
     perm = Calloc(nzcol, int);  
     ssc_metis_order(nzcol, Ap, Ai, perm, Parent);  
     ssc_symbolic_permute(nzcol, 1, Parent, Ap, Ai);  
     ldl_symbolic(nzcol, Ap, Ai, Lp, Parent,  
                  (int *) R_alloc(nzcol, sizeof(int)), /* Lnz */  
                  (int *) R_alloc(nzcol, sizeof(int)), /* Flag */  
                  (int *) NULL, (int *) NULL); /* P & Pinv */  
     aa[2] = Lp[nzcol];  
     ssclme_fill_LIp(nzcol, Parent, Lp);  
     aa[3] = Lp[nzcol];  
     Free(perm); Free(Parent); Free(Lp);  
     UNPROTECT(2);  
     return ans;  
 }  

Legend:
Removed from v.70  
changed lines
  Added in v.73

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