KarhunenLoeveP1Algorithm

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

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

Computation of Karhunen-Loeve decomposition using P1 approximation.

Parameters:

mesh : Mesh

The mesh \cD_N that discretizes the domain \cD.

covariance : CovarianceModel

The covariance function to decompose.

threshold : float

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

Notes

We suppose that C:\cD \times \cD \rightarrow  \cS^+_d(\Rset) is a covariance function defined on \cD \in \Rset^n, continuous at \vect{0}.

The class KarhunenLoeveP1Algorithm enables to determine the solutions of the second kind Fredholm equation associated to C, ie to find the (\lambda_k,  \vect{\varphi}_k)_{k \geq 1} such that:

\int_{\cD} \mat{C}(\vect{s},\vect{t}) \vect{\varphi}_k(\vect{t})\,  d\vect{t} = \lambda_k  \vect{\varphi}_k(\vect{s}) \quad \forall \vect{s} \in \cD

where (\lambda_k)_{k \geq 1} is a nonincreasing sequence of nonnegative values (the eigenvalues) and (\vect{\varphi}_k)_{k \geq 1} the associated sequence of eigenfunctions, normalized by \int_{\cD}\|\vect{\varphi}_k(\vect{s})\|^2\di{\vect{s}}=1. They constitue an hilbertian basis of L^2(\cD, \Rset^d).

OpenTURNS uses the threshold s in order to select the most significant eigenvalues, ie all the eigenvalues such that \lambda_k \geq s \lambda_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.

Examples

Create a Karhunen-Loeve P1 algorithm:

>>> import openturns as ot
>>> mesh = ot.IntervalMesher([10]*2).build(ot.Interval([-1.0]*2, [1.0]*2))
>>> threshold = 0.01
>>> model = ot.AbsoluteExponential([1.0]*2)
>>> algorithm = ot.KarhunenLoeveP1Algorithm(mesh, model, threshold)

Methods

getClassName() Accessor to the object’s name.
getCovarianceModel() Accessor to the covariance model.
getId() Accessor to the object’s id.
getMesh() Accessor to the mesh.
getName() Accessor to the object’s name.
getResult() Get the result structure.
getShadowedId() Accessor to the object’s shadowed id.
getThreshold() Accessor to the limit ratio on eigenvalues.
getVisibility() Accessor to the object’s visibility state.
hasName() Test if the object is named.
hasVisibleName() Test if the object has a distinguishable name.
run() Computation of the eigenvalues and eigen functions values at nodes.
setCovarianceModel(covariance) Accessor to the covariance model.
setName(name) Accessor to the object’s name.
setShadowedId(id) Accessor to the object’s shadowed id.
setThreshold(threshold) Accessor to the limit ratio on eigenvalues.
setVisibility(visible) Accessor to the object’s visibility state.
__init__(*args)
getClassName()

Accessor to the object’s name.

Returns:

class_name : str

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

getCovarianceModel()

Accessor to the covariance model.

Returns:

covModel : CovarianceModel

The covariance model.

getId()

Accessor to the object’s id.

Returns:

id : int

Internal unique identifier.

getMesh()

Accessor to the mesh.

Returns:

mesh : Mesh

The mesh \cD_N that discretizes the domain \cD.

getName()

Accessor to the object’s name.

Returns:

name : str

The name of the object.

getResult()

Get the result structure.

Returns:

resKL : KarhunenLoeveResult

The structure containing all the results of the Fredholm problem.

Notes

The structure contains all the results of the Fredholm problem.

getShadowedId()

Accessor to the object’s shadowed id.

Returns:

id : int

Internal unique identifier.

getThreshold()

Accessor to the limit ratio on eigenvalues.

Returns:

s : float, positive

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

Notes

OpenTURNS truncates the sequence (\lambda_k,  \vect{\varphi}_k)_{k \geq 1} at the highest index K such that \lambda_K \geq s \lambda_1.

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.

run()

Computation of the eigenvalues and eigen functions values at nodes.

Examples

>>> import openturns as ot
>>> mesh = ot.IntervalMesher([10]*2).build(ot.Interval([-1.0]*2, [1.0]*2))
>>> threshold = 0.01
>>> model = ot.AbsoluteExponential([1.0]*2)
>>> algorithm = ot.KarhunenLoeveP1Algorithm(mesh, model, threshold)
>>> algorithm.run()
>>> result = algorithm.getResult()
setCovarianceModel(covariance)

Accessor to the covariance model.

Parameters:

covModel : CovarianceModel

The covariance model.

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.

setThreshold(threshold)

Accessor to the limit ratio on eigenvalues.

Parameters:

s : float, positive

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

Notes

OpenTURNS truncates the sequence (\lambda_k,  \vect{\varphi}_k)_{k \geq 1} at the highest index K such that \lambda_K \geq s \lambda_1.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters:

visible : bool

Visibility flag.