SG++-Doxygen-Documentation
Loading...
Searching...
No Matches
python.uq.operations.sparse_grid Namespace Reference

Functions

 add (alpha, alphas)
 
 addConst (grid, alpha, c, y)
 
 balance (grid)
 
 checkInterpolation (grid, alpha, nodalValues, epsilon=1e-13)
 
 checkPositivity (grid, alpha)
 
 copyGrid (grid, level=0, deg=1)
 
 createGrid (grid, dim, deg=1, addTruncatedBorder=False)
 
 dehierarchize (grid, alpha)
 
 dehierarchizeList (grid, alpha, gps)
 
 dehierarchizeOnNewGrid (gridResult, grid, alpha)
 
 estimateConvergence (grid, gp, v)
 
 estimateSurplus (grid, gp, v)
 def estimateSurplus(grid, gp, v): gs = grid.getStorage() ix = gs.getSequenceNumber(gp)
 
 evalHierToTop (basis, grid, coeffs, gp, d)
 
 evalSGFunction (grid, alpha, p, isConsistent=True)
 
 evalSGFunctionBasedOnParents (grid, alpha, gpi)
 
 evalSGFunctionMulti (grid, alpha, samples, isConsistent=True)
 
 getBasis (grid)
 
 getBoundsOfSupport (gs, level, index, gridType=GridType_Linear)
 
 getDegree (grid)
 
 getGridPointsOnBoundary (level, index)
 
 getGridPointsOnBoundaryEfficiently (level, index)
 
 getHierarchicalAncestors (grid, gp)
 
 getIndex (gp)
 
 getLevel (gp)
 
 getLevelIndex (gp)
 
 getNonExistingHierarchicalAncestors (grid, gp)
 
 hasAllChildren (grid, gp)
 
 hasBorder (gridType)
 
 hasChildren (grid, gp)
 
 haveHierarchicalRelationshipByLevelIndex (location_i, location_j)
 
 haveOverlappingSupport (gpi, gpj)
 
 haveOverlappingSupportByLevelIndex (location_i, location_j)
 
 haveOverlappingSupportDimx (lid, iid, ljd, ijd)
 
 hierarchize (grid, nodalValues, isConsistent=True, ignore=None)
 
 hierarchizeBruteForce (grid, nodalValues, ignore=None)
 
 hierarchizeEvalHierToTop (grid, nodalValues)
 
 insertHierarchicalAncestors (grid, gp)
 
 insertPoint (grid, gp)
 
 insertTruncatedBorder (grid, gp)
 
 isHierarchicalAncestor (gpi, gpj)
 
 isHierarchicalAncestorByLevelIndex (location_i, location_j)
 
 isHierarchicalAncestorDimx (li, ii, lj, ij)
 
 isRefineable (grid, gp)
 
 isValid (grid, gp)
 
 isValid1d (grid, level, index)
 
 loadOperationMultiEval (grid, samples, isConsistent=True)
 
 parent (grid, gp, d)
 
 parents (grid, gp)
 
 sub (alpha, alphas)
 

Variables

list bsplineBoundaryGridTypes
 
list bsplineGridTypes = bsplineNoBoundaryGridTypes + bsplineBoundaryGridTypes
 
list bsplineNoBoundaryGridTypes
 
list linearBoundaryGridTypes
 
list linearGridTypes = linearNoBoundaryGridTypes + linearBoundaryGridTypes
 
list linearNoBoundaryGridTypes
 
list multipleEvalNaiveGridTypes
 
list polyBoundaryGridTypes
 
list polyGridTypes = polyNoBoundaryGridTypes + polyBoundaryGridTypes
 
list polyNoBoundaryGridTypes
 

Function Documentation

◆ add()

python.uq.operations.sparse_grid.add (   alpha,
  alphas 
)

◆ addConst()

python.uq.operations.sparse_grid.addConst (   grid,
  alpha,
  c,
  y 
)

◆ balance()

python.uq.operations.sparse_grid.balance (   grid)

