179 copy = general.AffParamMatrix;
181 copy =
clone@general.AProjectable(
this, copy);
185 copy.dims= this.
dims;
187 copy.cfun= this.
cfun;
202 if ~isa(coeff_fun,
" char ")
203 error(
" Coeff_fun must be a string. ");
205 error(
" Parameter 'mat' must be a real matrix. ");
207 if isempty(this.
dims)
212 this.
funStr[end+1] = coeff_fun;
236 if isa(A,
" general.AffParamMatrix ") && isa(B,
" general.AffParamMatrix ")
237 if ~
all(strcmp([
class(A),
class(B)],
" general.AffParamMatrix ")) && ~strcmp(
class(A),
class(B))
238 warning(
" KerMor:Ambiguousclass ",
" Cannot consistently multiply two real different subclasses of general.AffParamMatrix as the return type is not well defined. ");
241 if A.dims(2) ~= B.dims(1)
242 error(
" Matrix dimensions must agree. ");
247 pr.dims= [A.dims(1) B.dims(2)];
248 pr.Matrices= zeros(prod(pr.dims),pr.N);
253 pr.Matrices(:,(i-1)*B.N + j) = ...
254 reshape(M * B.getMatrix(j),1,[]);
255 pr.funStr[end+1] = [
" ( " A.funStr[i]
" )*( " B.funStr[j]
" ) "];
259 elseif isa(A,
" general.AffParamMatrix ")
262 pr.Matrices= B*pr.Matrices;
264 if A.dims(2) ~=
size(B,1)
265 error(
" Matrix dimensions must agree. ");
267 pr.dims= [A.dims(1)
size(B,2)];
268 pr.Matrices= zeros(prod(pr.dims),pr.N);
271 A.getMatrix(i) * B,[],1);
274 elseif isa(B,
" general.AffParamMatrix ")
277 pr.Matrices= A*pr.Matrices;
279 if size(A,2) ~= B.dims(1)
280 error(
" Matrix dimensions must agree. ");
282 pr.dims= [
size(A,1) B.dims(2)];
283 pr.Matrices= zeros(prod(pr.dims),pr.N);
286 A * B.getMatrix(i),[],1);
304 if isa(A,
" general.AffParamMatrix ") && isa(B,
" general.AffParamMatrix ")
305 if ~
all(strcmp([
class(A),
class(B)],
" general.AffParamMatrix ")) && ~strcmp(
class(A),
class(B))
306 error(
" Cannot consistently subtract two real different subclasses of general.AffParamMatrix as the return type is not well defined. Please perform subtraction manually. ");
308 if any(A.dims ~= B.dims)
309 error(
" Matrix dimensions must agree. ");
311 if A.N == B.N &&
all(strcmp(A.funStr,B.funStr))
313 diff.Matrices= A.Matrices - B.Matrices;
315 error(
" If two AffParamMatrices are subtracted, the number of elements must be the same and the coefficient functions must match. ");
317 elseif isa(A,
" general.AffParamMatrix ")
320 B = ones(
size(A.Matrices,1),1)*B;
322 diff.addMatrix(
" -1 ",B)
323 elseif isa(B,
" general.AffParamMatrix ")
325 diff.Matrices= -diff.Matrices;
327 A = ones(
size(B.Matrices,1),1)*A;
329 diff.addMatrix(
" 1 ",A);
350 transp.dims= fliplr(transp.dims);
369 if isa(A,
" general.AffParamMatrix ") && isa(B,
" general.AffParamMatrix ")
370 error(
" Not yet implemented ");
371 elseif isa(A,
" general.AffParamMatrix ")
373 dotprod.Matrices= A.Matrices .* repmat(B(:),1,A.N);
374 elseif isa(B,
" general.AffParamMatrix ")
375 dotprod = B.times(A);
382 error(
" Invalid index %d. Max index is %d. ",idx,this.
N);
398 if isempty(V) || isempty(W)
399 error(
" Both V and W must be given and nonempty (Set either to 1 for neutral as required). ");
405 target.dims(2) =
size(V,2);
408 target.dims(1) =
size(W,2);
437 function [n , m ] =
size(dim) {
440 if dim > 0 && dim < 3
469 function buildCoeffFun() {
Collection of generally useful functions.
Interface for all components that can be projected.
function diff = minus(B)
Implements the default substraction method.
Matrices
The matrices for the affine function.
string funStr
The function strings defining for the affine-linear combination of the matrices. ...
function addMatrix(coeff_fun, mat)
Adds a matrix with corresponding coefficient function to the affine parametric matrix.
reshape
hanges the dimensions of the handle object array to the specified dimensions. See the MATLAB reshape ...
handle cfun
coefficient function handle as specified by funStr
function transp = ctranspose()
Implements the transposition for affine parametric matrices.
Matlab's base handle class (documentation generation substitute)
function general.AffParamMatrix target = project(matrix< double > V,matrix< double > W,general.AffParamMatrix target)
Projects the affine parametric matrix using and .
V
The matrix of the biorthogonal pair .
function M = getMatrix(idx)
Returns the -th matrix of the AffParamMatrix.
function M = compose(t, mu)
Composes the affine-linear combination of matrices for given time and parameter .
rowvec< integer > dims
dimension of the matrices
function [ n , m ] = size(dim)
Implementation of ABlockedData.size.
function c = evalCoeffFun(double t,colvec< double > mu)
static function char str = implode(char|rowvec data,char glue,char format)
Implodes the elements of data using glue.
function copy = clone(copy)
Creates a copy of this affine parametric matrix.
General time/parameter-affine matrix.
W
The matrix of the biorthogonal pair .
integer N
The number of affine matrices / size of the linear combination.
function dotprod = times(B)
function pr = mtimes(B)
Implements the default multiplication method.