Skip to content

Add custom __repr__ for Kernel - #245

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

inducer merged 2 commits into
inducer:mainfrom
alexfikl:better-kernel-repr

Conversation

@alexfikl

Copy link
Copy Markdown
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

inducer commented Sep 27, 2025

Copy link
Copy Markdown
Owner

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