◆ checkInterpolation()

python.uq.operations.sparse_grid.checkInterpolation (   grid,
  alpha,
  nodalValues,
  epsilon = 1e-13 
)

◆ checkPositivity()

python.uq.operations.sparse_grid.checkPositivity (   grid,
  alpha 
)

◆ copyGrid()

python.uq.operations.sparse_grid.copyGrid (   grid,
  level = 0,
  deg = 1 
)

◆ createGrid()

python.uq.operations.sparse_grid.createGrid (   grid,
  dim,
  deg = 1,
  addTruncatedBorder = False 
)

◆ dehierarchize()

python.uq.operations.sparse_grid.dehierarchize (   grid,
  alpha 
)

◆ dehierarchizeList()

python.uq.operations.sparse_grid.dehierarchizeList (   grid,
  alpha,
  gps 
)
evaluate sparse grid function at grid points in gps
@param grid: Grid
@param alpha: DataVector
@param gps: list of HashGridPoint

◆ dehierarchizeOnNewGrid()

python.uq.operations.sparse_grid.dehierarchizeOnNewGrid (   gridResult,
  grid,
  alpha 
)

◆ estimateConvergence()

python.uq.operations.sparse_grid.estimateConvergence (   grid,
  gp,
  v 
)

◆ estimateSurplus()

python.uq.operations.sparse_grid.estimateSurplus (   grid,
  gp,
  v 
)

def estimateSurplus(grid, gp, v): gs = grid.getStorage() ix = gs.getSequenceNumber(gp)

surplus is already known

if ix < len(v): print( "warning: not estimated", ) return v[ix]

vgp = []

get all available parents

myParents = [(d, pgp) for (d, pgp) in parents(grid, gp) if gs.isContaining(pgp)] vparents = np.ndarray(len(myParents), dtype='float') for i, (dp, p) in enumerate(myParents): ipar = gs.getSequenceNumber(p) vparents[i] = v[ipar]

get all grand parents = parents of parents

for dgrp, grp in parents(grid, p):

use a linear extrapolation through parent and grandparent

to estimate the surplus of the current collocation node

igrandpar = gs.getSequenceNumber(grp) xpar = p.getStandardCoordinate(dgrp) xgrandpar = grp.getStandardCoordinate(dgrp) xgp = p.getStandardCoordinate(dgrp) + 2 ** -gp.getLevel(dp)

slope between parent and grand parent

a = (v[ipar] - v[igrandpar]) / (xpar - xgrandpar)

half the slope for the child

a /= 2.

same behavior -> keep direction

if (v[ipar] > 0 and v[igrandpar] > 0) or \ (v[ipar] < 0 and v[igrandpar] < 0): sign = 1.

alternating behavior -> change direction

else: sign = -1.

a *= sign

add constant part

b = v[ipar] - a * xpar

force extrapolation with half the difference between

father and grand father for the child

xgp = xpar + (xpar - xgrandpar) / 2.

do the linear extrapolation

y = a * xgp + b

import matplotlib.pyplot as plt

plt.plot([xpar, xgp], [a * xi + b for xi in [xpar, xgp]])

plt.plot([xgrandpar, xpar], [sign * 2 * a * xi + v[ipar]

- sign * 2 * a * xpar

for xi in [xgrandpar, xpar]])

plt.plot(xpar, v[ipar], marker='p', label='parent')

plt.plot(xgrandpar, v[igrandpar], marker='o', label='grand father')

plt.plot(xgp, y, marker='x', label='self')

plt.legend(loc='best')

plt.show()

        vgp.append(y)

if len(vgp) == 0:
    vgp = vparents

return np.max(vgp)
Linear extrapolation of the surplus
@param grid: Grid
@param gp: HashGridPoint
@param v: DataVector, surplus vector
@return: float, estimated surplus for gp

◆ evalHierToTop()

python.uq.operations.sparse_grid.evalHierToTop (   basis,
  grid,
  coeffs,
  gp,
  d 
)

◆ evalSGFunction()

