SCM

SCM Repository

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

Diff of /pkg/src/dgCMatrix.c

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

revision 581, Mon Feb 28 15:13:13 2005 UTC revision 582, Mon Feb 28 18:15:21 2005 UTC
# Line 14  Line 14 
14    
15      nrow = dims[0];      nrow = dims[0];
16      if (length(islot) != length(xslot))      if (length(islot) != length(xslot))
17          return mkString("lengths of slots i and x must match");          return mkString(_("lengths of slots i and x must match"));
18      if (length(pslot) <= 0)      if (length(pslot) <= 0)
19          return mkString("slot p must have length > 0");          return mkString(_("slot p must have length > 0"));
20      if (xp[0] != 0)      if (xp[0] != 0)
21          return mkString("first element of slot p must be zero");          return mkString(_("first element of slot p must be zero"));
22      if (length(islot) != xp[ncol])      if (length(islot) != xp[ncol])
23          return mkString("last element of slot p must match length of slots i and x");          return mkString(_("last element of slot p must match length of slots i and x"));
24      for (j = 0; j < ncol; j++) {      for (j = 0; j < ncol; j++) {
25          if (xp[j] > xp[j+1])          if (xp[j] > xp[j+1])
26              return mkString("slot p must be non-decreasing");              return mkString(_("slot p must be non-decreasing"));
27      }      }
28      for (j = 0; j < length(islot); j++) {      for (j = 0; j < length(islot); j++) {
29          if (xi[j] < 0 || xi[j] >= nrow)          if (xi[j] < 0 || xi[j] >= nrow)
30              return mkString("all row indices must be between 0 and nrow-1");              return mkString(_("all row indices must be between 0 and nrow-1"));
31      }      }
32      if (csc_unsorted_columns(ncol, xp, xi)) {      if (csc_unsorted_columns(ncol, xp, xi)) {
33          csc_sort_columns(ncol, xp, xi, REAL(xslot));          csc_sort_columns(ncol, xp, xi, REAL(xslot));
# Line 172  Line 172 
172          *ydims;          *ydims;
173      double *xx = REAL(GET_SLOT(x, Matrix_xSym));      double *xx = REAL(GET_SLOT(x, Matrix_xSym));
174    
175      if (!(isMatrix(y) && isReal(y))) error("y must be a numeric matrix");      if (!(isMatrix(y) && isReal(y))) error(_("y must be a numeric matrix"));
176      ydims = INTEGER(getAttrib(y, R_DimSymbol));      ydims = INTEGER(getAttrib(y, R_DimSymbol));
177      if (xnrow != ydims[0]) error("x and y must have the same number of rows");      if (xnrow != ydims[0]) error(_("x and y must have the same number of rows"));
178      ans = PROTECT(allocMatrix(REALSXP, xncol, ydims[1]));      ans = PROTECT(allocMatrix(REALSXP, xncol, ydims[1]));
179      for (j = 0; j < ydims[1]; j++) {      for (j = 0; j < ydims[1]; j++) {
180          int i; double *ypt = REAL(y) + j * ydims[0];          int i; double *ypt = REAL(y) + j * ydims[0];
# Line 272  Line 272 
272      double *vx;      double *vx;
273    
274      if (!(isMatrix(A) && isReal(A)))      if (!(isMatrix(A) && isReal(A)))
275          error("A must be a numeric matrix");          error(_("A must be a numeric matrix"));
276      nrow = adims[0]; ncol = adims[1];      nrow = adims[0]; ncol = adims[1];
277      SET_SLOT(val, Matrix_factorSym, allocVector(VECSXP, 0));      SET_SLOT(val, Matrix_factorSym, allocVector(VECSXP, 0));
278      SET_SLOT(val, Matrix_DimSym, allocVector(INTSXP, 2));      SET_SLOT(val, Matrix_DimSym, allocVector(INTSXP, 2));
# Line 383  Line 383 
383      SEXP val;      SEXP val;
384    
385      if (bdim[0] != r)      if (bdim[0] != r)
386          error("Matrices of sizes (%d,%d) and (%d,%d) cannot be multiplied",          error(_("Matrices of sizes (%d,%d) and (%d,%d) cannot be multiplied"),
387                m, r, bdim[0], n);                m, r, bdim[0], n);
388      val = PROTECT(allocMatrix(REALSXP, m, n));      val = PROTECT(allocMatrix(REALSXP, m, n));
389      for (j = 0; j < n; j++) {   /* across columns of b */      for (j = 0; j < n; j++) {   /* across columns of b */
# Line 413  Line 413 
413      SET_SLOT(val, Matrix_DimSym, duplicate(tmp));      SET_SLOT(val, Matrix_DimSym, duplicate(tmp));
414      ncol = INTEGER(tmp)[1];      ncol = INTEGER(tmp)[1];
415      if (!(isInteger(perm) && length(perm) == ncol))      if (!(isInteger(perm) && length(perm) == ncol))
416          error("perm must be an integer vector of length %d",          error(_("perm must be an integer vector of length %d"),
417                ncol);                ncol);
418      prm = INTEGER(perm);      prm = INTEGER(perm);
419      if (!R_ldl_valid_perm(ncol, prm))      if (!R_ldl_valid_perm(ncol, prm))
420          error("perm is not a valid 0-based permutation");          error(_("perm is not a valid 0-based permutation"));
421      iperm = Calloc(ncol, int);      iperm = Calloc(ncol, int);
422      for (j = 0; j < ncol; j++) iperm[prm[j]] = j;      for (j = 0; j < ncol; j++) iperm[prm[j]] = j;
423      tmp = GET_SLOT(x, Matrix_pSym);      tmp = GET_SLOT(x, Matrix_pSym);

Legend:
Removed from v.581  
changed lines
  Added in v.582

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