From 40e7280619909cd29afc1fc73e11436c1ba98ad7 Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Thu, 11 Apr 2024 11:46:39 +0100 Subject: [PATCH 1/3] Support numpy 2 --- FIAT/discontinuous_lagrange.py | 3 ++- test/unit/test_kong_mulder_veldhuizen.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/FIAT/discontinuous_lagrange.py b/FIAT/discontinuous_lagrange.py index 85907b56b..c2acc02f2 100644 --- a/FIAT/discontinuous_lagrange.py +++ b/FIAT/discontinuous_lagrange.py @@ -6,6 +6,7 @@ # SPDX-License-Identifier: LGPL-3.0-or-later import itertools +import math import numpy as np from FIAT import finite_element, polynomial_set, dual_set, functional, P0 from FIAT.reference_element import LINE, make_lattice @@ -17,7 +18,7 @@ def make_entity_permutations(dim, npoints): if npoints <= 0: - return {o: [] for o in range(np.math.factorial(dim + 1))} + return {o: [] for o in range(math.factorial(dim + 1))} # DG nodes are numbered, in order of significance, # - by g0: entity dim (vertices first, then edges, then ...) # - by g1: entity ids (DoFs on entities of smaller ids first) diff --git a/test/unit/test_kong_mulder_veldhuizen.py b/test/unit/test_kong_mulder_veldhuizen.py index 5fce238ec..323080f76 100644 --- a/test/unit/test_kong_mulder_veldhuizen.py +++ b/test/unit/test_kong_mulder_veldhuizen.py @@ -1,3 +1,4 @@ +import math import numpy as np import pytest @@ -12,7 +13,7 @@ @pytest.mark.parametrize("p_d", [(1, 1), (2, 3), (3, 4)]) def test_kmv_quad_tet_schemes(p_d): # noqa: W503 - fct = np.math.factorial + fct = math.factorial p, d = p_d q = create_quadrature(Te, p, "KMV") for i in range(d + 1): @@ -30,7 +31,7 @@ def test_kmv_quad_tet_schemes(p_d): # noqa: W503 @pytest.mark.parametrize("p_d", [(1, 1), (2, 3), (3, 5), (4, 7), (5, 9)]) def test_kmv_quad_tri_schemes(p_d): - fct = np.math.factorial + fct = math.factorial p, d = p_d q = create_quadrature(T, p, "KMV") for i in range(d + 1): From e02bde71e42a1829dee2c38d42e5b7944d8a0c11 Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Thu, 11 Apr 2024 13:23:43 +0100 Subject: [PATCH 2/3] fixup --- FIAT/orientation_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FIAT/orientation_utils.py b/FIAT/orientation_utils.py index 35ddc5293..92c678991 100644 --- a/FIAT/orientation_utils.py +++ b/FIAT/orientation_utils.py @@ -1,4 +1,5 @@ import itertools +import math from collections.abc import Sequence import numpy as np @@ -53,7 +54,7 @@ def make_entity_permutations_simplex(dim, npoints): from FIAT.polynomial_set import mis if npoints <= 0: - return {o: [] for o in range(np.math.factorial(dim + 1))} + return {o: [] for o in range(math.factorial(dim + 1))} a = np.array(sorted(mis(dim + 1, npoints - 1)), dtype=int)[:, ::-1] index_perms = sorted(itertools.permutations(range(dim + 1))) perms = {} From b75337057a5336e55e573bff98007e3302422a53 Mon Sep 17 00:00:00 2001 From: Connor Date: Fri, 12 Apr 2024 10:27:46 +0100 Subject: [PATCH 3/3] fixup --- FIAT/reference_element.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FIAT/reference_element.py b/FIAT/reference_element.py index 8ad5bd1a5..1dbfe667a 100644 --- a/FIAT/reference_element.py +++ b/FIAT/reference_element.py @@ -560,7 +560,7 @@ def is_simplex(self): return True def symmetry_group_size(self, dim): - return numpy.math.factorial(dim + 1) + return factorial(dim + 1) def cell_orientation_reflection_map(self): """Return the map indicating whether each possible cell orientation causes reflection (``1``) or not (``0``)."""