sgpykit

Functions

GK_lev_table(row_idx, col_idx)

Return entries from the Gauss-Kronrod level table.

adapt_sparse_grid(f, N_full, knots, ...)

Compute an adaptive sparse grid approximation of a function f.

asreduced(pts_list[, wgs_list])

Construct a reduced sparse grid structure from given points and weights.

cheb_eval(x, k, a, b)

Evaluate the k-th Chebyshev polynomial of the first kind on [a,b].

cheb_eval_multidim(X, k, a, b)

Evaluate the multidimensional Chebyshev polynomial of the first kind of order k (multi-index) on [a,b]^N.

check_index_admissibility(idx, idx_set[, ...])

Check if a multiindex is admissible with respect to an index set.

check_set_admissibility(I[, matlab_idx])

Check if a given index set is admissible and return the admissible set.

clear()

combination_technique(I)

Compute the coefficients of the combination technique expression of a sparse grid.

compare_sparse_grids(S, Sr, S_old, Sr_old[, tol])

Compare the points of two sparse grids.

compute_modal_tensor(S, S_values, domain, flags)

Convert a tensor grid interpolant to a modal expansion in orthogonal polynomials.

compute_sobol_indices_from_sparse_grid(S, ...)

Compute Sobol indices from a sparse grid approximation of a scalar-valued function.

convert_to_modal(S, Sr, nodal_values, ...)

Convert a sparse grid interpolant to a modal (spectral) expansion.

create_sparse_grid(N, w, knots, lev2knots[, ...])

Generate a sparse grid (and corresponding quadrature weights) as a linear combination of full tensor grids, employing formula (2.9) of [Nobile-Tempone-Webster, SINUM 46/5, pages 2309-2345].

create_sparse_grid_add_multiidx(new_idx, ...)

Produce a grid obtained by adding a single multi-idx to a previously existing grid.

create_sparse_grid_multiidx_set(C, knots, ...)

Create a sparse grid starting from a multiindex-set rather than from a rule IDXSET(I) <= W.

create_sparse_grid_quick_preset(N, w)

Create a sparse grid with a quick preset configuration.

define_functions_for_rule(rule, input2)

Define the level-to-knots and index set functions for a given sparse grid rule.

delta_to_combitec(ii)

Compute the combination technique contributions of a multi-index.

derive_sparse_grid(S, Sr, values_on_grid, ...)

Compute derivatives (gradients) of a scalar-valued function f: R^N -> R by centered finite differences formulas applied to the sparse grid approximation of f.

detect_insufficient_tolerance(pts, tol)

Check if the given tolerance is sufficient to detect identical points.

evaluate_on_sparse_grid(f, S, Sr[, ...])

Evaluate a function on a sparse grid, possibly recycling previous calls.

export_sparse_grid_to_file(Sr[, filename, ...])

Save knots of a reduced sparse grid to an ASCII file.

fast_TD_set(N, w[, base])

Generate the total-degree multi-index set TD(w) in N dimensions.

figure_create([nrows, ncols, figsize, dims])

find_lexicographic(lookfor, I[, nocheck])

Find specific rows of a matrix that is sorted lexicographically.

find_lexicographic_tol(lookfor, I[, tol])

Find specific rows of a matrix that is sorted lexicographically up to TOL.

generalized_lagu_eval(x, k, alpha, beta)

Evaluate the k-th generalized Laguerre polynomial orthonormal in [0, +inf).

generalized_lagu_eval_multidim(X, k, alpha, beta)

Evaluate the multidimensional generalized Laguerre polynomial of order k (multi-index) orthonormal on [0, +inf)^N with respect to the weight function: rho = prod_i beta_i^(alpha_i+1)/Gamma(alpha_i+1) * x^alpha_i * exp(-beta_i * x), where alpha_i > -1 and beta_i > 0.

generate_pattern(m)

Generate a pattern matrix for the Cartesian product of sequences.

get_interval_map(a, b, type_)

Build a mapping function to shift sparse grids from a reference domain to a target domain.

