SCM

SCM Repository

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

Diff of /pkg/src/Csparse.c

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

revision 1448, Sat Aug 26 03:29:36 2006 UTC revision 1461, Tue Aug 29 16:17:27 2006 UTC
# Line 131  Line 131 
131  SEXP Csparse_dense_prod(SEXP a, SEXP b)  SEXP Csparse_dense_prod(SEXP a, SEXP b)
132  {  {
133      cholmod_sparse *cha = as_cholmod_sparse(a);      cholmod_sparse *cha = as_cholmod_sparse(a);
134      cholmod_dense *chb = as_cholmod_dense(b);      cholmod_dense *chb = as_cholmod_dense(PROTECT(mMatrix_as_dgeMatrix(b)));
135      cholmod_dense *chc =      cholmod_dense *chc =
136          cholmod_allocate_dense(cha->nrow, chb->ncol, cha->nrow, chb->xtype, &c);          cholmod_allocate_dense(cha->nrow, chb->ncol, cha->nrow, chb->xtype, &c);
137      double alpha[] = {1,0}, beta[] = {0,0};      double alpha[] = {1,0}, beta[] = {0,0};
138    
139      cholmod_sdmult(cha, 0, alpha, beta, chb, chc, &c);      cholmod_sdmult(cha, 0, alpha, beta, chb, chc, &c);
140      Free(cha); Free(chb);      Free(cha); Free(chb);
141        UNPROTECT(1);
142      return chm_dense_to_SEXP(chc, 1);      return chm_dense_to_SEXP(chc, 1);
143  }  }
144    
145  SEXP Csparse_dense_crossprod(SEXP a, SEXP b)  SEXP Csparse_dense_crossprod(SEXP a, SEXP b)
146  {  {
147      cholmod_sparse *cha = as_cholmod_sparse(a);      cholmod_sparse *cha = as_cholmod_sparse(a);
148      cholmod_dense *chb = as_cholmod_dense(b);      cholmod_dense *chb = as_cholmod_dense(PROTECT(mMatrix_as_dgeMatrix(b)));
149      cholmod_dense *chc =      cholmod_dense *chc =
150          cholmod_allocate_dense(cha->ncol, chb->ncol, cha->ncol, chb->xtype, &c);          cholmod_allocate_dense(cha->ncol, chb->ncol, cha->ncol, chb->xtype, &c);
151      double alpha[] = {1,0}, beta[] = {0,0};      double alpha[] = {1,0}, beta[] = {0,0};
152    
153      cholmod_sdmult(cha, 1, alpha, beta, chb, chc, &c);      cholmod_sdmult(cha, 1, alpha, beta, chb, chc, &c);
154      Free(cha); Free(chb);      Free(cha); Free(chb);
155        UNPROTECT(1);
156      return chm_dense_to_SEXP(chc, 1);      return chm_dense_to_SEXP(chc, 1);
157  }  }
158    

Legend:
Removed from v.1448  
changed lines
  Added in v.1461

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