BasisFunctions.AbstractIntegerIndex β Type

An AbstractIntegerIndex represents an integer that is being used as an index in the BasisFunctions package.

The type implements basic functionality of integers such that one can do computations with the indices.

BasisFunctions.AbstractShiftedIndex β Type

A ShiftedIndex{S} is a linear index shifted by S. Thus, its value starts at 1-S and ranges up to n-S. A typical case is S=1.

BasisFunctions.AbstractSolverOperator β Type

Supertype of all dictionary solver operators. A solver operator typically implements an efficient algorithm to apply the inverse of an operator. Examples include a solver based on QR or SVD factorizations.

A solver operator stores the operator it has inverted.

BasisFunctions.ArrayOperator β Type

An ArrayOperator combines an AbstractArray with a source and destination dictionary.

From the 'AbstractArray' we expect that mul!, size, copy, diag, isdiag, inv, getindex, adjoint, conj are implemented where possible.

BasisFunctions.BlockOperator β Type

A BlockOperator has a block matrix structure, where each block is an operator, and it acts on multiple sets.

A BlockOperator is row-like if it only has one row of blocks. In that case, the destination of the operator is not necessarily a multidict.

A BlockOperator is column-like if it only has one column of blocks. In that case, the source set of the operator is not necessarily a multidict.

BasisFunctions.ComplexifiedDict β Type

A 'ComplexifiedDict' is a dictionary for which the coefficient type is the complex version of the original dictionary. It is obtained by calling promote or ensure_coefficienttype on a dictionary or dictionaries.

BasisFunctions.CompositeDict β Type

CompositeDict is the abstract supertype of a dictionary that consists of several subdictionaries. The CompositeDict type defines common routines for indexing and iteration.

The representation of a CompositeDict is a BlockVector. The outer array of this BlockVector adopts the structure of the components of the CompositeDict: if the components are stored in a tuple, the outer array will be a tuple. If the components are stored in an array, the outer array will be an array as well.

CompositeDict's that store components in an array can have a large number of components. However, for good efficiency they should have the same type. Tuples are suitable to hold mixed-type components with good efficiency, however in this case there can't be too many.

The concrete subtypes differ in what evaluation means. Examples include:

• MultiDict, where evaluation is the sum of the evaluation of the subsets
• PiecewiseDict, where evaluation depends on the location of the evaluation point
BasisFunctions.CompositeOperator β Type

A CompositeOperator consists of a sequence of operators that are applied consecutively.

Whenever possible, scratch space is allocated to hold intermediate results.

BasisFunctions.DefaultNativeIndex β Type

If a dictionary does not have a native index, we use the DefaultNativeIndex type to distinguish between linear and native indices. However, the default native index simply wraps the integer linear index.

BasisFunctions.DenseSubdict β Type

A DenseSubdict is a large subset of a dictionary. Operators associated with the subset are implemented in terms of corresponding operators on the underlying dictionary. This often leads to an explicit extension to the full set, but it can take advantage of possible fast implementations for the underlying dictionary. For large subsets this is more efficient than iterating over the individual elements.

BasisFunctions.DerivedDict β Type

A DerivedDict is a dictionary that inherits most of its behaviour from an underlying dictionary.

The abstract type for derived dictionaries implements the interface of a dictionary using composition and delegation. Concrete derived dictionaries may override functions to specialize behaviour. For example, a mapped dictionary may override the evaluation routine to apply the map first.

BasisFunctions.Dictionary β Type

A Dictionary{S,T} is an ordered family of functions, in which each function maps a variable of type S to a variable of type T. The dictionary can be thought of as an array, where the elements are functions that map S to T.

A Dictionary{S,T} has domain type S and codomain type T. The domain type corresponds to the type of a domain in the DomainSets.jl package, and it is the type of the expected argument to the elements of the dictionary. The codomain type is the type of the output.

Each dictionary is ordered via its index set: the ordering is determined by the iterator of the index set. A dictionary d can be indexed in several ways:

• the linear index is a positive natural number between 1 and length(d)
• the native index is an index that more closely corresponds to the conventional mathematical notation of the dictionary, if that differs from linear indexing. For example, polynomials may have degree ranging from 0 to length(d)-1. Fourier series may have negative frequencies.

