ORB5X 1.0.0
Performance-portable global electromagnetic gyrokinetic PIC code
Loading...
Searching...
No Matches
orb5x::spclibs Namespace Reference

Classes

struct  GBMat
 General Band Matrix (LAPACK GB storage format). More...
struct  GEMat
 General Dense Matrix (LAPACK GE storage format). More...
struct  PBMat
 Packed Band Matrix (LAPACK PB storage format). More...
struct  PeriodicMat
 Periodic Band Matrix. More...
struct  Spline1D
 1-dimensional B-spline More...
struct  Spline2D
 2-dimensional B-spline (tensor product) More...
struct  Spline2D1D
 2D+1D B-spline (for axisymmetric problems) More...
struct  ZGBMat
 Complex General Band Matrix. More...
struct  ZGEMat
 Complex General Dense Matrix. More...
struct  ZPBMat
 Complex Packed Band Matrix. More...
struct  ZPeriodicMat
 Complex Periodic Band Matrix. More...

Typedefs

using spline1d = Spline1D
using spline2d = Spline2D
using spline2d1d = Spline2D1D

Functions

void basfun (Real x, const Spline1D &sp, Real *fun, int left, int nderiv=1)
 Evaluate basis functions and derivatives at a point.
void bsolve (const GBMat &mat, Real *b, int nrhs=1)
 Solve linear system A*x = b.
void bsolve (const GEMat &mat, Real *b, int nrhs=1)
void bsolve (const PBMat &mat, Real *b, int nrhs=1)
void bsolve (const PeriodicMat &mat, Real *b, int nrhs=1)
void bsolve (const ZGBMat &mat, Complex *b, int nrhs=1)
void bsolve (const ZGEMat &mat, Complex *b, int nrhs=1)
void bsolve (const ZPBMat &mat, Complex *b, int nrhs=1)
void bsolve (const ZPeriodicMat &mat, Complex *b, int nrhs=1)
void bsplvb (const Real *t, int jhigh, Real x, int left, Real *biatx)
 Evaluate B-spline basis functions at a point.
void bsplvd (const Real *t, int k, Real x, int left, Real *a, Real *dbiatx, int nderiv)
 Evaluate B-spline basis functions and derivatives at a point.
void bspp2d (const Real *t, const Real *bcoef, int n, int k, Real *scrtch, Real *ppcoef)
 Convert B-spline coefficients to PPFORM.
void calc_integ (const Spline1D &sp, Real *integ)
 Calculate integral of each basis function.
void CompMassMatrix (const Spline1D &sp, GBMat &mat)
 Compute mass matrix for FEM discretization.
void CompMassMatrix (const Spline1D &sp, PeriodicMat &mat)
void def_basfun (Real x, const Spline1D &sp, Real *fun, int *left=nullptr, int nderiv=1)
 Define basis functions at a point (auto-locates interval).
void destroy (GBMat &mat)
void destroy (GEMat &mat)
void destroy (PBMat &mat)
void destroy (PeriodicMat &mat)
void destroy (ZGBMat &mat)
void destroy (ZGEMat &mat)
void destroy (ZPBMat &mat)
void destroy (ZPeriodicMat &mat)
void destroy_sp (Spline1D &sp)
void destroy_sp (Spline2D &sp)
void destroy_sp (Spline2D1D &sp)
Real determinant (const GBMat &mat)
 Compute determinant of factorized matrix.
Real determinant (const GEMat &mat)
Real determinant (const PBMat &mat)
Complex determinant (const ZGBMat &mat)
Complex determinant (const ZGEMat &mat)
Complex determinant (const ZPBMat &mat)
int factor (GBMat &mat)
 Compute LU factorization of matrix.
int factor (GEMat &mat)
int factor (PBMat &mat)
int factor (PeriodicMat &mat)
int factor (ZGBMat &mat)
int factor (ZGEMat &mat)
int factor (ZPBMat &mat)
int factor (ZPeriodicMat &mat)
void gauleg (Real x1, Real x2, Real *x, Real *w, int n)
 Compute Gauss-Legendre quadrature points and weights.
void get_dim (const Spline1D &sp, int &dim, int *nx=nullptr, int *nidbas=nullptr)
 Get dimension information from 1D spline.
void get_dim (const Spline2D &sp, int dim[2], int nx[2]=nullptr, int nidbas[2]=nullptr)
 Get dimension information from 2D spline.
void get_gauss (const Spline1D &sp, int &n, int i=-1, Real *x=nullptr, Real *w=nullptr)
 Get Gauss quadrature information from spline.
void get_splcoef (const Spline1D &sp, const Real *bcoef, Real *fvals)
 Get function values from spline coefficients.
void getcol (const GBMat &mat, int j, Real *col)
 Get column of matrix.
void getcol (const PBMat &mat, int j, Real *col)
void getcol (const PeriodicMat &mat, int j, Real *col)
Real getele (const GBMat &mat, int i, int j)
 Get matrix element.
