SG++-Doxygen-Documentation
python.uq.operations.sparse_grid Namespace Reference

Functions

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

◆ addConst()

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

◆ balance()

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

◆ checkInterpolation()

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

◆ checkPositivity()

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

◆ copyGrid()

◆ createGrid()

◆ dehierarchize()

◆ dehierarchizeList()

def 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

References sgpp::op_factory.createOperationMultipleEval().

◆ dehierarchizeOnNewGrid()

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

◆ estimateConvergence()

◆ estimateSurplus()

def 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

References python.uq.operations.sparse_grid.parents().

Referenced by python.uq.refinement.RefinementStrategy.SquaredSurplusBFRanking.rank(), python.uq.refinement.RefinementStrategy.ExpectationValueBFRanking.rank(), python.uq.refinement.RefinementStrategy.LinearSurplusEstimationRanking.rank(), and python.uq.refinement.RefinementStrategy.VarianceBFRanking.update().

◆ evalHierToTop()

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

◆ evalSGFunction()

◆ evalSGFunctionBasedOnParents()

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

◆ evalSGFunctionMulti()

◆ getBasis()

◆ getBoundsOfSupport()

◆ getDegree()

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

Referenced by sgpp::base::Grid.createGridOfEquivalentType(), sgpp::op_factory.createOperationEval(), sgpp::op_factory.createOperationEvalGradientNaive(), sgpp::op_factory.createOperationEvalHessianNaive(), sgpp::op_factory.createOperationEvalNaive(), sgpp::op_factory.createOperationEvalPartialDerivativeNaive(), sgpp::op_factory.createOperationHierarchisation(), sgpp::op_factory.createOperationMultipleEval(), sgpp::op_factory.createOperationMultipleEvalNaive(), sgpp::op_factory.createOperationQuadrature(), python.uq.operations.discretizeProduct.discretizeProduct(), sgpp::base::OperationFirstMomentModPoly.doQuadrature(), sgpp::base::OperationFirstMomentModPolyClenshawCurtis.doQuadrature(), sgpp::base::OperationFirstMomentPoly.doQuadrature(), sgpp::base::OperationFirstMomentPolyBoundary.doQuadrature(), sgpp::base::OperationFirstMomentPolyClenshawCurtis.doQuadrature(), sgpp::base::OperationFirstMomentBspline.doQuadrature(), sgpp::base::OperationSecondMomentBspline.doQuadrature(), sgpp::base::OperationSecondMomentBsplineBoundary.doQuadrature(), sgpp::base::OperationFirstMomentBsplineBoundary.doQuadrature(), sgpp::base::OperationSecondMomentModBspline.doQuadrature(), sgpp::base::OperationSecondMomentModPoly.doQuadrature(), sgpp::base::OperationFirstMomentModBspline.doQuadrature(), sgpp::base::OperationSecondMomentModPolyClenshawCurtis.doQuadrature(), sgpp::base::OperationSecondMomentPoly.doQuadrature(), sgpp::base::OperationSecondMomentPolyBoundary.doQuadrature(), sgpp::base::OperationSecondMomentPolyClenshawCurtis.doQuadrature(), sgpp::base::OperationSecondMomentPolyClenshawCurtisBoundary.doQuadrature(), sgpp::base::OperationFirstMomentPolyClenshawCurtisBoundary.doQuadrature(), sgpp::base::OperationSecondMomentBsplineClenshawCurtis.doQuadrature(), sgpp::base::OperationSecondMomentModBsplineClenshawCurtis.doQuadrature(), sgpp::base::OperationFirstMomentBsplineClenshawCurtis.doQuadrature(), sgpp::base::OperationFirstMomentModBsplineClenshawCurtis.doQuadrature(), sgpp::datadriven::OperationRosenblattTransformation1DBspline.doTransformation1D(), sgpp::datadriven::OperationRosenblattTransformation1DBsplineBoundary.doTransformation1D(), sgpp::datadriven::OperationRosenblattTransformation1DBsplineClenshawCurtis.doTransformation1D(), sgpp::datadriven::OperationRosenblattTransformation1DModBspline.doTransformation1D(), sgpp::datadriven::OperationRosenblattTransformation1DModPoly.doTransformation1D(), sgpp::datadriven::OperationRosenblattTransformation1DModPolyClenshawCurtis.doTransformation1D(), sgpp::datadriven::OperationRosenblattTransformation1DPoly.doTransformation1D(), sgpp::datadriven::OperationRosenblattTransformation1DPolyBoundary.doTransformation1D(), sgpp::datadriven::OperationRosenblattTransformation1DPolyClenshawCurtis.doTransformation1D(), sgpp::datadriven::OperationRosenblattTransformation1DPolyClenshawCurtisBoundary.doTransformation1D(), sgpp::datadriven::OperationRosenblattTransformation1DModBsplineClenshawCurtis.doTransformation1D(), python.uq.learner.builder.GridDescriptor.GridDescriptor.fromGrid(), sgpp::optimization::HierarchisationSLE.HierarchisationSLE(), sgpp::combigrid::LTwoScalarProductHashMapNakBsplineBoundaryCombigrid.LTwoScalarProductHashMapNakBsplineBoundaryCombigrid(), sgpp::pde::OperationLaplaceModBspline.mult(), sgpp::pde::OperationLaplaceModBsplineClenshawCurtis.mult(), sgpp::pde::OperationMatrixLTwoDotPolyClenshawCurtis.mult(), sgpp::pde::OperationLaplaceModPoly.mult(), sgpp::pde::OperationLaplaceModPolyClenshawCurtis.mult(), sgpp::pde::OperationMatrixLTwoDotModBsplineClenshawCurtis.mult(), sgpp::pde::OperationMatrixLTwoDotModPolyClenshawCurtis.mult(), sgpp::pde::OperationMatrixLTwoDotPolyClenshawCurtisBoundary.mult(), sgpp::pde::OperationLaplacePolyClenshawCurtis.mult(), sgpp::pde::OperationMatrixLTwoDotBspline.mult(), sgpp::pde::OperationMatrixLTwoDotBsplineClenshawCurtis.mult(), sgpp::pde::OperationMatrixLTwoDotPolyBoundary.mult(), sgpp::pde::OperationMatrixLTwoDotModBspline.mult(), sgpp::pde::OperationMatrixLTwoDotModPoly.mult(), sgpp::pde::OperationMatrixLTwoDotPoly.mult(), sgpp::pde::OperationLaplacePoly.mult(), sgpp::pde::OperationLaplaceBsplineClenshawCurtis.mult(), sgpp::pde::OperationLaplaceBsplineBoundary.mult(), sgpp::pde::OperationLaplacePolyClenshawCurtisBoundary.mult(), sgpp::pde::OperationLaplaceBspline.mult(), sgpp::pde::OperationMatrixLTwoDotBsplineBoundary.mult(), sgpp::pde::OperationLaplacePolyBoundary.mult(), sgpp::pde::OperationLaplaceExplicitBspline.OperationLaplaceExplicitBspline(), sgpp::pde::OperationLaplaceExplicitModBspline.OperationLaplaceExplicitModBspline(), sgpp::pde::OperationMatrixLTwoDotExplicitBspline.OperationMatrixLTwoDotExplicitBspline(), sgpp::pde::OperationMatrixLTwoDotExplicitBsplineBoundary.OperationMatrixLTwoDotExplicitBsplineBoundary(), sgpp::pde::OperationMatrixLTwoDotExplicitBsplineClenshawCurtis.OperationMatrixLTwoDotExplicitBsplineClenshawCurtis(), sgpp::pde::OperationMatrixLTwoDotExplicitModBspline.OperationMatrixLTwoDotExplicitModBspline(), sgpp::pde::OperationMatrixLTwoDotExplicitModBsplineClenshawCurtis.OperationMatrixLTwoDotExplicitModBsplineClenshawCurtis(), sgpp::pde::OperationMatrixLTwoDotExplicitModPoly.OperationMatrixLTwoDotExplicitModPoly(), sgpp::pde::OperationMatrixLTwoDotExplicitModPolyClenshawCurtis.OperationMatrixLTwoDotExplicitModPolyClenshawCurtis(), sgpp::pde::OperationMatrixLTwoDotExplicitPoly.OperationMatrixLTwoDotExplicitPoly(), sgpp::pde::OperationMatrixLTwoDotExplicitPolyBoundary.OperationMatrixLTwoDotExplicitPolyBoundary(), sgpp::pde::OperationMatrixLTwoDotExplicitPolyClenshawCurtis.OperationMatrixLTwoDotExplicitPolyClenshawCurtis(), sgpp::pde::OperationMatrixLTwoDotExplicitPolyClenshawCurtisBoundary.OperationMatrixLTwoDotExplicitPolyClenshawCurtisBoundary(), sgpp::datadriven::OperationMultiEvalStreamingBSplineOCL< T >.OperationMultiEvalStreamingBSplineOCL(), sgpp::combigrid::LTwoScalarProductHashMapNakBsplineBoundaryCombigrid.updateGrid(), sgpp::datadriven::OperationInverseRosenblattTransformation1DBspline.~OperationInverseRosenblattTransformation1DBspline(), sgpp::datadriven::OperationInverseRosenblattTransformation1DBsplineBoundary.~OperationInverseRosenblattTransformation1DBsplineBoundary(), sgpp::datadriven::OperationInverseRosenblattTransformation1DBsplineClenshawCurtis.~OperationInverseRosenblattTransformation1DBsplineClenshawCurtis(), sgpp::datadriven::OperationInverseRosenblattTransformation1DModBspline.~OperationInverseRosenblattTransformation1DModBspline(), sgpp::datadriven::OperationInverseRosenblattTransformation1DModBsplineClenshawCurtis.~OperationInverseRosenblattTransformation1DModBsplineClenshawCurtis(), sgpp::datadriven::OperationInverseRosenblattTransformation1DModPoly.~OperationInverseRosenblattTransformation1DModPoly(), sgpp::datadriven::OperationInverseRosenblattTransformation1DModPolyClenshawCurtis.~OperationInverseRosenblattTransformation1DModPolyClenshawCurtis(), sgpp::datadriven::OperationInverseRosenblattTransformation1DPoly.~OperationInverseRosenblattTransformation1DPoly(), sgpp::datadriven::OperationInverseRosenblattTransformation1DPolyBoundary.~OperationInverseRosenblattTransformation1DPolyBoundary(), sgpp::datadriven::OperationInverseRosenblattTransformation1DPolyClenshawCurtis.~OperationInverseRosenblattTransformation1DPolyClenshawCurtis(), and sgpp::datadriven::OperationInverseRosenblattTransformation1DPolyClenshawCurtisBoundary.~OperationInverseRosenblattTransformation1DPolyClenshawCurtisBoundary().

