bs_sparse_gaussian module¶
Sets up sparse integration over a Gaussian, given text files that contain rescaled Gauss-Hermite nodes and weights.
These files must be named GHsparseGrid{ndims}prec{iprec}.txt
, where
ndims
is the number of dimensions of integration
and iprec
is a precision level that must be 9, 13, or (most precise) 17.
The file must have (ndims+1)
columns,
with the weights in the first column.
The nodes and weights are rescaled so that f(nodes) @ weights
approximates
Ef(X)
for X
an N(0,I)
variable.
setup_sparse_gaussian(ndims, iprec, GHsparsedir=None)
¶
Get nodes and weights for sparse integration Ef(X) with X = N(0,1) in
ndims
dimensions.
Examples:
1 2 |
|
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ndims
|
int
|
number of dimensions (1 to 5) |
required |
iprec
|
int
|
precision (must be 9, 13, or 17) |
required |
GHsparsedir
|
str | None
|
the name of a directory that contains nodes and weights |
None
|
Returns:
Type | Description |
---|---|
TwoArrays
|
a pair of arrays |
TwoArrays
|
|
Source code in bs_python_utils/bs_sparse_gaussian.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|