Real getele (const PBMat &mat, int i, int j)
Real getele (const PeriodicMat &mat, int i, int j)
Complex getele (const ZGBMat &mat, int i, int j)
Complex getele (const ZPBMat &mat, int i, int j)
Complex getele (const ZPeriodicMat &mat, int i, int j)
void getrow (const GBMat &mat, int i, Real *row)
 Get row of matrix.
void getrow (const GEMat &mat, int i, Real *row)
void getrow (const PBMat &mat, int i, Real *row)
void getrow (const PeriodicMat &mat, int i, Real *row)
void getrow (const ZPBMat &mat, int i, Complex *row)
Realgetvalp (GBMat &mat, int i, int j)
 Get pointer to matrix value for element (i,j) Used for direct access to storage for assembly.
Realgetvalp (GEMat &mat, int i, int j)
Realgetvalp (PBMat &mat, int i, int j)
Complexgetvalp (ZGBMat &mat, int i, int j)
Complexgetvalp (ZGEMat &mat, int i, int j)
Complexgetvalp (ZPBMat &mat, int i, int j)
void gridval (const Spline1D &sp, const Real *xgrid, int npts, const Real *bcoef, Real *fvals, int jder=0)
 Evaluate spline on a grid of points.
void gridval (const Spline2D &sp, const Real *xgrid1, int npts1, const Real *xgrid2, int npts2, const Real *bcoef, Real *fvals, int jder1=0, int jder2=0)
 Evaluate 2D spline on a 2D grid.
void gridval (const Spline2D1D &sp, const Real *xgrid1, int npts1, const Real *xgrid2, int npts2, const Real *xgrid3, int npts3, const Real *bcoef, Real *fvals, int jder1=0, int jder2=0, int jder3=0)
 Evaluate 3D spline (2D+1D) on a 3D grid.
void init (int kl, int ku, int n, int nterms, GBMat &mat, int kmat=0, int mrows=-1)
 Initialize a general band matrix.
void init (int kl, int ku, int n, int nterms, PeriodicMat &mat, int kmat=0)
 Initialize a periodic band matrix.
void init (int kl, int ku, int n, int nterms, ZGBMat &mat, int kmat=0, int mrows=-1)
void init (int kl, int ku, int n, int nterms, ZPeriodicMat &mat, int kmat=0)
void init (int ku, int n, int nterms, PBMat &mat, int kmat=0)
 Initialize a packed band matrix.
void init (int ku, int n, int nterms, ZPBMat &mat, int kmat=0)
void init (int n, int nterms, GEMat &mat, int kmat=0, int mrows=-1)
 Initialize a general dense matrix.
void init (int n, int nterms, ZGEMat &mat, int kmat=0, int mrows=-1)
void interv (const Real *xt, int lxt, Real x, int &left, int &mflag)
 Locate interval containing x in a knot sequence.
void interv_hint (const Real *xt, int lxt, Real x, int &left, int &mflag, int &ilo)
 Thread-safe version of interv with explicit previous guess.
bool is_equid (const Real *grid, int n)
 Check if a grid is equidistant.
void locintv (const Spline1D &sp, Real x, int &left)
 Locate interval containing x in spline knot sequence.
void maddto (Real alpha, const GBMat &a, GBMat &b)
 Add matrices: B = B + alpha*A.
void maddto (Real alpha, const GEMat &a, GEMat &b)
void maddto (Real alpha, const PBMat &a, PBMat &b)
void maddto (Real alpha, const PeriodicMat &a, PeriodicMat &b)
void mcopy (const GBMat &src, GBMat &dst)
void mcopy (const GEMat &src, GEMat &dst)
void mcopy (const PBMat &src, PBMat &dst)
void mcopy (const PeriodicMat &src, PeriodicMat &dst)
Real ppval (const Real *t, const Real *coef, int n, int k, Real x, int &left)
 Evaluate polynomial in piecewise polynomial form.
void putcol (GBMat &mat, int j, const Real *col)
 Set column of matrix.
void putcol (GEMat &mat, int j, const Real *col)
void putcol (PBMat &mat, int j, const Real *col)
void putcol (PeriodicMat &mat, int j, const Real *col)
void putcol (ZPBMat &mat, int j, const Complex *col)
void putele (GBMat &mat, Real val, int i, int j)
 Set matrix element.
void putele (PBMat &mat, Real val, int i, int j)
void putele (PeriodicMat &mat, Real val, int i, int j)
void putele (ZGBMat &mat, Complex val, int i, int j)
void putele (ZPBMat &mat, Complex val, int i, int j)
void putele (ZPeriodicMat &mat, Complex val, int i, int j)
void putrow (GBMat &mat, int i, const Real *row)
 Set row of matrix.
void putrow (GEMat &mat, int i, const Real *row)
void putrow (PBMat &mat, int i, const Real *row)
void putrow (PeriodicMat &mat, int i, const Real *row)
void putrow (ZPBMat &mat, int i, const Complex *row)
void set_splcoef (Spline1D &sp, const Real *fvals, Real *bcoef)
 Set spline coefficients from function values.
