pymiediff.special.sph_jn_torch_via_rec#
- pymiediff.special.sph_jn_torch_via_rec(n: Tensor, z: Tensor, n_add='auto', eps=1e-07, **kwargs)#
Vectorized spherical Bessel of the first kind via downward recurrence
Seems a bit faster than continued-fraction ratios, but less stable for large |z| and medium large Im(z). Returns all orders. Vectorized over all z. Caution: May be unstable for medium and large |Im z|. Use continued-fraction ratios instead.
- Parameters:
n (torch.Tensor or int) – integer order(s)
z (torch.Tensor) – complex (or real) arguments to evalute
n_add (str or int) – ‘auto’ or integer extra depth for the downward recurrence. ‘auto’ picks a default based on max|z|. defaults to “auto”
eps (float) – minimum value for |z| to avoid numerical instability
kwargs – other kwargs are ignored
- Returns:
tensor of same shape of input z + (n_max+1,) dimension, where last dim indexes the order n=0..n_max.
- Return type:
torch.Tensor