Some dictionaries define other types of indices, such as multilinear and product indices. See CompositeDictionary and ProductDictionary. There is always a bijection between the different types of index sets supported by a dictionary.

A dictionary is the basic building block of the package. They can support several operations, such as interpolation, evaluation, differentiation and others. This functionality is made available using a specific interface. See the documentation of the features for a description of that interface and the syntax.

BasisFunctions.DictionaryOperator β Type

DictionaryOperator represents any linear operator that maps coefficients of a source set to coefficients of a destination set. Typically, source and destination are of type Dictionary. The action of the operator is defined by providing a method for apply!.

The dimension of an operator are like a matrix: (length(dest),length(src)).

Source and destination should at least implement the following:

• length
• size
• eltype

The element type should be equal for src and dest.

BasisFunctions.DictionarySolverOperator β Type

Supertype of all dictionary solver operators. A solver operator typically implements an efficient algorithm to apply the inverse of an operator. Examples include a solver based on QR or SVD factorizations.

A solver operator stores the operator it has inverted.

BasisFunctions.DictionaryValueIterator β Type

Supertype of iterators over the pointwise evaluation of a dictionary.

The value iterator depends on a point x in the support of the dictionary, and iterates over all the function values of the elements of the dictionary in that point. Value iterators can be useful if the computation of all elements is required and computing them in one go is more efficient than computing them one by one independently.

For example, orthogonal polynomial iterators may implement the three-term recurrence relation. The command '[val for val in pointvalues(ops, x)]' may be more efficient than '[eval_element(dict, i, x) for i in eachindex(dict)]'

BasisFunctions.DiscreteDictionary β Type

A DiscreteDictionary{I,T} is a dictionary where I is a discrete type, e.g., the integers. Expansions in this discrete set typically constitute a vector space.

The elements of the set are the Euclidean unit vectors, with a finite index set.

BasisFunctions.Expansion β Type

An Expansion describes a function using its expansion coefficients in a certain dictionary.

An expansion acts both like an array, the array of coefficients, and like a function.

Parameters:

• D is the dictionary.
• C is the type of the expansion coefficients
BasisFunctions.FFTIndexList β Type

FFTIndexList defines the map from native indices to linear indices for a finite Fourier basis, when the indices are ordered in the way they are expected in the FFT routine.

BasisFunctions.Fourier β Type

A Fourier basis on the interval [0,1]. The basis functions are given by exp(2 Ο i k), with k ranging from -N to N for Fourier series of odd length (2N+1) and from -N+1 to N for even length. In the latter case, the highest frequency basis function corresponding to frequency N is a cosine.

The basis functions are ordered the way they are expected by a typical FFT implementation. The frequencies k are in the following order:

0 1 2 3 ... N -N -N+1 ... -2 -1,

for odd length and

0 1 2 3 ... N -N+1 ... -2 -1,

for even length.

The Fourier basis is orthonormal with respect to a continuous measure (for odd length Fourier bases only) and a discrete measure.

BasisFunctions.FunctionSpace β Type

A FunctionSpace{S,T} is the supertype of all function spaces. The space contains functions that map type S to type T. Thus, S is the domaintype and T is the codomain type.

BasisFunctions.GenericOPS β Type

A generic orthogonal polynomial sequence is determined by its recurrence coefficients. The GenericOPS type stores the coefficients A_n, B_n and C_n from the recurrence relation in the following form:

p_{n+1}(x) = (A_n x + B_n) * p_n(x) - C_n * p_{n-1}(x).
p_{-1} = 0, p_0 = p0
BasisFunctions.Hermite β Type

A basis of the classicale Hermite polynomials. These polynomials are orthogonal on the real line (-β,β) with respect to the weight function w(x)=exp(-x^2).

BasisFunctions.IndexList β Type

The type IndexList implements a map from linear indices to another family of indices, and vice-versa.

It is implemented as an abstract vector. Hence, the functionality of vectors is available. This also means that the dimension of an index list is always a vector, whose length equals that of the dictionary it corresponds to. Still, in several cases one may index the list with other kinds of indices.

Concrete subtypes should implement:

• getindex(l::MyIndexList, idx::Int) -> this is the map from linear indices to native indices
• linear_index(l::MyIndexList, idxn::MyIndex) -> this is the inverse map
• size(l::MyIndexList)
BasisFunctions.Jacobi β Type