void set_spline (const int p[2], const int ngauss[2], const Real *grid1, int ngrid1, const Real *grid2, int ngrid2, Spline2D &sp, const bool period[2]=nullptr, bool nlppform=true, const int nlequid[2]=nullptr)
 Initialize a 2D spline.
void set_spline (const int p[3], const int ngauss[3], const Real *grid1, int ngrid1, const Real *grid2, int ngrid2, const Real *grid3, int ngrid3, Spline2D1D &sp, const bool period[3]=nullptr, bool nlppform=true, const int nlequid[3]=nullptr)
 Initialize a 2D+1D spline.
void set_spline (int p, int ngauss, const Real *grid, int ngrid, Spline1D &sp, bool period=false, bool nlppform=true, int nlequid=-1)
 Initialize a 1D spline.
void updtmat (GBMat &mat, Real val, int i, int j)
 Update matrix element: mat(i,j) += val.
void updtmat (GEMat &mat, Real val, int i, int j)
void updtmat (PBMat &mat, Real val, int i, int j)
void updtmat (PeriodicMat &mat, Real val, int i, int j)
void updtmat (ZGBMat &mat, Complex val, int i, int j)
void updtmat (ZPBMat &mat, Complex val, int i, int j)
void updtmat (ZPeriodicMat &mat, Complex val, int i, int j)
void vmx (const GBMat &mat, const Real *x, Real *y)
 Compute y = A*x.
void vmx (const GBMat &mat, const Real *x, Real *y, int nrhs)
 Compute Y = A*X for multiple vectors.
void vmx (const GEMat &mat, const Real *x, Real *y)
void vmx (const GEMat &mat, const Real *x, Real *y, int nrhs)
void vmx (const PBMat &mat, const Real *x, Real *y)
void vmx (const PeriodicMat &mat, const Real *x, Real *y)
void vmx (const ZGBMat &mat, const Complex *x, Complex *y)
void vmx (const ZGEMat &mat, const Complex *x, Complex *y)
void vmx (const ZPBMat &mat, const Complex *x, Complex *y)
void vmx (const ZPeriodicMat &mat, const Complex *x, Complex *y)

Variables

constexpr int JMAX = 20
 Maximum spline order supported (degree + 1).

Typedef Documentation

◆ spline1d

◆ spline2d

◆ spline2d1d

Function Documentation

◆ basfun()

void orb5x::spclibs::basfun ( Real x,
const Spline1D & sp,
Real * fun,
int left,
int nderiv = 1 )

Evaluate basis functions and derivatives at a point.

Parameters
xPoint at which to evaluate
spSpline
funOutput: basis function values and derivatives fun[i + j*order] = jth derivative of ith basis function i = 0, ..., order-1 (basis functions) j = 0, ..., nderiv-1 (derivatives)
leftInterval index (1-based as in Fortran)
nderivNumber of derivatives to compute (including function value)

◆ bsolve() [1/8]

void orb5x::spclibs::bsolve ( const GBMat & mat,
Real * b,
int nrhs = 1 )

Solve linear system A*x = b.

Parameters
matFactorized matrix (from factor())
bRight-hand side vector (input), solution vector (output)
nrhsNumber of right-hand sides (default 1)

The matrix must have been factorized with factor() before calling bsolve().

◆ bsolve() [2/8]

void orb5x::spclibs::bsolve ( const GEMat & mat,
Real * b,
int nrhs = 1 )

◆ bsolve() [3/8]

void orb5x::spclibs::bsolve ( const PBMat & mat,
Real * b,
int nrhs = 1 )

◆ bsolve() [4/8]

void orb5x::spclibs::bsolve ( const PeriodicMat & mat,
Real * b,
int nrhs = 1 )

◆ bsolve() [5/8]

void orb5x::spclibs::bsolve ( const ZGBMat & mat,
Complex * b,
int nrhs = 1 )

◆ bsolve() [6/8]

void orb5x::spclibs::bsolve ( const ZGEMat & mat,
Complex * b,
int nrhs = 1 )

◆ bsolve() [7/8]

void orb5x::spclibs::bsolve ( const ZPBMat & mat,
Complex * b,
int nrhs = 1 )

◆ bsolve() [8/8]

void orb5x::spclibs::bsolve ( const ZPeriodicMat & mat,
Complex * b,
int nrhs = 1 )

◆ bsplvb()

void orb5x::spclibs::bsplvb ( const Real * t,
int jhigh,
Real x,
int left,
Real * biatx )

Evaluate B-spline basis functions at a point.

Evaluates all possibly nonzero B-splines at X of order jhigh with knot sequence T. Uses the recurrence relation:

               X - T(I)               T(I+J+1) - X

B(I,J+1)(X) = --------— * B(I,J)(X) + ------------— * B(I+1,J)(X) T(I+J)-T(I) T(I+J+1)-T(I+1)

