Skip to content

Commit 0864f27

Browse files
author
Daniel Ruprecht
committed
test for summation property of Qmat and Smat now running correctly
1 parent 3c80536 commit 0864f27

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

tests/test_collocation.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
# py.test excludes classes with a constructor by default, so define parameter here
77
t_start = 0.0
88
t_end = 1.0
9-
classes = [ ["CollGaussLegendre", 2, 2]]
10-
#classes = [ ["CollGaussLegendre", 2, 12], ["CollGaussLobatto", 2, 12], ["CollGaussRadau_Right", 2, 12] ]
9+
#classes = [ ["CollGaussLegendre", 2, 2]]
10+
classes = [ ["CollGaussLegendre", 2, 12], ["CollGaussLobatto", 2, 12], ["CollGaussRadau_Right", 2, 12] ]
1111

1212
class TestCollocation:
1313

@@ -45,20 +45,14 @@ def test_2(self):
4545
for type in classes:
4646
for M in range(type[1],type[2]+1):
4747
coll = getattr(pySDC.CollocationClasses, type[0])(M, t_start, t_end)
48-
Q = coll.Qmat
49-
Q = Q[1:,1:]
50-
S = coll.Smat
51-
S = S[1:,1:]
52-
#print Q
53-
#print S
48+
Q = coll.Qmat[1:,1:]
49+
S = coll.Smat[1:,1:]
5450
assert np.shape(Q) == np.shape(S), "For node type " + type[0] + ", Qmat and Smat have different shape"
5551
shape = np.shape(Q)
5652
assert shape[0] == shape[1], "For node type " + type[0] + ", Qmat / Smat are not quadratic"
53+
SSum = np.cumsum(S[:,:],axis=0)
5754
for i in range(0,M):
58-
Ssum = np.sum(S[0:i,:], axis=0)
59-
#print Ssum
60-
#print Q[i,:]
61-
# ...the matrices do not have size MxM, but rather (M+1)x(M+1)... how does the summation property look like here
55+
assert np.linalg.norm( Q[i,:] - SSum[i,:] ) < 1e-15, "For node type " + type[0] + ", Qmat and Smat did not satisfy the expected summation property."
6256

6357
# TEST 3:
6458
# Check that the partial quadrature rules from Qmat entries have order equal to number of nodes M

0 commit comments

Comments
 (0)