TensorizedUniVariateFunctionFactory

class TensorizedUniVariateFunctionFactory(*args)

Base class for tensorized multivariate functions.

Parameters:
functionslist of UniVariateFunctionFamily

List of univariate function factories.

enumerateFunctionEnumerateFunction, optional

Associates to an integer its multi-index image in the \Nset^d dimension, which is the dimension of the basis. This multi-index represents the collection of degrees of the univariate polynomials.

Notes

TensorizedUniVariateFunctionFactory allows one to create multidimensional functions as the tensor product of univariate functions created by their respective factories (i.e. UniVariateFunctionFamily):

\Phi_n(x_1,\dots,x_d)=\prod_{i=1}^d \phi^i_{enum(n)_i}(x_i)

where \phi^i_k is the univariate basis of degree k associated to the component x_i and enum(n)_i is the ith component of the multi-index enum(n)

Let’s note that the exact hessian and gradient have been implemented for the product of polynomials.

Examples

>>> import openturns as ot
>>> funcColl = [ot.HaarWaveletFactory(), ot.FourierSeriesFactory(), ot.MonomialFunctionFactory()]
>>> dim = len(funcColl)
>>> enumerateFunction = ot.LinearEnumerateFunction(dim)
>>> productBasis = ot.TensorizedUniVariateFunctionFactory(funcColl, enumerateFunction)

Methods

add(elt)

Add a function.

build(index)

Build the element of the given index.

getClassName()

Accessor to the object's name.

getInputDimension()

Get the input dimension of the Basis.

getName()

Accessor to the object's name.

getOutputDimension()

Get the output dimension of the Basis.

getSize()

Get the size of the Basis.

getSubBasis(indices)

Get a sub-basis of the Basis.

hasName()

Test if the object is named.

isFinite()

Tell whether the basis is finite.

isOrthogonal()

Tell whether the basis is orthogonal.

setName(name)

Accessor to the object's name.

getEnumerateFunction

getFunctionFamilyCollection

setEnumerateFunction

setFunctionFamilyCollection

__init__(*args)
add(elt)

Add a function.

Parameters:
functiona Function

Function to be added.

build(index)

Build the element of the given index.

Parameters:
indexint, index \geq 0

Index of an element of the Basis.

Returns:
functionFunction

The function at the index index of the Basis.

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)
>>> print(basis.build(0).getEvaluation())
[x0,x1,x2]->[x0]
getClassName()

Accessor to the object’s name.

Returns:
class_namestr

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

getInputDimension()

Get the input dimension of the Basis.

Returns:
inDimint

Input dimension of the functions.

getName()

Accessor to the object’s name.

Returns:
namestr

The name of the object.

getOutputDimension()

Get the output dimension of the Basis.

Returns:
outDimint

Output dimension of the functions.

getSize()

Get the size of the Basis.

Returns:
sizeint

Size of the Basis.

getSubBasis(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.

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]
hasName()

Test if the object is named.

Returns:
hasNamebool

True if the name is not empty.

isFinite()

Tell whether the basis is finite.

Returns:
isFinitebool

True if the basis is finite.

isOrthogonal()

Tell whether the basis is orthogonal.

Returns:
isOrthogonalbool

True if the basis is orthogonal.

setName(name)

Accessor to the object’s name.

Parameters:
namestr

The name of the object.

Examples using the class

Create multivariate functions

Create multivariate functions