Parameters
tKnot sequence (at least left+jhigh elements)
jhighOrder of B-splines to evaluate
xPoint at which to evaluate
leftIndex such that t[left] <= x < t[left+1]
biatxOutput: B-spline values (jhigh elements)

Note: Uses 0-based indexing (Fortran version uses 1-based)

◆ bsplvd()

void orb5x::spclibs::bsplvd ( const Real * t,
int k,
Real x,
int left,
Real * a,
Real * dbiatx,
int nderiv )

Evaluate B-spline basis functions and derivatives at a point.

Computes values at X of all the relevant B-splines of order k, k-1, ..., k+1-nderiv and their derivatives.

Parameters
tKnot sequence (at least left+k elements)
kOrder of B-splines
xPoint at which to evaluate
leftIndex such that t[left] <= x < t[left+1]
aWorkspace array (k x k)
dbiatxOutput: B-spline values and derivatives (k x nderiv) dbiatx[i + m*k] = (m-1)th derivative of (left-k+i+1)th B-spline
nderivNumber of derivatives (including value) to compute

Note: Uses 0-based indexing

◆ bspp2d()

void orb5x::spclibs::bspp2d ( const Real * t,
const Real * bcoef,
int n,
int k,
Real * scrtch,
Real * ppcoef )

Convert B-spline coefficients to PPFORM.

Converts B-spline representation to piecewise polynomial form.

Parameters
tKnot sequence
bcoefB-spline coefficients (dim elements)
nNumber of intervals
kOrder
scrtchScratch array (k x k)
ppcoefOutput: PPFORM coefficients (k x n)

◆ calc_integ()

void orb5x::spclibs::calc_integ ( const Spline1D & sp,
Real * integ )

Calculate integral of each basis function.

Parameters
spSpline
integOutput: integrals (sp.dim elements)

◆ CompMassMatrix() [1/2]

void orb5x::spclibs::CompMassMatrix ( const Spline1D & sp,
GBMat & mat )

Compute mass matrix for FEM discretization.

Parameters
spSpline
matOutput: mass matrix

◆ CompMassMatrix() [2/2]

void orb5x::spclibs::CompMassMatrix ( const Spline1D & sp,
PeriodicMat & mat )

◆ def_basfun()

void orb5x::spclibs::def_basfun ( Real x,
const Spline1D & sp,
Real * fun,
int * left = nullptr,
int nderiv = 1 )

Define basis functions at a point (auto-locates interval).

Parameters
xPoint at which to evaluate
spSpline
funOutput: basis function values and derivatives
leftOutput (optional): interval index (0-based)
nderivNumber of derivatives

◆ destroy() [1/8]

void orb5x::spclibs::destroy ( GBMat & mat)

◆ destroy() [2/8]

void orb5x::spclibs::destroy ( GEMat & mat)

◆ destroy() [3/8]

void orb5x::spclibs::destroy ( PBMat & mat)

◆ destroy() [4/8]

void orb5x::spclibs::destroy ( PeriodicMat & mat)

◆ destroy() [5/8]

void orb5x::spclibs::destroy ( ZGBMat & mat)

◆ destroy() [6/8]

void orb5x::spclibs::destroy ( ZGEMat & mat)

◆ destroy() [7/8]

void orb5x::spclibs::destroy ( ZPBMat & mat)

◆ destroy() [8/8]

void orb5x::spclibs::destroy ( ZPeriodicMat & mat)

◆ destroy_sp() [1/3]

void orb5x::spclibs::destroy_sp ( Spline1D & sp)

◆ destroy_sp() [2/3]

void orb5x::spclibs::destroy_sp ( Spline2D & sp)

◆ destroy_sp() [3/3]

void orb5x::spclibs::destroy_sp ( Spline2D1D & sp)

◆ determinant() [1/6]

Real orb5x::spclibs::determinant ( const GBMat & mat)

Compute determinant of factorized matrix.

Parameters
matFactorized matrix
Returns
Determinant value

◆ determinant() [2/6]

Real orb5x::spclibs::determinant ( const GEMat & mat)

◆ determinant() [3/6]

Real orb5x::spclibs::determinant ( const PBMat & mat)

◆ determinant() [4/6]

Complex orb5x::spclibs::determinant ( const ZGBMat & mat)

◆ determinant() [5/6]

Complex orb5x::spclibs::determinant ( const ZGEMat & mat)

◆ determinant() [6/6]

Complex orb5x::spclibs::determinant ( const ZPBMat & mat)

◆ factor() [1/8]

int orb5x::spclibs::factor ( GBMat & mat)

Compute LU factorization of matrix.

Parameters
matMatrix to factorize (modified in place)
Returns
0 on success, non-zero on failure

For GBMat: Uses LAPACK DGBTRF For GEMat: Uses LAPACK DGETRF For PBMat: Uses LAPACK DPBTRF (Cholesky) For PeriodicMat: Uses Woodbury formula with DGBTRF

◆ factor() [2/8]

int orb5x::spclibs::factor ( GEMat & mat)

◆ factor() [3/8]

int orb5x::spclibs::factor ( PBMat & mat)

