rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
EICommon.m
1 classdef EICommon < Greedy.Plugin.Default
2  % interface for GreedyPlugin.Interface implementations generating an empirical
3  % interpolation basis
4  %
5  %
6 
7  properties
8  % boolean flag specifying whether after the final extension step the
9  % Lebesgue constant shall be computed and stored in the
11  compute_lebesgue = true;
12  end
13 
14  methods
15  function eiei = EICommon(generator)
16  % function eiei = EICommon(generator)
17  % constructor for an EICommon instance
18  %
19  % Parameters:
20  % generator: object of type SnapshotsGenerator.SpaceOpEvals generating the (high
21  % dimensional) basis functions, i.e. operator or function
22  % evaluations.
23  assert(isa(generator, 'SnapshotsGenerator.SpaceOpEvals'));
24  eiei = eiei@Greedy.Plugin.Default(generator);
25  end
26 
27  function [max_errs, max_err_sequence, max_mu_index] = error_estimators(this, rmodel, detailed_data, M_train)
28  % function [max_errs, max_err_sequence, max_mu_index] = error_estimators(this, rmodel, detailed_data, M_train)
30  %
32  %
33  % Parameters:
34  % rmodel: object of type IReducedModel
35  % detailed_data: object of type Greedy.DataTree.Detailed.EILeafNode
36  %
37  % @note This method is not implemented for empirical interpolation. There
38  % is no known a posteriori error estimator.
39 
40  error(['No error estimators available for empirical interpolation. Use', ...
41  'indicator_mode = ''error''']);
42  end
43 
44  function detailed_data = finalize(this, rmodel, detailed_data)
45  % function detailed_data = finalize(this, rmodel, detailed_data)
47  %
48  % @copydetails Greedy.Plugin.Interface.finalize()
49  %
50  % Parameters:
51  % rmodel: object of type IReducedModel
52  % detailed_data: object of type Greedy.DataTree.Detailed.EILeafNode
53  %
54  % Return values:
55  % detailed_data: object of type Greedy.DataTree.Detailed.EILeafNode
56  %
57  % This function actually computes the Lebesgue constant if indicated by
58  % 'compute_lebesgue' and stores it in info fields.
59  if this.compute_lebesgue
60  QM = detailed_data.QM;
61  BM = detailed_data.BM;
62  XI = QM / BM;
63  detailed_data.XI = XI;
64  set_field(detailed_data, 'lebesgue', max(sum(abs(XI),2)));
65  set_field(detailed_data, 'max_lebesgue', 2^size(BM,2) - 1);
66  end
67  end
68 
69  function merged = horzcat(this, varargin)
70  % function merged = horzcat(varargin)
71  % combines an arbitrary number of Greedy.Plugin.EI arguments to a big
72  % one, with added SnapshotsGenerator.Cached instances.
73  %
74  % @sa SnapshotsGenerator.Cached.plus()
75  %
76  % Usage is like this:
77  % @code ei_ext_merged = [ ei_ext1, ei_ext2, ei_ext3 ]; @endcode
78  %
79  % Parameters:
80  % varargin: a list of Greedy.Plugin.EI instances to be combined.
81  %
82  % Return values:
83  % merged: a new object of type Greedy.Plugin.EI with combined
84  % generator member.
85  mergedgen = this.generator;
86  for i = 1:length(varargin)
87  mergedgen = mergedgen + varargin{i}.generator;
88  end
89  %! \todo substitute the next line by some copy command
90  merged = Greedy.Plugin.EI(mergedgen);
91  end
92 
93  function summed = vertcat(this, varargin)
94  % function merged = vertcat(varargin)
95  % combines an arbitrary number of Greedy.Plugin.EI arguments to a
96  % Greedy.Plugin.SummedEI instance.
97  %
99  %
100  % Usage is like this:
101  % @code ei_ext_sum = [ ei_ext1; ei_ext2; ei_ext3 ]; @endcode
102  %
103  % Parameters:
104  % varargin: a list of Greedy.Plugin.EI instances to be combined.
105  %
106  % Return values:
107  % merged: a new object of type Greedy.Plugin.SummedEI
108  summed = Greedy.Plugin.SummedEI(this, varargin{:});
109  end
110 
111  end
112 
113  methods(Abstract)
114 
115  % function cop = copy(this);
116  % makes a deep copy of this extension instance
117  %
118  % Return values:
119  % cop: a new instance of type EICommon which is a deep copy of this
120  % one.
121  cop = copy(this);
122  end
123 
124 end
Interface for the storage and generation of detailed data that can be used to build reduced basis fun...
Definition: Cached.m:18
virtual function Greedy.User.IDetailedData detailed_data = finalize(Greedy.User.IReducedModel rmodel,Greedy.User.IDetailedData detailed_data)
function called after the last extension process
Implementation of a SnapshotsGenerator.Cached for empirical basis generation. The generate() method r...
Definition: SpaceOpEvals.m:18
Specialization plugins for the greedy algorithm.
Definition: Default.m:2
SnapshotsGenerator.Cached generator
an object generating possible (high dimension) basis functions
Definition: Interface.m:120
This is the interface for a reduced model providing methods to compute low dimensional reduced simula...
Definition: IReducedModel.m:17
Plugin for the Greedy.Algorithm class generating a collateral reduced basis space plus interpolation ...
Definition: EI.m:19
virtual function [ max_errs , max_err_sequence , max_mu_index ] = error_estimators(Greedy.User.IReducedModel rmodel,Greedy.User.IDetailedData detailed_data, M_train)
computes a posteriori error estimators for the reduced simulations for every parameter vector from a ...
detailed data node implementation storing a collateral reduced basis space and interpolation DOFs ...
Definition: EILeafNode.m:20
Default implementation of a Greedy.Plugin.Interface interface class.
Definition: Default.m:19
Customizable implementation of an abstract greedy algorithm.
Definition: DuneRBLeafNode.m:1
Plugin for the Greedy.Algorithm class generating collateral reduced basis space plus interpolation DO...
Definition: SummedEI.m:19