Skip to content

Add scipy-like kn helper #1313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 22, 2025
Merged

Conversation

Aarsh-Wankar
Copy link
Contributor

@Aarsh-Wankar Aarsh-Wankar commented Mar 21, 2025

I added an additional function kn in the pytensor/tensor/math.py file which just calls kv function under the hood. This is to provide functionality similar to that offered by scipy.special.kn.

Description

scipy has two functions for computing modified Bessel functions of the second kind: scipy.special.kv (which works for functions of real order) and scipy.special.kn (which works for functions of integer order). pytensor has a function pytensor.tensor.kv which is similar to scipy, but it lacks a kn counterpart. Thus I added an extra helper function kn which just calls kv under the hood, as kv also works for integers.

Related Issue

Checklist

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

📚 Documentation preview 📚: https://pytensor--1313.org.readthedocs.build/en/1313/

Copy link

codecov bot commented Mar 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.99%. Comparing base (b75c18f) to head (6e1a99c).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1313   +/-   ##
=======================================
  Coverage   81.99%   81.99%           
=======================================
  Files         188      188           
  Lines       48506    48508    +2     
  Branches     8672     8672           
=======================================
+ Hits        39771    39773    +2     
  Misses       6583     6583           
  Partials     2152     2152           
Files with missing lines Coverage Δ
pytensor/tensor/math.py 92.97% <100.00%> (+0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ricardoV94 ricardoV94 changed the title Add pytensor.tensor.kn function which calls pytensor.tensor.kv under the hood Add scipy-like kn helper Mar 22, 2025
@ricardoV94 ricardoV94 changed the title Add scipy-like kn helper Add scipy-like special.kn helper Mar 22, 2025
@ricardoV94 ricardoV94 changed the title Add scipy-like special.kn helper Add scipy-like kn helper Mar 22, 2025
@ricardoV94 ricardoV94 merged commit 95ce102 into pymc-devs:main Mar 22, 2025
74 checks passed
@ricardoV94
Copy link
Member

Thanks @Aarsh-Wankar

@Aarsh-Wankar Aarsh-Wankar deleted the kn_kv_1308 branch March 22, 2025 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add helper for special.kn that just calls special.kv under the hood
2 participants