SCM

SCM Repository

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

Diff of /pkg/src/dpoMatrix.c

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

revision 475, Tue Feb 1 14:44:06 2005 UTC revision 476, Wed Feb 2 11:51:24 2005 UTC
# Line 2  Line 2 
2    
3  SEXP poMatrix_chol(SEXP x)  SEXP poMatrix_chol(SEXP x)
4  {  {
5      SEXP val = get_factorization(x, "Cholesky"),      SEXP val = get_factors(x, "Cholesky"),
6          dimP = GET_SLOT(x, Matrix_DimSym),          dimP = GET_SLOT(x, Matrix_DimSym),
7          uploP = GET_SLOT(x, Matrix_uploSym);          uploP = GET_SLOT(x, Matrix_uploSym);
8      int *dims, info;      int *dims, info;
# Line 13  Line 13 
13      SET_SLOT(val, Matrix_uploSym, duplicate(uploP));      SET_SLOT(val, Matrix_uploSym, duplicate(uploP));
14      SET_SLOT(val, Matrix_diagSym, ScalarString(mkChar("N")));      SET_SLOT(val, Matrix_diagSym, ScalarString(mkChar("N")));
15      SET_SLOT(val, Matrix_rcondSym, allocVector(REALSXP, 0));      SET_SLOT(val, Matrix_rcondSym, allocVector(REALSXP, 0));
16      SET_SLOT(val, Matrix_factorization, allocVector(VECSXP, 0));      SET_SLOT(val, Matrix_factorSym, allocVector(VECSXP, 0));
17      SET_SLOT(val, Matrix_xSym, duplicate(GET_SLOT(x, Matrix_xSym)));      SET_SLOT(val, Matrix_xSym, duplicate(GET_SLOT(x, Matrix_xSym)));
18      SET_SLOT(val, Matrix_DimSym, duplicate(dimP));      SET_SLOT(val, Matrix_DimSym, duplicate(dimP));
19      F77_CALL(dpotrf)(CHAR(asChar(uploP)), dims,      F77_CALL(dpotrf)(CHAR(asChar(uploP)), dims,
20                       REAL(GET_SLOT(val, Matrix_xSym)), dims, &info);                       REAL(GET_SLOT(val, Matrix_xSym)), dims, &info);
21      if (info) error("Lapack routine dpotrf returned error code %d", info);      if (info) error("Lapack routine dpotrf returned error code %d", info);
22      UNPROTECT(1);      UNPROTECT(1);
23      return set_factorization(x, val, "Cholesky");      return set_factors(x, val, "Cholesky");
24  }  }
25    
26  static  static
# Line 57  Line 57 
57      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS("poMatrix")));      SEXP val = PROTECT(NEW_OBJECT(MAKE_CLASS("poMatrix")));
58      int *dims = INTEGER(GET_SLOT(x, Matrix_DimSym)), info;      int *dims = INTEGER(GET_SLOT(x, Matrix_DimSym)), info;
59    
60      SET_SLOT(val, Matrix_factorization, allocVector(VECSXP, 0));      SET_SLOT(val, Matrix_factorSym, allocVector(VECSXP, 0));
61      SET_SLOT(val, Matrix_uploSym, duplicate(GET_SLOT(Chol, Matrix_uploSym)));      SET_SLOT(val, Matrix_uploSym, duplicate(GET_SLOT(Chol, Matrix_uploSym)));
62      SET_SLOT(val, Matrix_xSym, duplicate(GET_SLOT(Chol, Matrix_xSym)));      SET_SLOT(val, Matrix_xSym, duplicate(GET_SLOT(Chol, Matrix_xSym)));
63      SET_SLOT(val, Matrix_DimSym, duplicate(GET_SLOT(Chol, Matrix_DimSym)));      SET_SLOT(val, Matrix_DimSym, duplicate(GET_SLOT(Chol, Matrix_DimSym)));
# Line 79  Line 79 
79      if (*adims != *bdims || bdims[1] < 1 || *adims < 1)      if (*adims != *bdims || bdims[1] < 1 || *adims < 1)
80          error("Dimensions of system to be solved are inconsistent");          error("Dimensions of system to be solved are inconsistent");
81      SET_SLOT(val, Matrix_rcondSym, allocVector(REALSXP, 0));      SET_SLOT(val, Matrix_rcondSym, allocVector(REALSXP, 0));
82      SET_SLOT(val, Matrix_factorization, allocVector(VECSXP, 0));      SET_SLOT(val, Matrix_factorSym, allocVector(VECSXP, 0));
83      SET_SLOT(val, Matrix_DimSym, duplicate(GET_SLOT(b, Matrix_DimSym)));      SET_SLOT(val, Matrix_DimSym, duplicate(GET_SLOT(b, Matrix_DimSym)));
84      SET_SLOT(val, Matrix_xSym, duplicate(GET_SLOT(b, Matrix_xSym)));      SET_SLOT(val, Matrix_xSym, duplicate(GET_SLOT(b, Matrix_xSym)));
85      F77_CALL(dpotrs)(CHAR(asChar(GET_SLOT(Chol, Matrix_uploSym))),      F77_CALL(dpotrs)(CHAR(asChar(GET_SLOT(Chol, Matrix_uploSym))),

Legend:
Removed from v.475  
changed lines
  Added in v.476

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