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 950, Wed Sep 28 12:42:11 2005 UTC revision 951, Wed Sep 28 12:42:51 2005 UTC
# Line 33  Line 33 
33      AZERO(vx, n * n);      AZERO(vx, n * n);
34      F77_CALL(dlacpy)(uplo, &n, &n, REAL(GET_SLOT(x, Matrix_xSym)), &n, vx, &n);      F77_CALL(dlacpy)(uplo, &n, &n, REAL(GET_SLOT(x, Matrix_xSym)), &n, vx, &n);
35      F77_CALL(dpotrf)(uplo, &n, vx, &n, &info);      F77_CALL(dpotrf)(uplo, &n, vx, &n, &info);
36      if (info) error(_("Lapack routine %s returned error code %d"), "dpotrf", info);      if (info)
37            error(_("Lapack routine %s returned error code %d"), "dpotrf", info);
38      UNPROTECT(1);      UNPROTECT(1);
39      return set_factors(x, val, "Cholesky");      return set_factors(x, val, "Cholesky");
40  }  }
# Line 50  Line 51 
51          int *dims = INTEGER(GET_SLOT(Chol, Matrix_DimSym)), info;          int *dims = INTEGER(GET_SLOT(Chol, Matrix_DimSym)), info;
52          double anorm = get_norm_sy(obj, typnm);          double anorm = get_norm_sy(obj, typnm);
53    
54          F77_CALL(dpocon)(CHAR(asChar(GET_SLOT(Chol, Matrix_uploSym))),          F77_CALL(dpocon)(uplo_P(Chol),
55                           dims, REAL(GET_SLOT(Chol, Matrix_xSym)),                           dims, REAL(GET_SLOT(Chol, Matrix_xSym)),
56                           dims, &anorm, &rcond,                           dims, &anorm, &rcond,
57                           (double *) R_alloc(3*dims[0], sizeof(double)),                           (double *) R_alloc(3*dims[0], sizeof(double)),
# Line 76  Line 77 
77      SET_SLOT(val, Matrix_uploSym, duplicate(GET_SLOT(Chol, Matrix_uploSym)));      SET_SLOT(val, Matrix_uploSym, duplicate(GET_SLOT(Chol, Matrix_uploSym)));
78      SET_SLOT(val, Matrix_xSym, duplicate(GET_SLOT(Chol, Matrix_xSym)));      SET_SLOT(val, Matrix_xSym, duplicate(GET_SLOT(Chol, Matrix_xSym)));
79      SET_SLOT(val, Matrix_DimSym, duplicate(GET_SLOT(Chol, Matrix_DimSym)));      SET_SLOT(val, Matrix_DimSym, duplicate(GET_SLOT(Chol, Matrix_DimSym)));
80      F77_CALL(dpotri)(CHAR(asChar(GET_SLOT(val, Matrix_uploSym))),      F77_CALL(dpotri)(uplo_P(val), dims,
81                       dims, REAL(GET_SLOT(val, Matrix_xSym)), dims, &info);                       REAL(GET_SLOT(val, Matrix_xSym)), dims, &info);
82      SET_SLOT(val, Matrix_rcondSym, duplicate(GET_SLOT(x, Matrix_rcondSym)));      SET_SLOT(val, Matrix_rcondSym, duplicate(GET_SLOT(x, Matrix_rcondSym)));
83      UNPROTECT(1);      UNPROTECT(1);
84      return val;      return val;
# Line 97  Line 98 
98      SET_SLOT(val, Matrix_factorSym, allocVector(VECSXP, 0));      SET_SLOT(val, Matrix_factorSym, allocVector(VECSXP, 0));
99      SET_SLOT(val, Matrix_DimSym, duplicate(GET_SLOT(b, Matrix_DimSym)));      SET_SLOT(val, Matrix_DimSym, duplicate(GET_SLOT(b, Matrix_DimSym)));
100      SET_SLOT(val, Matrix_xSym, duplicate(GET_SLOT(b, Matrix_xSym)));      SET_SLOT(val, Matrix_xSym, duplicate(GET_SLOT(b, Matrix_xSym)));
101      F77_CALL(dpotrs)(CHAR(asChar(GET_SLOT(Chol, Matrix_uploSym))),      F77_CALL(dpotrs)(uplo_P(Chol), adims, bdims + 1,
                      adims, bdims + 1,  
102                       REAL(GET_SLOT(Chol, Matrix_xSym)), adims,                       REAL(GET_SLOT(Chol, Matrix_xSym)), adims,
103                       REAL(GET_SLOT(val, Matrix_xSym)),                       REAL(GET_SLOT(val, Matrix_xSym)),
104                       bdims, &info);                       bdims, &info);
# Line 118  Line 118 
118          error(_("Argument b must be a numeric matrix"));          error(_("Argument b must be a numeric matrix"));
119      if (*adims != *bdims || bdims[1] < 1 || *adims < 1)      if (*adims != *bdims || bdims[1] < 1 || *adims < 1)
120          error(_("Dimensions of system to be solved are inconsistent"));          error(_("Dimensions of system to be solved are inconsistent"));
121      F77_CALL(dpotrs)(CHAR(asChar(GET_SLOT(Chol, Matrix_uploSym))),      F77_CALL(dpotrs)(uplo_P(Chol), adims, bdims + 1,
                      adims, bdims + 1,  
122                       REAL(GET_SLOT(Chol, Matrix_xSym)), adims,                       REAL(GET_SLOT(Chol, Matrix_xSym)), adims,
123                       REAL(val), bdims, &info);                       REAL(val), bdims, &info);
124      UNPROTECT(1);      UNPROTECT(1);

Legend:
Removed from v.950  
changed lines
  Added in v.951

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