python.uq.operations.sparse_grid.evalSGFunction (   grid,
  alpha,
  p,
  isConsistent = True 
)

◆ evalSGFunctionBasedOnParents()

python.uq.operations.sparse_grid.evalSGFunctionBasedOnParents (   grid,
  alpha,
  gpi 
)

References f.

◆ evalSGFunctionMulti()

python.uq.operations.sparse_grid.evalSGFunctionMulti (   grid,
  alpha,
  samples,
  isConsistent = True 
)

◆ getBasis()

python.uq.operations.sparse_grid.getBasis (   grid)

◆ getBoundsOfSupport()

python.uq.operations.sparse_grid.getBoundsOfSupport (   gs,
  level,
  index,
  gridType = GridType_Linear 
)

◆ getDegree()

python.uq.operations.sparse_grid.getDegree (   grid)

◆ getGridPointsOnBoundary()

python.uq.operations.sparse_grid.getGridPointsOnBoundary (   level,
  index 
)

◆ getGridPointsOnBoundaryEfficiently()

python.uq.operations.sparse_grid.getGridPointsOnBoundaryEfficiently (   level,
  index 
)

◆ getHierarchicalAncestors()

python.uq.operations.sparse_grid.getHierarchicalAncestors (   grid,
  gp 
)

◆ getIndex()

python.uq.operations.sparse_grid.getIndex (   gp)

◆ getLevel()

python.uq.operations.sparse_grid.getLevel (   gp)

◆ getLevelIndex()

python.uq.operations.sparse_grid.getLevelIndex (   gp)

◆ getNonExistingHierarchicalAncestors()

python.uq.operations.sparse_grid.getNonExistingHierarchicalAncestors (   grid,
  gp 
)

◆ hasAllChildren()

python.uq.operations.sparse_grid.hasAllChildren (   grid,
  gp 
)

◆ hasBorder()

python.uq.operations.sparse_grid.hasBorder (   gridType)

◆ hasChildren()

python.uq.operations.sparse_grid.hasChildren (   grid,
  gp 
)

◆ haveHierarchicalRelationshipByLevelIndex()

python.uq.operations.sparse_grid.haveHierarchicalRelationshipByLevelIndex (   location_i,
  location_j 
)

◆ haveOverlappingSupport()

python.uq.operations.sparse_grid.haveOverlappingSupport (   gpi,
  gpj 
)

◆ haveOverlappingSupportByLevelIndex()

python.uq.operations.sparse_grid.haveOverlappingSupportByLevelIndex (   location_i,
  location_j 
)

◆ haveOverlappingSupportDimx()

python.uq.operations.sparse_grid.haveOverlappingSupportDimx (   lid,
  iid,
  ljd,
  ijd 
)

◆ hierarchize()

python.uq.operations.sparse_grid.hierarchize (   grid,
  nodalValues,
  isConsistent = True,
  ignore = None 
)

◆ hierarchizeBruteForce()

python.uq.operations.sparse_grid.hierarchizeBruteForce (   grid,
  nodalValues,
  ignore = None 
)

◆ hierarchizeEvalHierToTop()

python.uq.operations.sparse_grid.hierarchizeEvalHierToTop (   grid,
  nodalValues 
)

◆ insertHierarchicalAncestors()

python.uq.operations.sparse_grid.insertHierarchicalAncestors (   grid,
  gp 
)

◆ insertPoint()

python.uq.operations.sparse_grid.insertPoint (   grid,
  gp 
)
insert a grid point to the storage if it is valid. Returns the
sequence number of the new grid point in the storage

◆ insertTruncatedBorder()

python.uq.operations.sparse_grid.insertTruncatedBorder (   grid,
  gp 
)
insert points on the border recursively for grids with border
@param grid: Grid
@param gp: HashGridPoint
@return: list of HashGridPoint, contains all the newly added grid points

◆ isHierarchicalAncestor()

python.uq.operations.sparse_grid.isHierarchicalAncestor (   gpi,
  gpj 
)