A basis of the classical Jacobi polynomials on the interval [-1,1]. These polynomials are orthogonal with respect to the weight function

w(x) = (1-x)^Ξ± (1+x)^Ξ².
BasisFunctions.Laguerre β Type

A basis of the classicale Laguerre polynomials. These polynomials are orthogonal on the positive halfline [0,β) with respect to the weight function w(x)=exp(-x).

BasisFunctions.Legendre β Type

A basis of Legendre polynomials on the interval [-1,1]. These classical polynomials are orthogonal with respect to the weight function w(x) = 1.

BasisFunctions.LinearizationOperator β Type

An operator that calls linearize on a native representation of a set, returning a Vector with the length of the set. For example, one can not apply a matrix to a non-arraylike representation, hence the representation has to be linearized first.

BasisFunctions.MappedDict β Type

A MappedDict has a dictionary and a map. The domain of the dictionary is mapped to a different one. Evaluating the MappedDict in a point uses the inverse map to evaluate the underlying dictionary element in the corresponding point.

BasisFunctions.MeasureSpace β Type

A function space equipped with a measure.

The measure ΞΌ induces a bilinear form (f,g) = int(f, g, dΞΌ) and possibly a (semi)norm or inner product. This depends on the properties of the measure.

BasisFunctions.MultiDict β Type

A MultiDict is the concatenation of several dictionaries. The components are contained in an indexable set, such as a tuple or an array. In case of an array, the number of dictionaries may be large.

The native representation of a MultiDict is a BlockVector, of which each element is the native representation of the corresponding element of the multidict.

Evaluation of an expansion at a point is defined by summing the evaluation of all functions in the set at that point.

BasisFunctions.MultilinearIndexIterator β Type

A MultilinearIndexIterator iterates over a sequence of linear indices. Each index is a tuple, where the first entry refers to the linear index, and the second entry is the linear index.

This resembles the Flatten iterator in Base, but the latter would yield only the second entry. For example, the composite indices of (1:5,1:3) are:

(1,1), (1,2), (1,3), (1,4), (1,5), (2,1), (2,2), (2,3).

In contrast, the Flatten iterator in Base would yield:

1, 2, 3, 4, 5, 1, 2, 3
BasisFunctions.OperatedDict β Type

An OperatedDict represents a set that is acted on by an operator, for example the differentiation operator. The OperatedDict has the dimension of the source set of the operator, but each basis function is acted on by the operator.

In practice the operator D acts on the coefficients. Thus, an expansion in an OperatedDict with coefficients c corresponds to an expansion in the underlying dictionary with coefficients Dc. If D represents differentiation, then the OperatedDict effectively represents the dictionary of derivatives of the underlying dictionary elements.

BasisFunctions.ParamDict β Type

A ParamDict is a dictionary combined with a map, which is the parameterization of some domain that is the image of the support of the dictionary.

If Ξ© is a domain, parameterized by the function ΞΊ : P β Ξ©, then the ParamDict is a dictionary defined on P, with each point t β P identified with x = ΞΊ(t) β Ξ©. The ParamDict acts like any other dictionary on P.

Note the difference with a MappedDict, which is defined on Ξ©. Operations on mapped dictionaries require an easily invertible map.

BasisFunctions.Partition β Type

A partition divides a region into several subregions. The main algorithm of every partition is deciding in which subregion a given point x lies, implemented by the partition_index function.

The intent of a partition is to be combined with a function set on each subregion, effectively creating a piecewise function.

The pieces of a partition have an index ranging from 1 to length(partition).

BasisFunctions.PartitionPiece β Type

A PartitionPiece represents a piece of a partition - it essentially combines a partition and an index into that partition. It is constructed by indexing a partition.

BasisFunctions.PiecewiseDict β Type

A PiecewiseDict has a dictionary for each piece in a partition. Its representation is a BlockVector containing the expansions of all dictionaries combined.

BasisFunctions.PiecewiseInterval β Type

A PiecewiseInterval is a subdivision of an interval into a number of subintervals. The subintervals are determined by a set of breakpoints $t_i$, $i=0,...,n$. The main interval is $[t_0,t_n]$. The subintervals always contain the right endpoint, i.e. the first subinterval is $[t_0,t_1]$, the second is the halfopen interval $(t_1,t_2]$ and so on until the n-th interval $(t_{n-1},t_n]$.