◆ factor() [4/8]

int orb5x::spclibs::factor ( PeriodicMat & mat)

◆ factor() [5/8]

int orb5x::spclibs::factor ( ZGBMat & mat)

◆ factor() [6/8]

int orb5x::spclibs::factor ( ZGEMat & mat)

◆ factor() [7/8]

int orb5x::spclibs::factor ( ZPBMat & mat)

◆ factor() [8/8]

int orb5x::spclibs::factor ( ZPeriodicMat & mat)

◆ gauleg()

void orb5x::spclibs::gauleg ( Real x1,
Real x2,
Real * x,
Real * w,
int n )

Compute Gauss-Legendre quadrature points and weights.

Computes the n-point Gauss-Legendre quadrature rule on [x1, x2].

Parameters
x1Left endpoint of interval
x2Right endpoint of interval
xOutput: quadrature points (n elements)
wOutput: quadrature weights (n elements)
nNumber of quadrature points

◆ get_dim() [1/2]

void orb5x::spclibs::get_dim ( const Spline1D & sp,
int & dim,
int * nx = nullptr,
int * nidbas = nullptr )

Get dimension information from 1D spline.

Parameters
spInput spline
dimOutput: dimension of spline space
nxOutput (optional): number of intervals
nidbasOutput (optional): spline degree

◆ get_dim() [2/2]

void orb5x::spclibs::get_dim ( const Spline2D & sp,
int dim[2],
int nx[2] = nullptr,
int nidbas[2] = nullptr )

Get dimension information from 2D spline.

◆ get_gauss()

void orb5x::spclibs::get_gauss ( const Spline1D & sp,
int & n,
int i = -1,
Real * x = nullptr,
Real * w = nullptr )

Get Gauss quadrature information from spline.

Parameters
spInput spline
nOutput: number of Gauss points per interval
iOptional: interval index (0-based)
xOutput (if i provided): Gauss points for interval i
wOutput (if i provided): Gauss weights for interval i

◆ get_splcoef()

void orb5x::spclibs::get_splcoef ( const Spline1D & sp,
const Real * bcoef,
Real * fvals )

Get function values from spline coefficients.

Computes fvals = M * bcoef where M is the interpolation matrix.

Parameters
spSpline
bcoefSpline coefficients
fvalsOutput: function values

◆ getcol() [1/3]

void orb5x::spclibs::getcol ( const GBMat & mat,
int j,
Real * col )

Get column of matrix.

◆ getcol() [2/3]

void orb5x::spclibs::getcol ( const PBMat & mat,
int j,
Real * col )

◆ getcol() [3/3]

void orb5x::spclibs::getcol ( const PeriodicMat & mat,
int j,
Real * col )

◆ getele() [1/6]

Real orb5x::spclibs::getele ( const GBMat & mat,
int i,
int j )

Get matrix element.

Parameters
matMatrix
iRow index (0-based)
jColumn index (0-based)
Returns
Matrix element value

◆ getele() [2/6]

Real orb5x::spclibs::getele ( const PBMat & mat,
int i,
int j )

◆ getele() [3/6]

Real orb5x::spclibs::getele ( const PeriodicMat & mat,
int i,
int j )

◆ getele() [4/6]

Complex orb5x::spclibs::getele ( const ZGBMat & mat,
int i,
int j )

◆ getele() [5/6]

Complex orb5x::spclibs::getele ( const ZPBMat & mat,
int i,
int j )

◆ getele() [6/6]

Complex orb5x::spclibs::getele ( const ZPeriodicMat & mat,
int i,
int j )

◆ getrow() [1/5]

void orb5x::spclibs::getrow ( const GBMat & mat,
int i,
Real * row )

Get row of matrix.

Parameters
matMatrix
iRow index (0-based)
rowOutput array (must be pre-allocated with size ncols)

◆ getrow() [2/5]

void orb5x::spclibs::getrow ( const GEMat & mat,
int i,
Real * row )

◆ getrow() [3/5]

void orb5x::spclibs::getrow ( const PBMat & mat,
int i,
Real * row )

◆ getrow() [4/5]

void orb5x::spclibs::getrow ( const PeriodicMat & mat,
int i,
Real * row )

◆ getrow() [5/5]

void orb5x::spclibs::getrow ( const ZPBMat & mat,
int i,
Complex * row )

◆ getvalp() [1/6]

Real * orb5x::spclibs::getvalp ( GBMat & mat,
int i,
int j )

Get pointer to matrix value for element (i,j) Used for direct access to storage for assembly.

◆ getvalp() [2/6]

Real * orb5x::spclibs::getvalp ( GEMat & mat,
int i,
int j )

◆ getvalp() [3/6]

Real * orb5x::spclibs::getvalp ( PBMat & mat,
int i,
int j )

◆ getvalp() [4/6]

Complex * orb5x::spclibs::getvalp ( ZGBMat & mat,
int i,
int j )

◆ getvalp() [5/6]

Complex * orb5x::spclibs::getvalp ( ZGEMat & mat,
int i,
int j )

