From c00a9828766f50a38e4b3e254bd3fa9abf88f1d7 Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Thu, 11 Apr 2024 17:12:45 +0100 Subject: [PATCH 1/2] Numpy 2.0 compat --- tsfc/loopy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsfc/loopy.py b/tsfc/loopy.py index be668d57..9a68c3dc 100644 --- a/tsfc/loopy.py +++ b/tsfc/loopy.py @@ -109,7 +109,7 @@ def assign_dtypes(expressions, scalar_type): mapper = Memoizer(_assign_dtype) mapper.scalar_type = scalar_type mapper.real_type = numpy.finfo(scalar_type).dtype - return [(e, numpy.find_common_type(mapper(e), [])) for e in expressions] + return [(e, numpy.result_type(*[mapper(e) for e in expressions])] class LoopyContext(object): From 7d26e1ba424cb90c0747f185d7b73d128d7932d1 Mon Sep 17 00:00:00 2001 From: Connor Date: Fri, 12 Apr 2024 09:48:58 +0100 Subject: [PATCH 2/2] fixup --- gem/flop_count.py | 2 +- tsfc/loopy.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gem/flop_count.py b/gem/flop_count.py index 934c3386..b9595e81 100644 --- a/gem/flop_count.py +++ b/gem/flop_count.py @@ -142,7 +142,7 @@ def flops_indexed(expr, temporaries): aggregate = sum(expression_flops(child, temporaries) for child in expr.children) # Average flops per entry - return aggregate / numpy.product(expr.children[0].shape, dtype=int) + return aggregate / numpy.prod(expr.children[0].shape, dtype=int) @flops.register(gem.IndexSum) diff --git a/tsfc/loopy.py b/tsfc/loopy.py index 9a68c3dc..e90899d8 100644 --- a/tsfc/loopy.py +++ b/tsfc/loopy.py @@ -109,7 +109,7 @@ def assign_dtypes(expressions, scalar_type): mapper = Memoizer(_assign_dtype) mapper.scalar_type = scalar_type mapper.real_type = numpy.finfo(scalar_type).dtype - return [(e, numpy.result_type(*[mapper(e) for e in expressions])] + return [(e, numpy.result_type(*mapper(e))) for e in expressions] class LoopyContext(object):