diff options
author | Peter Carbonetto | 2017-08-22 10:04:18 -0500 |
---|---|---|
committer | GitHub | 2017-08-22 10:04:18 -0500 |
commit | 2554242d10b9a7b58bd6c7df82a10e747b6cc0eb (patch) | |
tree | ef6a14e0f5d54c97f17aab9e28ddf464754372d7 /src/mathfunc.h | |
parent | c7cbd8b2d5a06b7b86733719315f9da1638cb32e (diff) | |
parent | 48da44bf2da05f76008b083923ddf5701b9c029a (diff) | |
download | pangemma-2554242d10b9a7b58bd6c7df82a10e747b6cc0eb.tar.gz |
Merge pull request #76 from genenetwork/merge-checkK
Fixes matrix checks---looking saner now.
Diffstat (limited to 'src/mathfunc.h')
-rw-r--r-- | src/mathfunc.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mathfunc.h b/src/mathfunc.h index 8a2ea64..6e20b37 100644 --- a/src/mathfunc.h +++ b/src/mathfunc.h @@ -23,6 +23,9 @@ #include "gsl/gsl_matrix.h" #include "gsl/gsl_vector.h" +#define CONDITIONED_MAXRATIO 2e+6 // based on http://mathworld.wolfram.com/ConditionNumber.html +#define EIGEN_MINVALUE 1e-10 + using namespace std; using namespace Eigen; @@ -34,10 +37,12 @@ void CenterMatrix(gsl_matrix *G, const gsl_vector *w); void CenterMatrix(gsl_matrix *G, const gsl_matrix *W); void StandardizeMatrix(gsl_matrix *G); double ScaleMatrix(gsl_matrix *G); +bool has_negative_values_but_one(const gsl_vector *v); +uint count_small_values(const gsl_vector *v, double min); bool isMatrixPositiveDefinite(const gsl_matrix *G); -bool isMatrixIllConditioned(const gsl_matrix *G, double max_ratio=4.0); +bool isMatrixIllConditioned(const gsl_vector *eigenvalues, double max_ratio=CONDITIONED_MAXRATIO); bool isMatrixSymmetric(const gsl_matrix *G); -bool checkMatrixEigen(const gsl_matrix *G, double min=1e-5); +gsl_vector *getEigenValues(const gsl_matrix *G); double SumVector(const gsl_vector *v); double CenterVector(gsl_vector *y); void CenterVector(gsl_vector *y, const gsl_matrix *W); |