From f3e5540af391b57f292965c13259fb0ec8d1cf33 Mon Sep 17 00:00:00 2001
From: Jakob Gabriel <jakob.gabriel@fau.de>
Date: Wed, 11 Dec 2019 17:57:11 +0100
Subject: [PATCH] testDiscrete: deleted dead code

---
 +unittests/+quantity/testDiscrete.m | 82 ++++++++---------------------
 1 file changed, 23 insertions(+), 59 deletions(-)

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