◆ getvalp() [6/6]

Complex * orb5x::spclibs::getvalp ( ZPBMat & mat,
int i,
int j )

◆ gridval() [1/3]

void orb5x::spclibs::gridval ( const Spline1D & sp,
const Real * xgrid,
int npts,
const Real * bcoef,
Real * fvals,
int jder = 0 )

Evaluate spline on a grid of points.

Given spline coefficients bcoef, compute function values on grid.

Parameters
spSpline
xgridGrid of points (npts points)
nptsNumber of grid points
bcoefSpline coefficients (sp.dim elements)
fvalsOutput: function values at grid points
jderDerivative order to compute (default 0 = function value)

◆ gridval() [2/3]

void orb5x::spclibs::gridval ( const Spline2D & sp,
const Real * xgrid1,
int npts1,
const Real * xgrid2,
int npts2,
const Real * bcoef,
Real * fvals,
int jder1 = 0,
int jder2 = 0 )

Evaluate 2D spline on a 2D grid.

◆ gridval() [3/3]

void orb5x::spclibs::gridval ( const Spline2D1D & sp,
const Real * xgrid1,
int npts1,
const Real * xgrid2,
int npts2,
const Real * xgrid3,
int npts3,
const Real * bcoef,
Real * fvals,
int jder1 = 0,
int jder2 = 0,
int jder3 = 0 )

Evaluate 3D spline (2D+1D) on a 3D grid.

Given spline coefficients bcoef, compute function values on 3D grid. Based on Fortran gridval2d1d_3d (bsplines.f90 lines 2613-2753).

Parameters
sp2D+1D spline (sp12 for first two dimensions, sp3 for third)
xgrid1Grid points in direction 1 (npts1 points)
npts1Number of grid points in direction 1
xgrid2Grid points in direction 2 (npts2 points)
npts2Number of grid points in direction 2
xgrid3Grid points in direction 3 (npts3 points)
npts3Number of grid points in direction 3
bcoefSpline coefficients (dim1 * dim2 * dim3 elements, row-major)
fvalsOutput: function values at grid points (npts1 * npts2 * npts3, row-major)
jder1Derivative order in direction 1 (default 0)
jder2Derivative order in direction 2 (default 0)
jder3Derivative order in direction 3 (default 0)

◆ init() [1/8]

void orb5x::spclibs::init ( int kl,
int ku,
int n,
int nterms,
GBMat & mat,
int kmat = 0,
int mrows = -1 )

Initialize a general band matrix.

Parameters
klNumber of subdiagonals
kuNumber of superdiagonals
nMatrix dimension (square matrix)
ntermsNumber of non-zero terms (informational)
matOutput matrix
kmatOptional matrix identifier
mrowsOptional number of rows (defaults to n)

Referenced by orb5x::Zbmat::allocate_band().

◆ init() [2/8]

void orb5x::spclibs::init ( int kl,
int ku,
int n,
int nterms,
PeriodicMat & mat,
int kmat = 0 )

Initialize a periodic band matrix.

◆ init() [3/8]

void orb5x::spclibs::init ( int kl,
int ku,
int n,
int nterms,
ZGBMat & mat,
int kmat = 0,
int mrows = -1 )

◆ init() [4/8]

void orb5x::spclibs::init ( int kl,
int ku,
int n,
int nterms,
ZPeriodicMat & mat,
int kmat = 0 )

◆ init() [5/8]

void orb5x::spclibs::init ( int ku,
int n,
int nterms,
PBMat & mat,
int kmat = 0 )

Initialize a packed band matrix.

◆ init() [6/8]

void orb5x::spclibs::init ( int ku,
int n,
int nterms,
ZPBMat & mat,
int kmat = 0 )

◆ init() [7/8]

void orb5x::spclibs::init ( int n,
int nterms,
GEMat & mat,
int kmat = 0,
int mrows = -1 )

Initialize a general dense matrix.

◆ init() [8/8]

void orb5x::spclibs::init ( int n,
int nterms,
ZGEMat & mat,
int kmat = 0,
int mrows = -1 )

◆ interv()

void orb5x::spclibs::interv ( const Real * xt,
int lxt,
Real x,
int & left,
int & mflag )

Locate interval containing x in a knot sequence.

Given a nondecreasing sequence xt and a value x, finds the largest index left such that xt[left] <= x.

Parameters
xtKnot sequence (lxt elements)
lxtLength of knot sequence
xPoint to locate
leftOutput: index of bracketing value 0 if x < xt[0] i if xt[i] <= x < xt[i+1] lxt-1 if xt[lxt-1] <= x
mflagOutput: indicates position relative to knot sequence -1: x < xt[0] 0: xt[left] <= x < xt[left+1] +1: xt[lxt-1] <= x

Note: Uses 0-based indexing

◆ interv_hint()

void orb5x::spclibs::interv_hint ( const Real * xt,
int lxt,
Real x,
int & left,
int & mflag,
int & ilo )

Thread-safe version of interv with explicit previous guess.