BasisFunctions.Span β Type

The span of a dictionary is the set of all possible expansions in that dictionary, with coefficient eltype determined uniquely by the dictionary.

The span of a dictionary is a function space, mapping S to T. Here, S is the domain type of the dictionary and T is the codomain type.

BasisFunctions.SparseSubdict β Type

A SparseSubdict is a subset of a dictionary with a small number of indices. The difference with a regular function subset is that operators on a small set are implemented by iterating explicitly over the indices, and not in terms of an operator on the full underlying set.

BasisFunctions.Subdictionary β Type

A Subdictionary is an abstract subset of a dictionary. It is characterized by the underlying larger dictionary, and a subcollection of its indices.

BasisFunctions.TrigSeries β Type

A trigonometric series consists of sines and cosines on the interval [0,1].

The span of TrigSeries(n) is the same as that of Fourier(n). To that end, TrigSeries(n) has ceil(n/2) cosine and floor(n/2) sine functions.

BasisFunctions.TupleProductDict β Type
struct TupleProductDict{N,DT,S,T} <: Dictionary{S,T}

Parameters:

• DT is a tuple of types, representing the (possibly different) types of the dicts.
• N is the dimension of the product (equal to the length of the DT tuple)
• S is the domain type
• T is the codomain type.
BasisFunctions.HalfRangeChebyshevIIkind β Method

Creates the (normalized) half range Chebyshev polynomials of the second kind.

These orthonormal polynomials (p_k(t)) on [-1,1] are orthogonal with respect to the weight

w(t) = [(1-t)(t-m(T))]^{1/2}

with

m(T) = 1-2cosec^2(pi/(2T))

They appear in the context of Fourier extensions. There, an odd function f(x) on [-1,1] is approximated with a sine series in x on [-T,T].

See also HalfRangeChebyshevIkind

BasisFunctions.HalfRangeChebyshevIkind β Method

Creates the (normalized) half range Chebyshev polynomials of the first kind.

These orthonormal polynomials (p_k(t)) on [-1,1] are orthogonal with respect to the weight

w(t) = [(1-t)(t-m(T))]^{-1/2}

with

m(T) = 1-2cosec^2(pi/(2T))

They appear in the context of Fourier extensions. There, an even function f(x) on [-1,1] is approximated with a cosine series in x on [-T,T]. By the cosine mapping

    y = m(x) = cos(pi/T x)

this problem is transformed. The Fourier Extension problem on f is then equivalent with the approximation of f(m^{-1}(y)) with orthogonal polynomials (q_k(y)) on [cos(pi/T),1]

By another mapping the interval [cos(pi/T),1] is mapped to [-1,1] and the polynomials (q_k(y)) are mapped to the polynomials (p_k(t))

See Huybrechs 2010, On the Fourier Extension of nonperiodic functions Adcock, Huybrechs, Vaquero 2014, On the numerical stability of Fourier Extension

The indicator_function_nodes refer to the boundary points of the domain of the function f(x) is approximated on. It is assumed that indicator_function_nodes has the form

    [-1,b_1,a_2,b_2, ..., a_n, 1 ] with -1<b_1<a_2<b_2<...<a_n<1.

By default it is the vector [-1.,1.].

See also HalfRangeChebyshevIkind

BasisFunctions.adaptive_stieltjes β Method

Calculates the first n recurrence coefficients (Ξ±_k) and (Ξ²_k) of the monic orthogonal polynomials up to the tolerance tol given a quadrature rule my_quadrature_rule with a relative degree of exactness

d(M)/M = Ξ΄ + O(1/M) as M goes to infinity

with d(M) the degree of exactness. Thus Ξ΄ is 2 for Gaussian quadrature.

See equation page 101 from Gautschi's book, "Orthogonal Polynomials and Computation"

BasisFunctions.antidifferentiation β Function

The antidifferentiation function returns an operator that can be used to find the antiderivative of a function in the dictionary, with the result an expansion in a second dictionary.

See also: differentiation.

BasisFunctions.approximation β Method

The approximation function returns an operator that can be used to approximate a function in the function set. This operator maps a grid to a set of coefficients.

BasisFunctions.approximation β Method