herm_eval(x, k, mi, sigma)

Evaluate the k-th orthonormal Hermite polynomial at points x.

herm_eval_multidim(X, k, mu, sig)

Evaluate the multidimensional Hermite polynomial of order k (multi-index) orthonormal on [-inf, +inf]^N with respect to the Gaussian weight function.

hessian_sparse_grid(S, Sr, values_on_grid, ...)

Compute the Hessian of a scalar-valued function f: R^N -> R by finite differences applied to the sparse grids approximation of f.

interpolate_on_sparse_grid(S, Sr, ...)

Interpolate a function on a sparse grid.

is_sparse_grid(S)

Check if the input is a sparse grid.

is_tensor_grid(S)

Check if a given struct is a tensor grid or a tensor grid in a sparse grid struct.

isequal_sparse_grids(S1, S2[, tol])

Compare two sparse grids for equality.

isequal_tensor_grids(T1, T2[, tol])

Compare two tensor grids field by field, checking that the two grids are identical and accounting for numerical tolerance when comparing knots and weights.

islexico(a, b)

Check lexicographic order of vectors.

islexico_tol(a, b, tol)

Check if vector a is lexicographically less-or-equal than vector b up to a numerical tolerance.

isreduced(S)

Check if a given object is a reduced sparse grid.

jacobi_prob_eval(x, k, alpha, beta, a, b)

Evaluate the k-th Jacobi probabilistic polynomial orthonormal in [a,b].

jacobi_prob_eval_multidim(X, k, alpha, beta, ...)

Evaluate the multidimensional probabilistic Jacobi polynomial of order k (multi-index) orthonormal on [a1,b1] x [a2,b2] x [a3,b3] x .

knots_CC(nn, x_a, x_b[, whichrho])

Calculate the collocation points and weights for the Clenshaw-Curtis integration formula.

knots_GK(n, mi, sigma)

Compute collocation points and weights for Genz-Keister quadrature.

knots_beta(n, alpha, beta, x_a, x_b)

Calculate the collocation points (x) and weights (w) for Gaussian integration with respect to the Beta distribution weight function.

knots_beta_leja(n, alpha, beta, x_a, x_b, type_)

Compute the first n collocation points (x) and the corresponding weights (w) for the weighted Leja sequence for integration w.r.t to the weight function rho(x)=Gamma(alpha+beta+2)/ (Gamma(alpha+1)*Gamma(beta+1)*(x_b-x_a)^(alpha+beta+1)) * (x-x_a)^alpha * (x_b-x)^beta i.e. the density of a Beta random variable with range [x_a,x_b], alpha,beta>-1.

knots_exponential(n, lambda_)

Compute collocation points and weights for Gaussian integration with respect to the exponential weight function.

knots_exponential_leja(n, lambda_)

Returns the collocation points (x) and the weights (w) for the weighted Leja sequence for integration with respect to the weight function rho(x) = exp(-lambda * abs(x)), lambda > 0, i.e., the density of an exponential random variable with rate parameter lambda.

knots_gamma(n, alpha, beta)

Compute collocation points and weights for Gaussian integration w.r.t.

knots_gamma_leja(n, alpha, beta[, saving_flag])

Compute the first n collocation points and corresponding weights for the weighted Leja sequence for integration with respect to the Gamma density.

knots_leja(n, x_a, x_b, type_[, whichrho])

Compute Leja points and weights for numerical integration.

knots_midpoint(n, x_a, x_b[, whichrho])

Generate nodes and weights for the n-point midpoint quadrature rule.

knots_normal(n, mi, sigma)

Calculate the collocation points (x) and weights (w) for Gaussian integration with respect to the weight function rho(x) = 1/sqrt(2*pi*sigma^2) * exp(-(x-mi)^2 / (2*sigma^2)), i.e., the density of a Gaussian random variable with mean mi and standard deviation sigma.

knots_normal_leja(n, mi, sigma, type_)

