Commit ae494589 authored by Ferdinand Fischer's avatar Ferdinand Fischer
Browse files

Merge branch '28-domain-argument-as-required-argument' of...

Merge branch '28-domain-argument-as-required-argument' of gitlab.cs.fau.de:lrt_infinite_dimensional_systems/coni into 28-domain-argument-as-required-argument
parents e7445e9b eba097ff
......@@ -251,7 +251,7 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
for i = 1:numel(obj)
data = obj(i).valueDiscrete();
data = obj(i).valueDiscrete;
zeros = find( abs(data) <= optArg.tol);
upCrossing = find( data(1:end-1) <= 0 & data(2:end) > 0);
......
......@@ -262,7 +262,7 @@ classdef Symbolic < quantity.Function
% of this quantity. The domains with the same domain name as
% DOMAIN will be replaced with the corresponding grid in
% DOMAIN.
%
%J
% solution = subs(obj, DOMAINNAME, GRID) can be used to
% change the grid of this quantity. The grid of the domains with the
% DOMAINNAME will be replaced by the values specified in
......@@ -312,8 +312,12 @@ classdef Symbolic < quantity.Function
% rename domains that are affected by symbolic substitution
gridName2ReplaceSymbolicOld = gridName2Replace(~isNumericValue);
gridName2ReplaceSymbolicNew = string(values(~isNumericValue));
resultingName = replace([newDomain.name], gridName2ReplaceSymbolicOld, gridName2ReplaceSymbolicNew);
resultingName = [newDomain.name];
for it = 1 : numel(gridName2ReplaceSymbolicOld)
resultingName(strcmp(resultingName, gridName2ReplaceSymbolicOld(it))) ...
= gridName2ReplaceSymbolicNew(it);
end % for it = 1 : numel(gridName2ReplaceSymbolicOld)
if misc.isunique(resultingName)
newDomain = newDomain.rename(gridName2ReplaceSymbolicNew, gridName2ReplaceSymbolicOld);
else % complicated case, for instance f(x, y).subs("x", "y") = f(y, y)
......
......@@ -236,4 +236,4 @@ classdef BasicVariable < handle
end
end
\ No newline at end of file
end
......@@ -20,12 +20,12 @@ end
function testDiscrete(tc)
d = quantity.Domain("a", linspace(0, 1, 3));
tc.verifyEqual(d.Discrete.on(), d.grid());
tc.verifyEqual(d.Discrete.on(), d.grid);
end % testDiscrete
function testSymbolic(tc)
d = quantity.Domain("a", linspace(0, 1, 3));
tc.verifyEqual(d.Symbolic.on(), d.grid());
tc.verifyEqual(d.Symbolic.on(), d.grid);
end % testDiscrete
function testRename(tc)
......@@ -40,6 +40,9 @@ tc.verifyEqual([xyz.name], [xyz2.name]);
cba = d.rename(["c", "b", "a"], ["a", "b", "ab"]);
tc.verifyEqual([cba.name], ["c", "b", "a"]);
tc.verifyEqual([cba.n], [d.n]);
zZetaDomain = [quantity.Domain("z", linspace(0, 1, 3)), quantity.Domain("zeta", linspace(0, 1, 3))];
tc.verifyEqual([zZetaDomain.rename("a", "z").name], ["a", "zeta"])
end % testRename()
function testParser(tc)%profile on
......
......@@ -868,6 +868,12 @@ solution = f.solveAlgebraic([1, 1], f(1).gridName{1});
testCase.verifyEqual(solution, 0.5);
end
function testSubs3(tc)
zZeta = [quantity.Domain("z", linspace(0, 1, 11)), quantity.Domain("zeta", linspace(0, 1, 11))];
Id = quantity.Symbolic(eye(2), zZeta);
tc.verifyEqual(Id.subs("z", 1).on(), Id.subs("z", "zeta").on(), 'AbsTol', 10*eps);
end % testSubs3()
function testSubs2(tc)
z = quantity.Domain("z", linspace(0, 1, 11));
Id = quantity.Symbolic(eye(2), z);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment