KerMor  0.9
Model order reduction for nonlinear dynamical systems and nonlinear approximation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
kernels.KernelExpansion Class Reference

KernelExpansion: Base class for state-space kernel expansions. More...

Detailed Description

KernelExpansion: Base class for state-space kernel expansions.

The KernelExpansion class represents a function \(f\) in the space induced by a given kernel \(\K\) as

\[f(x) = \sum\limits_{i=1}^N c_i\K(x,x_i)\]

This class has been introduced in order to allow standalone use of kernel expansions in approximation contexts outside of the intended model reduction scheme.

Author
Daniel Wirtz
Date
2011-07-07
Change in 0.6:
(Daniel Wirtz, 2012-04-25) Removed the RotationInvariant property from the kernel expansions and introduced kernels.BaseKernel.IsRBF and kernels.BaseKernel.IsScProd to indicate the properties on a per-kernel basis.
Change in 0.5:
(Daniel Wirtz, 2011-07-28) Fixed the evaluate method, it had an argument Centers.xi too much.
New in 0.5:
(Daniel Wirtz, 2011-07-07) Added this class.
Changes from former class CompwiseKernelCoreFun
Change in 0.4:
(Daniel Wirtz, 2011-05-03)
  • Removed the off property as proper RKHS functions dont have an offset
  • No more setter for Ma property - too slow even during offline phase
New in 0.3:
(Daniel Wirtz, 2011-04-21) Integrated this class to the property default value changed supervision system Property classes and levels. This class now inherits from KerMorObject and has an extended constructor registering any user-relevant properties using KerMorObject.registerProps.
Change in 0.3:
(Syed Ammar, 2011-04-16) Implemented Setter for the property off

This class is part of the framework

KerMor - Model Order Reduction using Kernels

Definition at line 18 of file KernelExpansion.m.

Public Member Functions

 KernelExpansion ()
 Default constructor. More...
 
function fx = evaluate (matrix x, varargin)
 Evaluates the kernel expansion. More...
 
function phi = getKernelVector (matrix x, varargin)
 Evaluates the kernel expansion. More...
 
function row = getKernelMatrixColumn (integer idx,matrix x, varargin)
 Evaluates the kernel expansion. More...
 
function J = getStateJacobian (x, varargin)
 Evaluates the jacobian matrix of this function at the given point. More...
 
function K = getKernelMatrix ()
 Computes the kernel matrix for the currently set center data. More...
 
function v = scalarProductWith (f)
 
function  normalize ()
 
function  setCentersFromATD (data.ApproxTrainData atd,rowvec< integer > idx)
 Sets the centers according to the indices idx of the data.ApproxTrainData. More...
 
function kernels.KernelExpansion
kexp = 
toTranslateBase ()
 Returns the same kernel expansion with the canonical translate base used. More...
 
function subexp = getSubExpansion (arg)
 
function c = getGlobalLipschitz (double t,colvec< double > mu)
 For some error estimators, a global Lipschitz constant estimation is performed. This function has to yield the global lipschitz constant for the spatial/state part of a CoreFunction \(f(x,t,mu)\). More...
 
function target = project (V, W)
 
function copy = clone (copy)
 The interface method with returns a copy of the current class instance. More...
 
function  clear ()
 Removes all centers and coefficients from the expansion and leaves the associated kernels untouched. More...
 
function sum = plus (B)
 Adds two kernel expansions and will clone the frist argument's class as result type. More...
 
function diff = minus (B)
 Adds two kernel expansions and will clone the frist argument's class as result type. More...
 
function neg = uminus ()
 
function  exportToDirectory (dir)
 
function json = toJSON (filename)
 
function res = test_getStateJacobianInstance ()
 
- Public Member Functions inherited from KerMorObject
 KerMorObject ()
 Constructs a new KerMor object. More...
 
function  display ()
 disp(object2str(this)); More...
 
function bool = eq (B)
 Checks equality of two KerMor objects. More...
 
function bool = ne (B)
 Checks if two KerMorObjects are different. More...
 
function cn = getClassName ()
 Returns the simple class name of this object without packages. More...
 
