247 if ~isa(this.f,
" dscomponents.ACompEvalCoreFun ");
248 error(
" Cannot use DEIM with non ACompEvalCoreFun-implementing functions. ");
250 error(
" Component evaluation does not match direct evaluation. ");
252 error(
" Component evaluation does not match direct evaluation for multi-arguments. ");
256 fprintf(2,
" Warning: MaxOrder %d of DEIM approximation is larger than actual f dimension %d. Setting MaxOrder=%d\n ",...
257 this.
MaxOrder,size(fxi,1),size(fxi,1));
268 if isa(Utmp,
" data.FileMatrix ")
269 Utmp = Utmp.toMemoryMatrix;
274 fprintf(
" POD returned less (=%d) than MaxOrder (=%d) basis vectors. Setting MaxOrder=%d.\n ",...
275 size(this.u,2),this.
MaxOrder,size(this.u,2));
286 if isempty(this.fOrder)
317 J = sparse(this.
f.
fDim,
this.f.xDim);
331 [v(1),
pts(1)] = max(abs(
u(:,1)));
335 c = (P
" *u(:,1:(i-1))) \ (P "*
u(:,i));
336 [v(i),
pts(i)] = max(abs(
u(:,i) -
u(:,1:(i-1))*c));
337 P = sparse(
pts(1:i),1:i,ones(i,1),n,i);
341 fprintf(
" DEIM interpolation points [%s] with values [%s]\n ",...
357 if this.fOrder(2) == 0
358 error(
" No error estimation possible with zero ErrorOrder property ");
370 target =
project@general.AProjectable(
this, V, W, target);
373 target.updateOrderData;
401 copy =
clone@general.AProjectable(
this, copy);
406 copy.fOrder= this.fOrder;
412 copy.Uerr1= this.
Uerr1;
413 copy.Uerr2= this.
Uerr2;
422 str = sprintf(
" %s: DEIM POD singular value decay, MaxOrder: %d ",context,this.
MaxOrder);
423 h = pm.nextPlot(
" deim_singvals ",...
424 str,
" POD size ",
" singular values ");
428 str = sprintf(
" %s: maximum basis residual, MaxOrder: %d ",context,this.
MaxOrder);
429 h = pm.nextPlot(
" max_residuals ",...
430 str,
" Point number ",
" residual ");
431 semilogy(h,this.
Residuals,
" LineWidth ",2);
441 fprintf(
" general.DEIM.updateOrderData: Updating order data of DEIM (%s, #%s) to [%d %d]\n ",
class(
this),this.
ID,this.fOrder);
447 P = sparse(this.
pts(1:o),1:o,ones(o,1),n,o);
458 Perr = sparse(this.
pts(o+1:o+om),1:om,ones(om,1),n,om);
461 Umd = this.
u(:,o+1:o+om);
468 this.
Uerr2= ((Um/A)*B - Umd) /
F;
479 this.
M1= this.
Uerr1 + (Um - this.
V*(this.
W^
t*Um))/A;
491 notify(
this,
" OrderUpdated ", event.EventData);
504 #if 0 //mtoc++: 'get.Order'
505 function o =
Order() {
513 #if 0 //mtoc++: 'set.Order'
514 function
Order(value) {
515 if isempty(this.
u) || isempty(this.
pts)
516 error(" Cannot set DEIM order as approximateSystemFunction has not been called yet. ");
520 error("
Order must be either a scalar or two element
integer vector ");
525 if any(value) > size(this.
u,2) || any(value) < 1
526 error(" Invalid
Order/ErrOrder value. Allowed are integers in [1, %d] ",size(this.u,2));
528 warning("
KerMor:DEIM ",sprintf(...
529 "
Order (%d) and ErrOrder (%d) values may not exceed
MaxOrder (%d). Using [%d 0] ",...
530 value,this.
MaxOrder,this.MaxOrder));
532 value = [this.MaxOrder 0];
536 if ~isequal(this.fOrder, value)
546 #if 0 //mtoc++: 'set.MaxOrder'
549 error(" MaxOrder has to be a positive
integer scalar. ");
551 this.MaxOrder= value;
572 obj =
loadobj@general.AProjectable(obj, varargin[:]);
Collection of generally useful functions.
function J = getStateJacobian(colvec< double > x,double t)
function res = test_ComponentEvalMatch(xsize)
Tests if the local implementation of evaluateComponents matches the full evaluation.
integer fDim
The current output dimension of the function.
DEIM: Implements the DEIM-Algorithm from .
notify
Broadcast a notice that a specific event is occurring on a specified handle object or array of handle...
function err = getEstimatedError(colvec< double > x,double t,colvec< double > mu)
function copy = clone(copy)
The interface method with returns a copy of the current class instance.
Interface for all components that can be projected.
EVENT OrderUpdated
Gets fired whenever this DEIM instance has updated it's order matrices.
rowvec< double > SingularValues
The singular values returned by the SVD decomposition to compute the DEIM POD basis.
integer MaxOrder
The maximum order up to which the DEIM approximation should be computed.
Base class for any KerMor class.
static function obj = loadobj(obj, varargin)
function fx = evaluate(colvec< double > x,double t)
matrix< double > U_nonproj
If projection is applied, this contains the non-projected full matrix for use in subclasses...
rowvec< integer > Order
The actual order for the current DEIM approximation.
function fx = evaluateComponentSetMulti(integer nr,matrix< double > x,rowvec< double > t,matrix< double > mu)
Computes the full component functions of the given point set.
rowvec< double > pts
Interpolation points.
dscomponents.ACompEvalCoreFun f
The function which DEIM is applied to.
KerMorObject()
Constructs a new KerMor object.
A variable number of input arguments.
function DEIM target = project(matrix< double > V,matrix< double > W,DEIM target)
Pojects instance according to the projection biorthogonal matrices .
IReductionSummaryPlotProvider:
matrix< double > Uerr1
Some matrices for M+M' error estimation.
function copy = clone(copy)
The interface method with returns a copy of the current class instance.
function pts = getInterpolationPoints(matrix< double > u)
Computes the interpolation indices according to the DEIM algorithm.
matrix< double > U
The U matrix for the current Order.
V
The matrix of the biorthogonal pair .
ID
An ID that allows to uniquely identify this DPCMObject (at least within the current MatLab session/co...
function setPointSet(nr, pts, jpd)
Parameters: pts: A row vector with the desired points jpd: ("Jacobian Partial Derivatives") A cell ar...
function target = project(V, W, target)
function computeDEIM(dscomponents.ACompEvalCoreFun f,matrix< double > fxi)
Implementation of the DEIM algorithm.
sparse< logical > JSparsityPattern
Sparsity pattern for the jacobian matrix.
matrix< double > u
The full approximation base.
ACompEvalCoreFun: A normal CoreFun which supports single-component evaluation.
function updateOrderData()
Update approximation order as specified in fOrder. As a consequence some matrices have to be recalcul...
static function char str = implode(char|rowvec data,char glue,char format)
Implodes the elements of data using glue.
function res = isposintscalar(value)
isposintscalar: Backwards-compatibility function for matlab versions greater than 2012a ...
Global configuration class for all KerMor run-time settings.
static function KerMor theinstance = App()
The singleton KerMor instance.
W
The matrix of the biorthogonal pair .
function dfx = evaluateComponentSetGradientsAt(integer nr,colvec< double > x,double t)
Computes the full/reduced gradients of all component functions of the given point set...
function fx = evaluateMulti(colvec< double > x,double t,colvec< double > mu)
rowvec< double > Residuals
The maximum residuals obtained along the magic points computation.
function plotSummary(pm, context)
function fx = evaluateComponentSet(integer nr,colvec< double > x,double t)
Computes the full or reduced component functions of the given point set.