Nonlinear Fourier Analysis Module
The nonlinear Fourier analysis (NLFA) module provides functions for working with nonlinear Fourier transforms and related operations.
- qsppack.nlfa.b_from_cheb(c, parity)[source]
Generate coefficients of b from Chebyshev coefficients of approximating polynomial.
This function takes an array of Chebyshev coefficients of definite parity and returns a new array based on the specified parity. If the parity is even, the function creates an array of size 2*len(c) - 1, otherwise it creates an array of size 2*len(c).
- Parameters:
c (array_like) – Array of Chebyshev coefficients of the approximating polynomial with definite parity.
parity (int) – Parity of the approximating polynomial.
- Returns:
An array of coefficients of complex polynomial b.
- Return type:
ndarray
Notes
The function handles the input array differently based on the specified parity. For even parity, the new array is constructed by reversing the input array, halving it, and then adding the original array (also halved) starting from the middle. For odd parity, the process is similar but the new array is one element longer.
Examples
>>> b_from_cheb(np.array([2,-1,6,-7,1]), 0) array([ 0.5, -3.5, 3. , -0.5, 2. , -0.5, 3. , -3.5, 0.5]) >>> b_from_cheb([1, 2, 3], 1) array([1.5, 1. , 0.5, 0.5, 1. , 1.5])
- qsppack.nlfa.weiss(b, N)[source]
Compute the Weiss algorithm to get coefficients of a given b.
This function calculates the Weiss algorithm to get coefficients of a given b. The algorithm involves evaluating the polynomial at the Nth roots of unity, computing a logarithmic function, and applying the Fast Fourier Transform (FFT).
- Parameters:
b (array_like) – Coefficients of the input polynomial.
N (int) – The number of roots of unity to consider.
- Returns:
The polynomial coefficients of a.
- Return type:
ndarray
Examples
>>> weiss(np.array([0.38157934, 0.05342111, 0.45789521]), 8) array([ 0.76099391, -0.08783997, -0.23742773]) >>> weiss(np.array([ 2.37136846e-01, 1.06711580e-01, 4.32585034e-01, -3.04180174e-01, -4.74273691e-04, 5.21701060e-01]), 64) array([ 0.47379318, 0.09424218, 0.11612456, -0.24713393, -0.06540336, -0.26132533])
- qsppack.nlfa.inverse_nonlinear_FFT(a: ndarray, b: ndarray) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray][source]
Computes the inverse nonlinear FFT of a and b.
- Parameters:
a (np.ndarray) – Input array a of length n.
b (np.ndarray) – Input array b of length n.
- Returns:
A tuple containing gammas, xi_n, and eta_n.
- Return type:
tuple of np.ndarray
Examples
>>> inverse_nonlinear_FFT(np.array([0.1, -0.5, -0.6]), np.array([0.2, -0.5, 0.3]))[0] array([2., 1., 3.])
- qsppack.nlfa.forward_nlft(gammas)[source]
Computes the forward nonlinear Fourier transform (NLFT) for a given set of gammas.
This function constructs a matrix product based on the input gammas and extracts the polynomial coefficients from the resulting matrix.
- Parameters:
gammas (array_like) – An array of gamma values used in the transformation.
- Returns:
An array of polynomial coefficients derived from the transformation.
- Return type:
np.ndarray
Examples
>>> forward_nlft(np.array([0.1, -0.5, 0.3])) array([...]) # Example output, replace with actual expected result
- qsppack.nlfa.forward_nonlinear_FFT(gammas: ndarray, m=0, debug=False) tuple[numpy.ndarray, numpy.ndarray][source]
Computes the forward nonlinear FFT, producing the polynomials a^* and b from the rotation parameters gammas.
- Parameters:
gammas (np.ndarray) – Array of complex rotation parameters gamma_k of length n.
m (int, optional) – starting index of gammas to use in the recursion.
- Returns:
A tuple (a_star, b) of length n+1 and n respectively, where a_star is the conjugate polynomial coefficients of a^*(z), and b is b(z).
- Return type:
tuple of np.ndarray
These functions provide essential operations for nonlinear Fourier analysis, including: - Converting Chebyshev coefficients to complex polynomial coefficients - Computing the Weiss algorithm for polynomial coefficients - Performing inverse nonlinear FFT operations - Computing forward nonlinear Fourier transforms - Computing forward nonlinear FFT with recursive algorithm
Example usage:
import numpy as np
from qsppack.nlfa import b_from_cheb, weiss, inverse_nonlinear_FFT, forward_nlft
# Convert Chebyshev coefficients to complex polynomial coefficients
cheb_coefs = np.array([2, -1, 6, -7, 1])
b_coefs = b_from_cheb(cheb_coefs, parity=0)
# Compute Weiss algorithm
a_coefs = weiss(b_coefs, N=8)
# Perform inverse nonlinear FFT
gammas, xi_n, eta_n = inverse_nonlinear_FFT(a_coefs, b_coefs)
# Compute forward nonlinear Fourier transform
result = forward_nlft(gammas)
# Compute forward nonlinear FFT with recursive algorithm
a_star, b = forward_nonlinear_FFT(gammas)