- Public Member Functions inherited from DPCMObject
 DPCMObject ()
 Creates a new DPCM object. More...
 
 DPCMObject ()
 
- Public Member Functions inherited from general.AProjectable
function handle target = project (matrix< double > V,matrix< double > W,handle target)
 Returns a NEW INSTANCE of the projected object that does not rely on data of the old one via references (everything must be copied to ensure separability of reduced(=projected) versions and full versions, unless. More...
 

Static Public Member Functions

static function res = test_getStateJacobian ()
 

Public Attributes

kernels.BaseKernel Kernel
 The Kernel to use for system variables. More...
 
rowvec Ma_norms
 The norms of the coefficient matrix of the kernel expansion. More...
 
double NativeNorm
 Returns the norm \(||f||^2_{\H^q}\) of \(f\) in the RKHS \(\H^q,\quad q\in\N\). More...
 
colvec< doubleComponentNorms
 Returns the native space norms \(||f_j||^2_\H\) for each component function \(j \equiv\)size(Ma,1) More...
 
 MBnd
 Returns the M upper bound for this KernelExpansion, which is \(M := \max\limits_{j=1}^d\sum\limits_{i=1}^m |c^d_i|\). More...
 
logical HasCustomBase
 Flag that indicates if a base other than the direct translate base is used for this kernel expansion. More...
 
 Size
 The size of the kernel expansion. More...
 
struct Centers = struct("'xi',[]")
 The kernel centers used in the approximation. More...
 
matrix< doubleMa = "[]"
 The coefficient data for each dimension. More...
 
matrix< doubleBase = 1
 This property lets the user store a custom base, for which the coefficients are set. The custom base tells which linear combinations of center elements belong to which base. More...
 
- Public Attributes inherited from DPCMObject
 WorkspaceVariableName = ""
 The workspace variable name of this class. Optional. More...
 
 ID = "[]"
 An ID that allows to uniquely identify this DPCMObject (at least within the current MatLab session/context). More...
 
 PropertiesChanged = "[]"
 The Dictionary containing all the property settings as key/value pairs. More...
 
- Public Attributes inherited from handle
 addlistener
 Creates a listener for the specified event and assigns a callback function to execute when the event occurs. More...
 
 notify
 Broadcast a notice that a specific event is occurring on a specified handle object or array of handle objects. More...
 
 delete
 Handle object destructor method that is called when the object's lifecycle ends. More...
 
 disp
 Handle object disp method which is called by the display method. See the MATLAB disp function. More...
 
 display
 Handle object display method called when MATLAB software interprets an expression returning a handle object that is not terminated by a semicolon. See the MATLAB display function. More...
 
 findobj
 Finds objects matching the specified conditions from the input array of handle objects. More...
 
 findprop
 Returns a meta.property objects associated with the specified property name. More...
 
 fields
 Returns a cell array of string containing the names of public properties. More...
 
 fieldnames
 Returns a cell array of string containing the names of public properties. See the MATLAB fieldnames function. More...
 
 isvalid
 Returns a logical array in which elements are true if the corresponding elements in the input array are valid handles. This method is Sealed so you cannot override it in a handle subclass. More...
 
 eq
 Relational functions example. See details for more information. More...
 
 transpose
 Transposes the elements of the handle object array. More...
 
 permute
 Rearranges the dimensions of the handle object array. See the MATLAB permute function. More...
 
 reshape
 hanges the dimensions of the handle object array to the specified dimensions. See the MATLAB reshape function. More...
 
 sort
 ort the handle objects in any array in ascending or descending order. More...
 
- Public Attributes inherited from general.AProjectable
 V
 The \(V\) matrix of the biorthogonal pair \(V,W\). More...
 
 W
 The \(W\) matrix of the biorthogonal pair \(V,W\). More...
 

Static Protected Member Functions

static function this = loadobj (this, from)
 As the constant properties are transient, they have to be re-computed upon loading. More...
 
- Static Protected Member Functions inherited from DPCMObject
static function obj = loadobj (obj, from)
 Re-register any registered change listeners! More...
 
static function obj = loadobj (obj, from)
 
- Static Protected Member Functions inherited from general.AProjectable
static function obj = loadobj (obj, from)
 

Protected Attributes

kernels.BaseKernel fSK
 The inner (state) kernel object. More...
 

Additional Inherited Members

- Protected Member Functions inherited from KerMorObject
function  checkType (obj, type)
 Object typechecker. More...
 
- Protected Member Functions inherited from DPCMObject
function  registerProps (varargin)
 Call this method at any class that defines DPCM observed properties. More...
 
function  registerProps (varargin)
 

Constructor & Destructor Documentation

kernels.KernelExpansion.KernelExpansion ( )

Default constructor.

Initializes default kernels.

Definition at line 249 of file KernelExpansion.m.

References fSK, KerMorObject.KerMorObject(), and DPCMObject.registerProps().

Referenced by testing.Speed.KernelExpCustomBaseEval().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Function Documentation

function kernels.KernelExpansion.clear ( )

Removes all centers and coefficients from the expansion and leaves the associated kernels untouched.

Definition at line 487 of file KernelExpansion.m.

References Centers, and Ma.

Referenced by approx.algorithms.AAdaptiveBase.initExpansion().

Here is the caller graph for this function:

function copy = kernels.KernelExpansion.clone (   target)
virtual

The interface method with returns a copy of the current class instance.

Parameters
targetIf clone was called for a subclass of this class, target must contain the new instance of the subclass that is to be the cloned result.

Reimplemented from general.AProjectable.

Reimplemented in kernels.ParamTimeKernelExpansion.

Definition at line 475 of file KernelExpansion.m.

References Base, Centers, kernels.BaseKernel.clone(), fSK, and Ma.

Referenced by dscomponents.ParamTimeKernelCoreFun.clone(), approx.KernelEI.clone(), getSubExpansion(), project(), toTranslateBase(), and uminus().

Here is the call graph for this function:

Here is the caller graph for this function:

function fx = kernels.KernelExpansion.evaluate ( matrix  x,
  varargin 
)

Evaluates the kernel expansion.

Parameters
xThe state space vector(s) to evaluate at
vararginDummy variable to also allow calls to this class with \(t_i,\mu_i\) parameters as in ParamTimeKernelExpansion.
Return values
fxiThe evaluation \(f(x) = \sumi c_i \K(x,x_i)\)

Definition at line 271 of file KernelExpansion.m.

References Ma, and t.

Referenced by dscomponents.ParamTimeKernelCoreFun.evaluate(), approx.KernelEI.evaluateCoreFun(), dscomponents.ParamTimeKernelCoreFun.evaluateMulti(), approx.algorithms.ABase.getError(), and test_getStateJacobianInstance().

Here is the caller graph for this function:

function kernels.KernelExpansion.exportToDirectory (   dir)

Definition at line 528 of file KernelExpansion.m.

References Centers, Utils.ensureDir(), k, Kernel, Ma, Util.saveRealMatrix(), and Util.saveRealVector().

Here is the call graph for this function:

function c = kernels.KernelExpansion.getGlobalLipschitz ( double  t,
colvec< double mu 
)
virtual

For some error estimators, a global Lipschitz constant estimation is performed. This function has to yield the global lipschitz constant for the spatial/state part of a CoreFunction \(f(x,t,mu)\).

Todo:
: what about cases where no lipschitz constants are available? somehow need to tell the error estimator etc.
Parameters
tThe current time(s) \(t \in [0, T]\)
muThe currently used parameter \(\vmu\). Set to \([]\) if not used.

Implements dscomponents.IGlobalLipschitz.

Reimplemented in kernels.ParamTimeKernelExpansion.

Definition at line 450 of file KernelExpansion.m.

References kernels.BaseKernel.getGlobalLipschitz(), Kernel, and Ma_norms.

Referenced by dscomponents.ParamTimeKernelCoreFun.getGlobalLipschitz().

Here is the call graph for this function:

Here is the caller graph for this function:

function K = kernels.KernelExpansion.getKernelMatrix ( )

Computes the kernel matrix for the currently set center data.

Convenience method, equal to call evaluateAtCenters with passing the center data as arguments. However, this method is (possibly, depends on kernel implementation) faster as it calls the kernels kernels.BaseKernel.evaluate -method with one argument.

See Also
evaluateAtCenters

Definition at line 341 of file KernelExpansion.m.

References Centers, kernels.BaseKernel.evaluate(), and fSK.

Referenced by general.regression.KernelLS.init(), and general.regression.BaseScalarSVR.init().

Here is the call graph for this function:

Here is the caller graph for this function:

function row = kernels.KernelExpansion.getKernelMatrixColumn ( integer  idx,
matrix  x,
  varargin 
)

Evaluates the kernel expansion.

Parameters
idxThe column index
xThe state space vector(s) to evaluate at Default: this.Centers.xi
vararginDummy variable to also allow calls to this class with \(t_i,\mu_i\) parameters as in ParamTimeKernelExpansion.
Return values
phiThe kernel vector \(\varphi(x) =\left(\K(x,x_i)\right)_{i}\).

Definition at line 301 of file KernelExpansion.m.

References Centers, kernels.BaseKernel.evaluate(), and fSK.

Here is the call graph for this function:

function phi = kernels.KernelExpansion.getKernelVector ( matrix  x,
  varargin 
)

Evaluates the kernel expansion.

Parameters
xThe state space vector(s) to evaluate at
vararginDummy variable to also allow calls to this class with \(t_i,\mu_i\) parameters as in ParamTimeKernelExpansion.
Return values
phiThe kernel vector \(\varphi(x) =\left(\K(x,x_i)\right)_{i}\).

Definition at line 286 of file KernelExpansion.m.

References Centers, kernels.BaseKernel.evaluate(), and fSK.

Here is the call graph for this function:

function J = kernels.KernelExpansion.getStateJacobian (   x,
  varargin 
)

Evaluates the jacobian matrix of this function at the given point.

As this is a component-wise kernel expansion, the jacobian is easily computed using the coefficient vectors and the state variable nablas.

See Also
kernels.BaseKernel
Parameters
xThe state vector at which the jacobian is required.
vararginDummy parameter to satisfy the interface calls for kernels.ParamTimeKernelExpansion classes, which also give a \(t\) and \(\mu\) parameter.

Definition at line 321 of file KernelExpansion.m.

References Centers, Ma, and t.

Referenced by dscomponents.ParamTimeKernelCoreFun.getStateJacobian(), and test_getStateJacobianInstance().

Here is the caller graph for this function:

function subexp = kernels.KernelExpansion.getSubExpansion (   arg)

Definition at line 429 of file KernelExpansion.m.

References Centers, and clone().

Referenced by demos.ResponseSurfaceApprox.iterationPlots().

Here is the call graph for this function:

Here is the caller graph for this function:

function this = kernels.KernelExpansion.loadobj (   this,
  from 
)
staticprotected

As the constant properties are transient, they have to be re-computed upon loading.

Any subclasser MUST call this superclasses loadobj function explicitly!

Required fields of from:
Required fields of this:
Generated fields of this:

Definition at line 761 of file KernelExpansion.m.

References Base, Centers, fSK, KerMorObject.KerMorObject(), Kernel, and Ma.

Here is the call graph for this function:

function diff = kernels.KernelExpansion.minus (   B)

Adds two kernel expansions and will clone the frist argument's class as result type.

Definition at line 510 of file KernelExpansion.m.

function kernels.KernelExpansion.normalize ( )

Definition at line 381 of file KernelExpansion.m.

References Ma, and NativeNorm.

function sum = kernels.KernelExpansion.plus (   B)

Adds two kernel expansions and will clone the frist argument's class as result type.

Definition at line 498 of file KernelExpansion.m.

Referenced by test_getStateJacobianInstance().

Here is the caller graph for this function:

function target = kernels.KernelExpansion.project (   V,
  W 
)

Definition at line 455 of file KernelExpansion.m.

References all(), Centers, clone(), k, Ma, t, and general.AProjectable.V.

Referenced by dscomponents.ParamTimeKernelCoreFun.project(), and approx.KernelEI.project().

Here is the call graph for this function:

Here is the caller graph for this function:

function v = kernels.KernelExpansion.scalarProductWith (   f)

Definition at line 367 of file KernelExpansion.m.

References Centers, and Ma.

function kernels.KernelExpansion.setCentersFromATD ( data.ApproxTrainData  atd,
rowvec< integer idx 
)

Sets the centers according to the indices idx of the data.ApproxTrainData.

Parameters
atdThe approximation training data instance
idxThe indices of the entries in the approx train data to use
Required fields of atd:

Definition at line 386 of file KernelExpansion.m.

References Centers, and data.ApproxTrainData.xi.

static function res = kernels.KernelExpansion.test_getStateJacobian ( )
static

Definition at line 729 of file KernelExpansion.m.

References k.

function res = kernels.KernelExpansion.test_getStateJacobianInstance ( )

Definition at line 564 of file KernelExpansion.m.

References Centers, evaluate(), getStateJacobian(), k, Kernel, plus(), and X.

Here is the call graph for this function:

function json = kernels.KernelExpansion.toJSON (   filename)

Definition at line 547 of file KernelExpansion.m.

References Base, Centers, HasCustomBase, Ma, and Util.matrixToJSON().

Here is the call graph for this function:

function kernels.KernelExpansion kexp = kernels.KernelExpansion.toTranslateBase ( )

Returns the same kernel expansion with the canonical translate base used.

If no custom base is used, a simple copy will be returned.

Using a non-standard base may be the result of a Newton-base type approximation algorithm. However, evaluating the kernel expansion in a different base is less effective. If the coefficients of the direct translates are not too bad (i.e. large values with opposite signs), using the direct translate base might give the same results at an improved evaluation speed.

Return values
kexpA cloned instance with the direct translate base.
Generated fields of kexp:

Definition at line 402 of file KernelExpansion.m.

References clone().

Here is the call graph for this function:

function neg = kernels.KernelExpansion.uminus ( )

Definition at line 522 of file KernelExpansion.m.

References clone(), and Ma.

Here is the call graph for this function:

Member Data Documentation

kernels.KernelExpansion.Base = 1

This property lets the user store a custom base, for which the coefficients are set. The custom base tells which linear combinations of center elements belong to which base.

In KerMor, this is typically set by the interpolating algorithms like approx.algorithm.VKOGA or general.interpolation.KernelInterpol

Property class optional:
A custom base for which the coefficients are set.

Default: 1

Note
This property has the MATLAB attribute SetObservable set to true.
Matlab documentation of property attributes.

Definition at line 210 of file KernelExpansion.m.

Referenced by clone(), loadobj(), and toJSON().

kernels.KernelExpansion.Centers = struct("'xi',[]")

The kernel centers used in the approximation.

This is the union of all center data used within the kernel function as a struct

with the following fields
  • xi The state variable centers
  • ti The times at which the state xi is taken
  • mui The parameter used to obtain the state xi

The only required field is xi, others can be set to [] if not used.

Property class data:
The expansion centers.

Default: struct(xi,[])

Note
This property has the MATLAB attribute SetObservable set to true.
Matlab documentation of property attributes.
This property has custom functionality when its value is changed.

Definition at line 170 of file KernelExpansion.m.

Referenced by kernels.ParamTimeKernelExpansion.clear(), clear(), clone(), exportToDirectory(), approx.algorithms.AAdaptiveBase.extendExpansion(), kernels.ParamTimeKernelExpansion.getGlobalLipschitz(), kernels.ParamTimeKernelExpansion.getKernelMatrix(), getKernelMatrix(), kernels.ParamTimeKernelExpansion.getKernelMatrixColumn(), getKernelMatrixColumn(), kernels.ParamTimeKernelExpansion.getKernelVector(), getKernelVector(), kernels.ParamTimeKernelExpansion.getStateJacobian(), getStateJacobian(), getSubExpansion(), demos.ResponseSurfaceApprox.iterationPlots(), loadobj(), kernels.ParamTimeKernelExpansion.ParamTimeKernelExpansion(), project(), scalarProductWith(), kernels.ParamTimeKernelExpansion.setCentersFromATD(), setCentersFromATD(), test_getStateJacobianInstance(), and toJSON().

kernels.KernelExpansion.ComponentNorms

Returns the native space norms \(||f_j||^2_\H\) for each component function \(j \equiv\)size(Ma,1)

Note
This property has the MATLAB attribute Dependent set to true.
Matlab documentation of property attributes.
[readonly]

Definition at line 117 of file KernelExpansion.m.

kernels.KernelExpansion.fSK
protected

The inner (state) kernel object.

Default: kernels.GaussKernel;

Note
This property has non-standard access specifiers: SetAccess = Private, GetAccess = Protected
Matlab documentation of property attributes.

Definition at line 234 of file KernelExpansion.m.

Referenced by clone(), getKernelMatrix(), getKernelMatrixColumn(), kernels.ParamTimeKernelExpansion.getKernelVector(), getKernelVector(), kernels.ParamTimeKernelExpansion.getStateJacobian(), KernelExpansion(), and loadobj().

kernels.KernelExpansion.HasCustomBase

Flag that indicates if a base other than the direct translate base is used for this kernel expansion.

Default: false

Note
This property has the MATLAB attribute Dependent set to true.
Matlab documentation of property attributes.
[readonly]

Definition at line 143 of file KernelExpansion.m.

Referenced by toJSON().

kernels.KernelExpansion.Kernel

The Kernel to use for system variables.

Property class critical:
Correct choice of the system kernel greatly influences the function behaviour.

Default: kernels.GaussKernel

See Also
kernels
Note
This property has the MATLAB attribute Dependent set to true.
This property has the MATLAB attribute SetObservable set to true.
Matlab documentation of property attributes.

Definition at line 68 of file KernelExpansion.m.

Referenced by exportToDirectory(), kernels.ParamTimeKernelExpansion.getGlobalLipschitz(), getGlobalLipschitz(), loadobj(), and test_getStateJacobianInstance().

kernels.KernelExpansion.Ma = "[]"

The coefficient data for each dimension.

Property class data:
The expansion coefficients.

Default: []

Note
This property has the MATLAB attribute SetObservable set to true.
Matlab documentation of property attributes.

Definition at line 195 of file KernelExpansion.m.

Referenced by clear(), clone(), kernels.ParamTimeKernelExpansion.evaluate(), evaluate(), exportToDirectory(), kernels.ParamTimeKernelExpansion.getStateJacobian(), getStateJacobian(), loadobj(), normalize(), approx.KernelEI.project(), project(), scalarProductWith(), toJSON(), and uminus().

kernels.KernelExpansion.Ma_norms

The norms of the coefficient matrix of the kernel expansion.

Note
This property has the MATLAB attribute Dependent set to true.
Matlab documentation of property attributes.
[readonly]

Definition at line 89 of file KernelExpansion.m.

Referenced by kernels.ParamTimeKernelExpansion.getGlobalLipschitz(), and getGlobalLipschitz().

kernels.KernelExpansion.MBnd

Returns the M upper bound for this KernelExpansion, which is \(M := \max\limits_{j=1}^d\sum\limits_{i=1}^m |c^d_i|\).

Note
This property has the MATLAB attribute Dependent set to true.
Matlab documentation of property attributes.
[readonly]

Definition at line 131 of file KernelExpansion.m.

kernels.KernelExpansion.NativeNorm

Returns the norm \(||f||^2_{\H^q}\) of \(f\) in the RKHS \(\H^q,\quad q\in\N\).

Returns the native norm of the kernel expansion.

For \(q=1\) this equals the ComponentNorms output.

Note
This property has the MATLAB attribute Dependent set to true.
Matlab documentation of property attributes.
[readonly]

Definition at line 102 of file KernelExpansion.m.

Referenced by normalize().

kernels.KernelExpansion.Size

The size of the kernel expansion.

Note
This property has the MATLAB attribute Dependent set to true.
Matlab documentation of property attributes.
[readonly]

Definition at line 157 of file KernelExpansion.m.


The documentation for this class was generated from the following file: