CholeskyMethod¶
- class CholeskyMethod(*args)¶
Least squares solver using Cholesky decomposition.
- Available constructors:
CholeskyMethod(proxy, weight, indices)
CholeskyMethod(proxy, indices)
CholeskyMethod(design)
- Parameters
- proxy
DesignProxy
Input sample
- weightsequence of float
Output weights
- indicessequence of int
Indices allowed in the basis
- design2-d sequence of float
A priori known design matrix
- proxy
See also
Examples
Solves a linear least squares problem with Cholesky method:
>>> import openturns as ot >>> A = ot.Matrix([[1,1],[1,2],[1,3],[1,4]]) >>> y = ot.Point([6,5,7,10]) >>> method = ot.CholeskyMethod(A) >>> x = method.solve(y) >>> print(x) [3.5,1.4]
Methods
computeWeightedDesign
([whole])Build the design matrix.
getBasis
()Accessor to the basis.
Accessor to the object's name.
Current indices accessor.
Get the inverse Gram matrix of input sample.
Get the diagonal of the inverse Gram matrix.
Get the trace of the inverse Gram matrix.
getH
()Get the projection matrix H.
getHDiag
()Get the diagonal of the projection matrix H.
getId
()Accessor to the object's id.
Initial indices accessor.
Input sample accessor.
getName
()Accessor to the object's name.
Accessor to the object's shadowed id.
Accessor to the object's visibility state.
Accessor to the weights.
hasName
()Test if the object is named.
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.
solve
(rhs)Solve the least-squares problem.
solveNormal
(rhs)Solve the least-squares problem using normal equation.
Drop the current decomposition.
update
(addedIndices, conservedIndices, ...)Update the current decomposition.
- __init__(*args)¶
- computeWeightedDesign(whole=False)¶
Build the design matrix.
- Parameters
- wholebool, defaults to False
Whether to use the initial indices instead of the current indices
- Returns
- psiAk
Matrix
The design matrix
- psiAk
- getClassName()¶
Accessor to the object’s name.
- Returns
- class_namestr
The object class name (object.__class__.__name__).
- getCurrentIndices()¶
Current indices accessor.
- Returns
- indices
Indices
Indices of the current decomposition in the global basis.
- indices
- getGramInverse()¶
Get the inverse Gram matrix of input sample.
- Returns
- c
CovarianceMatrix
The inverse Gram matrix.
- c
- getGramInverseDiag()¶
Get the diagonal of the inverse Gram matrix.
- Returns
- d
Point
The diagonal of the inverse Gram matrix.
- d
- getGramInverseTrace()¶
Get the trace of the inverse Gram matrix.
- Returns
- x
Scalar
The trace of inverse Gram matrix.
- x
- getH()¶
Get the projection matrix H.
- Returns
- h
SymmetricMatrix
The projection matrix H.
- h
- getId()¶
Accessor to the object’s id.
- Returns
- idint
Internal unique identifier.
- getInitialIndices()¶
Initial indices accessor.
- Returns
- indices
Indices
Initial indices of the terms in the global basis.
- indices
- getName()¶
Accessor to the object’s name.
- Returns
- namestr
The name of the object.
- getShadowedId()¶
Accessor to the object’s shadowed id.
- Returns
- idint
Internal unique identifier.
- getVisibility()¶
Accessor to the object’s visibility state.
- Returns
- visiblebool
Visibility flag.
- hasName()¶
Test if the object is named.
- Returns
- hasNamebool
True if the name is not empty.
- hasVisibleName()¶
Test if the object has a distinguishable name.
- Returns
- hasVisibleNamebool
True if the name is not empty and not the default one.
- setName(name)¶
Accessor to the object’s name.
- Parameters
- namestr
The name of the object.
- setShadowedId(id)¶
Accessor to the object’s shadowed id.
- Parameters
- idint
Internal unique identifier.
- setVisibility(visible)¶
Accessor to the object’s visibility state.
- Parameters
- visiblebool
Visibility flag.
- solve(rhs)¶
Solve the least-squares problem.
- Parameters
- bsequence of float
Second term of the equation
- Returns
- a
Point
The solution.
- a
- solveNormal(rhs)¶
Solve the least-squares problem using normal equation.
- Parameters
- bsequence of float
Second term of the equation
- Returns
- x
Point
The solution.
- x
- trashDecomposition()¶
Drop the current decomposition.
- update(addedIndices, conservedIndices, removedIndices, row=False)¶
Update the current decomposition.
- Parameters
- addedIndicessequence of int
Indices of added basis terms.
- conservedIndicessequence of int
Indices of conserved basis terms.
- removedIndicessequence of int
Indices of removed basis terms.