mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6567 Remove use of GNU GSL
This commit is contained in:
@@ -25,10 +25,6 @@
|
||||
|
||||
#include "cafAssert.h"
|
||||
|
||||
#ifdef USE_GSL
|
||||
#include "gsl/statistics/gsl_statistics_double.h"
|
||||
#endif
|
||||
|
||||
#include <QString>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -68,32 +64,6 @@ double RiaStatisticsTools::pearsonCorrelation( const std::vector<double>& xValue
|
||||
RigStatisticsMath::calculateBasicStatistics( yValues, nullptr, nullptr, nullptr, &rangeY, nullptr, nullptr );
|
||||
if ( rangeX < eps || rangeY < eps ) return 0.0;
|
||||
|
||||
#ifdef USE_GSL
|
||||
return pearsonCorrelationGSL( xValues, yValues );
|
||||
#else
|
||||
return pearsonCorrelationOwn( xValues, yValues );
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RiaStatisticsTools::pearsonCorrelationGSL( const std::vector<double>& xValues, const std::vector<double>& yValues )
|
||||
{
|
||||
#ifdef USE_GSL
|
||||
return gsl_stats_correlation( xValues.data(), 1, yValues.data(), 1, xValues.size() );
|
||||
#else
|
||||
CAF_ASSERT( false );
|
||||
return std::numeric_limits<double>::infinity();
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RiaStatisticsTools::pearsonCorrelationOwn( const std::vector<double>& xValues, const std::vector<double>& yValues )
|
||||
{
|
||||
const double eps = 1.0e-8;
|
||||
if ( xValues.size() != yValues.size() ) return 0.0;
|
||||
if ( xValues.empty() ) return 0.0;
|
||||
|
||||
@@ -124,22 +94,3 @@ double RiaStatisticsTools::pearsonCorrelationOwn( const std::vector<double>& xVa
|
||||
|
||||
return sumNumerator / ( std::sqrt( sumxDiffSquared ) * std::sqrt( sumyDiffSquared ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RiaStatisticsTools::spearmanCorrelation( const std::vector<double>& xValues, const std::vector<double>& yValues )
|
||||
{
|
||||
const double eps = 1.0e-8;
|
||||
double rangeX = 0.0, rangeY = 0.0;
|
||||
RigStatisticsMath::calculateBasicStatistics( xValues, nullptr, nullptr, nullptr, &rangeX, nullptr, nullptr );
|
||||
RigStatisticsMath::calculateBasicStatistics( yValues, nullptr, nullptr, nullptr, &rangeY, nullptr, nullptr );
|
||||
if ( rangeX < eps || rangeY < eps ) return 0.0;
|
||||
|
||||
#ifdef USE_GSL
|
||||
std::vector<double> work( 2 * xValues.size() );
|
||||
return gsl_stats_spearman( xValues.data(), 1, yValues.data(), 1, xValues.size(), work.data() );
|
||||
#else
|
||||
return 0.0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -52,7 +52,4 @@ public:
|
||||
}
|
||||
|
||||
static double pearsonCorrelation( const std::vector<double>& xValues, const std::vector<double>& yValues );
|
||||
static double pearsonCorrelationGSL( const std::vector<double>& xValues, const std::vector<double>& yValues );
|
||||
static double pearsonCorrelationOwn( const std::vector<double>& xValues, const std::vector<double>& yValues );
|
||||
static double spearmanCorrelation( const std::vector<double>& xValues, const std::vector<double>& yValues );
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user