BasisMatrices.Interpoland
— MethodConstruct an Interpoland from a function.
The function must have the signature f(::AbstractMatrix)::AbstractArray
where each column of the input matrix is a vector of values along a single dimension
BasisMatrices.a_chain
— MethodFinds all of the unidimensional disjoint sets of Chebychev extrema that are used to construct the grid. It improves on past algorithms by noting that $A_{n} = S_{n}$ [evens] except for $A_1= \{0\}$ and $A_2 = \{-1, 1\}$. Additionally, $A_{n} = A_{n+1}$ [odds] This prevents the calculation of these nodes repeatedly. Thus we only need to calculate biggest of the Sn's to build the sequence of ``An`` 's
See section 3.2 of the paper...
BasisMatrices.basis_eltype
— Functionbasis_eltype(p::Union{BasisParams,Type{<:BasisParams}, x)
Return the eltype of the Basis matrix that would be obtained by calling evalbase(p, x)
BasisMatrices.build_B!
— MethodCompute the matrix B(pts)
from equation 22 in JMMV 2013. This is the basis matrix
BasisMatrices.build_grid
— FunctionUse disjoint Smolyak sets to construct Smolyak grid of degree d
and density parameter mu
BasisMatrices.cheby2n!
— MethodComputes first n
Chebychev polynomials of the kind
kind evaluated at each point in x
and places them in out
. The trailing dimension of out
indexes the chebyshev polynomials. All inner dimensions correspond to points in x
.
BasisMatrices.check_basis_structure
— MethodDo common transformations to all constructor of BasisMatrix
Arguments
N::Int
: The number of dimensions in the correspondingBasis
x::AbstractArray
: The points for which theBasisMatrix
should be
constructed
order::Array{Int}
: The order of evaluation for each dimension of the basis
Returns
m::Int
: the total number of derivative order basis functions to compute.
This will be the number of rows in the matrix form of order
order::Matrix{Int}
: Am × N
matrix that, for each of them
desired
specifications, gives the derivative order along all N
dimensions
minorder::Matrix{Int}
: A1 × N
matrix specifying the minimum desired
derivative order along each dimension
numbases::Matrix{Int}
: A1 × N
matrix specifying the total number of
distinct derivative orders along each dimension
x::AbstractArray
: The properly transformed points at which to evaluate
the basis
BasisMatrices.complete_polynomial
— FunctionConstruct basis matrix for complete polynomial of degree d
, given input data z
. z
is assumed to be the degree 1 realization of each variable. For example, if variables are q
, r
, and s
, then z
should be z = [q r s]
Output is a basis matrix. In our example, with d
set to 2 we would have
out = [ones(size(z,1)) q q.^2 q.*r q.*s r r.^2 r.*s s s.^2]
TODO: Currently a bit more code repetition than is desireable. It would be nice to cut down on the repetition between the complete_polynomial
functions TODO: Current algorithm for computing derivatives is kind of slow – Is there any obvious ways to improve this?
BasisMatrices.evalbase
— MethodEvaluate spline basis matrices for a certain order derivative at x
Arguments
p::SplineParams
: ASplineParams
summarizing spline propertiesx(nodes(p))
: the nodes at which to evaluate the basis matricesorder(0)
: The order(s) of derivative for which to evaluate the basis
matrices. order=0
corresponds to the function itself, negative numbers correspond to integrals.
Returns
B::SparseMatrixCSC
: Matrix containing the evaluation of basis functions
at each point in x
. Each column represents a basis function.
x
: Points at which the functions were evaluated
BasisMatrices.lookup
— Functionlookup(table::AbstractVector, x, p::Int=0)
For a sorted vector table
, return the index of the last point smaller than x
. p
specifies endpoint adjustments and takes one of 4 values:
p=0
: no adjustment madep=1
: ifx < minimum(table)
, then returnsum(table .== table[1])
p=2
: ifx > maximum(table)
, then returnlength(table)-sum(table .== table[end])
p=3
: do both adjustments 1 and 2
If p > 3
, the p=3
case is applied
When x
is a vector, a vector of integers is returned
BasisMatrices.nodes
— MethodConstruct interpolation nodes, given SplineParams
Note that p.k - 1
additional nodes will be inserted
Arguments
p::SplineParams
:SplineParams
instance
Returns
x::Vector
: The Vector of 1d interpolation nodes.
BasisMatrices.phi_chain
— MethodFor each number in 1 to n
, compute the Smolyak indices for the corresponding basis functions. This is the $n$ in $\phi_n$. The output is A dictionary whose keys are the Smolyak index n
and values are ranges containing all basis polynomial subscripts for that Smolyak index
BasisMatrices.poly_inds
— FunctionBuild indices specifying all the Cartesian products of Chebychev polynomials needed to build Smolyak polynomial
BasisMatrices.s_n
— MethodFinds the set S_n
, which is the n
th Smolyak set of Chebychev extrema
BasisMatrices.smol_inds
— Methodsmol_inds(d::Int, mu::AbstractVector{Int})
Finds all of the indices that satisfy the requirement that $d \leq \sum_{i=1}^d \leq d + \mu_i$.
This is the anisotropic version of the method that allows mu to vary for each dimension
BasisMatrices.smol_inds
— Methodsmol_inds(d::Int, mu::Int)
Finds all of the indices that satisfy the requirement that $d \leq \sum_{i=1}^d \leq d + \mu$.