◆ isHierarchicalAncestorByLevelIndex()

python.uq.operations.sparse_grid.isHierarchicalAncestorByLevelIndex (   location_i,
  location_j 
)

◆ isHierarchicalAncestorDimx()

python.uq.operations.sparse_grid.isHierarchicalAncestorDimx (   li,
  ii,
  lj,
  ij 
)

◆ isRefineable()

python.uq.operations.sparse_grid.isRefineable (   grid,
  gp 
)

◆ isValid()

python.uq.operations.sparse_grid.isValid (   grid,
  gp 
)

◆ isValid1d()

python.uq.operations.sparse_grid.isValid1d (   grid,
  level,
  index 
)

◆ loadOperationMultiEval()

python.uq.operations.sparse_grid.loadOperationMultiEval (   grid,
  samples,
  isConsistent = True 
)

◆ parent()

python.uq.operations.sparse_grid.parent (   grid,
  gp,
  d 
)

◆ parents()

python.uq.operations.sparse_grid.parents (   grid,
  gp 
)

◆ sub()

python.uq.operations.sparse_grid.sub (   alpha,
  alphas 
)

Variable Documentation

◆ bsplineBoundaryGridTypes

list python.uq.operations.sparse_grid.bsplineBoundaryGridTypes
Initial value:
1= [GridType_BsplineBoundary,
2 GridType_BsplineClenshawCurtis]

◆ bsplineGridTypes

list python.uq.operations.sparse_grid.bsplineGridTypes = bsplineNoBoundaryGridTypes + bsplineBoundaryGridTypes

◆ bsplineNoBoundaryGridTypes

list python.uq.operations.sparse_grid.bsplineNoBoundaryGridTypes
Initial value:
1= [GridType_Bspline,
2 GridType_ModBspline,
3 GridType_ModBsplineClenshawCurtis]

◆ linearBoundaryGridTypes

list python.uq.operations.sparse_grid.linearBoundaryGridTypes
Initial value:
1= [GridType_LinearBoundary,
2 GridType_LinearL0Boundary,
3 GridType_LinearTruncatedBoundary,
4 GridType_LinearClenshawCurtisBoundary]

◆ linearGridTypes

list python.uq.operations.sparse_grid.linearGridTypes = linearNoBoundaryGridTypes + linearBoundaryGridTypes

◆ linearNoBoundaryGridTypes

list python.uq.operations.sparse_grid.linearNoBoundaryGridTypes
Initial value:
1= [GridType_Linear,
2 GridType_ModLinear,
3 GridType_LinearClenshawCurtis,
4 GridType_ModLinearClenshawCurtis]

◆ multipleEvalNaiveGridTypes

list python.uq.operations.sparse_grid.multipleEvalNaiveGridTypes
Initial value:
1= [GridType_Bspline,
2 GridType_BsplineClenshawCurtis,
3 GridType_BsplineBoundary,
4 GridType_ModBsplineClenshawCurtis,
5 GridType_ModBspline,
6 GridType_LinearClenshawCurtis,
7 GridType_LinearClenshawCurtisBoundary,
8 GridType_ModLinearClenshawCurtis,
9 GridType_PolyClenshawCurtis,
10 GridType_PolyClenshawCurtisBoundary,
11 GridType_ModPolyClenshawCurtis]

◆ polyBoundaryGridTypes

list python.uq.operations.sparse_grid.polyBoundaryGridTypes
Initial value:
1= [GridType_PolyBoundary,
2 GridType_PolyClenshawCurtisBoundary]

◆ polyGridTypes

list python.uq.operations.sparse_grid.polyGridTypes = polyNoBoundaryGridTypes + polyBoundaryGridTypes

◆ polyNoBoundaryGridTypes

list python.uq.operations.sparse_grid.polyNoBoundaryGridTypes
Initial value:
1= [GridType_Poly,
2 GridType_ModPoly,
3 GridType_PolyClenshawCurtis,
4 GridType_ModPolyClenshawCurtis]