DistributedSparseGrids.AHSGType
const AHSG{N,HCP} = AdaptiveHierarchicalSparseGrid{N,HCP}

Shortcut for AdaptiveHierarchicalSparseGrid

DistributedSparseGrids.AdaptiveHierarchicalSparseGridType
AdaptiveHierarchicalSparseGrid{N,HCP}

Container for hierarchical collocation points

Fields

cpts::Vector{PointDict{N,HCP}} : DistributedSparseGrids.PointDict with collocation points pointSetProperties::SVector{N,Int} : Vector containing all pointset properties.

Pointset properties = [psp1,...,pspN], psp_i in [1,2,3,4]. 1=>closed point set, 2=>open point set, 3=>left-open point set, 4=>right-open point set.

DistributedSparseGrids.CollocationPointType
CollocationPoint{N,CT} <: AbstractCollocationPoint{N,CT}

A collocation point.

Fields

i_multi::SVector{N,Int} : The i-th item of this Vector represents to the level of the collocation point in the i-th dimension. pt_idx::SVector{N,Int} : The i-th item of this Vector represents to the point index of the collocation point in the i-th dimension. coords::SVector{N,CT} : Coordinates of the collocation point. interv::SVector{N,SVector{2,CT}} : The i-th item of the Vector defines the non-zero interval of the associated basis function in the i-th dimension.

DistributedSparseGrids.HierarchicalCollocationPointType
HierarchicalCollocationPoint{N,CP,RT} <: AbstractHierarchicalCollocationPoint{N,CP,RT}

A collocation point.

Fields

cpt::CP : DistributedSparseGrids.CollocationPoint children::SVector{N,SVector{2,HierarchicalCollocationPoint{N,CP,RT}}} : Container for at most two children per dimension parents::SVector{N,HierarchicalCollocationPoint{N,CP,RT}} : Container for parents fval::RT : Function Value scaling_weight::RT : Scaling Weight (function value minus l-1 level interpolator both at cpt.coords)

DistributedSparseGrids.PointDictType
PointDict{ N, HCP <: AbstractHierarchicalCollocationPoint{N}}

Typedef for Dict{SVector{N,Int},Dict{SVector{N,Int},HCP}}

N : Dimension of hierarchical sparse grid HCP<:AbstractHierarchicalCollocationPoint : Collocation point type

DistributedSparseGrids.distributed_init_weights!Method
distributed_init_weights!(asg::SG, cpts::AbstractVector{HCP}, fun::F, worker_ids::Vector{Int})

Computes all weights in cpts on all workers in worker_ids.

Arguments

  • asg::SG<:AbstractHierarchicalSparseGrid{N,HCP}}: adaptive sparse grid
  • cpts::AbstractVector{HCP}: all weights of the collocation points in cpts will be (re-)calculated.
  • fun::Function to be interpolated.
  • worker_ids: All available workers (can be added via using Distributed; addprocs(...)).
DistributedSparseGrids.distributed_init_weights!Method
distributed_init_weights!(asg::SG, fun::F, worker_ids::Vector{Int})

Computes all weights in asg on all workers in worker_ids.

Arguments

  • asg::SG<:AbstractHierarchicalSparseGrid{N,HCP}}: adaptive sparse grid
  • fun::Function to be interpolated.
  • worker_ids: All available workers (can be added via using Distributed; addprocs(...)).
DistributedSparseGrids.distributed_init_weights_inplace_ops!Method
distributed_init_weights_inplace_ops!(asg::SG, cpts::AbstractVector{HCP}, fun::F, worker_ids::Vector{Int})

Computes all weights in cpts on all workers in worker_ids. In-place functions mul!(::RT,::RT),mul!(::RT,::Float64),add!(::RT,::RT) have to be defined.

Arguments

  • asg::SG<:AbstractHierarchicalSparseGrid{N,HCP}}: adaptive sparse grid
  • cpts::AbstractVector{HCP}: all weights of the collocation points in cpts will be (re-)calculated.
  • fun::Function to be interpolated.
  • worker_ids: All available workers (can be added via using Distributed; addprocs(...)).
DistributedSparseGrids.distributed_init_weights_inplace_ops!Method
distributed_init_weights_inplace_ops!(asg::SG, fun::F, worker_ids::Vector{Int})

(Re-)computes all weights in asg on all workers in worker_ids. In-place functions mul!(::RT,::RT),mul!(::RT,::Float64),add!(::RT,::RT) have to be defined.

Arguments

  • asg::SG<:AbstractHierarchicalSparseGrid{N,HCP}}: adaptive sparse grid
  • fun::Function to be interpolated.
  • worker_ids: All available workers (can be added via using Distributed; addprocs(...)).
DistributedSparseGrids.generate_next_level!Method
generate_next_level!(asg::AHSG{N,HCP}) where {N,HCP<:AbstractHierarchicalCollocationPoint{N}}

Generates all collocation point of the next hierarchical level.

Constructor

  • asg::AHSG{N,HCP}: sparse grid
DistributedSparseGrids.generate_next_level!Method
generate_next_level!(asg::AHSG{N,HCP}, tol::CT,maxlvl::Int) where {N,CT,CP<:AbstractCollocationPoint{N,CT},HCP<:AbstractHierarchicalCollocationPoint{N,CP}}

Adaptively generate all collocation point of the next hierarchical level, where norm(scaling_weight(cpt)) > tol && level(cpt)<maxlvl.

Constructor

  • asg::AHSG{N,HCP}: sparse grid
  • tol::CT: tolerance
  • maxlvl::Int: maximum hierarchical level
DistributedSparseGrids.initMethod
init(::Type{AHSG{N,HCP}}, pointSetProperties::SVector{N,Int})

Initialize the sparse grid. Returns a N-dimensional sparse grid where only the root point has been created.

Constructor

  • ::Type{AHSG{N,HCP}}: Define type of DistributedSparseGrids.ASHG
  • pointSetProperties::SVector{N,Int}: Vector containing all pointset properties.

Pointset properties = [psp1,...,pspN], psp_i in [1,2,3,4]. 1=>closed point set, 2=>open point set, 3=>left-open point set, 4=>right-open point set.

Example

N = 1; pointprobs = @SVector [1]; RT = Float64; CT = Float64; CPType = CollocationPoint{N,CT}; HCPType = HierarchicalCollocationPoint{N,CPType,RT}; asg = init(AHSG{N,HCPType},pointprobs)

DistributedSparseGrids.init_weights!Method
init_weights!(asg::SG, cpts::AbstractVector{HCP}, fun::F)

(Re-)Computes all weights in cpts.

Arguments

  • asg::SG<:AbstractHierarchicalSparseGrid{N,HCP}}: adaptive sparse grid
  • cpts::AbstractVector{HCP}: all weights of the collocation points in cpts will be (re-)calculated.
  • fun::Function to be interpolated.
DistributedSparseGrids.init_weights!Method
init_weights!(asg::SG, fun::F)

(Re-)Computes all weights in asg.

Arguments

  • asg::SG<:AbstractHierarchicalSparseGrid{N,HCP}}: adaptive sparse grid
  • fun::Function to be interpolated.
DistributedSparseGrids.init_weights_inplace_ops!Method
init_weights_inplace_ops!(asg::SG, cpts::AbstractVector{HCP}, fun::F)

(Re-)Computes all weights in cpts with in-place operations. In-place functions mul!(::RT,::RT),mul!(::RT,::Float64),add!(::RT,::RT) have to be defined.

Arguments

  • asg::SG<:AbstractHierarchicalSparseGrid{N,HCP}}: adaptive sparse grid
  • cpts::AbstractVector{HCP}: all weights of the collocation points in cpts will be (re-)calculated.
  • fun::Function to be interpolated.
DistributedSparseGrids.init_weights_inplace_ops!Method
init_weights_inplace_ops!(asg::SG, fun::F)

(Re-)Computes all weights in asg with in-place operations. In-place functions mul!(::RT,::RT),mul!(::RT,::Float64),add!(::RT,::RT) have to be defined.

Arguments

  • asg::SG<:AbstractHierarchicalSparseGrid{N,HCP}}: adaptive sparse grid
DistributedSparseGrids.integrateMethod
integrate(asg::SG) where {N,CP,RT,HCP<:AbstractHierarchicalCollocationPoint{N,CP,RT}, SG<:AbstractHierarchicalSparseGrid{N,HCP}}

Integrates the sparse grid. Returns an instance of RT.

Constructor

  • asg::SG: adaptie sparse grid
DistributedSparseGrids.interpolateMethod
interpolate(asg::SG, x::VCT, stplvl::Int=numlevels(asg))

Interpolate at position x.

Arguments

  • asg::SG<:AbstractHierarchicalSparseGrid{N,HCP}}: initialized adaptive sparse grid
  • cpts::Dict{SVector{N,Int},Dict{SVector{N,Int},HCP}}: Dict cointaining all collocation points
DistributedSparseGrids.root_pointMethod
root_point(::Type{CollocationPoint{N,CT}}) where {N,CT<:Real}

generates a root point.

Constructor

  • ::Type{CollocationPoint{N,CT}}: a colloction point of dimension N and collocation type CT.