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
DefaultEstimator.m
Go to the documentation of this file.
1 namespace error{
2 
3 
4 /* (Autoinserted by mtoc++)
5  * This source code has been filtered by the mtoc++ executable,
6  * which generates code that can be processed by the doxygen documentation tool.
7  *
8  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
9  * Except for the comments, the function bodies of your M-file functions are untouched.
10  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
11  * attached source files that are highly readable by humans.
12  *
13  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
14  * the correct locations in the source code browser.
15  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
16  */
17 
19  :public error.BaseEstimator {
51  public:
52 
69  public:
70 
72 
73  this.ExtraODEDims= 0;
74  if nargin == 1
75  this.Enabled= true;
76  this.offlineComputations(rmodel.FullModel);
77  this = this.prepareForReducedModel(rmodel);
78  else
79  this.Enabled= false;
80  end
81  }
95  function copy = clone() {
96  copy = error.DefaultEstimator;
97  copy = clone@error.BaseEstimator(this, copy);
98  /* No local properties there. */
99  }
107  function eint = evalODEPart() {
108  eint = [];
109  }
129  function e0 = getE0(colvec<double> mu) {
130  e0 = [];
131  }
142  function ct = postProcess(colvec<double> x,double t,integer inputidx) {
143 
144  m = this.ReducedModel.FullModel;
145 
146  /* Compute full solution */
147  [~, yf, ct, xf] = m.simulate(this.mu, inputidx);
148  st = tic;
149  xr = x(1:end-this.ExtraODEDims,:);
150  if ~isempty(this.ReducedModel.V)
151  diff = xf-this.ReducedModel.V*xr;
152  else
153  diff = xf-xr;
154  end
155  this.StateError= Norm.LG(diff,this.ReducedModel.G);
156 
157  /* The reduced model's output C contains scaling! */
158  yr = this.ReducedModel.System.computeOutput(xr);
159  this.RealOutputError= Norm.L2(yf-yr);
160  ct = ct + toc(st);
161  ct = ct + postProcess@error.BaseEstimator(this, x, t, inputidx);
162  }
174  function ct = prepareConstants(colvec<double> mu,integer inputidx) {
175 
176  /* Nothing to do here */
177  ct = prepareConstants@error.BaseEstimator(this, mu, inputidx);
178  }
190  public: /* ( Static ) */
191 
192  static function errmsg = validModelForEstimator(varargin) {
193  errmsg = [];
194  }
195 
196 
197 };
198 }
199 
200 
201 
function ct = prepareConstants(colvec< double > mu,integer inputidx)
Return values: ct: The time needed for postprocessing.
function copy = clone()
Clones this DefaultEstimator.
models.BaseFullModel FullModel
The full model this reduced model was created from.
Definition: ReducedModel.m:53
models.BaseFirstOrderSystem System
The actual dynamical system used in the model.
Definition: BaseModel.m:102
StateError
The reduction state-space error from the last simulation.
Definition: BaseEstimator.m:82
matrix< double > G
The custom scalar product matrix .
Definition: BaseModel.m:132
DEFAULTESTIMATOR Default error "estimator" for reduced models Standard estimator that is independent ...
An integer value.
The KerMor reduced model class.
Definition: ReducedModel.m:18
matrix< double > V
The matrix that has been used for projection.
Definition: ReducedModel.m:72
Base class for all error estimators.
Definition: BaseEstimator.m:18
Enabled
Flag that indicates whether error estimation is used or not.
Definition: BaseEstimator.m:67
A variable number of input arguments.
static function errmsg = validModelForEstimator(varargin)
function prepared = prepareForReducedModel(models.ReducedModel rmodel)
Default implementation which simply clones this (subclass!)instance and returns the copy to use in re...
function eint = evalODEPart()
The default estimator does not have an ODE part as it computes the full error in the postprocessing s...
DefaultEstimator(models.ReducedModel rmodel)
Creates the default error estimator that works with every model since it computes the full system err...
static function rowvec< double > n = LG(matrix< double > x, G)
Returns the -induced norm for each column vector in .
Definition: Norm.m:87
function ct = postProcess(colvec< double > x,double t,integer inputidx)
Overwrites the default postprocess method.
function y = computeOutput(matrix< double > x,colvec< double > mu)
Computes the output from a given state result vector , using the system's time and current mu (if gi...
static function rowvec< double > n = L2(matrix< double > x)
Returns the discrete norm for each column vector in x.
Definition: Norm.m:39
RealOutputError
The true output error for .
function offlineComputations(models.BaseFullModel model)
Performs a validity check for the given model and sets up the estimator for use with the specified mo...
models.ReducedModel ReducedModel
The reduced model associated with the error estimator.
Norm: Static class for commonly used norms on sets of vectors.
Definition: Norm.m:17
ExtraODEDims
The dimensions added to the ODE function by the estimator.
Definition: BaseEstimator.m:97
function [ rowvec< double > t , matrix< double > y , double sec , x ] = simulate(colvec< double > mu,integer inputidx)
Simulates the system and produces the system's output.
Definition: BaseModel.m:477
function e0 = getE0(colvec< double > mu)
This error estimator does not use any ODE dimensions, so the initial error part is an empty matrix...