GaussLPQuadratureRule

class GaussLPQuadratureRule(*args)

Immutable Gauss-LP quadrature rule.

Warning

This class is experimental and likely to be modified in future releases. To use it, import the openturns.experimental submodule.

This class stores the nodes and weights produced by GaussLPQuadrature. Unlike the builder, its size is known when it is constructed: it is the number of nodes actually returned by the algorithm, which may be smaller than the requested number of functions. The stored distribution is the measure against which the rule was built.

The rule is immutable: setSize() rejects any size other than the stored one and setDistribution() always raises, so a built rule stays fixed. generateWithWeights() always returns the same nodes and weights, and isRandom() returns False.

Parameters:
nodesSample

The quadrature nodes.

weightsPoint

The quadrature weights, one per node.

measureDistribution

The measure against which the rule was built.

Methods

generate()

Generate points according to the type of the experiment.

generateWithWeights()

Generate the stored quadrature rule.

getClassName()

Accessor to the object's name.

getDistribution()

Accessor to the distribution.

getName()

Accessor to the object's name.

getSize()

Accessor to the size of the generated sample.

hasName()

Test if the object is named.

hasUniformWeights()

Tell whether the weights are uniform.

isRandom()

Tell whether the rule is random.

setDistribution(distribution)

Set the measure.

setLevels(levels)

Accessor to the experiment nesting levels.

setName(name)

Accessor to the object's name.

setSize(size)

Set the number of nodes.

Examples

>>> import openturns as ot
>>> import openturns.experimental as otexp
>>> measure = ot.JointDistribution([ot.Uniform(0.0, 1.0)] * 2)
>>> functions = [ot.SymbolicFunction(['x', 'y'], [formula])
...              for formula in ['1.0', 'x', 'y', 'x * y']]
>>> builder = otexp.GaussLPQuadrature(functions, measure)
>>> rule = builder.buildRule(3)
>>> nodes, weights = rule.generateWithWeights()
__init__(*args)
generate()

Generate points according to the type of the experiment.

Returns:
sampleSample

Points (\inputReal_i)_{i = 1, ..., \sampleSize} of the design of experiments. The sampling method is defined by the type of the weighted experiment.

Examples

>>> import openturns as ot
>>> ot.RandomGenerator.SetSeed(0)
>>> myExperiment = ot.MonteCarloExperiment(ot.Normal(2), 5)
>>> sample = myExperiment.generate()
>>> print(sample)
    [ X0        X1        ]
0 : [  0.608202 -1.26617  ]
1 : [ -0.438266  1.20548  ]
2 : [ -2.18139   0.350042 ]
3 : [ -0.355007  1.43725  ]
4 : [  0.810668  0.793156 ]
generateWithWeights()

Generate the stored quadrature rule.

Returns:
nodesSample

The quadrature nodes.

weightsPoint

The quadrature weights, returned in the second output argument.

getClassName()

Accessor to the object’s name.

Returns:
class_namestr

The object class name (object.__class__.__name__).

getDistribution()

Accessor to the distribution.

Returns:
distributionDistribution

Distribution of the input random vector.

getName()

Accessor to the object’s name.

Returns:
namestr

The name of the object.

getSize()

Accessor to the size of the generated sample.

Returns:
sizepositive int

Number \sampleSize of points constituting the design of experiments.

hasName()

Test if the object is named.

Returns:
hasNamebool

True if the name is not empty.

hasUniformWeights()

Tell whether the weights are uniform.

Returns:
uniformbool

True when all the weights are equal to 1 / getSize().

isRandom()

Tell whether the rule is random.

Returns:
randombool

Always False: the rule is built once and then stored.

setDistribution(distribution)

Set the measure.

The measure of a quadrature rule is fixed when the rule is built. Any call raises an exception.

Parameters:
distributionDistribution

The requested measure.

setLevels(levels)

Accessor to the experiment nesting levels.

Parameters:
levelssequence of int

Nesting level for each component.

setName(name)

Accessor to the object’s name.

Parameters:
namestr

The name of the object.

setSize(size)

Set the number of nodes.

The size of a quadrature rule is fixed by its nodes. Setting the current size is a no-op; setting another size raises an exception.

Parameters:
sizeint

The requested size.

Examples using the class

Build a sparse quadrature rule with the Gauss-LP algorithm

Build a sparse quadrature rule with the Gauss-LP algorithm

Orthonormalize a finite set of functions on a multivariate domain

Orthonormalize a finite set of functions on a multivariate domain