The 2-argument approximation exists to allow you to transform any Dictionary coefficients to any other Dictionary coefficients, including Discrete Grid Spaces. If a transform exists, the transform is used.

BasisFunctions.conversion β Function
conversion(::Type{T}, src::Dictionary, dest::Dictionary; options...)

Construct an operator with element type T that converts coefficients from the source dictionary to coefficients of the destination dictionary.

The conversion is often exact, but this can not always be achieved with certainty. For example, it is hard to know in advance whether converting to evaluations in a grid is invertible.

BasisFunctions.differentiation β Function

The differentation function returns an operator that can be used to differentiate a function in the dictionary, with the result as an expansion in a second dictionary.

The differentiation operator is efficient for some combinations of source and destination dictionary. If a dictionary supports at least one differentiation operator, than hasderivative(dict) is true and derivative_dict(dict) returns the destination dictionary.

The order of the differentation can be passed as an optional second argument.

Examples are:

differentiation(Ξ¦::Dictionary)

This will use the default destination dictionary, order 1 and dimension 1. Another example is:

differentiation(Ξ¦, 1)

or

differentiation(Ξ¦, (0,1))
BasisFunctions.differentiation_dict β Method
A dictionary that evaluates in the same way as the diffentiated dictionary,
but constructed using the derivative_dict and a transformation matrix that maps the coefficients.
BasisFunctions.dimensions β Method

The length and size of a dictionary may not be enough to uniquely determine the size of the dictionary, if it has additional internal structure. The output of dimensions is such that resize(dict, dimensions(dict)) == dict.

BasisFunctions.eval_element β Method

A member function of a dictionary is evaluated using the eval_element routine. It takes as arguments the dictionary, the index of the member function and the point in which to evaluate.

This function performs bounds checking on the index and also checks whether the point x lies inside the support of the function. A BoundsError is thrown for an index out of bounds. The value 0 is returned when x is outside the support.

After the check on the index, the function calls unsafe_eval_element1. This function checks whether x lies in the support, and then calls unsafe_eval_element. The latter function should be implemented by a concrete dictionary. Any user who wants to avoid the bounds check or the support check can intercept eval_element or unsafe_eval_element1 respectively.

BasisFunctions.extensionsize β Method

Return a suitable length to extend to, for example one such that the corresponding grids are nested and function evaluations can be shared. The default is twice the length of the current set.

BasisFunctions.gauss_weights_from_points β Method

Compute the weights of Gaussian quadrature rule from the given roots of the orthogonal polynomial and using the formula:

w_j = 1 / \sum_{k=0}^{n-1} p_k(x_j)^2

This formula only holds for the orthonormal polynomials.

BasisFunctions.mixedgram β Method

Compute the mixed Gram matrix corresponding to two dictionaries. The matrix has elements given by the inner products between the elements of the dictionaries, relative to the given measure.

BasisFunctions.modified_chebyshev! β Function

Modified Chebyshev Algorithm

see chebyshev

Ο, Οzero, and Οmone are vectors of size or larger then 2n n is the number of coefficients required and os is the offset, i.e., the initial index that can be used in Ο, Οzero, and Οmone.

BasisFunctions.modified_chebyshev β Method

Modified Chebyshev Algorithm

Implements the map of the modified moments

\mu_k = \int p_k(x) dΞ»(x), k=0,...,2N-1

where (p_k) are some monic orthogonal polynomials satisfying the recurrence relation

p_{k+1}(t) = a_k(t_k)p_k(t) - b_kp{k-1}(t)
p_0(t) = 1, p_{-1}(t) = 0

to the first recurrence coefficients (Ξ±k), (Ξ²k), with k=0,...,N-1, such that the monic polynomials (q_k) satisfying

q_{k+1}(t) = Ξ±_k(t_k)q_k(t) - Ξ²_kq{k-1}(t)
q_0(t) = 1, q_{-1}(t) = 0

are orthogonal with respect to the measure Ξ».

By default a, and b are zero vectors and therefore the moments are assumed to be

\mu_k = \int x^k dΞ»(x), k=0,...,2N-1

This procedure is however not stable.

See e.g. Gautschi's book, "Orthogonal Polynomials and Computation". Algorithm 2.1, p77

Note: The vectors used have indices starting at 1 (such that Ξ±_n above is given by Ξ±[n+1]). The last value is Ξ±_{n-1} = Ξ±[n].

