Skip to content

Comments

Add custom __repr__ for Kernel#245

Merged
inducer merged 2 commits intoinducer:mainfrom
alexfikl:better-kernel-repr
Sep 27, 2025
Merged

Add custom __repr__ for Kernel#245
inducer merged 2 commits intoinducer:mainfrom
alexfikl:better-kernel-repr

Conversation

@alexfikl
Copy link
Collaborator

Before:

LaplaceKernel(
	dim=2,
	expression=Call(Variable('log'), (Call(Variable('sqrt'), (Sum((Product((..., ...)), Product((..., ...)))),)),)),
	global_scaling_const=Quotient(1, Product((-2, Variable('pi'))))
)

After:

LaplaceKernel(dim=2, expression=log(sqrt(d[0]*d[0] + d[1]*d[1])), global_scaling_const=1 / ((-2)*pi))

Thoughts? I mostly added it because the repr for the expression is quite unhelpful in the current version.

@inducer inducer merged commit de315ae into inducer:main Sep 27, 2025
9 checks passed
@inducer
Copy link
Owner

inducer commented Sep 27, 2025

I agree that seems better.

@alexfikl alexfikl deleted the better-kernel-repr branch September 27, 2025 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants