Skip to content

Commit 5c1b672

Browse files
committed
feat: rename Kernel to ScalarKernel
1 parent 83c5db0 commit 5c1b672

17 files changed

Lines changed: 146 additions & 139 deletions

sumpy/expansion/__init__.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
from sumpy.expansion.diff_op import MultiIndex
4949
from sumpy.expansion.local import LocalExpansionBase
5050
from sumpy.expansion.multipole import MultipoleExpansionBase
51-
from sumpy.kernel import Kernel, KernelArgument
51+
from sumpy.kernel import KernelArgument, ScalarKernel
5252

5353

5454
logger = logging.getLogger(__name__)
@@ -99,7 +99,7 @@ class ExpansionBase(ABC):
9999
.. automethod:: __ne__
100100
"""
101101

102-
kernel: Kernel
102+
kernel: ScalarKernel
103103
order: int
104104
use_rscale: bool = field(kw_only=True, default=True)
105105

@@ -152,7 +152,7 @@ def get_coefficient_identifiers(self) -> Sequence[MultiIndex]:
152152

153153
@abstractmethod
154154
def coefficients_from_source(self,
155-
kernel: Kernel,
155+
kernel: ScalarKernel,
156156
avec: sym.Matrix,
157157
bvec: sym.Matrix | None,
158158
rscale: sym.Expr,
@@ -171,7 +171,7 @@ def coefficients_from_source(self,
171171
"""
172172

