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
DEIMEstimator.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,
63  public:
64 
148  UseTrueDEIMErr = false;
159  public:
160 
209  public:
210 
211  M3 = "[]";
212 
213  M4 = "[]";
214 
215  M5 = "[]";
216 
217  M6 = "[]";
218 
219  M7 = "[]";
220 
221  M8 = "[]";
222 
223  M9 = "[]";
224 
225  M10 = "[]";
226 
227  M11 = "[]";
228 
229  M12 = "[]";
230 
231  Ah;
273 
274 
276 
277 
289  public: /* ( Dependent ) */
290 
329  private:
330 
331  jstSize = 0;
332 
333  deim;
334 
335 
336  private: /* ( Transient ) */
337 
338  fullsol;
339 
340  uolst = "[]";
341 
342  silent = false;
343 
344  lastvalpos;
345 
346 
347  public: /* ( Transient ) */
348 
350  this = this@error.BaseEstimator;
351  this.ExtraODEDims= 1;
352  this.TrainDataSelector= data.selection.DefaultSelector;
353  }
354 
355 
357 
358  if KerMor.App.Verbose > 0
359  fprintf(" error.DEIMEstimator: Starting offline computations...\n ");
360  end
361 
362  /* Call superclass */
363  offlineComputations@error.BaseEstimator(this, fm);
364 
365  /* Precompute log norm of A component if existing */
366  this.Aln= [];
367  fA = fm.System.A;
368  if ~isempty(fA)
369  /* Precompute logarithmic norm of A(t,\mu) */
370  a = general.AffParamMatrix;
371  if isa(fA, " dscomponents.LinearCoreFun ")
372  a.addMatrix(" 1 ",Utils.logNorm(fA.A));
373  else
374  for i=1:fA.N
375  a.addMatrix([" abs( " fA.funStr[i] " ) "],...
376  Utils.logNorm(fA.getMatrix(i)));
377  end
378  end
379  this.Aln= a;
380  end
381 
382  /* Jacobian matrix DEIM approx */
383  this.compute_jacmdeim(fm);
384 
385  /* Similarity transformation */
386  this.compute_simtrans(fm);
387 
388  /* Compute approximation for local logarithmic norm
389  * this.computeLogNormApprox; */
390  }
402  function prepared = prepareForReducedModel(models.ReducedModel rm) {
403  prepared = prepareForReducedModel@error.BaseEstimator(this, rm);
404 
405  fm = rm.FullModel;
406 
407  W = rm.W;
408  if isempty(W)
409  W = rm.V;
410  end
411 
412  /* Perform projection of JacMDeim instance */
413  prepared.JacMDEIM= this.JacMDEIM.project(rm.V, W);
414 
415  /* Precompute all the projected quantities that are independent of the DEIM error
416  * orders */
417  fA = fm.System.A;
418  G = fm.G;
419  A = [];
420  if ~isempty(fA)
421  hlp = fA*rm.V;
422  A = hlp - rm.V*(W^t*hlp); /* (I-VW^T)AV */
423 
424  prepared.M6= A^t*(G*A);
425  prepared.Ah= A;
426  else
427  prepared.M6= []; prepared.M7= []; prepared.M8= []; prepared.M9= [];
428  end
429  B = [];
430  if ~isempty(fm.System.B)
431  B = fm.System.B - rm.V*(W^t*fm.System.B);
432  prepared.M12= B^t*(G*B);
433  prepared.Bh= B;
434  else
435  prepared.M9= []; prepared.M10= []; prepared.M11= []; prepared.M12= [];
436  end
437  if ~isempty(A) && ~isempty(B)
438  if isa(B," dscomponents.LinearInputConv ")
439  prepared.M9= 2*A^t*(G*B.B);
440  else
441  /* Both inherit from AffParamMatrix, so they can be
442  * multiplied :-) */
443  prepared.M9= 2*A^t*(G*B);
444  end
445  else
446  prepared.M9= [];
447  end
448 
449  newd = rm.System.f;
450  prepared.uolst= addlistener(newd," OrderUpdated ",@prepared.handleOrderUpdate);
451  prepared.deim= newd;
452  prepared.updateErrMatrices;
453  }
469  function ct = prepareConstants(colvec<double> mu,integer inputidx) {
470  prepareConstants@error.BaseEstimator(this, mu, inputidx);
471  if this.deim.Order(2) == 0 && ~this.UseTrueDEIMErr
472  warning(" KerMor:DEIMEstimator "," No DEIM error order set. Disabling error estimator. ");
473  this.Enabled= false;
474  ct = 0;
475  return;
476  end
477  /* True log lip const comparison estimator */
478  if this.Enabled
479  rm = this.ReducedModel;
481  [~, this.fullsol, ct] = rm.FullModel.computeTrajectory(mu, inputidx);
482  else
483  this.JacMDEIM.f.prepareSimulation(mu);
484  ct = 0;
485  end
486  this.LastAlpha= zeros(1,length(rm.Times));
487  this.LastBeta= zeros(1,length(rm.Times));
488  this.lastvalpos= [1 1];
489 
490  if ~isempty(this.M6)
491  this.M6.prepareSimulation(mu);
492  end
493  if ~isempty(this.M7)
494  this.M7.prepareSimulation(mu);
495  end
496  if ~isempty(this.M8)
497  this.M8.prepareSimulation(mu);
498  end
499  if ~isempty(this.M9)
500  this.M9.prepareSimulation(mu);
501  end
502  end
503  this.kexp= [];
504  }
505 
506 
507  function a = getAlpha(colvec<double> x,double t,colvec<double> ut) {
508  mu = this.mu;
509  if this.UseTrueDEIMErr
510  rm = this.ReducedModel;
511  fs = rm.FullModel.System;
512  A = fs.A.evaluate(rm.V*x,t);
513  if isempty(rm.W)
514  a = A - rm.V*(rm.W^t*A);
515  else
516  a = A - rm.V*(rm.V^t*A);
517  end
518  a = a + fs.f.evaluate(rm.V*x,t,mu) ...
519  - rm.V*rm.System.f.evaluate(x,t,mu);
520  if ~isempty(fs.B)
521  hlp = fs.B.evaluate(t,mu)*ut;
522  a = a + (hlp-rm.V*(rm.W^t*hlp));
523  end
524  a = Norm.LG(a,rm.FullModel.G);
525  else
526  f = this.ReducedModel.System.f.f;
527  v1 = f.evaluateComponentSet(1, x, t);
528  v2 = f.evaluateComponentSet(2, x, t);
529 
530  /* NOTE: The factors 2 before some summands are added at offline
531  * stage!! */
532  a = v1" *this.M3*v1 - v1 "*this.M4*v2 + v2^t*this.M5*v2;
533  if ~isempty(this.M6) /* An time/param affine A is set */
534 
535  a = a + x" *this.M6.evaluate(x,t) + v1 "*this.M7.evaluate(x,t) ...
536  - v2^t*this.M8.evaluate(x,t);
537  if ~isempty(ut)
538  a = a + x^t*this.M9.evaluate(ut,t);
539  end
540  end
541  if ~isempty(ut) /* An input function u is set */
542 
543  a = a + v1" *this.M10.evaluate(t,mu)*ut - v2 "*this.M11.evaluate(t,mu)*ut ...
544  + ut^t*this.M12.evaluate(t,mu)*ut;
545  end
546  a = sqrt(a);
547 /* %% Validation: direct computation (expensive)
548  * V = this.ReducedModel.V;
549  * fs = this.ReducedModel.FullModel.System;
550  * I = speye(size(V,1));
551  * hlp = fs.A.evaluate(V*x,t,mu);
552  * a_1 = hlp - V*(V'*hlp);
553  * a_2 = this.ReducedModel.System.f.M1 * v1;
554  * a_3 = this.ReducedModel.System.f.M2 * v2;
555  * a_4 = 0;
556  * if ~isempty(fs.B)
557  * a_4 = (I-V*V')*fs.B.evaluate(t,mu)*ut;
558  * end
559  * a2 = sqrt((a_1+a_2-a_3+a_4)'*this.ReducedModel.FullModel.G...
560  * *(a_1+a_2-a_3+a_4));
561  * if abs((a-a2)/a2) > 1e-1
562  * error('alpha computation mismatch.');
563  * end */
564  end
565  this.LastAlpha(this.lastvalpos(1)) = a;
566  this.lastvalpos(1) = this.lastvalpos(1)+1;
567  }
580  function b = getBeta(colvec<double> x,double t) {
581  mu = this.mu;
582  /* Validation code */
584  rm = this.ReducedModel;
585  f = rm.FullModel.System.f;
586  tx = this.fullsol(:,find(abs(rm.scaledTimes - t) < eps,1));
587  rx = rm.V*x;
588  d = tx - rx;
589  diff = sum(d.*d);
590  if diff ~= 0
591  /* Use local jacobian matrix log lip const */
592  if this.UseJacobianLogLipConst
593  b = d^t*(f.getStateJacobian(tx,t,mu)*d) / diff;
594  /* Use local function log lip const */
595  else
596  b = d^t*(f.evaluate(tx,t,mu) - f.evaluate(rx,t,mu)) / diff;
597  end
598  else
599  b = 0;
600  end
601  elseif this.UseFullJacobian || this.UseJacobianNorm
602  rm = this.ReducedModel;
603  f = rm.FullModel.System.f;
604  J = f.getStateJacobian(rm.V*x, t, mu);
605  if this.UseJacobianNorm
606  b = normest(J);
607  else
608  b = Utils.logNorm(J);
609  end
610  else
611  DJ = this.JacMDEIM.evaluate(x,t);
612  b = Utils.logNorm(DJ);
613  end
614 
615  /* DFJ = fm.Approx.getStateJacobian(rx,t,mu);
616  * jtlc = (d'*(FJ*d)) / sum(d.*d);
617  * djtlc = (d'*(DFJ*d)) / sum(d.*d); */
618 
619  /* fprintf('True: %g, Jac: %g, diff: %g, rel: %g, DEIMJac: %g, diff: %g, rel: %g\n',...
620  * tlc,jtlc,abs(tlc-jtlc),abs((tlc-jtlc)/tlc),...
621  * djtlc,abs(tlc-djtlc),abs((tlc-djtlc)/tlc)); */
622 
623  /* J = this.deim.getStateJacobian(x,t,mu);
624  * jln = Utils.logNorm(J); */
625 
626  /* fprintf('Log norms - F: %g, SF: %g, SR: %g, R: %g\n',...
627  * fjln,sfjln,dsjln,jln); %, FJN: %g */
628 
629  if isnan(b)
630  fprintf(2," NaN b value occured in error.DEIMEstimator.getBeta!\n ");
631  b = 0;
632  end
633 
634  /* Take care of the A(t,\mu) part, if existing
635  *this.kexp(1,end+1) = b; */
636  if ~isempty(this.Aln)
637  b = b + this.Aln.compose(t, mu);
638  end
639  /* this.kexp(2,end) = b; */
640  this.LastBeta(this.lastvalpos(2)) = b;
641  this.lastvalpos(2) = this.lastvalpos(2) + 1;
642  }
656  function eint = evalODEPart(colvec<double> x,double t,colvec<double> ut) {
657  eint = this.getBeta(x(1:end-1), t)*x(end) + this.getAlpha(x(1:end-1), t, ut);
658  }
670  function time = postProcess(matrix<double> x,double t,integer inputidx) {
671  time = tic;
672  rm = this.ReducedModel;
673  /* Get initial values of alpha/beta for completeness */
674  ut = [];
675  t0 = rm.scaledTimes(1);
676  if ~isempty(inputidx)
677  ut = rm.System.Inputs[inputidx](t0);
678  end
679  x0 = rm.System.x0.evaluate(this.mu);
680  this.LastAlpha(1) = this.getAlpha(x0, t0, ut);
681  this.LastBeta(1) = this.getBeta(x0, t0);
682 
683  this.StateError= x(end,:);
684  time = toc(time) + postProcess@error.BaseEstimator(this, x, t, inputidx);
685  }
702  function copy = clone() {
703  copy = clone@error.BaseEstimator(this, error.DEIMEstimator);
704  copy.silent= true;
705 
706  /* DEIM stuff */
707  copy.JacMatDEIMMaxOrder= this.JacMatDEIMMaxOrder;
708  copy.JacMDEIM= [];
709  if ~isempty(this.JacMDEIM)
710  copy.JacMDEIM= this.JacMDEIM.clone;
711  end
712  copy.deim= this.deim;
713  if ~isempty(copy.deim)
714  copy.uolst= addlistener(copy.deim," OrderUpdated ",@copy.handleOrderUpdate);
715  end
716 
717  /* Sim Trans stuff */
718  copy.JacSimTransMaxSize= this.JacSimTransMaxSize;
719  copy.jstSize= this.jstSize;
720  copy.QFull= this.QFull;
721  copy.QSingVals= this.QSingVals;
722 
723  copy.UseTrueLogLipConst= this.UseTrueLogLipConst;
724  copy.UseTrueDEIMErr= this.UseTrueDEIMErr;
725  copy.UseFullJacobian= this.UseFullJacobian;
726 
727  copy.TrainDataSelector= this.TrainDataSelector.clone;
728 
729  copy.scale= this.scale;
730  copy.kexp= this.kexp;
731  copy.fullsol= this.fullsol;
732 
733  copy.M3= this.M3;
734  copy.M4= this.M4;
735  copy.M5= this.M5;
736  if ~isempty(this.M6)
737  copy.M6= this.M6.clone;
738  end
739  if ~isempty(this.M7)
740  copy.M7= this.M7.clone;
741  end
742  if ~isempty(this.M8)
743  copy.M8= this.M8.clone;
744  end
745  if ~isempty(this.M9)
746  copy.M9= this.M9.clone;
747  end
748  if ~isempty(this.M10)
749  copy.M10= this.M10.clone;
750  end
751  if ~isempty(this.M11)
752  copy.M11= this.M11.clone;
753  end
754  if ~isempty(this.M12)
755  copy.M12= this.M12.clone;
756  end
757  if ~isempty(this.Ah)
758  copy.Ah= this.Ah.clone;
759  end
760  if ~isempty(this.Aln)
761  copy.Aln= this.Aln;
762  end
763  if ~isempty(this.Bh)
764  copy.Bh= this.Bh.clone;
765  end
766  copy.silent= false;
767  }
768 
769 
770  function plotSummary(pm,context) {
771  if ~isempty(this.QSingVals)
772  str = sprintf(" %s: Singular value decay for partial similarity transformation ",context);
773  h = pm.nextPlot(" deimest_simtrans_singvals ",...
774  str,...
775  " transformation size "," singular values ");
776  semilogy(h,this.QSingVals," LineWidth ",2);
777  end
778  }
779 
780 
781  private: /* ( Transient ) */
782 
783  function compute_jacmdeim(models.BaseFullModel fm) {
784  jtd = data.ApproxTrainData.computeFrom(fm, ...
785  general.JacCompEvalWrapper(fm.System.f), this.TrainDataSelector, false);
786  md = fm.Data;
787  md.JacobianTrainData= jtd;
788 
789  /* % Matrix DEIM */
790  jd = general.MatrixDEIM;
791  jd.MaxOrder= this.JacMatDEIMMaxOrder;
792  jd.NumRows= fm.System.f.fDim;
793  if KerMor.App.Verbose > 0
794  fprintf(" Computing matrix DEIM (MaxOrder=%d) of system jacobian...\n ",...
795  this.JacMatDEIMMaxOrder);
796  end
797  jd.computeDEIM(general.JacCompEvalWrapper(fm.System.f), ...
798  md.JacobianTrainData.fxi);
799  /* Project, as arguments that will be passed are in reduced
800  * dimension */
801  this.JacMDEIM= jd;
802  /* Initialize to certain order */
803  this.JacMatDEIMOrder= ceil(this.JacMatDEIMMaxOrder/2);
804  }
815  function compute_simtrans(models.BaseFullModel fm) {
816  if ~isempty(this.JacSimTransMaxSize)
817  jtd = fm.Data.JacobianTrainData;
818 
819  d = fm.System.f.xDim;
820  n = size(jtd.fxi,2);
821  v = data.FileMatrix(d,n," Dir ",fm.Data.DataDirectory);
822  ln = zeros(1,n);
823  times = ln;
824  pi = ProcessIndicator(" Computing Jacobian similarity transform data for %d jacobians ",n,false,n);
825  hassparse = ~isempty(fm.System.f.JSparsityPattern);
826  if hassparse
827  [i,j] = find(fm.System.f.JSparsityPattern);
828  end
829  for nr = 1:n
830  if hassparse
831  J = sparse(i,j,jtd.fxi(:,nr),d,d);
832  else
833  J = reshape(jtd.fxi(:,nr),d,d);
834  end
835  t = tic;
836  [ln(nr), v(:,nr)] = Utils.logNorm(J);
837  times(nr) = toc(t);
838  pi.step;
839  end
840  pi.stop;
841 
842  jstd.VFull= v;
843  jstd.LogNorms= ln;
844  jstd.CompTimes= times;
845  fm.Data.JacSimTransData= jstd;
846 
847  p = general.POD;
848  p.Mode= " abs ";
849  p.Value= this.JacSimTransMaxSize;
850  [Q, this.QSingVals] = p.computePOD(jstd.VFull);
851  if isa(Q," data.FileMatrix ")
852  this.QFull= Q.toMemoryMatrix;
853  else
854  this.QFull= Q;
855  end
856  if size(this.QFull,2) < this.JacSimTransMaxSize
857  fprintf(2," Only %d nonzero singular values in difference to %d desired ones. Setting JacSimTransMaxSize=%d\n ",...
858  size(this.QFull,2),this.JacSimTransMaxSize,size(this.QFull,2));
859  this.silent= true;
860  this.JacSimTransMaxSize= size(this.QFull,2);
861  this.silent= false;
862  end
863  red = 1-size(this.QFull,2)/size(this.QFull,1);
864  if KerMor.App.Verbose > 0
865  fprintf([" Computed partial similarity transform with target size %d over %d eigenvectors. "...
866  " Resulting reduction %d/%d (%g%%)\n "],...
867  p.Value,size(jstd.VFull,2),...
868  size(this.QFull,2),size(this.QFull,1),100*red);
869  end
870  if red < .2
871  this.JacSimTransSize= [];
872  fprintf(2," Achieved reduction under 20%%, disabling similarity transformation.\n ");
873  else
874  this.JacSimTransSize= ceil(this.JacSimTransMaxSize/2);
875  end
876  end
877  }
878 
879 
880  function handleOrderUpdate(unused1,unused2) {
881  this.updateErrMatrices;
882  }
883 
884 
885  function updateErrMatrices() {
886  if isempty(this.deim)
887  if isempty(this.ReducedModel)
888  error(" Cannot update error matrices as no reduced model instance is specified for this estimator. ");
889  else
890  error(" Unintended error. No deim instance stored but a reduced model is set. ");
891  end
892  end
893 
894  if KerMor.App.Verbose > 3
895  fprintf(" error.DEIMEstimator: Updating error matrices of DEIMEstimator (#%s) to [%d %d]\n ",...
896  this.ID,this.deim.Order);
897  end
898 
899  if this.deim.Order(2) > 0
900  G = this.ReducedModel.FullModel.G;
901  M1 = this.deim.M1;
902  M2 = this.deim.M2;
903  this.M3= M1^t*(G*M1);
904  this.M4= 2*M1^t*(G*M2);
905  this.M5= M2^t*(G*M2);
906  if ~isempty(this.Ah)
907  this.M7= 2*M1^t*(G*this.Ah);
908  this.M8= 2*M2^t*(G*this.Ah);
909  end
910  if ~isempty(this.Bh)
911  this.M10= 2*M1^t*(G*this.Bh);
912  this.M11= 2*M2^t*(G*this.Bh);
913  end
914  else
915  this.M3= [];
916  this.M4= [];
917  this.M5= [];
918  this.M7= [];
919  this.M8= [];
920  this.M10= [];
921  this.M11= [];
922  end
923  }
932  function computeLogNormApprox() {
933 
934  load(fullfile(KerMor.App.HomeDirectory," data/lognorm/res_loclognorms_scaled.mat "));
935  this.kexp= kexp;/* #ok */
936 
937  this.scale= [ms Ms];
938  }
956  /* % Getter & Setter */
957  public: /* ( Transient ) */
958 
959 
960 #if 0 //mtoc++: 'get.JacSimTransSize'
961 function value = JacSimTransSize() {
962  value = this.jstSize;
963  }
964 
965 #endif
966 
967 
968 
969 #if 0 //mtoc++: 'set.JacSimTransSize'
970 function JacSimTransSize(value) {
971  if isempty(value) || (isposintscalar(value) ...
972  && value <= this.JacSimTransMaxSize)
973  if ~isequal(this.jstSize,value)
974  this.jstSize= value;
976  this.QFull(:,1:this.jstSize));
977  end
978  else
979  error(" Value must be empty or a positive int scalar smaller than JacSimTransMaxSize ");
980  end
981  }
982 
983 #endif
984 
985 
986 
987 #if 0 //mtoc++: 'get.JacMatDEIMOrder'
988 function value = JacMatDEIMOrder() {
989  if ~isempty(this.JacMDEIM)
990  value = this.JacMDEIM.Order(1);
991  else
992  value = -1;
993  end
994  }
995 
996 #endif
997 
998 
999 
1000 #if 0 //mtoc++: 'set.JacMatDEIMOrder'
1001 function JacMatDEIMOrder(value) {
1002  if ~isposintscalar(value)
1003  error(" JacMatDEIMOrder must be a positive integer. ");
1004  end
1005  if value <= this.JacMatDEIMMaxOrder
1006  if this.JacMDEIM.Order(1) ~= value
1007  this.JacMDEIM.Order= value;
1008  end
1009  else
1010  error(" Cannot set an order higher (%d) than the current JacMatDEIMMaxOrder of %d ",...
1011  value,this.JacMatDEIMMaxOrder);
1012  end
1013  }
1014 
1015 #endif
1016 
1017 
1018 
1019 #if 0 //mtoc++: 'set.TrainDataSelector'
1020 function TrainDataSelector(value) {
1021  this.checkType(value, " data.selection.ASelector ");
1022  this.TrainDataSelector= value;
1023  }
1024 
1025 #endif
1026 
1027 
1028 
1029 #if 0 //mtoc++: 'set.JacSimTransMaxSize'
1030 function JacSimTransMaxSize(value) {
1031  if ~this.silent && ~isempty(value) && ~isempty(this.JacSimTransMaxSize) && ...
1032  this.JacSimTransMaxSize ~= value /* #ok<MCSUP> */
1033 
1034  fprintf(2," New maximum size of similarity transform. Re-run of offlineComputations necessary.\n ");
1035  end
1036  this.JacSimTransMaxSize= value;
1037  }
1038 
1039 #endif
1040 
1041 
1042  protected: /* ( Static ) */ /* ( Transient ) */
1043 
1044  static function obj = loadobj(obj) {
1045  if ~isempty(obj.deim)
1046  obj.uolst= addlistener(obj.deim," OrderUpdated ",@obj.handleOrderUpdate);
1047  end
1048  }
1049 
1050 
1051  public: /* ( Static ) */ /* ( Transient ) */
1052 
1053 
1054  static function errmsg = validModelForEstimator(models.BaseFullModel model) {
1055  errmsg = ;
1056  if ~isa(model.Approx," approx.DEIM ")
1057  errmsg = " The reduced models core function must be a DEIM approximation. ";
1058  elseif ~isempty(model.System.B) && ...
1059  ~any(strcmp(class(model.System.B),[" dscomponents.LinearInputConv "," dscomponents.AffLinInputConv "]))
1060  errmsg = " The systems input must be either Linear- or AffLinInputConv ";
1061  elseif ~isempty(model.System.A) && ...
1062  ~any(strcmp(class(model.System.A),...
1063  [" dscomponents.LinearCoreFun "," dscomponents.AffLinCoreFun "]))
1064  errmsg = [" If the system component A is set, is has to be either a "...
1065  " LinearCoreFun or AffLinCoreFun. "];
1066  end
1067  }
1096 };
1097 }
1098 
integer JacSimTransSize
The size of the partial similarity transform to apply to the matrix DEIM approximated jacobians...
Collection of generally useful functions.
Definition: Utils.m:17
function time = postProcess(matrix< double > x,double t,integer inputidx)
Postprocessing for the error estimate.
Ah
the component
UseJacobianLogLipConst
"Even More Expensive version 2": Precompute the full solution and use the true logarithmic lipschitz ...
integer fDim
The current output dimension of the function.
Definition: ACoreFun.m:171
static function errmsg = validModelForEstimator(models.BaseFullModel model)
Abstract static method that forces subclasses to specify whether an estimator can be used for a given...
UseTrueLogLipConst
"Even More Expensive version": Precompute the full solution and use the true logarithmic lipschitz co...
Base interface for any approximation training data selection algorithm.
Definition: ASelector.m:19
The base class for any KerMor detailed model.
Definition: BaseFullModel.m:18
models.BaseFullModel FullModel
The full model this reduced model was created from.
Definition: ReducedModel.m:53
matrix< double > QFull
The complete similarity transformation matrix of size .
MatrixDEIM:
Definition: MatrixDEIM.m:18
function J = getStateJacobian(x, t)
Default implementation of jacobian matrix evaluation via finite differences.
Definition: ACoreFun.m:395
function ct = prepareConstants(colvec< double > mu,integer inputidx)
integer JacMatDEIMMaxOrder
Maximum order for the DEIM approximation of the state space jacobian.
Definition: DEIMEstimator.m:80
models.BaseFirstOrderSystem System
The actual dynamical system used in the model.
Definition: BaseModel.m:102
dscomponents.AInputConv B
The input conversion.
function b = getBeta(colvec< double > x,double t)
Old log lip const kernel learning code x = x .* (this.scale(:,2) - this.scale(:,1)) + this...
function prepareSimulation(colvec< double > mu)
A method that allows parameter-dependent computations to be performed before a simulation using this ...
Definition: ACoreFun.m:380
function plotSummary(pm, context)
function target = project(V, unused1)
Definition: MatrixDEIM.m:106
scale
Stores zi min- and max scaling.
StateError
The reduction state-space error from the last simulation.
Definition: BaseEstimator.m:82
rowvec< double > QSingVals
The singular values computed by the SimTransPOD in the offline stage.
static function obj = loadobj(obj)
matrix< double > G
The custom scalar product matrix .
Definition: BaseModel.m:132
reshape
hanges the dimensions of the handle object array to the specified dimensions. See the MATLAB reshape ...
function prepared = prepareForReducedModel(models.ReducedModel rm)
Prepares this estimator for use with a given reduced model. Basically uses the projection matrices an...
An integer value.
The KerMor reduced model class.
Definition: ReducedModel.m:18
Aln
The precomputed logarithmic norms of the system's A components.
matrix< double > V
The matrix that has been used for projection.
Definition: ReducedModel.m:72
matrix< double > W
The biorthogonal matrix for V, i.e. .
Definition: ReducedModel.m:85
dscomponents.ACompEvalCoreFun f
The function which DEIM is applied to.
Definition: DEIM.m:214
function copy = clone()
function offlineComputations(models.BaseFullModel fm)
Overrides the method from BaseEstimator and performs additional computations.
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
function fx = evaluate(colvec< double > x, unused1, unused2)
Definition: LinearCoreFun.m:80
IReductionSummaryPlotProvider:
ID
An ID that allows to uniquely identify this DPCMObject (at least within the current MatLab session/co...
Definition: DPCMObject.m:70
UseFullJacobian
"Expensive version": Using the full system's jacobian for logarithmic norm computation. Included for easy error estimator comparison.
approx.BaseApprox Approx
The approximation method for the CoreFunction.
virtual function copy = clone(target)
The interface method with returns a copy of the current class instance.
data.ModelData Data
The full model's data container. Defaults to an empty container.
Bh
the component
UseJacobianNorm
Expensive conservative guess.
function M = evaluate(colvec< double > x,double t)
Definition: MatrixDEIM.m:74
function checkType(obj, type)
Object typechecker.
Definition: KerMorObject.m:122
static function rowvec< double > n = LG(matrix< double > x, G)
Returns the -induced norm for each column vector in .
Definition: Norm.m:87
dscomponents.ACoreFun f
The core f function from the dynamical system.
#define G(x, y, z)
Definition: CalcMD5.c:169
data.selection.ASelector TrainDataSelector
The selector that chooses the full model's trajectory points that are used for the MatrixDEIM approxi...
Definition: DEIMEstimator.m:91
data.ApproxTrainData JacobianTrainData
Training data for the jacobian approximation.
Definition: ModelData.m:120
integer JacMatDEIMOrder
The actual order of the DEIM approximation for the system's jacobian.
rowvec< double > scaledTimes
The time steps Times in scaled time units .
Definition: BaseModel.m:218
integer JacSimTransMaxSize
The maximum size of the similarity transformation.
Definition: DEIMEstimator.m:65
function res = isposintscalar(value)
isposintscalar: Backwards-compatibility function for matlab versions greater than 2012a ...
Global configuration class for all KerMor run-time settings.
Definition: KerMor.m:17
static function [ double ln , colvec< double > v ] = logNorm(matrix< double > A,matrix< double > G,colvec< double > v0)
Computes the logarithmic norm of a matrix , optionally using a positive definite symmetric matrix in...
Definition: Utils.m:551
models.ReducedModel ReducedModel
The reduced model associated with the error estimator.
static function KerMor theinstance = App()
The singleton KerMor instance.
Definition: KerMor.m:910
Norm: Static class for commonly used norms on sets of vectors.
Definition: Norm.m:17
kexp
The local logarithmic norm estimation.
addlistener
Creates a listener for the specified event and assigns a callback function to execute when the event ...
ExtraODEDims
The dimensions added to the ODE function by the estimator.
Definition: BaseEstimator.m:97
function setSimilarityTransform(Qk)
Definition: MatrixDEIM.m:86
UseTrueDEIMErr
"Expensive" version that uses the true approximation error between the DEIM approximation and the ful...
DEIMEstimator: A-posteriori error estimation for DEIM reduced models.
Definition: DEIMEstimator.m:18
function a = getAlpha(colvec< double > x,double t,colvec< double > ut)
More expensive variant, using the true DEIM approximation error instead of the estimated ones using M...
function copy = clone()
Definition: MatrixDEIM.m:111
general.MatrixDEIM JacMDEIM
The MatrixDEIM instance used to approximate the state space jacobian matrices.
function eint = evalODEPart(colvec< double > x,double t,colvec< double > ut)
Compose the ode function.
dscomponents.LinearCoreFun A
Represents a linear or affine-linear component of the dynamical system.
ProcessIndicator: A simple class that indicates process either via waitbar or text output...