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
RotationDecorator.m
Go to the documentation of this file.
1 namespace spacereduction{
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 
39  public:
40 
41  Degree = .05;
54  Dims = 5;
68  private:
69 
70  sp;
78  public:
79 
81  if isempty(s)
82  error(" Rotation decorator must be given an underlying space reduction class. ");
83  end
84  if ~strcmp(s.TargetDimensions," : ")
85  error(" Rotation decorator not implemented for partial reduction (ReducableDims != :) ");
86  end
87  this.sp= s;
88  this.registerProps(" Degree "," Dims ");
89  }
102  protected:
103 
104 
105  function [V , W ] = generateReducedSpaceImpl(models.BaseFullModel model,subset) {
106 
107  /* Call subclass reduction */
108  [V, W] = this.sp.generateReducedSpaceImpl(model, subset);
109 
110  /* rnd = RandStream('mt19937ar','Seed',2564); */
111 
112  n = size(V,1); /* #ok<*PROP> */
113 
114  if this.Dims >= n/2
115  warning(" KerMor:spacereduction:RotationDecorator "," Too large Dims property (%d) for full space dimension %d, setting to %d ",this.Dims,n,floor(n/2));
116  this.Dims= floor(n/2);
117  end
118  R = spdiags(ones(n,1),0,n,n);
119  for idx = 1:this.Dims
120  Q = spdiags(ones(n,1),0,n,n);
121  /* idx1 = rnd.randi(n); */
122  idx1 = 2*(idx-1)+1;
123  /* idx2 = rnd.randi(n); */
124  idx2 = idx1+1;
125 
126  Q(idx1,idx1) = cos(this.Degree);
127  Q(idx1,idx2) = -sin(this.Degree);
128  Q(idx2,idx1) = sin(this.Degree);
129  Q(idx2,idx2) = cos(this.Degree);
130  R = R*Q;
131  end
132  V = R*V;
133  W = R*W;
134  }
146 };
147 }
148 
RotationDecorator(s)
Creates a new rotation decorator Parameters: s: Subclass of spacereduction.BaseSpaceReducer.
The base class for any KerMor detailed model.
Definition: BaseFullModel.m:18
RotationDecorator: Decorator for any other space reducer which rotates the resulting matrix...
function registerProps(varargin)
Call this method at any class that defines DPCM observed properties.
Definition: DPCMObject.m:125
function [ V , W ] = generateReducedSpaceImpl(models.BaseFullModel model, subset)
Computes the subspace given by the underlying subspace reduction class but then rotates for Dims time...
Dims
Number of dimensions to rotate by Degree.
Base class for all space reduction algorithms.