BasisFunctions.monic_recurrence_coefficients β Method

Return the recurrence coefficients Ξ±_n and Ξ²_n for the monic orthogonal polynomials (i.e., with leading order coefficient 1). The recurrence relation is

p_{n+1}(x) = (x-Ξ±_n)p_n(x) - Ξ²_n p_{n-1}(x).

The result is a vector with indices starting at 1 (such that Ξ±_n above is given by Ξ±[n+1]). The last value is Ξ±_{n-1} = Ξ±[n].

BasisFunctions.monic_to_orthonormal_recurrence_coefficients β Method

Transforms the N recurrence coefficients (Ξ±k) and (Ξ²k) of monic orthogonal polynomials (p_k), which satisfy the three-term recurrence relation

p_{k+1}(t) = (t-Ξ±_k)p_k(t)-Ξ²_kp_{k-1}(t)

to the N-1 first recurrence coefficients (ak), (bk), and (ck) the associated monic polynomials (qk), such that

q_{k+1}(t) = (a_kt+b_k)q_k(t)-c_kq_{k-1}(t)
BasisFunctions.ordering β Method

Dictionaries are ordered lists. Their ordering is defined by the way their index sets are ordered.

The ordering of a dictionary returns a list-like object that can be indexed with integers between 1 and length(dict). This operation returns the corresponding native index. This defines the ordering of the native index set of the dictionary.

BasisFunctions.recurrence_eval β Method

Evaluate an orthogonal polynomial using the three term recurrence relation. The recurrence relation is assumed to have the form: ''' p{n+1}(x) = (An x + Bn) * pn(x) - Cn * p{n-1}(x) p{-1} = 0; p0 = p0 ''' with the coefficients implemented by the rec_An, rec_Bn and rec_Cn functions and with the initial value implemented with the p0 function. This is the convention followed by the DLMF, see http://dlmf.nist.gov/18.9#i.

BasisFunctions.restrictionsize β Method

Return a suitable length to restrict to, for example one such that the corresponding grids are nested and function evaluations can be shared. The default is half the length of the current set.

BasisFunctions.sampling_normalization β Method

Return a normalization for a sampling operator on a grid. The normalization ensures a norm equivalence between the continuous norm of the function space associated with the measure, and the discrete norm of the sampling vector.

In practice, this amounts to a diagonal scaling with the square roots of the weights of a quadrature rule on the grid that is exact on the span of the dictionary in the space.

BasisFunctions.split_interval β Method

Make a piecewise function set from a one-dimensional function set, by inserting the point x in the support of the original set. This yields a PiecewiseDict on the partition [left(set), x, right(set)].

The original set is duplicated and rescaled to the two subintervals.

BasisFunctions.stieltjes! β Method

In-place Stieltjes Algorithm

see stieltjes

p0, p1, p2, and scratch are vectors of size N

BasisFunctions.stieltjes β Method

Stieltjes Algorithm

Given nodes (tk) and weights (wk) of a quadrature rule, the Stieltjes Algorithm calculates the N first recurrence coefficients of the monic polynomials (p_k) satisfying

p_{k+1}(t) = (t-a_k)p_k(t)-b_kp_{k-1}(t)
p_0(t) = 1, p_{-1}(t) = 0

and orthogonal with respect to the inner product induced by the quadrature

\sum w_k p_m(t_k)q_n(t_k) = \delta_{m,n}

See e.g. Gautschi's book, "Orthogonal Polynomials and Computation" and its accompanying code https://www.cs.purdue.edu/archives/2002/wxg/codes/OPQ.html

Note: The vectors used have indices starting at 1 (such that a_n above is given by a[n+1]). The last value is a_{n-1} = a[n].

BasisFunctions.tensorproduct β Method

Create a tensor product of the supplied arguments.

The function tensorproduct applies some simplifications and does not necessarily return a Product type.

A tensorproduct(a) with just a single element returns a.

For integer n, tensorproduct(a, n) becomes tensorproduct(a, a, ..., a). A type-safe variant is tensorproduct(a, Val{N}).

BasisFunctions.unsafe_offsets β Method

Pass the internal offsets vector of the composite dict. This is not safe because the vector is not copied, hence its components could be changed. That would affect the original composite dictionary. Use with care.