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

testDiscrete: deleted dead code

parent 4ec292a2
......@@ -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));
%
......@@ -1269,29 +1259,3 @@ tc.verifyTrue(isempty(quantity.Discrete()));
c = quantity.Discrete(1, 'grid', {}, 'gridName', {});
tc.verifyTrue(~isempty(c));
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