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
ParamTimeExpansionConfig.m
Go to the documentation of this file.
1 namespace kernels{
2 namespace config{
3 
4 
5 /* (Autoinserted by mtoc++)
6  * This source code has been filtered by the mtoc++ executable,
7  * which generates code that can be processed by the doxygen documentation tool.
8  *
9  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
10  * Except for the comments, the function bodies of your M-file functions are untouched.
11  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
12  * attached source files that are highly readable by humans.
13  *
14  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
15  * the correct locations in the source code browser.
16  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
17  */
18 
38  public:
39 
60  public:
61 
63  this.RequiredPrototypeClass= " kernels.ParamTimeKernelExpansion ";
64  this.Prototype= kernels.ParamTimeKernelExpansion;
65  }
66 
67 
68  function integern = getNumConfigurations() {
69 
70  /* Passive strategy: Only use as many configurations as
71  * available over all kernel configs. */
72  n = getNumConfigurations@kernels.config.ExpansionConfig(this);
73  if ~isempty(this.TimeConfig)
74  n = min(n,this.TimeConfig.getNumConfigurations);
75  end
76  if ~isempty(this.ParamConfig)
77  n = min(n,this.ParamConfig.getNumConfigurations);
78  end
79  }
88  function kernels.KernelExpansionkexp = configureInstance(nr) {
89  kexp = configureInstance@kernels.config.ExpansionConfig(this, nr);
90  if ~isempty(this.TimeConfig)
91  kexp.TimeKernel= this.TimeConfig.configureInstance(nr);
92  end
93  if ~isempty(this.ParamConfig)
94  kexp.ParamKernel= this.ParamConfig.configureInstance(nr);
95  end
96  }
97 
98 
99  function str = getConfigurationString(nr,asCell) {
100  if nargin < 3
101  asCell = false;
102  end
103  str = getConfigurationString@kernels.config.ExpansionConfig(this, nr, asCell);
104  if ~isempty(this.TimeConfig)
105  str = [str sprintf(" , TimeKernel: %s ",this.TimeConfig.getConfigurationString(nr, asCell))];
106  end
107  if ~isempty(this.ParamConfig)
108  str = [str sprintf(" , ParamKernel: %s ",this.ParamConfig.getConfigurationString(nr, asCell))];
109  end
110  }
111 
112 
113  function str = getConfiguredPropertiesString() {
114  e = [getConfiguredPropertiesString@kernels.config.ExpansionConfig(this)];
115  if ~isempty(this.ParamConfig) || ~isempty(this.TimeConfig)
116  e[end] = [" State: " e[end]];
117  end
118  if ~isempty(this.TimeConfig)
119  e(end+1) = [[" Time: " this.TimeConfig.getConfiguredPropertiesString]];
120  end
121  if ~isempty(this.ParamConfig)
122  e(end+1) = [[" Param: " this.ParamConfig.getConfiguredPropertiesString]];
123  end
124  str = Utils.implode(e," , ");
125  }
126 
127 
128  function conf = getSubPart(partNr,totalParts) {
129  conf = this.clone;
130  if ~isempty(this.StateConfig)
131  conf.StateConfig= this.StateConfig.getSubPart(partNr, totalParts);
132  end
133  if ~isempty(this.TimeConfig)
134  conf.TimeConfig= this.TimeConfig.getSubPart(partNr, totalParts);
135  end
136  if ~isempty(this.ParamConfig)
137  conf.ParamConfig= this.ParamConfig.getSubPart(partNr, totalParts);
138  end
139  }
140 
141 
142  function copy = clone() {
143  copy = kernels.config.ParamTimeExpansionConfig;
144  copy = clone@kernels.config.ExpansionConfig(this, copy);
145  if ~isempty(this.TimeConfig)
146  copy.TimeConfig= this.TimeConfig.clone;
147  end
148  if ~isempty(this.ParamConfig)
149  copy.ParamConfig= this.ParamConfig.clone;
150  end
151  }
152 
153 
154 
155  protected:
156 
157  function collectRanges(ptable,proppath) {
158  collectRanges@kernels.config.ExpansionConfig(this, ptable, proppath);
159  if ~isempty(this.TimeConfig)
160  this.TimeConfig.collectRanges(ptable, ...
161  [proppath [sprintf(" Time(%s) ",this.TimeConfig.getClassName)]]);
162  end
163  if ~isempty(this.ParamConfig)
164  this.ParamConfig.collectRanges(ptable, ...
165  [proppath [sprintf(" Param(%s) ",this.ParamConfig.getClassName)]]);
166  end
167  }
168 
169 
170  public: /* ( Static ) */
171 
172  static function res = test_ParamTimeExpansionConfig() {
173  ptc = kernels.config.ParamTimeExpansionConfig;
174  n = randi(100)*2;
175  gk = kernels.config.GaussConfig(" G ",1:n);
176  ptc.StateConfig= gk;
177  ptc.ParamConfig= gk;
178  tk = kernels.config.PolyConfig(linspace(0,5,n-1));
179  ptc.TimeConfig= tk;
180 
181  res = ptc.getNumConfigurations == n-1;
182 
183  tk = kernels.config.PolyConfig(linspace(0,5,n));
184  ptc.TimeConfig= tk;
185  res = res && ptc.getNumConfigurations == n;
186 
187  kexp = ptc.configureInstance(1);
188  res = res && isa(kexp," kernels.ParamTimeKernelExpansion ");
189 
190  disp(ptc.getConfigurationString(1));
191  disp(ptc.getConfiguredPropertiesString);
192  ptc1 = ptc.getSubPart(1,2);
193  res = res && ptc1.getNumConfigurations == n/2;
194  ptc2 = ptc.getSubPart(2,2);
195  res = res && ptc2.getNumConfigurations == n/2;
196 
197  t = ptc.getValueRanges;
198  t.print;
199 
200  }
201 
202 
203 
204 };
205 }
206 }
207 
Collection of generally useful functions.
Definition: Utils.m:17
IClassConfig TimeConfig
The time kernel configuration.
function conf = getSubPart(partNr, totalParts)
IClassConfig: Abstract interface for a set of configurations that can be applied to a given algorithm...
Definition: IClassConfig.m:17
virtual function integer n = getNumConfigurations()
Returns the number of configurations that can be applied.
IClassConfig StateConfig
The state space kernel configuration.
virtual function char str = getConfiguredPropertiesString()
Returns a string of the changed properties by this IClassConfig instance.
function str = getConfigurationString(nr, asCell)
virtual function IClassConfig conf = getSubPart(integer partNr,integer totalParts)
Returns a sub-part of this configuration as a new instance.
function copy = clone(copy)
The interface method with returns a copy of the current class instance.
Definition: IClassConfig.m:109
IClassConfig ParamConfig
The parameter kernel configuration.
virtual function collectRanges(ptable, proppath)
virtual function integer str = getConfigurationString(integer nr,logical asCell)
Returns the number of configurations that can be applied.
function str = getConfiguredPropertiesString()
Returns a string of the changed properties by this IClassConfig instance.
ICloneable Prototype
The prototype class that is to be used as base class before configuring a new instance.
Definition: IClassConfig.m:42
function cn = getClassName()
Returns the simple class name of this object without packages.
Definition: KerMorObject.m:108
disp
Handle object disp method which is called by the display method. See the MATLAB disp function...
function integer n = getNumConfigurations()
Returns the number of configurations that can be applied.
ParamTimeExpansionConfig: Collects several class configurations for state, time and paramter kernels ...
function kernels.KernelExpansion kexp = configureInstance(nr)
char RequiredPrototypeClass
Determines the class that is allowed to be configured.
Definition: IClassConfig.m:55
static function char str = implode(char|rowvec data,char glue,char format)
Implodes the elements of data using glue.
Definition: Utils.m:208
virtual function ICloneable object = configureInstance(integer nr)
Creates a new instance with given configuration.
ExpansionConfig: Base class config for kernel expansions.