Skip to content

Commit 07db8c0

Browse files
authored
Merge pull request #263 from tlunet/test_lagrange
Looking for 100% coverage for lagrange core module
2 parents 53d6faf + 4b3f452 commit 07db8c0

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

pySDC/tests/test_lagrange.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
"""
4+
Created on Fri Jan 20 14:52:18 2023
5+
6+
@author: telu
7+
"""
8+
import pytest
9+
import numpy as np
10+
11+
from pySDC.core.Lagrange import LagrangeApproximation
12+
13+
# Pre-compute reference integration matrix
14+
nNodes = 5
15+
approx = LagrangeApproximation(np.linspace(0, 1, nNodes))
16+
nIntegPoints = 13
17+
tEndVals = np.linspace(0, 1, nIntegPoints)
18+
integMatRef = approx.getIntegrationMatrix([(0, t) for t in tEndVals])
19+
20+
21+
@pytest.mark.base
22+
@pytest.mark.parametrize("numQuad", ["LEGENDRE_NUMPY", "LEGENDRE_SCIPY"])
23+
def test_numericalQuadrature(numQuad):
24+
integMat = approx.getIntegrationMatrix([(0, t) for t in tEndVals], numQuad=numQuad)
25+
assert np.allclose(integMat, integMatRef)

0 commit comments

Comments
 (0)