@@ -112,6 +112,36 @@ def test_integration_matrix(N, plot=False):
112112 assert np .allclose (expect , Du )
113113
114114
115+ @pytest .mark .base
116+ @pytest .mark .parametrize ('x0' , [- 1 , 0 ])
117+ @pytest .mark .parametrize ('x1' , [0.789 , 1 ])
118+ @pytest .mark .parametrize ('N' , [32 , 45 ])
119+ def test_integral_whole_interval (x0 , x1 , N ):
120+ import numpy as np
121+ from pySDC .helpers .spectral_helper import FFTHelper
122+ from qmat .lagrange import LagrangeApproximation
123+
124+ helper = FFTHelper (N , x0 = x0 , x1 = x1 )
125+ x = helper .get_1dgrid ()
126+
127+ u = np .zeros_like (x )
128+
129+ num_coef = N // 2 - 1
130+ coeffs = np .random .random ((2 , N ))
131+ u += coeffs [0 , 0 ]
132+ for i in range (1 , num_coef + 1 ):
133+ u += coeffs [0 , i ] * np .sin (2 * np .pi * i * x / helper .L )
134+ u += coeffs [1 , i ] * np .cos (2 * np .pi * i * x / helper .L )
135+
136+ u_hat = helper .transform (u )
137+
138+ weights = helper .get_integration_weights ()
139+ integral = weights @ u_hat
140+ integral_ref = coeffs [0 , 0 ] * helper .L
141+
142+ assert np .isclose (integral , integral_ref , atol = 1e-7 ), abs (integral_ref - integral )
143+
144+
115145@pytest .mark .base
116146@pytest .mark .parametrize ('N' , [4 , 32 ])
117147@pytest .mark .parametrize ('v' , [0 , 4.78 ])
@@ -141,4 +171,5 @@ def test_tau_method(N, v):
141171 # test_tau_method(6, 1)
142172 # test_transform(True)
143173 # test_transform(False)
144- test_transform_cupy (4 )
174+ # test_transform_cupy(4)
175+ test_integral_whole_interval (0 , 2 , 90 )
0 commit comments