Public API

Index

    Exported types and functions

    UnifiedSparseGrids.CombinationSubproblemType

    A single full-grid subproblem in the sparse grid combination technique.

    Fields:

    • cap: full-tensor refinement-cap vector L (0-based), meaning the tensor grid includes all subspaces W_ℓ with ℓ ≤ L componentwise.
    • weight: integer combination weight.
    source
    UnifiedSparseGrids.CrossGridPlanType

    Plan for applying a (possibly) cross-grid tensor-product operator.

    The plan chooses an intermediate covering grid gridW that provides a stable storage layout for unidirectional sweeps.

    • If gridX === gridW, input embedding is skipped.
    • If gridY === gridW, output restriction is skipped.

    Otherwise, x_to_w and/or y_to_w hold index maps into gridW.

    source
    UnifiedSparseGrids.CyclicLayoutPlanMethod
    CyclicLayoutPlan(grid, ::Type{T}; Ti=Int)

    Build a reusable cyclic-layout plan for grid and coefficient element type T. The plan captures the current :default thread-pool size and precomputes one layout-only fiber queue per cyclic orientation.

    source
    UnifiedSparseGrids.DyadicNodesType
    struct DyadicNodes{O,EM} <: AbstractNestedNodes

    Nested dyadic node family on [0, 1] with storage order O and endpoint mask EM. With both endpoints present, the total number of points is 2^level + 1 at refinement level level.

    source
    UnifiedSparseGrids.HatBasisType

    Piecewise-linear hierarchical hat basis on dyadic grids.

    The basis adapts to the node rule: if the dyadic nodes include endpoints at level 0, the basis includes the corresponding boundary functions; otherwise, level 0 is empty.

    source
    UnifiedSparseGrids.LevelOrderType
    struct LevelOrder <: AbstractNodeOrder

    Hierarchical one-dimensional order obtained by recursively splitting even indices before odd indices. On radix-2 grids this agrees with bit reversal.

    source
    UnifiedSparseGrids.LineBandedOpType
    struct LineBandedOp{Part,F} <: AbstractLineOp

    Size-parameterized banded family acting on one fiber.

    The family function f(n, T) must return a square BandedMatrices.AbstractBandedMatrix of size n × n; the recommended concrete return type is BandedMatrix. Smaller refinement levels reuse leading principal banded views, so the family must be prefix-compatible across n.

    When a banded family is algebraically lower- or upper-triangular, prefer LineBandedOp(Val(:lower), f) or LineBandedOp(Val(:upper), f) so UpDownTensorOp can avoid splitting that dimension.

    source
    UnifiedSparseGrids.LineDiagonalOpType
    struct LineDiagonalOp{F} <: AbstractLineOp

    Size-parameterized diagonal family acting on one fiber.

    The family function f(n, T) must return a vector-like container of diagonal entries of length n. Smaller refinement levels reuse prefix views d[1:m], so the family must be prefix-compatible across n.

    source
    UnifiedSparseGrids.LineMatrixOpType
    struct LineMatrixOp{MatVecT<:AbstractVector} <: AbstractLineOp

    Level-dependent dense or structured square matrix family acting on one fiber.

    source
    UnifiedSparseGrids.SparseGridType

    Sparse grid container.

    A SparseGrid stores only its specification (SparseGridSpec). Layouts are views over the same coefficient set and are selected explicitly when iterating.

    source
    UnifiedSparseGrids.SubspaceLayoutType

    Subspace (block) coefficient order.

    Coefficients are grouped by hierarchical increment blocks indexed by refinement vectors r = (r_1,\ldots,r_D). Each block is stored contiguously as a tensor-product block, and the blocks are concatenated in a deterministic (sum, colex) order.

    source
    UnifiedSparseGrids.TransferPlanType

    Plan for transferring vectors between a small grid and a big grid.

    The plan stores a map from indices in the small grid traversal into indices in the big grid traversal.

    This is intended for cheap gather/scatter operations when traverse(grid_small) is an ordered subsequence of traverse(grid_big) up to a coordinate mapping.

    source
    UnifiedSparseGrids.UpDownTensorOpType
    struct UpDownTensorOp{D,OpsT,LOpsT,UOpsT} <: AbstractTensorOp{D}

    Tensor operator evaluated as a sum of triangular tensor terms from per-dimension L + U splits.

    source
    UnifiedSparseGrids.UpDownTensorOpMethod
    UpDownTensorOp(ops; omit_dim=1)

    Construct an UpDownTensorOp by pre-splitting each dimension into lower and upper factors.

    omit_dim == 0 keeps all split dimensions in the term expansion. 1 <= omit_dim <= D omits that physical dimension from the split and instead applies the unsplit line operator in that dimension.

    source
    UnifiedSparseGrids.active_localMethod

    Return the (0-based) local indices in level with nonzero basis value at x.

    For most local bases (hat / piecewise polynomial) this is either empty or a singleton tuple.

    source
    UnifiedSparseGrids.apply_lastdim_cycled!Method
    apply_lastdim_cycled!(dest, src, grid, op, plan)
    apply_lastdim_cycled!(dest, src, grid, op)

    Apply op along the last storage dimension and write the result in the next cyclic orientation.

    source
    UnifiedSparseGrids.apply_line!Method

    Apply an in-place line operator on a single fiber.

    In-place line ops may still take an optional per-refinement plan (see lineplan).

    The work argument is a caller-provided scratch buffer (same length as buf). Thread-safe planned operators must not mutate internal scratch; use work instead.

    source
    UnifiedSparseGrids.apply_line!Method
    apply_line!(outbuf, op, inp, work, nodes, level, plan)
    apply_line!(op, buf, work, nodes, level, plan)

    Apply one line operator to a single fiber, using work as caller-owned scratch.

    source
    UnifiedSparseGrids.apply_unidirectional!Method
    apply_unidirectional!(u, grid, op, plan)
    apply_unidirectional!(u, grid, op)

    Apply a line, tensor, composite, or UpDown operator to u using cyclic unidirectional sweeps.

    For UpDownTensorOp, the backend is chosen automatically from the number of effective split terms: if Threads.threadpoolsize(:default) > 1 and 2*nterms >= pool, term-level parallelism is used; otherwise fiber-level parallelism is used.

    source
    UnifiedSparseGrids.blocksizeMethod
    blocksize(axis::AbstractAxisFamily, r::Integer)

    Return the number of entries in the increment block added at refinement level r.

    source
    UnifiedSparseGrids.each_combination_subproblemMethod

    Enumerate full-grid subproblems for the sparse grid combination technique.

    For dimension d and level parameter n, this returns the collection of full-tensor refinement-cap vectors L and their integer weights.

    The combination layers are grouped by |L|₁:

    • |L|₁ = n + d - 1 has weight +binomial(d-1, 0)
    • |L|₁ = n + d - 2 has weight -binomial(d-1, 1)
    • |L|₁ = n has weight (-1)^(d-1) * binomial(d-1, d-1)

    Keyword arguments:

    • cap: optional per-dimension upper bound on L (isotropic Integer or NTuple{d} / SVector{d} cap).

    Notes:

    This function uses the package's 0-based level convention.

    source
    UnifiedSparseGrids.each_lastdim_fiberMethod
    each_lastdim_fiber(spec)
    each_lastdim_fiber(grid, perm)
    each_lastdim_fiber(grid)

    Iterate the contiguous last-dimension fibers of a sparse-grid specification or grid.

    source
    UnifiedSparseGrids.embed!Method

    Embed a subgrid vector into a covering grid vector (missing entries set to zero).

    This is a convenience wrapper around the internal scatter kernel.

    plan must be a TransferPlan from the small grid to the big grid.

    source
    UnifiedSparseGrids.evaluateMethod

    Sample a function f on the sparse grid points.

    The returned vector is ordered consistently with traverse(grid). f is called with an SVector{D,T}.

    source
    UnifiedSparseGrids.integrate_adaptiveMethod

    Dimension-adaptive sparse quadrature over a static admissibility envelope.

    Returns (integral, state) where state follows the Gerstner–Griebel active/old semantics:

    • integral already includes contributions from both active and old indices,
    • eta is the additive estimate over the active set only,
    • accepted records activation order, and
    • frontier_pops records the order in which active indices are moved to old.
    source
    UnifiedSparseGrids.jacobi_precondMethod

    Construct a Jacobi (diagonal) preconditioner from a diagonal vector.

    Zero diagonal entries are treated as fixed-0 dofs: their inverse is set to zero.

    source
    UnifiedSparseGrids.lineplanMethod
    lineplan(op::LineBandedOp, axis::AbstractUnivariateNodes, rmax::Integer, ::Type{T}) where {T<:Number}

    Build a cached vector of banded principal-prefix views for LineBandedOp. The family function f(n, T) must return a square BandedMatrices.AbstractBandedMatrix of size n × n, and smaller levels reuse leading principal banded views.

    source
    UnifiedSparseGrids.lineplanMethod
    lineplan(op::LineDiagonalOp, axis::AbstractUnivariateNodes, rmax::Integer, ::Type{T}) where {T<:Number}

    Build a cached vector of diagonal-data prefixes for LineDiagonalOp. The family function f(n, T) must return a vector-like container of length n, and smaller levels reuse prefix views d[1:m].

    source
    UnifiedSparseGrids.ncoeffMethod

    Number of coefficients for basis at axis family axis and refinement index r.

    Default: matches the axis size, i.e. totalsize(axis, r).

    source
    UnifiedSparseGrids.plan_evaluateMethod

    Create an evaluation plan.

    bases may be a single univariate basis (used for all dimensions) or an explicit NTuple{D}.

    backend=:auto selects:

    • :unidirectional for TensorProductPoints,
    • :pseudorecursive for ScatteredPoints with all LocalSupport() bases,
    • :naive otherwise.
    source
    UnifiedSparseGrids.qdiffruleMethod

    Incremental 1D difference rule Δ_r.

    For non-nested families the default is the full rule qrule(Q, r); nested families should specialize this to return the true incremental difference rule.

    source
    UnifiedSparseGrids.restrict!Method

    Restrict values from a covering grid vector into a subgrid vector.

    This is a convenience wrapper around the internal gather kernel.

    plan must be a TransferPlan from the small grid to the big grid.

    source
    UnifiedSparseGrids.subgrid_index_mapMethod

    Return an index map from a subgrid to a covering grid.

    map[i] is the index in grid_big corresponding to index i in grid_small.

    This is valid when traverse(grid_small) produces an ordered subsequence of traverse(grid_big).

    The returned indices refer to the recursive-layout ordering of each grid.

    source
    UnifiedSparseGrids.traverseMethod

    Iterate sparse grid coordinates in a chosen layout.

    This iterator emits pseudo-recursive coordinates coords::SVector{D,Int}: for each physical dimension d, the coordinate is the 1-based position in the hierarchical concatenation of refinement blocks.

    Use layout=RecursiveLayout() for the package's native recursive order, and layout=SubspaceLayout() for contiguous subspace blocks.

    source