SCM

SCM Repository

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

Diff of /pkg/src/dsCMatrix.c

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

revision 492, Thu Feb 3 14:24:03 2005 UTC revision 534, Tue Feb 8 08:59:31 2005 UTC
# Line 7  Line 7 
7      char *val;      char *val;
8    
9      if (length(uplo) != 1)      if (length(uplo) != 1)
10          return ScalarString(mkChar("uplo slot must have length 1"));          return mkString("uplo slot must have length 1");
11      val = CHAR(STRING_ELT(uplo, 0));      val = CHAR(STRING_ELT(uplo, 0));
12      if (strlen(val) != 1)      if (strlen(val) != 1)
13          return ScalarString(mkChar("uplo[1] must have string length 1"));          return mkString("uplo[1] must have string length 1");
14      if (toupper(*val) != 'U' && toupper(*val) != 'L')      if (*val != 'U' && *val != 'L')
15          return ScalarString(mkChar("uplo[1] must be \"U\" or \"L\""));          return mkString("uplo[1] must be \"U\" or \"L\"");
16      if (Dim[0] != Dim[1])      if (Dim[0] != Dim[1])
17          return ScalarString(mkChar("Symmetric matrix must be square"));          return mkString("Symmetric matrix must be square");
18      csc_check_column_sorting(obj);      csc_check_column_sorting(obj);
19      return ScalarLogical(1);      return ScalarLogical(1);
20  }  }
# Line 25  Line 25 
25      int *Ai = INTEGER(GET_SLOT(x, Matrix_iSym)),      int *Ai = INTEGER(GET_SLOT(x, Matrix_iSym)),
26          *Ap = INTEGER(pSlot),          *Ap = INTEGER(pSlot),
27          *Lp, *Parent, info,          *Lp, *Parent, info,
28          lo = toupper(CHAR(asChar(GET_SLOT(x, Matrix_uploSym)))[0]) == 'L',          lo = CHAR(asChar(GET_SLOT(x, Matrix_uploSym)))[0] == 'L',
29          n = length(pSlot)-1,          n = length(pSlot)-1,
30          nnz, piv = asLogical(pivot);          nnz, piv = asLogical(pivot);
31      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS("dCholCMatrix")));      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS("dCholCMatrix")));
# Line 144  Line 144 
144          *xdims = INTEGER(GET_SLOT(x, Matrix_DimSym));          *xdims = INTEGER(GET_SLOT(x, Matrix_DimSym));
145    
146      adims[0] = xdims[1]; adims[1] = xdims[0];      adims[0] = xdims[1]; adims[1] = xdims[0];
147      if (toupper(CHAR(asChar(GET_SLOT(x, Matrix_uploSym)))[0]) == 'U')      if (CHAR(asChar(GET_SLOT(x, Matrix_uploSym)))[0] == 'U')
148          SET_SLOT(ans, Matrix_uploSym, ScalarString(mkChar("L")));          SET_SLOT(ans, Matrix_uploSym, mkString("L"));
149      SET_SLOT(ans, Matrix_pSym, allocVector(INTSXP, xdims[0] + 1));      SET_SLOT(ans, Matrix_pSym, allocVector(INTSXP, xdims[0] + 1));
150      SET_SLOT(ans, Matrix_iSym, allocVector(INTSXP, nnz));      SET_SLOT(ans, Matrix_iSym, allocVector(INTSXP, nnz));
151      SET_SLOT(ans, Matrix_xSym, allocVector(REALSXP, nnz));      SET_SLOT(ans, Matrix_xSym, allocVector(REALSXP, nnz));
# Line 214  Line 214 
214          *P = (int *) NULL, *Pinv = (int *) NULL;          *P = (int *) NULL, *Pinv = (int *) NULL;
215    
216    
217      if (toupper(CHAR(asChar(GET_SLOT(x, Matrix_uploSym)))[0]) == 'L') {      if (CHAR(asChar(GET_SLOT(x, Matrix_uploSym)))[0] == 'L') {
218          x = PROTECT(ssc_transpose(x));          x = PROTECT(ssc_transpose(x));
219      } else {      } else {
220          x = PROTECT(duplicate(x));          x = PROTECT(duplicate(x));
# Line 236  Line 236 
236      Parent = INTEGER(VECTOR_ELT(ans, 0));      Parent = INTEGER(VECTOR_ELT(ans, 0));
237      SET_VECTOR_ELT(ans, 1, NEW_OBJECT(MAKE_CLASS("dtCMatrix")));      SET_VECTOR_ELT(ans, 1, NEW_OBJECT(MAKE_CLASS("dtCMatrix")));
238      tsc = VECTOR_ELT(ans, 1);      tsc = VECTOR_ELT(ans, 1);
239      SET_SLOT(tsc, Matrix_uploSym, ScalarString(mkChar("L")));      SET_SLOT(tsc, Matrix_uploSym, mkString("L"));
240      SET_SLOT(tsc, Matrix_diagSym, ScalarString(mkChar("U")));      SET_SLOT(tsc, Matrix_diagSym, mkString("U"));
241      SET_SLOT(tsc, Matrix_DimSym, Dims);      SET_SLOT(tsc, Matrix_DimSym, Dims);
242      SET_SLOT(tsc, Matrix_pSym, allocVector(INTSXP, n + 1));      SET_SLOT(tsc, Matrix_pSym, allocVector(INTSXP, n + 1));
243      Lp = INTEGER(GET_SLOT(tsc, Matrix_pSym));      Lp = INTEGER(GET_SLOT(tsc, Matrix_pSym));

Legend:
Removed from v.492  
changed lines
  Added in v.534

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