Fourier Module
The Fourier module provides low-level helpers for working with Fourier-Taylor coefficient arrays in action-angle variables.
Base Functions
The base module provides core Fourier analysis framework.
_pack_fourier_index()
The _pack_fourier_index()
function packs exponents into a 64-bit key for constant-time lookup.
_decode_fourier_index()
The _decode_fourier_index()
function is the inverse of _pack_fourier_index()
.
- hiten.algorithms.fourier.base._decode_fourier_index()[source]
Inverse of :pyfunc:`~_pack_fourier_index`.
- Parameters:
key (np.uint64) – A 64-bit integer representing the packed Fourier index.
_init_fourier_tables()
The _init_fourier_tables()
function builds psiF and clmoF lookup tables for Fourier polynomials.
- hiten.algorithms.fourier.base._init_fourier_tables()[source]
Build psiF and clmoF lookup tables for Fourier polynomials.
- Parameters:
- Returns:
psiF (numpy.ndarray (shape
(degree+1,)
)) – psiF[d] = number of terms with total action degree d.clmoF (numba.typed.List) – For each degree d, an array of packed indices (dtype uint64) of size psiF[d].
_create_encode_dict_fourier()
The _create_encode_dict_fourier()
function creates a list of dictionaries mapping packed index to position for each degree.
- hiten.algorithms.fourier.base._create_encode_dict_fourier()[source]
Create a list of dictionaries mapping packed index -> position for each degree.
- Parameters:
clmoF (List) – List of arrays containing packed multi-indices.
- Returns:
List of dictionaries mapping packed multi-indices to their positions.
- Return type:
List
_encode_fourier_index()
The _encode_fourier_index()
function encodes a Fourier index tuple to find its position in the coefficient array.
Algebra Functions
The algebra module provides Fourier algebra operations.
_fpoly_add()
The _fpoly_add()
function adds two Fourier polynomial coefficient arrays element-wise.
- hiten.algorithms.fourier.algebra._fpoly_add()[source]
Add two Fourier polynomial coefficient arrays element-wise.
- Parameters:
p (np.ndarray) – First Fourier polynomial coefficient array.
q (np.ndarray) – Second Fourier polynomial coefficient array.
out (np.ndarray) – Output Fourier polynomial coefficient array.
- Return type:
None
_fpoly_scale()
The _fpoly_scale()
function scales a Fourier polynomial coefficient array by a constant factor.
- hiten.algorithms.fourier.algebra._fpoly_scale()[source]
Scale a Fourier polynomial coefficient array by a constant factor.
- Parameters:
p (np.ndarray) – Fourier polynomial coefficient array.
alpha (float) – Scaling factor.
out (np.ndarray) – Output Fourier polynomial coefficient array.
- Return type:
None
_fpoly_mul()
The _fpoly_mul()
function multiplies two Fourier polynomials using their coefficient arrays.
- hiten.algorithms.fourier.algebra._fpoly_mul()[source]
Multiply two Fourier polynomial coefficient arrays.
- Parameters:
p (np.ndarray) – First Fourier polynomial coefficient array.
deg_p (int) – Degree of the first polynomial.
q (np.ndarray) – Second Fourier polynomial coefficient array.
deg_q (int) – Degree of the second polynomial.
psiF (np.ndarray) – Combinatorial table from _init_index_tables.
clmoF (numba.typed.List) – List of arrays containing packed multi-indices.
encodeF (numba.typed.List) – List of dictionaries mapping packed multi-indices to their positions.
- Returns:
Output Fourier polynomial coefficient array.
- Return type:
np.ndarray
_fpoly_diff_action()
The _fpoly_diff_action()
function computes the partial derivative of a Fourier polynomial with respect to an action variable.
- hiten.algorithms.fourier.algebra._fpoly_diff_action()[source]
Differentiate a Fourier polynomial coefficient array with respect to an action.
- Parameters:
p (np.ndarray) – Fourier polynomial coefficient array.
deg_p (int) – Degree of the polynomial.
action_idx (int) – Index of the action to differentiate with respect to.
psiF (np.ndarray) – Combinatorial table from _init_index_tables.
clmoF (numba.typed.List) – List of arrays containing packed multi-indices.
encodeF (numba.typed.List) – List of dictionaries mapping packed multi-indices to their positions.
- Return type:
_fpoly_diff_angle()
The _fpoly_diff_angle()
function computes the partial derivative of a Fourier polynomial with respect to an angle variable.
_fpoly_poisson()
The _fpoly_poisson()
function computes the Poisson bracket of two Fourier polynomials.
- hiten.algorithms.fourier.algebra._fpoly_poisson()[source]
Compute the Poisson bracket of two Fourier polynomial coefficient arrays.
- Parameters:
p (np.ndarray) – First Fourier polynomial coefficient array.
deg_p (int) – Degree of the first polynomial.
q (np.ndarray) – Second Fourier polynomial coefficient array.
deg_q (int) – Degree of the second polynomial.
psiF (np.ndarray) – Combinatorial table from _init_index_tables.
clmoF (numba.typed.List) – List of arrays containing packed multi-indices.
encodeF (numba.typed.List) – List of dictionaries mapping packed multi-indices to their positions.
- Return type:
_fpoly_block_evaluate()
The _fpoly_block_evaluate()
function evaluates a Fourier polynomial block at specific action and angle values.
- hiten.algorithms.fourier.algebra._fpoly_block_evaluate()[source]
Evaluate a Fourier polynomial coefficient block at a specific point.
- Parameters:
coeffs_block (np.ndarray) – Fourier polynomial coefficient block.
degree (int) – Degree of the polynomial.
I_vals (np.ndarray) – Values of the actions.
theta_vals (np.ndarray) – Values of the angles.
clmoF (numba.typed.List) – List of arrays containing packed multi-indices.
_fpoly_block_gradient()
The _fpoly_block_gradient()
function computes the gradient of a Fourier polynomial block.
- hiten.algorithms.fourier.algebra._fpoly_block_gradient()[source]
Compute the gradient of a Fourier polynomial coefficient block.
- Parameters:
coeffs_block (np.ndarray) – Fourier polynomial coefficient block.
degree (int) – Degree of the polynomial.
I_vals (np.ndarray) – Values of the actions.
theta_vals (np.ndarray) – Values of the angles.
clmoF (numba.typed.List) – List of arrays containing packed multi-indices.
_fpoly_block_hessian()
The _fpoly_block_hessian()
function computes the Hessian matrix of a Fourier polynomial block.
- hiten.algorithms.fourier.algebra._fpoly_block_hessian()[source]
Compute the Hessian matrix of a Fourier polynomial coefficient block.
- Parameters:
coeffs_block (np.ndarray) – Fourier polynomial coefficient block.
degree (int) – Degree of the polynomial.
I_vals (np.ndarray) – Values of the actions.
theta_vals (np.ndarray) – Values of the angles.
clmoF (numba.typed.List) – List of arrays containing packed multi-indices.
Operations Functions
The operations module provides high-level Fourier operations.
_make_fourier_poly()
The _make_fourier_poly()
function creates a new Fourier polynomial coefficient array of specified degree.
_fourier_evaluate()
The _fourier_evaluate()
function evaluates a Fourier polynomial at specific action and angle values.
- hiten.algorithms.fourier.operations._fourier_evaluate()[source]
Evaluate a Fourier polynomial at specific action and angle values.
- Parameters:
coeffs_list (List) – List of Fourier polynomial coefficient arrays.
I_vals (np.ndarray) – Values of the actions.
theta_vals (np.ndarray) – Values of the angles.
clmoF (List) – List of arrays containing packed multi-indices.
_fourier_evaluate_with_grad()
The _fourier_evaluate_with_grad()
function evaluates a Fourier polynomial with gradient computation.
- hiten.algorithms.fourier.operations._fourier_evaluate_with_grad()[source]
Evaluate a Fourier polynomial with gradient at specific action and angle values.
- Parameters:
coeffs_list (List) – List of Fourier polynomial coefficient arrays.
I_vals (np.ndarray) – Values of the actions.
theta_vals (np.ndarray) – Values of the angles.
clmoF (List) – List of arrays containing packed multi-indices.
_fourier_hessian()
The _fourier_hessian()
function computes the Hessian matrix of a Fourier polynomial.
- hiten.algorithms.fourier.operations._fourier_hessian()[source]
Compute the Hessian matrix of a Fourier polynomial.
- Parameters:
coeffs_list (List) – List of Fourier polynomial coefficient arrays.
I_vals (np.ndarray) – Values of the actions.
theta_vals (np.ndarray) – Values of the angles.
clmoF (List) – List of arrays containing packed multi-indices.