Problem
Several SpecialFunctions that take an integer as the first argument are missing overloads in the SpecialFunctions extension.
The extension comment notes: # TODO: add functions with integer arguments.
Affected functions
using SparseConnectivityTracer, SpecialFunctions
detector = TracerSparsityDetector()
# polygamma(m, x) - takes integer order m
jacobian_sparsity(x -> polygamma.(1, x), [2.0, 3.0], detector)
# MethodError: no method matching _polygamma(::Int64, ::GradientTracer...)
# zeta(s)
jacobian_sparsity(x -> zeta.(x), [2.0, 3.0], detector)
# MethodError
# gamma_inc(a, x) - incomplete gamma
jacobian_sparsity(x -> [gamma_inc(x[1], x[2])[1]], [2.0, 0.5], detector)
# MethodError
# logabsgamma(x) - returns tuple (logabs, sign)
jacobian_sparsity(x -> [logabsgamma(x[1])[1]], [2.0], detector)
# MethodError
Implementation notes
For functions like polygamma(m::Int, x), the overload needs to handle the integer first argument as a constant (not a tracer), similar to how besseli(0, x) works.
For functions returning tuples like gamma_inc and logabsgamma, the tuple handling from #310 may need to be addressed first, or special handling added.
Problem
Several SpecialFunctions that take an integer as the first argument are missing overloads in the SpecialFunctions extension.
The extension comment notes:
# TODO: add functions with integer arguments.Affected functions
Implementation notes
For functions like
polygamma(m::Int, x), the overload needs to handle the integer first argument as a constant (not a tracer), similar to howbesseli(0, x)works.For functions returning tuples like
gamma_incandlogabsgamma, the tuple handling from #310 may need to be addressed first, or special handling added.