diff --git a/doc/cppEDM.pdf b/doc/cppEDM.pdf index f572043..1cac2a8 100644 Binary files a/doc/cppEDM.pdf and b/doc/cppEDM.pdf differ diff --git a/src/API.h b/src/API.h index 7e148a1..b1b0235 100644 --- a/src/API.h +++ b/src/API.h @@ -359,6 +359,7 @@ DataFrame< double > PredictNonlinear( std::string pathIn = "./data/", bool verbose = true, std::vector validLib = std::vector(), + bool ignoreNan = true, unsigned nThreads = 4 ); DataFrame< double > PredictNonlinear( DataFrame< double > & dataFrameIn, @@ -378,5 +379,6 @@ DataFrame< double > PredictNonlinear( DataFrame< double > & dataFrameIn, bool verbose = true, std::vector validLib = std::vector(), + bool ignoreNan = true, unsigned nThreads = 4 ); #endif diff --git a/src/Eval.cc b/src/Eval.cc index d4c4e26..3d77c79 100644 --- a/src/Eval.cc +++ b/src/Eval.cc @@ -79,7 +79,8 @@ void SMapThread( EDM_Eval::WorkQueue &workQ, std::string target, bool embedded, bool verbose, - std::vector validLib ); + std::vector validLib, + bool ignoreNan ); //---------------------------------------------------------------- // EmbedDimension() : Evaluate Simplex rho vs. dimension E @@ -497,6 +498,7 @@ DataFrame< double > PredictNonlinear( std::string pathIn, bool embedded, bool verbose, std::vector validLib, + bool ignoreNan, unsigned nThreads ) { // Create DataFrame (constructor loads data) @@ -518,6 +520,7 @@ DataFrame< double > PredictNonlinear( std::string pathIn, embedded, verbose, validLib, + ignoreNan, nThreads ); return Theta_rho; } @@ -542,6 +545,7 @@ DataFrame< double > PredictNonlinear( DataFrame< double > & data, bool embedded, bool verbose, std::vector validLib, + bool ignoreNan, unsigned nThreads ) { std::vector ThetaValues( { 0.01, 0.1, 0.3, 0.5, 0.75, 1, @@ -600,7 +604,8 @@ DataFrame< double > PredictNonlinear( DataFrame< double > & data, target, embedded, verbose, - validLib ) ); + validLib, + ignoreNan ) ); } // join threads @@ -647,7 +652,8 @@ void SMapThread( EDM_Eval::WorkQueue &workQ, std::string target, bool embedded, bool verbose, - std::vector validLib ) + std::vector validLib, + bool ignoreNan ) { std::size_t i = std::atomic_fetch_add( &EDM_Eval::smap_count_i, std::size_t(1) ); @@ -679,7 +685,8 @@ void SMapThread( EDM_Eval::WorkQueue &workQ, embedded, false, // const_predict verbose, - validLib ); + validLib, + ignoreNan ); DataFrame< double > predictions = S.predictions; DataFrame< double > coefficients = S.coefficients; diff --git a/src/Parameter.cc b/src/Parameter.cc index 8187497..b33a06b 100644 --- a/src/Parameter.cc +++ b/src/Parameter.cc @@ -102,7 +102,7 @@ Parameters::Parameters( validated ( false ), // Instantiate Version - version( 1, 15, 0, "2023-10-21" ) + version( 1, 15, 1, "2023-10-27" ) { // Constructor code if ( method != Method::None ) { @@ -184,14 +184,15 @@ void Parameters::Validate() { if ( randomLib ) { if ( subSamples < 1 ) { std::string errMsg( "Parameters::Validate(): " - "CCM samples must be > 0.\n" ); + "CCM sample must be > 0.\n" ); throw std::runtime_error( errMsg ); } } // CCM librarySizes if ( not libSizes_str.size() ) { - std::string errMsg( "Parameters::Validate(): CCM libSize empty.\n" ); + std::string errMsg( "Parameters::Validate(): " + "CCM libSizes empty.\n" ); throw std::runtime_error( errMsg ); } diff --git a/src/SMap.cc b/src/SMap.cc index 78f5e5b..36bc769 100644 --- a/src/SMap.cc +++ b/src/SMap.cc @@ -490,6 +490,11 @@ void SMapClass::WriteOutput () { } } +//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +// Do not use LAPACK on Windog: use scikit-learn LinearRegression +//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +#if !defined _WIN32 || defined USING_R + //---------------------------------------------------------------- // Singular Value Decomposition : wrapper for Lapack_SVD() //---------------------------------------------------------------- @@ -504,11 +509,11 @@ SVDValues SVD( DataFrame < double > A, double *b = &( B[0] ); - SVDValues SVD_ = Lapack_SVD( A.NRows(), // number of rows - A.NColumns(), // number of columns - a, // A - b, // b - 1.E-9 ); // rcond + SVDValues SVD_ = Lapack_SVD( A.NRows(), // number of rows + A.NColumns(), // number of columns + a, // A + b, // b + 1.E-9 ); // rcond #ifdef DEBUG_ALL std::cout << "SVD------------------------\n"; @@ -657,3 +662,18 @@ SVDValues Lapack_SVD( int m, // rows in matrix return SVD_; } +#else +//----------------------------------------------------------------- +// Singular Value Decomposition : SVD() dummy function: Replaced by +// scikit-learn LinearRegression on Windog. LAPACK is not feasible. +//----------------------------------------------------------------- +SVDValues SVD( DataFrame < double > A, + std::valarray< double > B ) { + if ( A.NRows() == B.size() ) {} // Avoid compiler unused warn + SVDValues SVD_; + return SVD_; +} +#endif +//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +// Do not use LAPACK on Windog: use scikit-learn LinearRegression +//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< diff --git a/src/SMap.h b/src/SMap.h index 6a5d948..fe0469a 100644 --- a/src/SMap.h +++ b/src/SMap.h @@ -11,11 +11,16 @@ using Solver = SVDValues (*) ( DataFrame < double >, // Prototype declaration of general functions SVDValues SVD( DataFrame < double > A, std::valarray< double > B ); +//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +// Do not use LAPACK on Windog: use scikit-learn LinearRegression +//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +#if !defined _WIN32 || defined USING_R SVDValues Lapack_SVD( int m, // number of rows in matrix int n, // number of columns in matrix double *a, // pointer to top-left corner double *b, double rcond ); +#endif //---------------------------------------------------------------- // SMap class inherits from EDM class and defines