173173
def coefficients_from_source_vec(self,
174-
kernels: Sequence[Kernel],
174+
kernels: Sequence[ScalarKernel],
175175
avec: sym.Matrix,
176176
bvec: sym.Matrix | None,
177177
rscale: sym.Expr,
@@ -198,7 +198,7 @@ def coefficients_from_source_vec(self,
198198
return result
199199

200200
def loopy_expansion_formation(self,
201-
kernels: Sequence[Kernel],
201+
kernels: Sequence[ScalarKernel],
202202
strength_usage: Sequence[int],
203203
nstrengths: int
204204
) -> lp.TranslationUnit:
@@ -212,7 +212,7 @@ def loopy_expansion_formation(self,
212212

213213
@abstractmethod
214214
def evaluate(self,
215-
kernel: Kernel,
215+
kernel: ScalarKernel,
216216
coeffs: Sequence[sym.Expr],
217217
bvec: sym.Matrix,
218218
rscale: sym.Expr,
@@ -224,7 +224,7 @@ def evaluate(self,
224224
in *coeffs*.
225225
"""
226226

227-
def loopy_evaluator(self, kernels: Sequence[Kernel]) -> lp.TranslationUnit:
227+
def loopy_evaluator(self, kernels: Sequence[ScalarKernel]) -> lp.TranslationUnit:
228228
"""
229229
:returns: a :mod:`loopy` kernel that returns the evaluated
230230
target transforms of the potential given by *kernels*.
@@ -236,7 +236,7 @@ def loopy_evaluator(self, kernels: Sequence[Kernel]) -> lp.TranslationUnit:
236236

237237
# {{{ copy
238238

239-
def with_kernel(self, kernel: Kernel) -> ExpansionBase:
239+
def with_kernel(self, kernel: ScalarKernel) -> ExpansionBase:
240240
return replace(self, kernel=kernel)
241241

242242
def copy(self, **kwargs: Any) -> Self:
@@ -566,7 +566,7 @@ class LinearPDEBasedExpansionTermsWrangler(ExpansionTermsWrangler):
566566
.. automethod:: __init__
567567
"""
568568

569-
knl: Kernel
569+
knl: ScalarKernel
570570

571571
@override
572572
def get_coefficient_identifiers(self) -> Sequence[MultiIndex]:
@@ -973,7 +973,7 @@ class MultipoleExpansionFactory(Protocol):
973973
.. automethod:: __call__
974974
"""
975975
def __call__(self,
976-
kernel: Kernel,
976+
kernel: ScalarKernel,
977977
order: int,
978978
*, use_rscale: bool = True
979979
) -> MultipoleExpansionBase:
@@ -987,7 +987,7 @@ class LocalExpansionFactory(Protocol):
987987
.. automethod:: __call__
988988
"""
989989
def __call__(self,
990-
kernel: Kernel,
990+
kernel: ScalarKernel,
991991
order: int,
992992
*, use_rscale: bool = True
993993
) -> LocalExpansionBase:
@@ -1002,15 +1002,15 @@ class ExpansionFactoryBase(ABC):
10021002

10031003
@abstractmethod
10041004
def get_local_expansion_class(self,
1005-
base_kernel: Kernel, /
1005+
base_kernel: ScalarKernel, /
10061006
) -> LocalExpansionFactory:
10071007
"""
10081008
:returns: a subclass of :class:`ExpansionBase` suitable for *base_kernel*.
10091009
"""
10101010

10111011
@abstractmethod
10121012
def get_multipole_expansion_class(self,
1013-
base_kernel: Kernel, /
1013+
base_kernel: ScalarKernel, /
10141014
) -> MultipoleExpansionFactory:
10151015
"""
10161016
:returns: a subclass of :class:`ExpansionBase` suitable for *base_kernel*.
@@ -1024,7 +1024,7 @@ class VolumeTaylorExpansionFactory(ExpansionFactoryBase):
10241024

10251025
@override
10261026
def get_local_expansion_class(
1027-
self, base_kernel: Kernel, /
1027+
self, base_kernel: ScalarKernel, /
10281028
) -> type[LocalExpansionBase]:
10291029
"""
10301030
:returns: a subclass of :class:`ExpansionBase` suitable for *base_kernel*.
@@ -1034,7 +1034,7 @@ def get_local_expansion_class(
10341034

10351035
@override
10361036
def get_multipole_expansion_class(
1037-
self, base_kernel: Kernel, /
1037+
self, base_kernel: ScalarKernel, /
10381038
) -> type[MultipoleExpansionBase]:
10391039
"""
10401040
:returns: a subclass of :class:`ExpansionBase` suitable for *base_kernel*.
@@ -1050,7 +1050,7 @@ class DefaultExpansionFactory(ExpansionFactoryBase):
10501050

10511051
@override
10521052
def get_local_expansion_class(self,
1053-
base_kernel: Kernel, /,
1053+
base_kernel: ScalarKernel, /,
10541054
) -> LocalExpansionFactory:
10551055
"""
10561056
:returns: a subclass of :class:`ExpansionBase` suitable for *base_kernel*.
@@ -1067,7 +1067,7 @@ def get_local_expansion_class(self,
10671067

10681068
@override
10691069
def get_multipole_expansion_class(self,
1070-
base_kernel: Kernel, /,
1070+
base_kernel: ScalarKernel, /,
10711071
) -> MultipoleExpansionFactory:
10721072
"""
10731073
:returns: a subclass of :class:`ExpansionBase` suitable for *base_kernel*.

sumpy/expansion/level_to_order.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
from collections.abc import Sequence
4444

4545
import sumpy.symbolic as sym
46-
from sumpy.kernel import Kernel
46+
from sumpy.kernel import ScalarKernel
4747

4848

4949
class TreeLike(Protocol):
@@ -71,7 +71,7 @@ class FMMLibExpansionOrderFinder:
7171
"""
7272

7373
def __call__(self,
74-
kernel: Kernel,
74+
kernel: ScalarKernel,
7575
kernel_args: dict[str, sym.Expr] | Sequence[tuple[str, sym.Expr]],
7676
tree: TreeLike,
7777
level: int) -> int:
@@ -163,7 +163,7 @@ class SimpleExpansionOrderFinder:
163163
"""
164164

165165
def __call__(self,
166-
kernel: Kernel,
166+
kernel: ScalarKernel,
167167
kernel_args: dict[str, sym.Expr] | Sequence[tuple[str, sym.Expr]],
168168
tree: TreeLike,
169169
level: int) -> int:

sumpy/expansion/local.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
HankelBased2DMultipoleExpansion,
5757
MultipoleExpansionBase,
5858
)
59-
from sumpy.kernel import Kernel
59+
from sumpy.kernel import ScalarKernel
6060

6161

6262
logger = logging.getLogger(__name__)
@@ -131,7 +131,7 @@ def get_coefficient_identifiers(self) -> Sequence[MultiIndex]:
131131

132132
@override
133133
def coefficients_from_source(self,
134-
kernel: Kernel,
134+
kernel: ScalarKernel,
135135
avec: sym.Matrix,
136136
bvec: sym.Matrix | None,
137137
rscale: sym.Expr,
@@ -171,7 +171,7 @@ def coefficients_from_source(self,
171171

172172
@override
173173
def evaluate(self,
174-
kernel: Kernel,
174+
kernel: ScalarKernel,
175175
coeffs: Sequence[sym.Expr],
176176
bvec: sym.Matrix,
177177
rscale: sym.Expr,
@@ -224,7 +224,7 @@ def m2l_translation(self) -> M2LTranslationBase:
224224

225225
@override
226226
def coefficients_from_source_vec(self,
227-
kernels: Sequence[Kernel],
227+
kernels: Sequence[ScalarKernel],
228228
avec: sym.Matrix,
229229
bvec: sym.Matrix | None,
230230
rscale: sym.Expr,
@@ -272,7 +272,7 @@ def save_temp(x: sym.Expr) -> sym.Expr:
272272

273273
@override
274274
def coefficients_from_source(self,
275-
kernel: Kernel,
275+
kernel: ScalarKernel,
276276
avec: sym.Matrix,
277277
bvec: sym.Matrix | None,
278278
rscale: sym.Expr,
@@ -283,7 +283,7 @@ def coefficients_from_source(self,
283283

284284
@override
285285
def evaluate(self,
286-
kernel: Kernel,
286+
kernel: ScalarKernel,
287287
coeffs: Sequence[sym.Expr],
288288
bvec: sym.Matrix,
289289
rscale: sym.Expr,
@@ -556,7 +556,7 @@ def get_coefficient_identifiers(self) -> Sequence[MultiIndex]:
556556

557557
@override
558558
def coefficients_from_source(self,
559-
kernel: Kernel,
559+
kernel: ScalarKernel,
560560
avec: sym.Matrix,
561561
bvec: sym.Matrix | None,
562562
rscale: sym.Expr,
@@ -580,7 +580,7 @@ def coefficients_from_source(self,
580580

581581
@override
582582
def evaluate(self,
583-
kernel: Kernel,
583+
kernel: ScalarKernel,
584584
coeffs: Sequence[sym.Expr],
585585
bvec: sym.Matrix,
586586
rscale: sym.Expr,

sumpy/expansion/loopy.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,16 @@
4242
from pymbolic.typing import ArithmeticExpression
4343

4444
from sumpy.expansion import ExpansionBase
45-
from sumpy.kernel import Kernel
45+
from sumpy.kernel import ScalarKernel
4646

4747

4848
logger = logging.getLogger(__name__)
4949

5050

5151
def make_e2p_loopy_kernel(
52-
expansion: ExpansionBase, kernels: Sequence[Kernel]) -> lp.TranslationUnit:
52+
expansion: ExpansionBase,
53+
kernels: Sequence[ScalarKernel],
54+
) -> lp.TranslationUnit:
5355
"""
5456
A helper function that creates a :mod:`loopy` kernel for multipole/local evaluation.
5557
@@ -152,7 +154,7 @@ def make_e2p_loopy_kernel(
152154

153155
def make_p2e_loopy_kernel(
154156
expansion: ExpansionBase,
155-
kernels: Sequence[Kernel],
157+
kernels: Sequence[ScalarKernel],
156158
strength_usage: Sequence[int],
157159
nstrengths: int) -> lp.TranslationUnit:
158160
"""

sumpy/expansion/m2l.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
from sumpy.assignment_collection import SymbolicAssignmentCollection
6161
from sumpy.expansion.diff_op import MultiIndex
62-
from sumpy.kernel import Kernel
62+
from sumpy.kernel import ScalarKernel
6363

6464

6565
logger = logging.getLogger(__name__)
@@ -88,7 +88,7 @@ class M2LTranslationClassFactoryBase(ABC):
8888
@abstractmethod
8989
def get_m2l_translation_class(
9090
self,
91-
base_kernel: Kernel,
91+
base_kernel: ScalarKernel,
9292
local_expansion_class: type[LocalExpansionBase]
9393
) -> type[M2LTranslationBase]:
9494
"""
@@ -105,7 +105,7 @@ class NonFFTM2LTranslationClassFactory(M2LTranslationClassFactoryBase):
105105
@override
106106
def get_m2l_translation_class(
107107
self,
108-
base_kernel: Kernel,
108+
base_kernel: ScalarKernel,
109109
local_expansion_class: type[LocalExpansionBase]
110110
) -> type[M2LTranslationBase]:
111111
from sumpy.expansion.local import (
@@ -129,7 +129,7 @@ class FFTM2LTranslationClassFactory(M2LTranslationClassFactoryBase):
129129
@override
130130
def get_m2l_translation_class(
131131
self,
132-
base_kernel: Kernel,
132+
base_kernel: ScalarKernel,
133133
local_expansion_class: type[LocalExpansionBase]
134134
) -> type[M2LTranslationBase]:
135135
from sumpy.expansion.local import (
@@ -153,7 +153,7 @@ class DefaultM2LTranslationClassFactory(M2LTranslationClassFactoryBase):
153153
@override
154154
def get_m2l_translation_class(
155155
self,
156-
base_kernel: Kernel,
156+
base_kernel: ScalarKernel,
157157
local_expansion_class: type[LocalExpansionBase]
158158
) -> type[M2LTranslationBase]:
159159
from sumpy.expansion.local import (

sumpy/expansion/multipole.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
from sumpy.assignment_collection import SymbolicAssignmentCollection
4747
from sumpy.expansion.diff_op import MultiIndex
48-
from sumpy.kernel import Kernel
48+
from sumpy.kernel import ScalarKernel
4949

5050

5151
logger = logging.getLogger(__name__)
@@ -76,7 +76,7 @@ class VolumeTaylorMultipoleExpansionBase(VolumeTaylorExpansionMixin,
7676

7777
@override
7878
def coefficients_from_source_vec(self,
79-
kernels: Sequence[Kernel],
79+
kernels: Sequence[ScalarKernel],
8080
avec: sym.Matrix,
8181
bvec: sym.Matrix | None,
8282
rscale: sym.Expr,
@@ -116,7 +116,7 @@ def coefficients_from_source_vec(self,
116116
@override
117117
def coefficients_from_source(
118118
self,
119-
kernel: Kernel,
119+
kernel: ScalarKernel,
120120
avec: sym.Matrix,
121121
bvec: sym.Matrix | None,
122122
rscale: sym.Expr,
@@ -130,7 +130,7 @@ def coefficients_from_source(
130130

131131
@override
132132
def evaluate(self,
133-
kernel: Kernel,
133+
kernel: ScalarKernel,
134134
coeffs: Sequence[sym.Expr],
135135
bvec: sym.Matrix,
136136
rscale: sym.Expr,
@@ -440,7 +440,7 @@ def get_coefficient_identifiers(self) -> Sequence[MultiIndex]:
440440
@override
441441
def coefficients_from_source(
442442
self,
443-
kernel: Kernel,
443+
kernel: ScalarKernel,
444444
avec: sym.Matrix,
445445
bvec: sym.Matrix | None,
446446
rscale: sym.Expr,
@@ -469,7 +469,7 @@ def coefficients_from_source(
469469

470470
@override
471471
def evaluate(self,
472-
kernel: Kernel,
472+
kernel: ScalarKernel,
473473
coeffs: Sequence[sym.Expr],
474474
bvec: sym.Matrix,
475475
rscale: sym.Expr,

0 commit comments

Comments
 (0)