Basis

class Basis(*args)

Basis.

Available constructors:

Basis(functionsColl)

Basis(size)

Parameters:

functionsColl : list of NumericalMathFunction

Functions constituting the Basis.

size : int

Size of the Basis.

Examples

>>> import openturns as ot
>>> dimension = 3
>>> input = ['x0', 'x1', 'x2']
>>> functions = []
>>> for i in range(dimension):
...     functions.append(ot.NumericalMathFunction(input, ['y'], [input[i]]))
>>> basis = ot.Basis(functions)

Methods

add(elt) Add an element in the Basis.
build(index) Build the element of the given index.
getClassName() Accessor to the object’s name.
getDimension() Get the dimension of the Basis.
getId() Accessor to the object’s id.
getImplementation(*args) Accessor to the underlying implementation.
getName() Accessor to the object’s name.
getSize() Get the size of the Basis.
getSubBasis(indices) Get a sub-basis of the Basis.
isFunctional() Tell whether the basis is functional.
isOrthogonal() Tell whether the basis is orthogonal.
setName(name) Accessor to the object’s name.
__init__(*args)
add(elt)

Add an element in the Basis.

Parameters:

function : NumericalMathFunction

Function added in the Basis.

Examples

>>> import openturns as ot
>>> dimension = 3
>>> input = ['x0', 'x1', 'x2']
>>> functions = []
>>> for i in range(2):
...     functions.append(ot.NumericalMathFunction(input, ['y'], [input[i]]))
>>> basis = ot.Basis(functions)
>>> basis.add(ot.NumericalMathFunction(input, ['y'], [input[2]]))
build(index)

Build the element of the given index.

Parameters:

index : int, index \geq 0

Index of an element of the Basis.

Returns:

function : NumericalMathFunction

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.NumericalMathFunction(input, ['y'], [input[i]]))
>>> basis = ot.Basis(functions)
>>> print(basis.build(0).getEvaluation())
[x0,x1,x2]->[x0]
getClassName()

Accessor to the object’s name.

Returns:

class_name : str

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

getDimension()

Get the dimension of the Basis.

Returns:

dimension : int

Dimension of the Basis.

getId()

Accessor to the object’s id.

Returns:

id : int

Internal unique identifier.

getImplementation(*args)

Accessor to the underlying implementation.

Returns:

impl : Implementation

The implementation class.

getName()

Accessor to the object’s name.

Returns:

name : str

The name of the object.

getSize()

Get the size of the Basis.

Returns:

size : int

Size of the Basis.

getSubBasis(indices)

Get a sub-basis of the Basis.

Parameters:

indices : list of int

Indices of the terms of the Basis put in the sub-basis.

Returns:

subBasis : list of NumericalMathFunction

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.NumericalMathFunction(input, ['y'], [input[i]]))
>>> basis = ot.Basis(functions)
>>> subbasis = basis.getSubBasis([1])
>>> print(subbasis[0].getEvaluation())
[x0,x1,x2]->[x1]
isFunctional()

Tell whether the basis is functional.

Returns:

isOrthogonal : bool

True if the basis is functional i.e. if its terms are a solution to an equation (e.g. a basis made up of Legendre functions).

isOrthogonal()

Tell whether the basis is orthogonal.

Returns:

isOrthogonal : bool

True if the basis is orthogonal.

setName(name)

Accessor to the object’s name.

Parameters:

name : str

The name of the object.