SCM

SCM Repository

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

Diff of /pkg/src/dgeMatrix.c

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

revision 1462, Tue Aug 29 16:34:49 2006 UTC revision 1463, Tue Aug 29 22:30:57 2006 UTC
# Line 266  Line 266 
266      return val;      return val;
267  }  }
268    
269  SEXP dgeMatrix_matrix_mm(SEXP a, SEXP b, SEXP classed, SEXP right)  SEXP dgeMatrix_matrix_mm(SEXP a, SEXP bP, SEXP right)
270  {  {
271      int cl = asLogical(classed);      SEXP b = PROTECT(mMatrix_as_dgeMatrix(bP)),
272      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS("dgeMatrix")));          val = PROTECT(NEW_OBJECT(MAKE_CLASS("dgeMatrix")));
273      int *adims = INTEGER(GET_SLOT(a, Matrix_DimSym)),      int *adims = INTEGER(GET_SLOT(a, Matrix_DimSym)),
274          *bdims = INTEGER(cl ? GET_SLOT(b, Matrix_DimSym) :          *bdims = INTEGER(GET_SLOT(b, Matrix_DimSym)),
                          getAttrib(b, R_DimSymbol)),  
275          *cdims = INTEGER(ALLOC_SLOT(val, Matrix_DimSym, INTSXP, 2));          *cdims = INTEGER(ALLOC_SLOT(val, Matrix_DimSym, INTSXP, 2));
276      double one = 1., zero = 0.;      double one = 1., zero = 0.;
277    
# Line 284  Line 283 
283              error(_("Matrices with zero extents cannot be multiplied"));              error(_("Matrices with zero extents cannot be multiplied"));
284          cdims[0] = m; cdims[1] = n;          cdims[0] = m; cdims[1] = n;
285          F77_CALL(dgemm) ("N", "N", &m, &n, &k, &one,          F77_CALL(dgemm) ("N", "N", &m, &n, &k, &one,
286                           REAL(cl ? GET_SLOT(b, Matrix_xSym) : b), &m,                           REAL(GET_SLOT(b, Matrix_xSym)), &m,
287                           REAL(GET_SLOT(a, Matrix_xSym)), &k, &zero,                           REAL(GET_SLOT(a, Matrix_xSym)), &k, &zero,
288                           REAL(ALLOC_SLOT(val, Matrix_xSym, REALSXP, m * n)),                           REAL(ALLOC_SLOT(val, Matrix_xSym, REALSXP, m * n)),
289                           &m);                           &m);
# Line 298  Line 297 
297          cdims[0] = m; cdims[1] = n;          cdims[0] = m; cdims[1] = n;
298          F77_CALL(dgemm)          F77_CALL(dgemm)
299              ("N", "N", &m, &n, &k, &one, REAL(GET_SLOT(a, Matrix_xSym)),              ("N", "N", &m, &n, &k, &one, REAL(GET_SLOT(a, Matrix_xSym)),
300               &m, REAL(cl ? GET_SLOT(b, Matrix_xSym) : b), &k, &zero,               &m, REAL(GET_SLOT(b, Matrix_xSym)), &k, &zero,
301               REAL(ALLOC_SLOT(val, Matrix_xSym, REALSXP, m * n)), &m);               REAL(ALLOC_SLOT(val, Matrix_xSym, REALSXP, m * n)), &m);
302      }      }
303      UNPROTECT(1);      ALLOC_SLOT(val, Matrix_DimNamesSym, VECSXP, 2);
304        UNPROTECT(2);
305      return val;      return val;
306  }  }
307    

Legend:
Removed from v.1462  
changed lines
  Added in v.1463

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