diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ff97c1..cc7e58e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,8 +9,11 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) +INCLUDE_DIRECTORIES("/usr/include/") +LINK_DIRECTORIES("/usr/lib/") + ADD_DEFINITIONS( -Wall -W -Wextra ) ADD_EXECUTABLE(test test.cpp) -TARGET_LINK_LIBRARIES(test ${Boost_LIBRARIES}) +TARGET_LINK_LIBRARIES(test ${Boost_LIBRARIES} gmpxx) diff --git a/cholesky.h b/cholesky.h index a131a52..8a19602 100644 --- a/cholesky.h +++ b/cholesky.h @@ -55,6 +55,9 @@ public: // FIXME check if triangular types behaviour is like having 0 typedef ublas::matrix< T > FactorMat; + //! The type of the scalars + typedef T AtomType; + /** Instanciate without computing anything, you are responsible of * calling the algorithm and getting the result with operator() * */ @@ -205,7 +208,8 @@ public: inline virtual T L_i_i( const typename Cholesky::CovarMat& V, const unsigned int& i, const T& sum ) const { /***** ugly hack *****/ - return sqrt( fabs( V(i,i) - sum) ); + //return sqrt( fabs( V(i,i) - sum) ); + return sqrt( abs( V(i,i) - sum) ); } }; @@ -322,8 +326,8 @@ public: T sum = 0.0; // for( unsigned int k=1; k_L(i, k) * this->_L(i, k); } this->_L(i,i) = this->_L(i,i) - sum; @@ -338,8 +342,8 @@ public: sum = 0.0; // for( unsigned int k = 1; k < i-1; ++k ) { // for( unsigned int k = 1; k < i; ++k ) { - for( unsigned int k = 0; k < i; ++k ) { -// for( unsigned int k = 0; k < i-1; ++k ) { +// for( unsigned int k = 0; k < i; ++k ) { + for( unsigned int k = 0; k < i-1; ++k ) { sum += this->_L(j, k) * this->_L(i, k); } this->_L(j,i) = this->_L(j,i) - sum; diff --git a/test.cpp b/test.cpp index 044d35c..98b4388 100644 --- a/test.cpp +++ b/test.cpp @@ -28,6 +28,8 @@ Authors: #include #include +#include + #include "cholesky.h" @@ -112,7 +114,8 @@ T trigsum( const MT& M ) T sum = 0; for( unsigned int i=0; i(M,N,F,R,seed); @@ -246,5 +252,10 @@ int main(int argc, char** argv) std::cout << std::endl << "LONG DOUBLE" << std::endl; test(M,N,F,R,seed); + */ + + std::cout << std::endl << "MPF 128" << std::endl; + mpf_set_default_prec(128); + test(M,N,F,R,seed); }