81 bool normalize =
false )
83 auto y = bfunc ( x0 ) ;
88 std::deque<long double> accu ;
89 accu.push_back ( y ) ;
91 for (
int k = 1 ; ; k++ )
93 y = bfunc ( x0 - k * step ) ;
96 accu.push_front ( y ) ;
99 for (
int k = 1 ; ; k++ )
101 y = bfunc ( x0 + k * step ) ;
104 accu.push_back ( y ) ;
108 size_t sz = accu.size() ;
109 std::vector < long double > result ( sz ) ;
113 for (
size_t i = 0 ; i < sz ; i++ )
114 result[i] = accu[i] / sum ;
118 for (
size_t i = 0 ; i < sz ; i++ )
119 result[i] = accu[i] ;
125int main (
int argc,
char * argv[] )
130 <<
"use: basis_sample degree(int) x0(float) step(float) normalize(0/1)"
135 int degree = std::atoi ( argv[1] ) ;
136 auto bfunc =
bf_type ( degree ) ;
137 auto x0 = std::atof ( argv[2] ) ;
138 auto step = std::atof ( argv[3] ) ;
139 bool normalize = std::atoi ( argv[4] ) ;
141 auto sample =
sample_basis ( bfunc , x0 , step , normalize ) ;
143 std::cout << std::fixed << std::showpoint
145 (std::numeric_limits<long double>::max_digits10) ;
147 for (
auto & e : sample )
148 std::cout << e << std::endl ;
int main(int argc, char *argv[])
vspline::basis_functor< long double > bf_type
basis_sample.cc - access to the b-spline basis functions
std::vector< long double > sample_basis(bf_type bfunc, long double x0, long double step, bool normalize=false)
basis_functor is an object producing the b-spline basis function value for given arguments,...
includes all headers from vspline (most of them indirectly)