Commit 1240b6c4 authored by Laurent Belcour's avatar Laurent Belcour

Merge

parents 963d5573 d9ea8068
......@@ -56,7 +56,8 @@ NLOPT_DIR = ['#external/build/lib']
NLOPT_LIBS = ['nlopt']
NLOPT_OPT_LIBS = []
# MATLAB library and Engine
## MATLAB library and Engine
##
MATLAB_INC = ['/home/pac/MATLAB/R2013b/extern/include/']
MATLAB_DIR = ['/home/pac/MATLAB/R2013b/bin/glnxa64/']
MATLAB_LIBS = ['']
MATLAB_LIBS = ['engine']
import os
Import('env')
env = env.Clone()
if env.GetOption('clean'):
print "Nothing to do in external"
......
Import('env')
env = env.Clone()
env.AppendUnique(CPPPATH = env['MATLAB_INC'])
env.AppendUnique(LIBPATH = env['MATLAB_DIR'])
env.AppendUnique(LIBS = env['MATLAB_LIBS'])
env.AppendUnique(LIBS = ['core'])
conf = Configure(env)
sources = ['rational_fitter.cpp']
if conf.CheckLib(env['MATLAB_LIBS']):
env.SharedLibrary('../../build/rational_fitter_matlab', sources)
#end
conf.Finish()
......@@ -4,15 +4,19 @@ env = env.Clone()
env.AppendUnique(CPPPATH = env['QUADPROG_INC'])
env.AppendUnique(LIBPATH = env['QUADPROG_DIR'])
env.AppendUnique(LIBS = env['QUADPROG_LIBS'])
env.AppendUnique(CCFLAGS = env['OPENMP_FLAGS'])
env.AppendUnique(LIBS = env['OPENMP_LIBS'])
env.AppendUnique(LIBS = ['core'])
conf = Configure(env)
sources = ['rational_fitter.cpp']
if conf.CheckLib(env['QUADPROG_LIBS']) and conf.CheckLib(env['OPENMP_LIBS']):
if conf.CheckLib(env['QUADPROG_LIBS']):
env.AppendUnique(CCFLAGS = env['OPENMP_FLAGS'])
if conf.CheckLib(env['OPENMP_LIBS']):
env.AppendUnique(LIBS = env['OPENMP_LIBS'])
#end
env.SharedLibrary('../../build/rational_fitter_parallel', sources)
#end
conf.Finish()
......@@ -217,10 +217,11 @@ bool rational_fitter_quadprog::fit_data(const vertical_segment* d, int np, int n
std::cout << "]" << std::endl ;
}
#endif
/*
// Update the ci column with the delta parameter
// (See Celis et al. 2007 p.12)
Eigen::JacobiSVD<Eigen::MatrixXd, Eigen::HouseholderQRPreconditioner> svd(eCI, Eigen::ComputeThinU | Eigen::ComputeThinV);
Eigen::JacobiSVD<Eigen::MatrixXd, Eigen::HouseholderQRPreconditioner> svd(eCI);
const double sigma_m = svd.singularValues()(std::min(2*M, N)-1) ;
const double sigma_M = svd.singularValues()(0) ;
......@@ -235,6 +236,10 @@ bool rational_fitter_quadprog::fit_data(const vertical_segment* d, int np, int n
double delta = sigma_m / sigma_M ;
#ifndef DEBUG
std::cout << "<<DEBUG>> delta factor: " << sigma_m << " / " << sigma_M << " = " << delta << std::endl ;
#endif
if(isnan(delta) || (std::abs(delta) == std::numeric_limits<double>::infinity()))
{
std::cerr << "<<ERROR>> delta factor is NaN of Inf" << std::endl ;
......@@ -244,10 +249,9 @@ bool rational_fitter_quadprog::fit_data(const vertical_segment* d, int np, int n
{
delta = 1.0 ;
}
#ifndef DEBUG
std::cout << "<<DEBUG>> delta factor: " << sigma_m << " / " << sigma_M << " = " << delta << std::endl ;
#endif
/*/
const double delta = 1.0;
//*/
for(int i=0; i<2*M; ++i)
{
ci[i] = ci[i] * delta ;
......
......@@ -34,6 +34,30 @@ double rational_function_legendre_1d::legendre(double x, int i) const
{
return x;
}
else if (i == 2)
{
return (3*x*x - 1) * 0.5;
}
else if (i == 3)
{
return ( (5*x*x - 3) * x ) * 0.5;
}
else if (i == 4)
{
return ((7*x*x - 6) * 5*x*x + 3) * 0.125;
}
else if (i== 5)
{
return (((63*x*x - 70)*x*x + 15)*x)*0.125;
}
else if (i== 6)
{
return (((231*x*x-315)*x*x + 105)*x*x - 5) * 0.0625;
}
else if (i==7)
{
return ((((429*x*x-693)*x*x + 315)*x*x - 35)*x) * 0.0625;
}
else
{
return ((2*i-1)*x*legendre(x, i-1) - (i-1)*legendre(x, i-2)) / (double)i ;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment