sgpykit.util.create_sparse_grid_construct

Functions

apply_lev2knots(i, lev2knots[, N])

Apply level-to-knots mapping to an index array.

create_sparse_grid_construct(C, N, knots, ...)

Construct a sparse grid from a given set of multi-indices.

find_lexicographic(lookfor, I[, nocheck])

Find specific rows of a matrix that is sorted lexicographically.

matlab_to_python_index(var)

Convert MATLAB-style index to Python-style index.

tensor_grid(N, m, knots)

Generate a tensor grid and compute the corresponding weights.

sgpykit.util.create_sparse_grid_construct.create_sparse_grid_construct(C, N, knots, lev2knots, S2=None, base=0)[source]

Construct a sparse grid from a given set of multi-indices.

This function builds a sparse grid by combining tensor grids according to the combination technique. It optionally reuses tensor grids from a previously constructed sparse grid to improve efficiency.

Parameters:
Cndarray

Array of multi-indices (in 0 or 1-based index scheme) defining the sparse grid.

Nint

Number of dimensions.

knotscallable or list of callable

Function(s) to generate knots for each dimension.

lev2knotscallable

Function to convert level indices to number of knots.

S2struct, optional

Previously constructed sparse grid for tensor grid recycling.

baseint, optional

if matrix C is using 1-based indexing

Returns:
Sstruct

Constructed sparse grid with fields: - knots : Cell array of knot coordinates for each tensor grid. - weights : Cell array of weights for each tensor grid. - size : Cell array of sizes for each tensor grid. - knots_per_dim : Cell array of knots per dimension for each tensor grid. - m : Cell array of level indices for each tensor grid. - coeff : Array of combination technique coefficients. - idx : Array of multi-indices corresponding to each tensor grid.

Cndarray

Array of multi-indices used in the construction (0-based indexing).