Parameters
xtKnot sequence
lxtLength of sequence
xPoint to locate
leftOutput: interval index
mflagOutput: boundary flag
iloPrevious guess for left (updated on output)

◆ is_equid()

bool orb5x::spclibs::is_equid ( const Real * grid,
int n )

Check if a grid is equidistant.

Parameters
gridGrid points
nNumber of grid points
Returns
true if grid is equidistant (within tolerance)

◆ locintv()

void orb5x::spclibs::locintv ( const Spline1D & sp,
Real x,
int & left )

Locate interval containing x in spline knot sequence.

Parameters
spSpline
xPoint to locate
leftOutput: interval index (0-based, 0 to nints-1)

◆ maddto() [1/4]

void orb5x::spclibs::maddto ( Real alpha,
const GBMat & a,
GBMat & b )

Add matrices: B = B + alpha*A.

◆ maddto() [2/4]

void orb5x::spclibs::maddto ( Real alpha,
const GEMat & a,
GEMat & b )

◆ maddto() [3/4]

void orb5x::spclibs::maddto ( Real alpha,
const PBMat & a,
PBMat & b )

◆ maddto() [4/4]

void orb5x::spclibs::maddto ( Real alpha,
const PeriodicMat & a,
PeriodicMat & b )

◆ mcopy() [1/4]

void orb5x::spclibs::mcopy ( const GBMat & src,
GBMat & dst )

◆ mcopy() [2/4]

void orb5x::spclibs::mcopy ( const GEMat & src,
GEMat & dst )

◆ mcopy() [3/4]

void orb5x::spclibs::mcopy ( const PBMat & src,
PBMat & dst )

◆ mcopy() [4/4]

void orb5x::spclibs::mcopy ( const PeriodicMat & src,
PeriodicMat & dst )

◆ ppval()

Real orb5x::spclibs::ppval ( const Real * t,
const Real * coef,
int n,
int k,
Real x,
int & left )

Evaluate polynomial in piecewise polynomial form.

Evaluates the piecewise polynomial at point x using the PPFORM coefficients.

Parameters
tBreakpoints (n+1 elements)
coefPPFORM coefficients (k x n, column-major)
nNumber of intervals
kOrder of polynomial
xPoint at which to evaluate
leftHint for interval location
Returns
Value of polynomial at x

◆ putcol() [1/5]

void orb5x::spclibs::putcol ( GBMat & mat,
int j,
const Real * col )

Set column of matrix.

◆ putcol() [2/5]

void orb5x::spclibs::putcol ( GEMat & mat,
int j,
const Real * col )

◆ putcol() [3/5]

void orb5x::spclibs::putcol ( PBMat & mat,
int j,
const Real * col )

◆ putcol() [4/5]

void orb5x::spclibs::putcol ( PeriodicMat & mat,
int j,
const Real * col )

◆ putcol() [5/5]

void orb5x::spclibs::putcol ( ZPBMat & mat,
int j,
const Complex * col )

◆ putele() [1/6]

void orb5x::spclibs::putele ( GBMat & mat,
Real val,
int i,
int j )

Set matrix element.

◆ putele() [2/6]

void orb5x::spclibs::putele ( PBMat & mat,
Real val,
int i,
int j )

◆ putele() [3/6]

void orb5x::spclibs::putele ( PeriodicMat & mat,
Real val,
int i,
int j )

◆ putele() [4/6]

void orb5x::spclibs::putele ( ZGBMat & mat,
Complex val,
int i,
int j )

◆ putele() [5/6]

void orb5x::spclibs::putele ( ZPBMat & mat,
Complex val,
int i,
int j )

◆ putele() [6/6]

void orb5x::spclibs::putele ( ZPeriodicMat & mat,
Complex val,
int i,
int j )

◆ putrow() [1/5]

void orb5x::spclibs::putrow ( GBMat & mat,
int i,
const Real * row )

Set row of matrix.

◆ putrow() [2/5]

void orb5x::spclibs::putrow ( GEMat & mat,
int i,
const Real * row )

◆ putrow() [3/5]

void orb5x::spclibs::putrow ( PBMat & mat,
int i,
const Real * row )

◆ putrow() [4/5]

void orb5x::spclibs::putrow ( PeriodicMat & mat,
int i,
const Real * row )

◆ putrow() [5/5]

void orb5x::spclibs::putrow ( ZPBMat & mat,
int i,
const Complex * row )

◆ set_splcoef()

void orb5x::spclibs::set_splcoef ( Spline1D & sp,
const Real * fvals,
Real * bcoef )

Set spline coefficients from function values.

Computes spline coefficients by interpolation: solve M * bcoef = fvals where M is the interpolation matrix.

Parameters
spSpline (must have interpolation matrix set up)
fvalsFunction values at interpolation sites
bcoefOutput: spline coefficients

◆ set_spline() [1/3]

