SCM

SCM Repository

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

Diff of /pkg/Matrix/src/dpoMatrix.c

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

revision 2898, Mon Sep 2 15:48:30 2013 UTC revision 2996, Thu Aug 7 18:44:26 2014 UTC
# Line 2  Line 2 
2    
3  SEXP dpoMatrix_validate(SEXP obj)  SEXP dpoMatrix_validate(SEXP obj)
4  {  {
5      int i, n = INTEGER(GET_SLOT(obj, Matrix_DimSym))[0];      SEXP val;
6      int np1 = n + 1;      if (isString(val = dense_nonpacked_validate(obj)))
7            return(val);
8    
9        int n = INTEGER(GET_SLOT(obj, Matrix_DimSym))[0],
10            np1 = n + 1;
11      double *x = REAL(GET_SLOT(obj, Matrix_xSym));      double *x = REAL(GET_SLOT(obj, Matrix_xSym));
12    
13      /* quick but nondefinitive check on positive definiteness */      /* quick but nondefinitive check on positive definiteness */
14      for (i = 0; i < n; i++)      for (int i = 0; i < n; i++)
15          if (x[i * np1] < 0)          if (x[i * np1] < 0)
16              return mkString(_("dpoMatrix is not positive definite"));              return mkString(_("dpoMatrix is not positive definite"));
17      return ScalarLogical(1);      return ScalarLogical(1);

Legend:
Removed from v.2898  
changed lines
  Added in v.2996

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