SoizeGhanemFactory¶
-
class
SoizeGhanemFactory
(*args)¶ SoizeGhanem orthonormal multivariate functional family.
For the any multivariate distribution with continuous copula.
- Available constructor:
SoizeGhanemFactory()
SoizeGhanemFactory(measure, useCopula)
SoizeGhanemFactory(measure, phi, useCopula)
- Parameters
- measure
Distribution
The measure defining the inner product of the factory.
- phi
EnumerateFunction
The function mapping the index of the multivariate basis function to the multi-index of the marginal variables. Default is to use the
LinearEnumerateFunction
.- useCopulabool
Flag to tell if the copula density has to be used directly or indirectly through the joint PDF of the measure. Default is True.
- measure
Notes
This class implements the multivariate orthonormal basis associated with an arbitrary multidimensional distribution with continuous copula and marginals with well-defined orthonormal polyomials of arbitrary order. The details are in [soizeghanem2004].
Examples
>>> import openturns as ot >>> marginals = [ot.Uniform(-1.0, 1.0), ot.Normal(0.0, 1.0)] >>> copula = ot.ClaytonCopula(1.0) >>> distribution = ot.ComposedDistribution(marginals, copula) >>> factory = ot.SoizeGhanemFactory(distribution) >>> point = [0.5]*2 >>> for i in range(3): ... value = factory.build(i)(point) ... print('SoizeGhanem_' + str(i) + '(' + str(point) + ')=' + str(value)) SoizeGhanem_0([0.5, 0.5])=[0.870518] SoizeGhanem_1([0.5, 0.5])=[0.753891] SoizeGhanem_2([0.5, 0.5])=[0.435259]
Methods
build
(self, \*args)Get the term of the basis collection at a given index or multi-indices.
getClassName
(self)Accessor to the object’s name.
getDimension
(self)Get the dimension of the Basis.
getEnumerateFunction
(self)Return the enumerate function.
getId
(self)Accessor to the object’s id.
getMeasure
(self)Get the measure upon which the basis is orthogonal.
getName
(self)Accessor to the object’s name.
getShadowedId
(self)Accessor to the object’s shadowed id.
getSize
(self)Get the size of the Basis.
getSubBasis
(self, indices)Get a sub-basis of the Basis.
getVisibility
(self)Accessor to the object’s visibility state.
hasName
(self)Test if the object is named.
hasVisibleName
(self)Test if the object has a distinguishable name.
isFinite
(self)Tell whether the basis is finite.
isOrthogonal
(self)Tell whether the basis is orthogonal.
setName
(self, name)Accessor to the object’s name.
setShadowedId
(self, id)Accessor to the object’s shadowed id.
setVisibility
(self, visible)Accessor to the object’s visibility state.
add
-
__init__
(self, \*args)¶ Initialize self. See help(type(self)) for accurate signature.
-
build
(self, \*args)¶ Get the term of the basis collection at a given index or multi-indices.
- Parameters
- indexint
Indicates the term of the basis which must be constructed. In other words, index is used by a bijection from to (with the dimension of the basis). The bijection is detailed in
EnumerateFunction
.- indicessequence of int
Indicates the term of the basis which must be constructed. In other words, indices is used by a bijection from to (with the dimension of the basis). The bijection is the inverse of
EnumerateFunction
.
- Returns
- function
Function
The term of the basis collection at the index index or the inverse of indices.
- function
Examples
>>> import openturns as ot >>> # Create an orthogonal basis >>> polynomialCollection = [ot.LegendreFactory(), ot.LaguerreFactory(), ot.HermiteFactory()] >>> productBasis = ot.OrthogonalBasis(ot.OrthogonalProductPolynomialFactory(polynomialCollection)) >>> termBasis = productBasis.build(4) >>> print(termBasis.getEvaluation()) -1.11803 + 3.3541 * x0^2 >>> termBasis = productBasis.build(5) >>> print(termBasis.getEvaluation()) (1.73205 * x0) * (-1 + x1) >>> termBasis2 = productBasis.build([1,1,0]) >>> print(termBasis2.getEvaluation()) (1.73205 * x0) * (-1 + x1)
-
getClassName
(self)¶ Accessor to the object’s name.
- Returns
- class_namestr
The object class name (object.__class__.__name__).
-
getDimension
(self)¶ Get the dimension of the Basis.
- Returns
- dimensionint
Dimension of the Basis.
-
getEnumerateFunction
(self)¶ Return the enumerate function.
- Returns
- enumerateFunction
EnumerateFunction
Enumerate function that translates unidimensional indices into multidimensional indices.
- enumerateFunction
-
getId
(self)¶ Accessor to the object’s id.
- Returns
- idint
Internal unique identifier.
-
getMeasure
(self)¶ Get the measure upon which the basis is orthogonal.
- Returns
- measure
Distribution
Measure upon which the basis is orthogonal.
- measure
Examples
>>> import openturns as ot >>> # Create an orthogonal basis >>> polynomialCollection = [ot.LegendreFactory(), ot.LaguerreFactory(), ot.HermiteFactory()] >>> productBasis = ot.OrthogonalBasis(ot.OrthogonalProductPolynomialFactory(polynomialCollection)) >>> measure = productBasis.getMeasure() >>> print(measure.getMarginal(0)) Uniform(a = -1, b = 1) >>> print(measure.getMarginal(1)) Gamma(k = 1, lambda = 1, gamma = 0) >>> print(measure.getMarginal(2)) Normal(mu = 0, sigma = 1)
-
getName
(self)¶ Accessor to the object’s name.
- Returns
- namestr
The name of the object.
-
getShadowedId
(self)¶ Accessor to the object’s shadowed id.
- Returns
- idint
Internal unique identifier.
-
getSize
(self)¶ Get the size of the Basis.
- Returns
- sizeint
Size of the Basis.
-
getSubBasis
(self, indices)¶ Get a sub-basis of the Basis.
- Parameters
- indiceslist of int
Indices of the terms of the Basis put in the sub-basis.
- Returns
- subBasislist of
Function
Functions defining a sub-basis.
- subBasislist of
Examples
>>> import openturns as ot >>> dimension = 3 >>> input = ['x0', 'x1', 'x2'] >>> functions = [] >>> for i in range(dimension): ... functions.append(ot.SymbolicFunction(input, [input[i]])) >>> basis = ot.Basis(functions) >>> subbasis = basis.getSubBasis([1]) >>> print(subbasis[0].getEvaluation()) [x0,x1,x2]->[x1]
-
getVisibility
(self)¶ Accessor to the object’s visibility state.
- Returns
- visiblebool
Visibility flag.
-
hasName
(self)¶ Test if the object is named.
- Returns
- hasNamebool
True if the name is not empty.
-
hasVisibleName
(self)¶ Test if the object has a distinguishable name.
- Returns
- hasVisibleNamebool
True if the name is not empty and not the default one.
-
isFinite
(self)¶ Tell whether the basis is finite.
- Returns
- isFinitebool
True if the basis is finite.
-
isOrthogonal
(self)¶ Tell whether the basis is orthogonal.
- Returns
- isOrthogonalbool
True if the basis is orthogonal.
-
setName
(self, name)¶ Accessor to the object’s name.
- Parameters
- namestr
The name of the object.
-
setShadowedId
(self, id)¶ Accessor to the object’s shadowed id.
- Parameters
- idint
Internal unique identifier.
-
setVisibility
(self, visible)¶ Accessor to the object’s visibility state.
- Parameters
- visiblebool
Visibility flag.