KarhunenLoeveP1Factory

(Source code, png, hires.png, pdf)

../../_images/KarhunenLoeveP1Factory.png
class KarhunenLoeveP1Factory(*args)

Computation of Karhunen-Loeve decomposition using P1 approximation.

Parameters:

mesh : Mesh

The mesh on which the covariance model and the Karhunen-Loeve eigenfunctions (modes) are discretized.

threshold : float

The minimal relative amplitude of the eigenvalues to consider in the decomposition wrt the maximum eigenvalue.

Notes

The Karhunen-Loeve decomposition using P1 approximation allows to approximate the solution of the second kind Fredholm equation:

\int_{\cD} \mat{C}(\vect{s},\vect{t})\vect{\phi}_n(\vect{s})\di{\vect{s}}=\lambda_n\vect{\phi}_n(\vect{t})

with \mat{C}: \cD\times\cD \mapsto \cS^+_d(\Rset) a given covariance function, \lambda_n a nonincreasing sequence of nonnegative values (the eigenvalues of the equation) and \vect{\phi}_n: \cD\mapsto\Rset^d the associated sequence of eigenfunctions, normalized by \int_{\cD_N}\|\vect{\phi}_n(\vect{s})\|^2\di{\vect{s}}=1.

The Karhunen-Loeve P1 approximation consists in replacing the covariance model \mat{C} by its P1 approximation \hat{\mat{C}} on a mesh \cD_N which approximates the domain \cD:

\forall \vect{s},\vect{t}\in\cD_N,\quad \hat{\mat{C}}(\vect{s},\vect{t})=\sum_{\vect{\xi}_i,\vect{\xi}_j\in\cV_N}\mat{C}(\vect{\xi}_i,\vect{\xi}_j)\theta_i(\vect{s})\theta_j(\vect{t})

Where \theta_n: \cD_N \mapsto \Rset are the basis functions of the P1 finite element space associated to \cD_N, see P1LagrangeEvaluationImplementation.

Examples

Create a Karhunen-Loeve P1 factory:

>>> import openturns as ot
>>> mesh = ot.IntervalMesher([10]*2).build(ot.Interval([-1.0]*2, [1.0]*2))
>>> threshold = 0.01
>>> factory = ot.KarhunenLoeveP1Factory(mesh, threshold)

Methods

build(covarianceModel, eigenvalues) Computation of the eigenvalues and eigen functions.
buildAsProcessSample(covarianceModel, ...) Computation of the eigenvalues and eigen functions values at nodes.
getClassName() Accessor to the object’s name.
getId() Accessor to the object’s id.
getName() Accessor to the object’s name.
getShadowedId() Accessor to the object’s shadowed id.
getVisibility() Accessor to the object’s visibility state.
hasName() Test if the object is named.
hasVisibleName() Test if the object has a distinguishable name.
setName(name) Accessor to the object’s name.
setShadowedId(id) Accessor to the object’s shadowed id.
setVisibility(visible) Accessor to the object’s visibility state.
__init__(*args)
build(covarianceModel, eigenvalues)

Computation of the eigenvalues and eigen functions.

Parameters:

C : CovarianceModel, \mat{C}: \cD\times\cD \mapsto \cS^+_d(\Rset)

The covariance model.

ev : NumericalPoint

The eigenvalues \lambda_n in descending order such that \lambda_n/\lambda_0\geq\mathrm{threshold}

Returns:

functions : Basis

Eigen functions of the covariance model as a basis of functions using P1LagrangeEvaluationImplementation.

Examples

>>> import openturns as ot
>>> mesh = ot.IntervalMesher([10]*2).build(ot.Interval([-1.0]*2, [1.0]*2))
>>> threshold = 0.01
>>> factory = ot.KarhunenLoeveP1Factory(mesh, threshold)
>>> model = ot.AbsoluteExponential([1.0]*2)
>>> ev = ot.NumericalPoint()
>>> functions = factory.build(model, ev)
buildAsProcessSample(covarianceModel, eigenvalues)

Computation of the eigenvalues and eigen functions values at nodes.

Parameters:

C : CovarianceModel, \mat{C}: \cD\times\cD \mapsto \cS^+_d(\Rset)

The covariance model.

ev : NumericalPoint

The eigenvalues \lambda_n in descending order such that \lambda_n\geq\mathrm{threshold}\,\lambda_0

Returns:

modes : ProcessSample

Values of the eigen functions at the nodes \cV_N of the mesh \cD_N.

Examples

>>> import openturns as ot
>>> mesh = ot.IntervalMesher([10]*2).build(ot.Interval([-1.0]*2, [1.0]*2))
>>> threshold = 0.01
>>> factory = ot.KarhunenLoeveP1Factory(mesh, threshold)
>>> model = ot.AbsoluteExponential([1.0]*2)
>>> ev = ot.NumericalPoint()
>>> modes = factory.buildAsProcessSample(model, ev)
getClassName()

Accessor to the object’s name.

Returns:

class_name : str

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

getId()

Accessor to the object’s id.

Returns:

id : int

Internal unique identifier.

getName()

Accessor to the object’s name.

Returns:

name : str

The name of the object.

getShadowedId()

Accessor to the object’s shadowed id.

Returns:

id : int

Internal unique identifier.

getVisibility()

Accessor to the object’s visibility state.

Returns:

visible : bool

Visibility flag.

hasName()

Test if the object is named.

Returns:

hasName : bool

True if the name is not empty.

hasVisibleName()

Test if the object has a distinguishable name.

Returns:

hasVisibleName : bool

True if the name is not empty and not the default one.

setName(name)

Accessor to the object’s name.

Parameters:

name : str

The name of the object.

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters:

id : int

Internal unique identifier.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters:

visible : bool

Visibility flag.