Commit f3e5540a authored by Jakob Gabriel's avatar Jakob Gabriel
Browse files

testDiscrete: deleted dead code

parent 4ec292a2
...@@ -27,7 +27,6 @@ end % testQuadraticNorm() ...@@ -27,7 +27,6 @@ end % testQuadraticNorm()
function testBlkdiag(tc) function testBlkdiag(tc)
% init some data % init some data
syms z zeta syms z zeta
t = linspace(0, 1, 25);
A = quantity.Symbolic(... A = quantity.Symbolic(...
[1+z*zeta, -zeta; -z, z^2], 'grid', {linspace(0, 1, 21), linspace(0, 1, 41)},... [1+z*zeta, -zeta; -z, z^2], 'grid', {linspace(0, 1, 21), linspace(0, 1, 41)},...
'variable', {z, zeta}, 'name', 'q'); 'variable', {z, zeta}, 'name', 'q');
...@@ -374,7 +373,7 @@ function testSolveDVariableEqualQuantityComparedToSym(testCase) ...@@ -374,7 +373,7 @@ function testSolveDVariableEqualQuantityComparedToSym(testCase)
%% compare with symbolic implementation %% compare with symbolic implementation
syms z syms z
assume(z>0 & z<1); assume(z>0 & z<1);
quanBSym = quantity.Symbolic([1+z], 'grid', {linspace(0, 1, 21)}, ... quanBSym = quantity.Symbolic(1+z, 'grid', {linspace(0, 1, 21)}, ...
'gridName', 'z', 'name', 'bSym', 'variable', {z}); 'gridName', 'z', 'name', 'bSym', 'variable', {z});
quanBDiscrete = quantity.Discrete(quanBSym.on(), 'grid', {linspace(0, 1, 21)}, ... quanBDiscrete = quantity.Discrete(quanBSym.on(), 'grid', {linspace(0, 1, 21)}, ...
'gridName', 'z', 'name', 'bDiscrete', 'size', size(quanBSym)); 'gridName', 'z', 'name', 'bDiscrete', 'size', size(quanBSym));
...@@ -388,7 +387,7 @@ function testSolveDVariableEqualQuantityAbsolut(testCase) ...@@ -388,7 +387,7 @@ function testSolveDVariableEqualQuantityAbsolut(testCase)
%% compare with symbolic implementation %% compare with symbolic implementation
syms z syms z
assume(z>0 & z<1); assume(z>0 & z<1);
quanBSym = quantity.Symbolic([1+z], 'grid', {linspace(0, 1, 51)}, ... quanBSym = quantity.Symbolic(1+z, 'grid', {linspace(0, 1, 51)}, ...
'gridName', 'z', 'name', 'bSym', 'variable', {z}); 'gridName', 'z', 'name', 'bSym', 'variable', {z});
quanBDiscrete = quantity.Discrete(quanBSym.on(), 'grid', {linspace(0, 1, 51)}, ... quanBDiscrete = quantity.Discrete(quanBSym.on(), 'grid', {linspace(0, 1, 51)}, ...
'gridName', 'z', 'name', 'bDiscrete', 'size', size(quanBSym)); 'gridName', 'z', 'name', 'bDiscrete', 'size', size(quanBSym));
...@@ -536,7 +535,7 @@ c = a*b; ...@@ -536,7 +535,7 @@ c = a*b;
testCase.verifyEqual(c.on(), a.on()); testCase.verifyEqual(c.on(), a.on());
end end
function testMTimesPointWise(testCase) function testMTimesPointWise(tc)
syms z zeta syms z zeta
Z = linspace(0, 1, 501)'; Z = linspace(0, 1, 501)';
...@@ -550,7 +549,7 @@ p = quantity.Discrete(P); ...@@ -550,7 +549,7 @@ p = quantity.Discrete(P);
b = quantity.Discrete(B); b = quantity.Discrete(B);
pb = p*b; pb = p*b;
tc.verifyEqual(MAX(abs(PB-pb)), 0, 'AbsTol', 10*eps);
end end
function testMldivide(testCase) function testMldivide(testCase)
...@@ -978,7 +977,7 @@ ALrA = ALr+A; ...@@ -978,7 +977,7 @@ ALrA = ALr+A;
testCase.verifyEqual(a+a, ABAB(1).on()); testCase.verifyEqual(a+a, ABAB(1).on());
testCase.verifyEqual(b+b, ABAB(2).on()); testCase.verifyEqual(b+b, ABAB(2).on());
testCase.verifyEqual(a+b, ApB.on()); testCase.verifyEqual(a+b, ApB.on());
numeric.near(bc, BC.on()) testCase.verifyTrue(numeric.near(bc, BC.on()));
testCase.verifyEqual(azZeta+bzZeta, ABZZETA.on()); testCase.verifyEqual(azZeta+bzZeta, ABZZETA.on());
testCase.verifyEqual(a+a, ALrA.on(z), 'RelTol', 1e-3); testCase.verifyEqual(a+a, ALrA.on(z), 'RelTol', 1e-3);
...@@ -996,7 +995,6 @@ testCase.verifyEqual(eMat(:), eMatReference(:)); ...@@ -996,7 +995,6 @@ testCase.verifyEqual(eMat(:), eMatReference(:));
%% addition with constant values %% addition with constant values
AB12 = AB + [1 2];
testCase.verifyEqual(permute([a b], [1 3 2]), AB.on()); testCase.verifyEqual(permute([a b], [1 3 2]), AB.on());
AB2 = AB' * AB; AB2 = AB' * AB;
...@@ -1046,21 +1044,21 @@ a = quantity.Discrete(cat(3, sin(z*t), cos(z*t)), ... ...@@ -1046,21 +1044,21 @@ a = quantity.Discrete(cat(3, sin(z*t), cos(z*t)), ...
'size', [2 1], 'grid', {z, t}, 'gridName', {'z', 't'}); 'size', [2 1], 'grid', {z, t}, 'gridName', {'z', 't'});
At = int(a, 'z'); At = int(a, 'z');
Anumt = []; Anumt = zeros(numel(t), numel(F));
for tau = t for tau = 1 : numel(t)
Anumt = [Anumt; ... Anumt(tau, :) = [
integral(@(z)F{1}(z,tau), z(1), z(end)), ... integral(@(z)F{1}(z, t(tau)), z(1), z(end)), ...
integral(@(z)F{2}(z,tau), z(1), z(end))]; integral(@(z)F{2}(z, t(tau)), z(1), z(end))];
end end
verifyTrue(testCase, numeric.near(At.on(), Anumt, 1e-3)); verifyTrue(testCase, numeric.near(At.on(), Anumt, 1e-3));
Az = int(a, 't'); Az = int(a, 't');
AnumZ = []; AnumZ = zeros(numel(z), numel(F));
for zeta = z' for zIdx = 1 : numel(z)
AnumZ = [AnumZ; ... AnumZ(zIdx, :) = [...
integral(@(t)F{1}(zeta,t), t(1), t(end)), ... integral(@(t)F{1}(z(zIdx), t), t(1), t(end)), ...
integral(@(t)F{2}(zeta,t), t(1), t(end))]; integral(@(t)F{2}(z(zIdx), t), t(1), t(end))];
end end
verifyTrue(testCase, numeric.near(Az.on(), AnumZ, 1e-3)); verifyTrue(testCase, numeric.near(Az.on(), AnumZ, 1e-3));
...@@ -1073,16 +1071,15 @@ verifyTrue(testCase, numeric.near(A, Anum, 1e-2)); ...@@ -1073,16 +1071,15 @@ verifyTrue(testCase, numeric.near(A, Anum, 1e-2));
end end
function testNDGrid(testCase) % function testNDGrid(testCase)
%% % %%
z = linspace(0,1).'; % z = linspace(0,1).';
t = linspace(0,1,101); % t = linspace(0,1,101);
b = quantity.Discrete({sin(z * t * pi); cos(z * t * pi)}, 'grid', {z, t}, 'gridName', {'z', 't'}); % b = quantity.Discrete({sin(z * t * pi); cos(z * t * pi)}, 'grid', {z, t}, 'gridName', {'z', 't'});
% #TODO % % #TODO
end % end
function testDefaultGrid(testCase) function testDefaultGrid(testCase)
v = quantity.Discrete.value2cell( rand([100, 42, 2, 3]), [100, 42], [2, 3]);
g = quantity.Discrete.defaultGrid([100, 42]); g = quantity.Discrete.defaultGrid([100, 42]);
testCase.verifyEqual(g{1}, linspace(0, 1, 100).'); testCase.verifyEqual(g{1}, linspace(0, 1, 100).');
testCase.verifyEqual(g{2}, linspace(0, 1, 42)); testCase.verifyEqual(g{2}, linspace(0, 1, 42));
...@@ -1234,13 +1231,6 @@ b = quantity.Discrete({sin(z * t * pi); cos(z * t * pi)}, 'grid', {z, t}, 'gridN ...@@ -1234,13 +1231,6 @@ b = quantity.Discrete({sin(z * t * pi); cos(z * t * pi)}, 'grid', {z, t}, 'gridN
A = a.' * a; A = a.' * a;
syms Z T
c = quantity.Symbolic([sin(Z * pi), cos(Z* pi)], 'grid', z);
d = quantity.Symbolic([sin(Z * T * pi); cos(Z * T * pi)], 'grid', {z, t});
C = c' * c;
Cd = C * d;
Anum = cat(3, sin(z * pi).^2 .* sin(z * t * pi) + sin(z * pi) .* cos(z * pi) .* cos(z * t * pi), ... Anum = cat(3, sin(z * pi).^2 .* sin(z * t * pi) + sin(z * pi) .* cos(z * pi) .* cos(z * t * pi), ...
sin(z * pi) .* cos(z * pi) .* sin(z * t * pi) + cos(z * pi).^2 .* cos(z * t * pi)); sin(z * pi) .* cos(z * pi) .* sin(z * t * pi) + cos(z * pi).^2 .* cos(z * t * pi));
% %
...@@ -1268,30 +1258,4 @@ tc.verifyTrue(isempty(quantity.Discrete())); ...@@ -1268,30 +1258,4 @@ tc.verifyTrue(isempty(quantity.Discrete()));
% create a constant quantity.Discrete. This should not be empty: % create a constant quantity.Discrete. This should not be empty:
c = quantity.Discrete(1, 'grid', {}, 'gridName', {}); c = quantity.Discrete(1, 'grid', {}, 'gridName', {});
tc.verifyTrue(~isempty(c)); tc.verifyTrue(~isempty(c));
end end
\ No newline at end of file
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