ampsci
c++ program for high-precision atomic structure calculations of single-valence systems
Public Types | Public Member Functions | List of all members
BSpline

#include <BSpline.hpp>

Public Types

enum class  KnotDistro { logarithmic , linear , loglinear }
 

Public Member Functions

 BSpline (std::size_t n, std::size_t k, double x0, double xmax, KnotDistro kd=KnotDistro::logarithmic)
 Constructs basis of n splines of order k, defined over [0,xmax]. x0 is first non-zero knot. kd = { logarithmic, linear, loglinear }.
 
BSplineoperator= (const BSpline &)=delete
 
 BSpline (const BSpline &)=delete
 
std::size_t K ()
 Order of the splines, K.
 
std::size_t d ()
 Degree of the splines, d:=K-1.
 
std::size_t N ()
 Number of splines, N.
 
std::size_t find_i0 (double x)
 Returns the first nonzero spline index i0; Note that i runs [0,N). The last non-zero index is min(i0+K-1, N-1).
 
std::vector< double > get (double x)
 Returns a std::vector of all splines {b0, b1, ..., b_N-1} evaluated at x.
 
std::pair< std::size_t, LinAlg::Matrix< double > > get_nonzero (double x, std::size_t n_deriv)
 Returns a pair {i0, M}, where i0 is spline index of first non-zero spline, and M is a matrix of non-zero splines and their derivatives. M_ij contains the jth derivative of the spline b[i+i0] evaulated at x. More...
 
void print_knots () const
 

Detailed Description

Calculates basis of N B-splines of order K (degree K-1), defined over range [0, xmax]. x0 is first non-zero ("internal") knot point.

N - K + 2 break-points "internal knots" placed between [x0,xmax]. By default: on a logarithmic scale May also be placed on a linear or log-linear scale If log-linear scale, b=(xmax/2) (see qip::loglinear_range) knots are the same as breakpoints, but the ends are repeated K times. Uses the GSL Bspline library, gsl/gsl_bspline.h https://www.gnu.org/software/gsl/doc/html/bspline.html See also: Bachau et al., Reports Prog. Phys. 64, 1815 (2001).

Member Function Documentation

◆ get_nonzero()

std::pair<std::size_t, LinAlg::Matrix<double> > BSpline::get_nonzero ( double  x,
std::size_t  n_deriv 
)
inline

Returns a pair {i0, M}, where i0 is spline index of first non-zero spline, and M is a matrix of non-zero splines and their derivatives. M_ij contains the jth derivative of the spline b[i+i0] evaulated at x.

  • n_deriv is the maximum derivative calculated (inclusive).
  • Matrix M is has K rows, and (n_deriv+1) columns.
  • If x>xmax, will return a matrix of zeros, and i0+K will be >N
  • If x=xmax, only last spline is nonzero, still i0+K=N [lower derivs may be non-zero]

The documentation for this class was generated from the following file: