Trapani#

s2fft.recursions.trapani.compute_eighth(dl: ndarray, L: int, el: int) ndarray#

Compute Wigner-d at argument \(\pi/2\) for eighth of plane using Trapani & Navaza recursion.

The Wigner-d plane is computed by recursion over \(\ell\) (el). Thus, for \(\ell > 0\) the plane must be computed already for \(\ell - 1\). For \(\ell = 1\) the recusion must already be initialised (see init()).

The Wigner-d plane \(d^\ell_{mm^\prime}(\pi/2)\) is indexed for \(-L < m, m^\prime < L\) by dl[m + L - 1, m’ + L - 1] but is only computed for the eighth of the plane \(m^\prime <= m < \ell\) and \(0 <= m^\prime <= \ell\). Symmetry relations can be used to fill in the remainder of the plane if required (see fill_eighth2quarter(), fill_quarter2half(), fill_half2full()).

Warning

This recursion may not be stable above \(\ell \gtrsim 1024\).

Note

Loop-based implementation.

Parameters:
  • dl (np.ndarray) – Wigner-d plane for \(\ell - 1\) at \(\pi/2\).

  • L (int) – Harmonic band-limit.

  • el (int) – Spherical harmonic degree \(\ell\).

Returns:

Plane of Wigner-d for el, with eighth of plane computed.

Return type:

np.ndarray

s2fft.recursions.trapani.compute_full(dl: ndarray, L: int, el: int, implementation: str = 'vectorized') ndarray#

Compute Wigner-d at argument \(\pi/2\) for full plane using Trapani & Navaza recursion (multiple implementations).

The Wigner-d plane is computed by recursion over \(\ell\) (el). Thus, for \(\ell > 0\) the plane must be computed already for \(\ell - 1\). For \(\ell = 1\) the recusion must already be initialised (see init()).

The Wigner-d plane \(d^\ell_{mm^\prime}(\pi/2)\) (el) is indexed for \(-L < m, m^\prime < L\) by dl[m + L - 1, m’ + L - 1]. The plane is computed directly for the eighth of the plane \(m^\prime <= m < \ell\) and \(0 <= m^\prime <= \ell\) (see compute_eighth()). Symmetry relations are then used to fill in the remainder of the plane (see fill_eighth2quarter(), fill_quarter2half(), fill_half2full()).

Warning

This recursion may not be stable above \(\ell \gtrsim 1024\).

Parameters:
  • dl (np.ndarray) – Wigner-d plane for \(\ell - 1\) at \(\pi/2\).

  • L (int) – Harmonic band-limit.

  • el (int) – Spherical harmonic degree \(\ell\).

  • implementation (str, optional) – Implementation to adopt. Supported implementations include {“loop”, “vectorized”, “jax”}. Defaults to “vectorized”.

Returns:

Plane of Wigner-d for el, with full plane computed.

Return type:

np.ndarray

s2fft.recursions.trapani.compute_full_jax(dl: Array, L: int, el: int) Array#

Compute Wigner-d at argument \(\pi/2\) for full plane using Trapani & Navaza recursion (JAX implementation).

See compute_full() for further details.

Note

JAX implementation.

Warning

This recursion may not be stable above \(\ell \gtrsim 1024\).

Parameters:
  • dl (np.ndarray) – Wigner-d plane for \(\ell - 1\) at \(\pi/2\).

  • L (int) – Harmonic band-limit.

  • el (int) – Spherical harmonic degree \(\ell\).

Returns:

Plane of Wigner-d for el, with full plane computed.

Return type:

np.ndarray

s2fft.recursions.trapani.compute_full_loop(dl: ndarray, L: int, el: int) ndarray#

Compute Wigner-d at argument \(\pi/2\) for full plane using Trapani & Navaza recursion (loop-based implementation).

See compute_full() for further details.

Note

Loop-based implementation.

Warning

This recursion may not be stable above \(\ell \gtrsim 1024\).

Parameters:
  • dl (np.ndarray) – Wigner-d plane for \(\ell - 1\) at \(\pi/2\).

  • L (int) – Harmonic band-limit.

  • el (int) – Spherical harmonic degree \(\ell\).

Returns:

Plane of Wigner-d for el, with full plane computed.

Return type:

np.ndarray

s2fft.recursions.trapani.compute_full_vectorized(dl: ndarray, L: int, el: int) ndarray#

Compute Wigner-d at argument \(\pi/2\) for full plane using Trapani & Navaza recursion (vectorized implementation).

See compute_full() for further details.

Note

Vectorized implementation.

Warning

This recursion may not be stable above \(\ell \gtrsim 1024\).

Parameters:
  • dl (np.ndarray) – Wigner-d plane for \(\ell - 1\) at \(\pi/2\).

  • L (int) – Harmonic band-limit.

  • el (int) – Spherical harmonic degree \(\ell\).

Returns:

Plane of Wigner-d for el, with full plane computed.

Return type:

np.ndarray

s2fft.recursions.trapani.compute_quarter(dl: ndarray, L: int, el: int) ndarray#

Compute Wigner-d at argument \(\pi/2\) for quarter plane using Trapani & Navaza recursion.

The Wigner-d plane is computed by recursion over \(\ell\) (el). Thus, for \(\ell > 0\) the plane must be computed already for \(\ell - 1\). For \(\ell = 1\) the recusion must already be initialised (see init()).

The Wigner-d plane \(d^\ell_{mm^\prime}(\pi/2)\) (el) is indexed for \(-L < m, m^\prime < L\) by dl[m + L - 1, m’ + L - 1]. The plane is computed directly for the eighth of the plane \(m^\prime <= m < \ell\) and \(0 <= m^\prime <= \ell\) (see compute_eighth()). Symmetry relations are then used to fill in the remainder of the quarter plane (see fill_eighth2quarter()).

Warning

This recursion may not be stable above \(\ell \gtrsim 1024\).

Parameters:
  • dl (np.ndarray) – Wigner-d plane for \(\ell - 1\) at \(\pi/2\).

  • L (int) – Harmonic band-limit.

  • el (int) – Spherical harmonic degree \(\ell\).

Returns:

Plane of Wigner-d for el, with quarter plane computed.

Return type:

np.ndarray

s2fft.recursions.trapani.compute_quarter_jax(dl: Array, L: int, el: int) Array#

Compute Wigner-d at argument \(\pi/2\) for quarter of plane using Trapani & Navaza recursion (JAX implementation).

The Wigner-d plane is computed by recursion over \(\ell\) (el). Thus, for \(\ell > 0\) the plane must be computed already for \(\ell - 1\). For \(\ell = 1\) the recusion must already be initialised (see init()).

The Wigner-d plane \(d^\ell_{mm^\prime}(\pi/2)\) is indexed for \(-L < m, m^\prime < L\) by dl[m + L - 1, m’ + L - 1] but is only computed for the quarter of the plane \(0 <= m, m^\prime <= \ell\).

Note

JAX implementation.

For vectorised implementations it is better to compute the full quarter of the plane directly, rather than compute an eight and fill the quarter by symmetry.

Warning

Writes garbage outside of m,`mm` range for given el.

Parameters:
  • dl (jnp.ndarray) – Wigner-d plane for \(\ell - 1\) at \(\pi/2\).

  • L (int) – Harmonic band-limit.

  • el (int) – Spherical harmonic degree \(\ell\).

Returns:

Plane of Wigner-d for el, with quarter of plane computed.

Return type:

jnp.ndarray

s2fft.recursions.trapani.compute_quarter_vectorized(dl: ndarray, L: int, el: int) ndarray#

Compute Wigner-d at argument \(\pi/2\) for quarter of plane using Trapani & Navaza recursion (vector implementation).

The Wigner-d plane is computed by recursion over \(\ell\) (el). Thus, for \(\ell > 0\) the plane must be computed already for \(\ell - 1\). For \(\ell = 1\) the recusion must already be initialised (see init()).

The Wigner-d plane \(d^\ell_{mm^\prime}(\pi/2)\) is indexed for \(-L < m, m^\prime < L\) by dl[m + L - 1, m’ + L - 1] but is only computed for the quarter of the plane \(0 <= m, m^\prime <= \ell\).

Note

Vectorized implementation.

For vectorised implementations it is better to compute the full quarter of the plane directly, rather than compute an eight and fill the quarter by symmetry.

Parameters:
  • dl (np.ndarray) – Wigner-d plane for \(\ell - 1\) at \(\pi/2\).

  • L (int) – Harmonic band-limit.

  • el (int) – Spherical harmonic degree \(\ell\).

Returns:

Plane of Wigner-d for el, with quarter of plane computed.

Return type:

np.ndarray

s2fft.recursions.trapani.fill_eighth2quarter(dl: ndarray, L: int, el: int) ndarray#

Fill in quarter of Wigner-d plane from eighth.

The Wigner-d plane passed as an argument should be computed for the eighth of the plane \(m^\prime <= m < \ell\) and \(0 <= m^\prime <= \ell\). The returned plane is computed by symmetry for \(0 <= m, m^\prime <= \ell\).

Parameters:
  • dl (np.ndarray) – Eighth of Wigner-d plane for \(\ell\) at \(\pi/2\).

  • L (int) – Harmonic band-limit.

  • el (int) – Spherical harmonic degree \(\ell\).

Returns:

Plane of Wigner-d for el, with quarter of plane computed.

Return type:

np.ndarray

s2fft.recursions.trapani.fill_half2full(dl: ndarray, L: int, el: int) ndarray#

Fill in full Wigner-d plane from half.

The Wigner-d plane passed as an argument should be computed for the half of the plane \(-\ell <= m <= \ell\) and \(0 <= m^\prime <= \ell\). The returned plane is computed by symmetry for \(-\ell <= m, m^\prime <= \ell\).

Note

Loop-based implementation.

Parameters:
  • dl (np.ndarray) – Half of Wigner-d plane for \(\ell\) at \(\pi/2\).

  • L (int) – Harmonic band-limit.

  • el (int) – Spherical harmonic degree \(\ell\).

Returns:

Plane of Wigner-d for el, with full plane computed.

Return type:

np.ndarray

s2fft.recursions.trapani.fill_half2full_jax(dl: Array, L: int, el: int) Array#

Fill in full Wigner-d plane from half (JAX implementation).

See fill_half2full() for further details.

Note

JAX implementation.

Parameters:
  • dl (jnp.ndarray) – Half of Wigner-d plane for \(\ell\) at \(\pi/2\).

  • L (int) – Harmonic band-limit.

  • el (int) – Spherical harmonic degree \(\ell\).

Returns:

Plane of Wigner-d for el, with full plane computed.

Return type:

jnp.ndarray

s2fft.recursions.trapani.fill_half2full_vectorized(dl: ndarray, L: int, el: int) ndarray#

Fill in full Wigner-d plane from half (vectorized implementation).

See fill_half2full() for further details.

Note

Vectorized implementation.

Parameters:
  • dl (np.ndarray) – Half of Wigner-d plane for \(\ell\) at \(\pi/2\).

  • L (int) – Harmonic band-limit.

  • el (int) – Spherical harmonic degree \(\ell\).

Returns:

Plane of Wigner-d for el, with full plane computed.

Return type:

np.ndarray

s2fft.recursions.trapani.fill_quarter2half(dl: ndarray, L: int, el: int) ndarray#

Fill in half of Wigner-d plane from quarter.

The Wigner-d plane passed as an argument should be computed for the quarter of the plane \(0 <= m, m^\prime <= \ell\). The returned plane is computed by symmetry for \(-\ell <= m <= \ell\) and \(0 <= m^\prime <= \ell\).

Parameters:
  • dl (np.ndarray) – Quarter of Wigner-d plane for \(\ell\) at \(\pi/2\).

  • L (int) – Harmonic band-limit.

  • el (int) – Spherical harmonic degree \(\ell\).

Returns:

Plane of Wigner-d for el, with half of plane computed.

Return type:

np.ndarray

s2fft.recursions.trapani.fill_quarter2half_jax(dl: Array, L: int, el: int) Array#

Fill in half of Wigner-d plane from quarter (JAX implementation).

See fill_quarter2half() for further details.

Note

JAX implementation.

Parameters:
  • dl (jnp.ndarray) – Quarter of Wigner-d plane for \(\ell\) at \(\pi/2\).

  • L (int) – Harmonic band-limit.

  • el (int) – Spherical harmonic degree \(\ell\).

Returns:

Plane of Wigner-d for el, with half of plane computed.

Return type:

jnp.ndarray

s2fft.recursions.trapani.fill_quarter2half_vectorized(dl: ndarray, L: int, el: int) ndarray#

Fill in half of Wigner-d plane from quarter (vectorised implementation).

See fill_quarter2half() for further details.

Note

Vectorized implementation.

Parameters:
  • dl (np.ndarray) – Quarter of Wigner-d plane for \(\ell\) at \(\pi/2\).

  • L (int) – Harmonic band-limit.

  • el (int) – Spherical harmonic degree \(\ell\).

Returns:

Plane of Wigner-d for el, with half of plane computed.

Return type:

np.ndarray

s2fft.recursions.trapani.init(dl: ndarray, L: int, implementation: str = 'vectorized') ndarray#

Initialise Wigner-d at argument \(\pi/2\) for \(\ell=0\) for Trapani & Navaza recursion (multiple implementations).

Parameters:
  • dl (np.ndarray) – Wigner-d plane \(d^\ell_{mm^\prime}(\pi/2)\) allocated for all \(-L < m, m^\prime < L\), to be indexed by dl[m + L - 1, m’ + L - 1].

  • L (int) – Harmonic band-limit.

  • implementation (str, optional) – Implementation to adopt. Supported implementations include {“loop”, “vectorized”, “jax”}. Defaults to “vectorized”.

Returns:

Plane of Wigner-d initialised for \(\ell=0\),

Return type:

np.ndarray

s2fft.recursions.trapani.init_jax(dl: Array, L: int) Array#

Initialise Wigner-d at argument \(\pi/2\) for \(\ell=0\) for Trapani & Navaza recursion (JAX implementation).

See init() for further details.

Note

JAX implementation.

Parameters:
  • dl (jnp.ndarray) – Wigner-d plane \(d^\ell_{mm^\prime}(\pi/2)\) allocated for all \(-L < m, m^\prime < L\), to be indexed by dl[m + L - 1, m’ + L - 1].

  • L (int) – Harmonic band-limit.

Returns:

Plane of Wigner-d initialised for \(\ell=0\),

Return type:

jnp.ndarray

s2fft.recursions.trapani.init_nonjax(dl: ndarray, L: int) ndarray#

Initialise Wigner-d at argument \(\pi/2\) for \(\ell=0\) for Trapani & Navaza recursion (loop-based/vectorized implementation).

See init() for further details.

Note

Loop-based/vectorized implementation.

Parameters:
  • dl (np.ndarray) – Wigner-d plane \(d^\ell_{mm^\prime}(\pi/2)\) allocated for all \(-L < m, m^\prime < L\), to be indexed by dl[m + L - 1, m’ + L - 1].

  • L (int) – Harmonic band-limit.

Returns:

Plane of Wigner-d initialised for \(\ell=0\),

Return type:

np.ndarray