+/*
+ choleski.cc -- implement Choleski_decomposition
+
+ source file of the Flower Library
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
#include "choleski.hh"
const Real EPS = 1e-7; // so sue me. Hard coded
/*
Standard matrix algorithm.
+ Should add support for banded matrices
*/
Choleski_decomposition::Choleski_decomposition(Matrix P)
: L(P.dim()), D(P.dim())
{
int n = P.dim();
- assert((P-P.transposed()).norm()/P.norm() < EPS);
+#ifdef PARANOID
+ assert((P-P.transposed()).norm()/P.norm() < EPS);
+#endif
+
L.unit();
for (int k= 0; k < n; k++) {
for (int j = 0; j < k; j++){
D(k) = d;
}
-#ifndef NDEBUG
+#ifdef PARANOID
assert((original()-P).norm() / P.norm() < EPS);
#endif
}
invm(i,j) = inv(j);
}
-#ifndef NDEBUG
+#ifdef PARANOID
Matrix I1(n), I2(original());
I1.unit();
assert((I1-I2*invm).norm()/I2.norm() < EPS);