Skip to content

Commit 67aefb2

Browse files
committed
feat: Add dims/dimsd to Laplacian
1 parent 0fb71dc commit 67aefb2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pylops/basicoperators/Laplacian.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,18 @@ def Laplacian(
7070
if not (len(axes) == len(weights) == len(sampling)):
7171
raise ValueError("axes, weights, and sampling have different size")
7272

73-
l2op = weights[0] * SecondDerivative(
73+
l2op = SecondDerivative(
7474
dims, axis=axes[0], sampling=sampling[0], edge=edge, kind=kind, dtype=dtype
7575
)
76+
dims, dimsd = l2op.dims, l2op.dimsd
7677

78+
l2op *= weights[0]
7779
for ax, samp, weight in zip(axes[1:], sampling[1:], weights[1:]):
7880
l2op += weight * SecondDerivative(
7981
dims, axis=ax, sampling=samp, edge=edge, dtype=dtype
8082
)
8183

82-
return aslinearoperator(l2op)
84+
l2op = aslinearoperator(l2op)
85+
l2op.dims = dims
86+
l2op.dimsd = dimsd
87+
return l2op

0 commit comments

Comments
 (0)