void orb5x::spclibs::set_spline ( const int p[2],
const int ngauss[2],
const Real * grid1,
int ngrid1,
const Real * grid2,
int ngrid2,
Spline2D & sp,
const bool period[2] = nullptr,
bool nlppform = true,
const int nlequid[2] = nullptr )

Initialize a 2D spline.

Parameters
pDegrees in each direction (p[0], p[1])
ngaussNumber of Gauss points in each direction
grid1Grid points in direction 1
ngrid1Number of grid points in direction 1
grid2Grid points in direction 2
ngrid2Number of grid points in direction 2
spOutput: initialized 2D spline
periodPeriodicity flags for each direction
nlppformUse PPFORM for evaluation
nlequidEquidistant flags (-1 for auto-detect)

◆ set_spline() [2/3]

void orb5x::spclibs::set_spline ( const int p[3],
const int ngauss[3],
const Real * grid1,
int ngrid1,
const Real * grid2,
int ngrid2,
const Real * grid3,
int ngrid3,
Spline2D1D & sp,
const bool period[3] = nullptr,
bool nlppform = true,
const int nlequid[3] = nullptr )

Initialize a 2D+1D spline.

Parameters
pDegrees in each direction (p[0], p[1], p[2])
ngaussNumber of Gauss points in each direction
grid1,grid2,grid3Grid points in each direction
ngrid1,ngrid2,ngrid3Number of grid points
spOutput: initialized 2D+1D spline
periodPeriodicity flags
nlppformUse PPFORM
nlequidEquidistant flags

◆ set_spline() [3/3]

void orb5x::spclibs::set_spline ( int p,
int ngauss,
const Real * grid,
int ngrid,
Spline1D & sp,
bool period = false,
bool nlppform = true,
int nlequid = -1 )

Initialize a 1D spline.

Parameters
pSpline degree (order = p + 1)
ngaussNumber of Gauss quadrature points per interval (0 to skip)
gridGrid points (nints+1 points defining nints intervals)
ngridNumber of grid points
spOutput: initialized spline
periodWhether the spline is periodic
nlppformWhether to use PPFORM for evaluation (default true)
nlequidWhether the grid is equidistant (auto-detected if not specified)

◆ updtmat() [1/7]

void orb5x::spclibs::updtmat ( GBMat & mat,
Real val,
int i,
int j )

Update matrix element: mat(i,j) += val.

Parameters
matMatrix to update
valValue to add
iRow index (0-based)
jColumn index (0-based)

◆ updtmat() [2/7]

void orb5x::spclibs::updtmat ( GEMat & mat,
Real val,
int i,
int j )

◆ updtmat() [3/7]

void orb5x::spclibs::updtmat ( PBMat & mat,
Real val,
int i,
int j )

◆ updtmat() [4/7]

void orb5x::spclibs::updtmat ( PeriodicMat & mat,
Real val,
int i,
int j )

◆ updtmat() [5/7]

void orb5x::spclibs::updtmat ( ZGBMat & mat,
Complex val,
int i,
int j )

◆ updtmat() [6/7]

void orb5x::spclibs::updtmat ( ZPBMat & mat,
Complex val,
int i,
int j )

◆ updtmat() [7/7]

void orb5x::spclibs::updtmat ( ZPeriodicMat & mat,
Complex val,
int i,
int j )

◆ vmx() [1/10]

void orb5x::spclibs::vmx ( const GBMat & mat,
const Real * x,
Real * y )

Compute y = A*x.

Parameters
matMatrix A
xInput vector
yOutput vector

◆ vmx() [2/10]

void orb5x::spclibs::vmx ( const GBMat & mat,
const Real * x,
Real * y,
int nrhs )

Compute Y = A*X for multiple vectors.

Parameters
matMatrix A
xInput vectors (n x nrhs)
yOutput vectors (n x nrhs)
nrhsNumber of right-hand sides

◆ vmx() [3/10]

void orb5x::spclibs::vmx ( const GEMat & mat,
const Real * x,
Real * y )

◆ vmx() [4/10]

void orb5x::spclibs::vmx ( const GEMat & mat,
const Real * x,
Real * y,
int nrhs )

◆ vmx() [5/10]

void orb5x::spclibs::vmx ( const PBMat & mat,
const Real * x,
Real * y )

◆ vmx() [6/10]

void orb5x::spclibs::vmx ( const PeriodicMat & mat,
const Real * x,
Real * y )

◆ vmx() [7/10]

void orb5x::spclibs::vmx ( const ZGBMat & mat,
const Complex * x,
Complex * y )

◆ vmx() [8/10]

void orb5x::spclibs::vmx ( const ZGEMat & mat,
const Complex * x,
Complex * y )

◆ vmx() [9/10]

void orb5x::spclibs::vmx ( const ZPBMat & mat,
const Complex * x,
Complex * y )

◆ vmx() [10/10]

void orb5x::spclibs::vmx ( const ZPeriodicMat & mat,
const Complex * x,
Complex * y )

Variable Documentation

◆ JMAX

int orb5x::spclibs::JMAX = 20
constexpr

Maximum spline order supported (degree + 1).