NJIT Utilities#

pylit.njit_utils.argmax(array)#

Find the index of the maximum value in a 1D array.

Parameters:

array (ndarray) – A 1D array of numeric values.

Return type:

int

Returns:

The index of the maximum value in the array.

Notes

  • Equivalent to np.argmax(array), but implemented manually for use in Numba-compiled functions.

  • Assumes the array has at least one element.

pylit.njit_utils.svd_optim(R, F, x0)#

Perform a singular value decomposition (SVD) of matrix R and transform F and x0 into the SVD coordinate system.

Parameters:
  • R (ndarray) – A 2D square matrix to decompose (shape: (n, n)).

  • F (ndarray) – A 2D array to be transformed using the left singular vectors of R (shape: (n, m)).

  • x0 (ndarray) – A 1D array to be transformed using the right singular vectors of R (shape: (n,)).

Return type:

Tuple[ndarray, ndarray, ndarray, ndarray]

Returns:

  • S: (np.ndarray)

    A diagonal matrix of singular values (shape: (n, n)).

    F_prime: (np.ndarray)

    The transformed version of F in the SVD coordinate system (shape: (n, m)).

    x0_prime: (np.ndarray)

    The transformed version of x0 in the SVD coordinate system (shape: (n,)).

    V: (np.ndarray)

    The right singular vector matrix (shape: (n, n)).

  • Notes

    • This function uses the decomposition \(R = U S V^\top\) where \(U\) and \(V\) are orthogonal matrices, and S is diagonal with singular values.