◆ getGridPointsOnBoundary()

◆ getGridPointsOnBoundaryEfficiently()

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

◆ getHierarchicalAncestors()

◆ getIndex()

◆ getLevel()

◆ getLevelIndex()

◆ getNonExistingHierarchicalAncestors()

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

◆ hasAllChildren()

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

◆ hasBorder()

◆ hasChildren()

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

◆ haveHierarchicalRelationshipByLevelIndex()

◆ haveOverlappingSupport()

◆ haveOverlappingSupportByLevelIndex()

◆ haveOverlappingSupportDimx()

◆ hierarchize()

◆ hierarchizeBruteForce()

◆ hierarchizeEvalHierToTop()

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

◆ insertHierarchicalAncestors()

◆ insertPoint()

◆ insertTruncatedBorder()

def 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

References python.uq.operations.sparse_grid.insertPoint().

Referenced by python.uq.operations.forcePositivity.operationMakePositive.OperationMakePositive.addFullGridPoints(), python.uq.learner.builder.GridDescriptor.GridDescriptor.createGrid(), and python.uq.refinement.LocalRefinementStrategy.CreateAllChildrenRefinement.refine().

◆ isHierarchicalAncestor()

◆ isHierarchicalAncestorByLevelIndex()

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

◆ isHierarchicalAncestorDimx()

◆ isRefineable()

◆ isValid()

◆ isValid1d()

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

◆ loadOperationMultiEval()

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

◆ parent()

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

◆ parents()

◆ sub()

def 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]