Compute collocation points and weights for Gaussian-weighted Leja sequences.

knots_trap(n, x_a, x_b[, whichrho])

Compute knots and weights for the trapezoidal quadrature rule.

knots_triangular_leja(n, a, b)

Returns the collocation points (x) and the weights (w) for the weighted Leja sequence for integration with respect to the weight function rho(x) = 2/(b-a)^2 (b-x), i.e., a linear decreasing pdf over the interval [a, b].

knots_uniform(n, x_a, x_b[, whichrho])

Calculate collocation points and weights for Gaussian integration with respect to a uniform weight function.

lagr_eval(current_knot, other_knots, ...)

Evaluate the Lagrange basis polynomial at non-grid points.

lagr_eval_fast(current_knot, other_knots, ...)

Evaluate the Lagrange basis polynomial at non-grid points.

lagr_eval_multidim(current_knot, ...)

Evaluate the multidimensional Lagrange function centered at current_knot in non_grid_points.

lagu_eval(x, k, lambda_)

Evaluate the k-th Laguerre polynomial orthonormal in [0, +inf) w.r.t.

lagu_eval_multidim(X, k, lambda_)

Evaluate the multidimensional Laguerre polynomial of order k (multi-index) orthonormal on [0, +inf)^N with respect to rho=prod_i lambda_i*exp(-lambda_i*x), lambda_i>0 on the list of points X (each column is a point in R^N).

lege_eval(x, k, a, b)

Evaluate the k-th orthonormal Legendre polynomial on the interval [a, b].

lege_eval_multidim(X, k, a, b)

Evaluate the multidimensional Legendre polynomial of order k (multi-index) orthonormal on [a,b]^N on the list of points X (each column is a point in R^N).

lev2knots_2step(I)

Convert level index to number of knots using the 2-step rule.

lev2knots_GK(I)

Map sparse-grid levels to the corresponding number of knots using the Genz-Keister (GK) table.

lev2knots_doubling(I)

Convert level index to number of knots using a doubling rule.

lev2knots_lin(I)

Relation between level and number of points for linear level-to-knots mapping.

lev2knots_tripling(I)

Convert sparse-grid level index to number of knots using a tripling rule.

lookup_merge_and_diff(pts_list, pts_list_old)

Identify points to compute, recycle, and discard between two sparse grids.

multiidx_box_set(shape[, min_idx])

Generate a set of multi-dimensional box indices up to a given shape.

multiidx_gen(N, rule, w[, base, multiidx, ...])

Generate all multi-indexes of length N with elements such that rule(M_I) <= w.

mysortrows(A[, tol])

Sort the rows of a matrix in lexicographic order with a tolerance.

plot(ax, x, y, *args, **kwargs)

Plot data on a given axis with optional formatting.

plot3_sparse_grid(S, dims, *args, **kwargs)

Plot a sparse grid in 3D.

plot_idx_status(G, I, idx_bin, idx)

Plot the status of a two-dimensional adaptive sparse grid.

plot_multiidx_set(ax, I, *args, **kwargs)

Plot the index set I for 2D and 3D cases.

plot_sparse_grid(ax, S, dims, *args, **kwargs)

Plot object based on the provided structure S and dimensions.

plot_sparse_grids_interpolant(ax, S, Sr, ...)

Plot the sparse grid interpolant of a function.

quadrature_on_sparse_grid(f, S, Sr[, ...])

Compute the integral of a function using a sparse grid.

reduce_sparse_grid(S[, tol])

Reduce a sparse grid by removing duplicate points within a given tolerance.

standard_lege_eval(x, k)

Evaluate the k-th standard Legendre polynomial.

tensor_grid(N, m, knots)

Generate a tensor grid and compute the corresponding weights.

tensor_to_sparse(T[, idx])

Convert a tensor grid into a sparse grid structure.

univariate_interpolant(grid_points, ...)

Interpolates values at non_grid_points using a Lagrange interpolant built from given grid_points and tabulated function_on_grid.

Modules

main

src

tools

util