Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LRT_infinite_dimensional_systems
conI
Commits
b6c78d30
Commit
b6c78d30
authored
Nov 04, 2020
by
Jakob Gabriel
Browse files
quantity.Discrete.l2norm: revised
parent
fe4ac7c6
Changes
1
Show whitespace changes
Inline
Side-by-side
+quantity/Discrete.m
View file @
b6c78d30
...
...
@@ -1914,35 +1914,29 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
'name'
,
"log10("
+
obj
(
1
)
.
name
+
")"
);
end
% log10()
function
xNorm
=
l2norm
(
obj
,
integralGridName
,
optArg
)
% calculates the l2 norm, for instance
% xNorm = sqrt(int_0^1 x.' * x dz).
% Optionally, a weight can be defined, such that instead
% xNorm = sqrt(int_0^1 x.' * weight * x dz).
% The integral domain is specified by integralGrid.
function
xNorm
=
l2norm
(
obj
,
integrationDomain
,
optArg
)
% l2norm calculates the l2 norm
% xNorm = sqrt(int x.' * weight * x ddomain).
%
% xNorm = l2norm(x) returns sqrt(int x.' * x ddomain), while the integral is
% performed over every domain
%
% xNorm = l2norm(x, integrationDomain) returns sqrt(int x.' * x ddomain), while the
% integral is performed over every domain specified by the string-array
% integrationDomain. Default value is [obj(1).domain.name]
%
% l2norm(..., "weight", weight) considers the weight according to
% xNorm = sqrt(int x.' * weight * x ddomain). Default falue is the identety matrix.
arguments
obj
;
integra
lGridName
{
mustBe
.
gridName
}
=
[
obj
(
1
)
.
domain
.
name
];
optArg
.
weight
=
eye
(
size
(
obj
,
1
));
integra
tionDomain
string
=
[
obj
(
1
)
.
domain
.
name
];
optArg
.
weight
(:,
:)
double
=
eye
(
size
(
obj
,
1
));
end
integralGridName
=
misc
.
ensureString
(
integralGridName
);
if
obj
.
nargin
==
1
&&
all
(
strcmp
([
obj
(
1
)
.
domain
.
name
],
integralGridName
))
integratedValue
=
int
(
obj
.'
*
optArg
.
weight
*
obj
);
if
isnumeric
(
integratedValue
)
xNorm
=
sqrtm
(
integratedValue
);
else
xNorm
=
sqrtm
(
on
(
integratedValue
,
integralGridName
));
end
else
xNorm
=
sqrtm
(
int
(
obj
.'
*
optArg
.
weight
*
obj
,
integralGridName
)
);
xNorm
=
sqrtm
(
int
(
obj
.'
*
optArg
.
weight
*
obj
,
integrationDomain
)
);
if
isa
(
xNorm
,
'quantity.Discrete'
)
xNorm
=
xNorm
.
setName
(
"||"
+
obj
(
1
)
.
name
+
"||_{L2}"
);
end
end
end
% l2norm()
function
xNorm
=
norm
(
obj
,
p
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment