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
testsettings.m
Go to the documentation of this file.
1 namespace testing{
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 
18 function s = testsettings() {
19 
20 s = struct;
21 
22 /* % Test sizes
23  * What dimension? */
24 s.testdim= 10;
25 
26 /* How many params? (to use from the ones defined below) */
27 s.testparams= 2;
28 s.testinputs= 1;
29 
30 /* % Model settings */
31 s.m= models.BaseFullModel;
32 s.m.T= 3;
33 s.m.dt= .2;
34 s.m.Sampler= sampling.RandomSampler;
35 s.m.Sampler.Samples= 10;
36 s.m.System.MaxTimestep= s.m.dt;
37 s.m.ODESolver= solvers.ExplEuler;
38 
39 a = approx.KernelApprox(s.m.System);
40 ap = approx.algorithms.VKOGA;
41 ec = kernels.config.ParamTimeExpansionConfig;
42 ec.StateConfig= kernels.config.GaussConfig(" G ",1:2);
43 ec.ParamConfig= kernels.config.GaussConfig(" G ",.1:.1:.3);
44 ap.ExpConfig= ec;
45 ap.MaxExpansionSize= 5; /* Keep test run short! */
46 
47 a.Algorithm= ap;
48 /* a.CoeffComp = general.regression.ScalarEpsSVR; */
49 s.TimeKernel= kernels.NoKernel;
50 /* a.TimeKernel = kernels.GaussKernel(2); */
51 s.Kernel= kernels.GaussKernel(2);
52 s.ParamKernel= kernels.GaussKernel(2);
53 s.m.Approx= a;
54 
55 /* % Dynamical System settings/functions */
56 s.Inputs[1] = @(t)1; /* Function 1: Constant 1 */
57 
58 s.Inputs[2] = @(t)sin(4*t); /* Function 2: some sin(t) */
59 
60 s.Inputs= s.Inputs(1:s.testinputs);
61 
62 /* Used Parameter Space */
63 s.params(1) = struct(" Name ", " P1 ", " MinVal ", -1, " MaxVal ", 1, " Desired ", 10, " Default ", 0);
64 s.params(2) = struct(" Name ", " P2 ", " MinVal ", 2, " MaxVal ", 3, " Desired ", 5, " Default ", 2.5);
65 s.params(3) = struct(" Name ", " P3 ", " MinVal ", 0, " MaxVal ", 10, " Desired ", 6, " Default ", 5);
66 s.params= s.params(1:s.testparams);
67 
68 /* Input conversion */
69 muidx = randi(s.testparams,s.testdim,1);
70 s.B= @(t,mu)ones(s.testdim,1);
71 s.B_p= @(t,mu)ones(s.testdim,1).*mu(muidx);
72 
73 /* Initials */
74 musel = (rand(s.testdim,1)<.5);
75 s.x0= dscomponents.ConstInitialValue(rand(s.testdim,1));
76 av = dscomponents.AffineInitialValue;
77 av.addMatrix([" mu( " num2str(randi(s.testparams)) " ) "],musel .* rand(s.testdim,1));
78 av.addMatrix(" .5 + mu(1) ",5*rand(s.testdim,1));
79 s.x0_p= av;
80 
81 /* Linear functions */
82 muidx = randi(s.testparams,s.testdim,1);
83 A = rand(s.testdim,s.testdim);
84 s.flin= @(x,t,mu)A*x;
85 s.flin_p= @(x,t,mu)(A + diag(mu(muidx)))*x;
86 
87 /* Nonlinear functions */
88 randx = randi(s.testdim);
89 randmu = randi(s.testparams);
90 s.fnlin_p= @(x,t,mu)(.5+t/2)*sin(x) + x(randx)*mu(randmu);
91 s.fnlin= @(x,t,mu)(.5+t/2).*sin(x);
92 
93 end
94 
95 
96 }
115 };
function s = testsettings()
TESTSETTINGS KerMor test settings collection.
Definition: testsettings.m:18