lcyllp/moonbit-nlse-ssfm/src/types does not have a README file

    Complex

    pub struct Complex {
    re : Double
    im : Double
    } derive(Eq,
    Debug
    )

    Complex::abs

    fn Complex::abs(self : Complex) -> Double

    Complex::abs2

    fn Complex::abs2(self : Complex) -> Complex

    Complex::add

    fn Complex::add(self : Complex, other : Complex) -> Complex

    Complex::arg

    fn Complex::arg(self : Complex) -> Double

    Complex::conj

    fn Complex::conj(self : Complex) -> Complex

    Complex::cos

    fn Complex::cos(self : Complex) -> Complex

    Complex::cosh

    fn Complex::cosh(self : Complex) -> Complex

    Complex::div

    fn Complex::div(self : Complex, other : Complex) -> Complex

    Complex::div_real

    fn Complex::div_real(self : Complex, s : Double) -> Complex

    Complex::exp

    fn Complex::exp(self : Complex) -> Complex

    Complex::from_imag

    fn Complex::from_imag(i : Double) -> Complex

    Complex::from_real

    fn Complex::from_real(r : Double) -> Complex

    Complex::i

    fn Complex::i() -> Complex

    Complex::log

    fn Complex::log(self : Complex) -> Complex

    Complex::magnitude2

    fn Complex::magnitude2(self : Complex) -> Double

    Complex::mul

    fn Complex::mul(self : Complex, other : Complex) -> Complex

    Complex::neg

    fn Complex::neg(self : Complex) -> Complex

    Complex::new

    fn Complex::new(re : Double, im : Double) -> Complex

    Complex::one

    fn Complex::one() -> Complex

    Complex::op_add

    fn Complex::op_add(self : Complex, other : Complex) -> Complex

    Complex::op_div

    fn Complex::op_div(self : Complex, other : Complex) -> Complex

    Complex::op_mul

    fn Complex::op_mul(self : Complex, other : Complex) -> Complex

    Complex::op_sub

    fn Complex::op_sub(self : Complex, other : Complex) -> Complex

    Complex::polar

    fn Complex::polar(r : Double, theta : Double) -> Complex

    Complex::pow_real

    fn Complex::pow_real(self : Complex, p : Double) -> Complex

    Complex::scale

    fn Complex::scale(self : Complex, s : Double) -> Complex

    Complex::sech

    fn Complex::sech(self : Complex) -> Complex

    Complex::sin

    fn Complex::sin(self : Complex) -> Complex

    Complex::sinh

    fn Complex::sinh(self : Complex) -> Complex

    Complex::sqrt

    fn Complex::sqrt(self : Complex) -> Complex

    Complex::sub

    fn Complex::sub(self : Complex, other : Complex) -> Complex

    Complex::tan

    fn Complex::tan(self : Complex) -> Complex

    Complex::tanh

    fn Complex::tanh(self : Complex) -> Complex

    Complex::zero

    fn Complex::zero() -> Complex

    DispersionProfile

    pub struct DispersionProfile {
    alpha_db_per_km : Double
    beta2 : Double
    beta3 : Double
    beta4 : Double
    beta5 : Double
    beta6 : Double
    beta7 : Double
    beta8 : Double
    beta9 : Double
    beta10 : Double
    } derive(Eq,
    Debug
    )

    Fiber dispersion profile up to 10th order

    DispersionProfile::new

    fn DispersionProfile::new(alpha_db_per_km? : Double, beta2? : Double, beta3? : Double, beta4? : Double, beta5? : Double, beta6? : Double, beta7? : Double, beta8? : Double, beta9? : Double, beta10? : Double) -> DispersionProfile

    Constructor for DispersionProfile

    DispersionProfile::smf28

    Default dispersion profile (SMF-28 at 1550 nm)

    FiberSegment

    pub struct FiberSegment {
    name : String
    length : Double
    dispersion : DispersionProfile
    nonlinearity : NonlinearProfile
    gain_db_per_m : Double
    saturation_energy : Double
    } derive(Eq,
    Debug
    )

    Fiber segment configuration

    FiberSegment::new

    fn FiberSegment::new(name : String, length : Double, dispersion : DispersionProfile, nonlinearity : NonlinearProfile, gain_db_per_m? : Double, saturation_energy? : Double) -> FiberSegment

    Create standard fiber segment

    Matrix2x2

    pub struct Matrix2x2 {
    m00 : Complex
    m01 : Complex
    m10 : Complex
    m11 : Complex
    } derive(Eq,
    Debug
    )

    2x2 Complex matrix struct

    Matrix2x2::identity

    fn Matrix2x2::identity() -> Matrix2x2

    Identity 2x2 matrix

    Matrix2x2::new

    fn Matrix2x2::new(m00 : Complex, m01 : Complex, m10 : Complex, m11 : Complex) -> Matrix2x2

    Create 2x2 complex matrix

    Matrix3x3

    pub struct Matrix3x3 {
    m00 : Double
    m01 : Double
    m02 : Double
    m10 : Double
    m11 : Double
    m12 : Double
    m20 : Double
    m21 : Double
    m22 : Double
    } derive(Eq,
    Debug
    )

    3x3 Double matrix container

    Matrix3x3::det

    fn Matrix3x3::det(self : Matrix3x3) -> Double

    Compute determinant of 3x3 matrix

    Matrix3x3::identity

    fn Matrix3x3::identity() -> Matrix3x3

    Identity 3x3 Double matrix

    Matrix3x3::inverse

    fn Matrix3x3::inverse(self : Matrix3x3) -> Matrix3x3

    Inverse of 3x3 matrix

    Matrix3x3::new

    fn Matrix3x3::new(m00 : Double, m01 : Double, m02 : Double, m10 : Double, m11 : Double, m12 : Double, m20 : Double, m21 : Double, m22 : Double) -> Matrix3x3

    Create 3x3 Double matrix

    Matrix4x4Complex

    pub struct Matrix4x4Complex {
    m00 : Complex
    m01 : Complex
    m02 : Complex
    m03 : Complex
    m10 : Complex
    m11 : Complex
    m12 : Complex
    m13 : Complex
    m20 : Complex
    m21 : Complex
    m22 : Complex
    m23 : Complex
    m30 : Complex
    m31 : Complex
    m32 : Complex
    m33 : Complex
    } derive(Eq,
    Debug
    )

    4x4 Complex matrix for multimode spatial-polarization optics

    Matrix4x4Complex::identity

    Identity 4x4 Complex matrix

    NonlinearProfile

    pub struct NonlinearProfile {
    gamma : Double
    self_steepening : Bool
    tau_s : Double
    enable_raman : Bool
    fr : Double
    tau1 : Double
    tau2 : Double
    } derive(Eq,
    Debug
    )

    Fiber nonlinear parameters and Raman model choices

    NonlinearProfile::default_silica

    fn NonlinearProfile::default_silica() -> NonlinearProfile

    Default silica fiber nonlinear properties

    NonlinearProfile::new

    fn NonlinearProfile::new(gamma? : Double, self_steepening? : Bool, tau_s? : Double, enable_raman? : Bool, fr? : Double, tau1? : Double, tau2? : Double) -> NonlinearProfile

    Constructor for NonlinearProfile

    PulseConfig

    pub struct PulseConfig {
    shape : PulseShape
    peak_power : Double
    fwhm_duration : Double
    central_wavelength : Double
    chirp : Double
    order : Double
    phase_offset : Double
    time_window : Double
    num_points : Int
    } derive(Eq,
    Debug
    )

    Pulse specifications

    PulseConfig::default

    fn PulseConfig::default() -> PulseConfig

    Default pulse parameters

    PulseConfig::new

    fn PulseConfig::new(shape? : PulseShape, peak_power? : Double, fwhm_duration? : Double, central_wavelength? : Double, chirp? : Double, order? : Double, phase_offset? : Double, time_window? : Double, num_points? : Int) -> PulseConfig

    Constructor for PulseConfig

    PulseShape

    pub enum PulseShape {
    Gaussian
    Sech
    SuperGaussian(power~ : Int)
    ChirpedGaussian(chirp~ : Double)
    ChirpedSech(chirp~ : Double)
    DualPulse(delay~ : Double, ratio~ : Double)
    CustomWaveform
    } derive(Eq,
    Debug
    )

    Optical pulse initial shape enumeration
    impl Show for PulseShape

    PulseShape::chirped_gaussian

    fn PulseShape::chirped_gaussian(chirp : Double) -> PulseShape

    PulseShape::chirped_sech

    fn PulseShape::chirped_sech(chirp : Double) -> PulseShape

    PulseShape::custom_waveform

    fn PulseShape::custom_waveform() -> PulseShape

    PulseShape::dual_pulse

    fn PulseShape::dual_pulse(delay : Double, ratio : Double) -> PulseShape

    PulseShape::gaussian

    fn PulseShape::gaussian() -> PulseShape

    PulseShape constructor functions

    PulseShape::sech

    fn PulseShape::sech() -> PulseShape

    PulseShape::super_gaussian

    fn PulseShape::super_gaussian(power : Int) -> PulseShape

    SimulationConfig

    pub struct SimulationConfig {
    solver_method : SolverMethod
    total_length : Double
    num_steps : Int
    adaptive_step : Bool
    tolerance : Double
    max_step_size : Double
    min_step_size : Double
    save_history_steps : Int
    } derive(Eq,
    Debug
    )

    Simulation numerical settings

    SimulationConfig::default

    Default simulation options

    SimulationConfig::new

    fn SimulationConfig::new(solver_method? : SolverMethod, total_length? : Double, num_steps? : Int, adaptive_step? : Bool, tolerance? : Double, max_step_size? : Double, min_step_size? : Double, save_history_steps? : Int) -> SimulationConfig

    Constructor for SimulationConfig

    SolverMethod

    pub enum SolverMethod {
    StandardSSFM
    SymmetricSSFM
    RK4IP
    } derive(Eq,
    Debug
    )

    SSFM algorithm solver options

    SolverMethod::rk4ip

    fn SolverMethod::rk4ip() -> SolverMethod

    SolverMethod::standard_ssfm

    fn SolverMethod::standard_ssfm() -> SolverMethod

    SolverMethod constructors

    SolverMethod::symmetric_ssfm

    fn SolverMethod::symmetric_ssfm() -> SolverMethod

    Tensor10D

    pub struct Tensor10D {
    dim0 : Int
    dim1 : Int
    dim2 : Int
    dim3 : Int
    dim4 : Int
    dim5 : Int
    dim6 : Int
    dim7 : Int
    dim8 : Int
    dim9 : Int
    data : Array[Double]
    } derive(Eq,
    Debug
    )

    10D Double Tensor container

    Tensor10D::new

    fn Tensor10D::new(dim0 : Int, dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int, dim7 : Int, dim8 : Int, dim9 : Int) -> Tensor10D

    Create 10D Tensor

    Tensor11D

    pub struct Tensor11D {
    dim0 : Int
    dim1 : Int
    dim2 : Int
    dim3 : Int
    dim4 : Int
    dim5 : Int
    dim6 : Int
    dim7 : Int
    dim8 : Int
    dim9 : Int
    dim10 : Int
    data : Array[Double]
    } derive(Eq,
    Debug
    )

    11D Double Tensor container

    Tensor11D::new

    fn Tensor11D::new(dim0 : Int, dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int, dim7 : Int, dim8 : Int, dim9 : Int, dim10 : Int) -> Tensor11D

    Create 11D Tensor

    Tensor12D

    pub struct Tensor12D {
    dim0 : Int
    dim1 : Int
    dim2 : Int
    dim3 : Int
    dim4 : Int
    dim5 : Int
    dim6 : Int
    dim7 : Int
    dim8 : Int
    dim9 : Int
    dim10 : Int
    dim11 : Int
    data : Array[Double]
    } derive(Eq,
    Debug
    )

    12D Double Tensor container

    Tensor12D::new

    fn Tensor12D::new(dim0 : Int, dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int, dim7 : Int, dim8 : Int, dim9 : Int, dim10 : Int, dim11 : Int) -> Tensor12D

    Create 12D Tensor

    Tensor13D

    pub struct Tensor13D {
    dim0 : Int
    dim1 : Int
    dim2 : Int
    dim3 : Int
    dim4 : Int
    dim5 : Int
    dim6 : Int
    dim7 : Int
    dim8 : Int
    dim9 : Int
    dim10 : Int
    dim11 : Int
    dim12 : Int
    data : Array[Double]
    } derive(Eq,
    Debug
    )

    13D Double Tensor container

    Tensor13D::new

    fn Tensor13D::new(dim0 : Int, dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int, dim7 : Int, dim8 : Int, dim9 : Int, dim10 : Int, dim11 : Int, dim12 : Int) -> Tensor13D

    Create 13D Tensor

    Tensor3D

    pub struct Tensor3D {
    dim0 : Int
    dim1 : Int
    dim2 : Int
    data : Array[Complex]
    } derive(Eq,
    Debug
    )

    3D Complex tensor structure

    Tensor3D::get

    fn Tensor3D::get(self : Tensor3D, i : Int, j : Int, k : Int) -> Complex

    Get tensor element at (i, j, k)

    Tensor3D::new

    fn Tensor3D::new(dim0 : Int, dim1 : Int, dim2 : Int) -> Tensor3D

    Create 3D Complex Tensor

    Tensor3D::set

    fn Tensor3D::set(self : Tensor3D, i : Int, j : Int, k : Int, val : Complex) -> Unit

    Set tensor element at (i, j, k)

    Tensor4D

    pub struct Tensor4D {
    dim0 : Int
    dim1 : Int
    dim2 : Int
    dim3 : Int
    data : Array[Double]
    } derive(Eq,
    Debug
    )

    4D Double Tensor structure

    Tensor4D::get

    fn Tensor4D::get(self : Tensor4D, i : Int, j : Int, k : Int, l : Int) -> Double

    Get 4D tensor element

    Tensor4D::new

    fn Tensor4D::new(dim0 : Int, dim1 : Int, dim2 : Int, dim3 : Int) -> Tensor4D

    Create 4D Tensor

    Tensor4D::set

    fn Tensor4D::set(self : Tensor4D, i : Int, j : Int, k : Int, l : Int, val : Double) -> Unit

    Set 4D tensor element

    Tensor5D

    pub struct Tensor5D {
    dim0 : Int
    dim1 : Int
    dim2 : Int
    dim3 : Int
    dim4 : Int
    data : Array[Double]
    } derive(Eq,
    Debug
    )

    5D Double Tensor container

    Tensor5D::new

    fn Tensor5D::new(dim0 : Int, dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int) -> Tensor5D

    Create 5D Tensor

    Tensor6D

    pub struct Tensor6D {
    dim0 : Int
    dim1 : Int
    dim2 : Int
    dim3 : Int
    dim4 : Int
    dim5 : Int
    data : Array[Double]
    } derive(Eq,
    Debug
    )

    6D Double Tensor structure

    Tensor6D::new

    fn Tensor6D::new(dim0 : Int, dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int) -> Tensor6D

    Create 6D Tensor

    Tensor7D

    pub struct Tensor7D {
    dim0 : Int
    dim1 : Int
    dim2 : Int
    dim3 : Int
    dim4 : Int
    dim5 : Int
    dim6 : Int
    data : Array[Double]
    } derive(Eq,
    Debug
    )

    7D Double Tensor container

    Tensor7D::new

    fn Tensor7D::new(dim0 : Int, dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int) -> Tensor7D

    Create 7D Tensor

    Tensor8D

    pub struct Tensor8D {
    dim0 : Int
    dim1 : Int
    dim2 : Int
    dim3 : Int
    dim4 : Int
    dim5 : Int
    dim6 : Int
    dim7 : Int
    data : Array[Double]
    } derive(Eq,
    Debug
    )

    8D Double Tensor container

    Tensor8D::new

    fn Tensor8D::new(dim0 : Int, dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int, dim7 : Int) -> Tensor8D

    Create 8D Tensor

    Tensor9D

    pub struct Tensor9D {
    dim0 : Int
    dim1 : Int
    dim2 : Int
    dim3 : Int
    dim4 : Int
    dim5 : Int
    dim6 : Int
    dim7 : Int
    dim8 : Int
    data : Array[Double]
    } derive(Eq,
    Debug
    )

    9D Double Tensor container

    Tensor9D::new

    fn Tensor9D::new(dim0 : Int, dim1 : Int, dim2 : Int, dim3 : Int, dim4 : Int, dim5 : Int, dim6 : Int, dim7 : Int, dim8 : Int) -> Tensor9D

    Create 9D Tensor

    Vector3D

    pub struct Vector3D {
    x : Double
    y : Double
    z : Double
    } derive(Eq,
    Debug
    )

    3D Double Vector

    Vector3D::new

    fn Vector3D::new(x : Double, y : Double, z : Double) -> Vector3D

    Create 3D Vector

    Vector3D::zero

    fn Vector3D::zero() -> Vector3D

    Zero 3D Vector

    Vector4D

    pub struct Vector4D {
    v0 : Double
    v1 : Double
    v2 : Double
    v3 : Double
    } derive(Eq,
    Debug
    )

    4D Double Vector

    Vector4D::new

    fn Vector4D::new(v0 : Double, v1 : Double, v2 : Double, v3 : Double) -> Vector4D

    Create 4D Vector

    C_LIGHT

    let C_LIGHT : Double

    Speed of light in vacuum (m/s)

    EPSILON_0

    let EPSILON_0 : Double

    Vacuum permittivity (F/m)

    H_BAR

    let H_BAR : Double

    Reduced Planck's constant (J*s)
    let PI : Double

    Mathematical constant PI

    PLANCK_H

    let PLANCK_H : Double

    Planck's constant (J*s)

    TWO_PI

    let TWO_PI : Double

    2 * PI

    WAVELENGTH_1064NM

    let WAVELENGTH_1064NM : Double

    Ytterbium laser wavelength (1064 nm in meters)

    WAVELENGTH_1550NM

    let WAVELENGTH_1550NM : Double

    Standard C-band telecommunication wavelength (1550 nm in meters)

    WAVELENGTH_800NM

    let WAVELENGTH_800NM : Double

    Titanium-Sapphire laser wavelength (800 nm in meters)

    add_complex_arrays

    fn add_complex_arrays(a : Array[Complex], b : Array[Complex]) -> Array[Complex]

    apply_jones_matrix

    fn apply_jones_matrix(m : Matrix2x2, ex : Complex, ey : Complex) -> (Complex, Complex)

    Transform 2D complex vector (Ex, Ey) by 2x2 Jones matrix

    arange

    fn arange(start : Double, stop : Double, step : Double) -> Array[Double]

    array_max_double

    fn array_max_double(arr : Array[Double]) -> Double

    array_min_double

    fn array_min_double(arr : Array[Double]) -> Double

    array_sum_double

    fn array_sum_double(arr : Array[Double]) -> Double

    average_power_to_energy

    fn average_power_to_energy(avg_power_w : Double, rep_rate_hz : Double) -> Double

    Convert average power (W) to pulse energy (J) given repetition rate f_rep (Hz)

    bessel_i0

    fn bessel_i0(x : Double) -> Double

    Modified Bessel function of the first kind I0(x)

    bessel_j0

    fn bessel_j0(x : Double) -> Double

    Bessel function of the first kind J0(x) polynomial approximation

    bessel_j1

    fn bessel_j1(x : Double) -> Double

    Bessel function of the first kind J1(x) polynomial approximation

    beta2_to_d

    fn beta2_to_d(beta2 : Double, wavelength_m : Double) -> Double

    Convert Group Velocity Dispersion (GVD) beta2 (s^2/m) to D parameter (ps/(nm*km))

    complex_magnitude

    fn complex_magnitude(arr : Array[Complex]) -> Array[Double]

    complex_magnitude_squared

    fn complex_magnitude_squared(arr : Array[Complex]) -> Array[Double]

    complex_phase

    fn complex_phase(arr : Array[Complex]) -> Array[Double]

    copy_complex

    fn copy_complex(arr : Array[Complex]) -> Array[Complex]

    copy_double

    fn copy_double(arr : Array[Double]) -> Array[Double]

    cross_correlation

    fn cross_correlation(x : Array[Complex], y : Array[Complex]) -> Array[Complex]

    Compute cross-correlation of two complex signals

    cross_product_3d

    fn cross_product_3d(v1 : Vector3D, v2 : Vector3D) -> Vector3D

    Cross product of two 3D vectors

    d_to_beta2

    fn d_to_beta2(d_param : Double, wavelength : Double) -> Double

    Calculate group velocity dispersion (GVD) parameter beta2 (ps^2/km) from dispersion D (ps/(nm*km))

    d_to_beta2_param

    fn d_to_beta2_param(d_param : Double, wavelength_m : Double) -> Double

    Convert Dispersion D parameter (ps/(nm*km)) to GVD beta2 (s^2/m)

    dbm_to_watts

    fn dbm_to_watts(power_dbm : Double) -> Double

    Convert power in dBm to Watts

    dot_product_3d

    fn dot_product_3d(v1 : Vector3D, v2 : Vector3D) -> Double

    Dot product of two 3D vectors

    dot_product_4d

    fn dot_product_4d(a : Vector4D, b : Vector4D) -> Double

    Dot product of two 4D vectors

    dt_to_frequency_span

    fn dt_to_frequency_span(dt : Double) -> Double

    Convert temporal grid time step dt to frequency grid span F_span (Hz)

    energy_to_average_power

    fn energy_to_average_power(energy_j : Double, rep_rate_hz : Double) -> Double

    Convert energy density (J) to average power (W) given repetition rate f_rep (Hz)

    energy_to_gaussian_peak_power

    fn energy_to_gaussian_peak_power(energy_j : Double, fwhm_duration : Double) -> Double

    Calculate peak power P0 (W) from pulse energy E (J) and FWHM duration for Gaussian pulse

    energy_to_sech_peak_power

    fn energy_to_sech_peak_power(energy_j : Double, fwhm_duration : Double) -> Double

    Calculate peak power P0 (W) from pulse energy E (J) and FWHM duration for Sech pulse

    erf

    fn erf(x : Double) -> Double

    Error function erf(x) approximation via Abramowitz and Stegun formula

    erfc

    fn erfc(x : Double) -> Double

    Complementary error function erfc(x) = 1 - erf(x)

    gamma_function

    fn gamma_function(z : Double) -> Double

    Gamma function Lanczos approximation

    grid_frequency_resolution

    fn grid_frequency_resolution(num_points : Int, dt : Double) -> Double

    Convert number of points N and time step dt to frequency resolution df (Hz)

    interp1d_linear

    fn interp1d_linear(x : Array[Double], y : Array[Double], x_target : Double) -> Double

    1D Linear interpolation: evaluate y(x_target) from sorted grid x and y

    jones_polarizer

    fn jones_polarizer(theta : Double) -> Matrix2x2

    Create linear polarizer Jones matrix at angle theta (rad)

    jones_waveplate

    fn jones_waveplate(phi : Double, theta : Double) -> Matrix2x2

    Create waveplate (birefringence) Jones matrix with phase retardance phi and fast axis angle theta

    kronecker_product_2x2

    fn kronecker_product_2x2(a : Matrix2x2, b : Matrix2x2) -> Matrix4x4Complex

    Compute Kronecker product of two 2x2 Complex matrices A x B -> 4x4 Complex matrix

    linspace

    fn linspace(start : Double, stop : Double, num : Int) -> Array[Double]

    magnitude_3d

    fn magnitude_3d(v : Vector3D) -> Double

    Magnitude of 3D vector

    matrix2x2_det

    fn matrix2x2_det(m : Matrix2x2) -> Complex

    Compute determinant of 2x2 complex matrix det(M) = m00m11 - m01m10

    matrix2x2_eigenvalues

    fn matrix2x2_eigenvalues(m : Matrix2x2) -> (Complex, Complex)

    Compute 2x2 Complex Matrix Eigenvalues (lambda1, lambda2) via characteristic equation

    matrix2x2_exp

    fn matrix2x2_exp(m : Matrix2x2, terms : Int) -> Matrix2x2

    Compute matrix exponential exp(M) for 2x2 matrix via Taylor series

    matrix2x2_frobenius_norm

    fn matrix2x2_frobenius_norm(m : Matrix2x2) -> Double

    Compute 2x2 complex matrix norm (Frobenius norm)

    matrix2x2_inv

    fn matrix2x2_inv(m : Matrix2x2) -> Matrix2x2

    Inverse of 2x2 complex matrix

    matrix2x2_power

    fn matrix2x2_power(m : Matrix2x2, power : Int) -> Matrix2x2

    Compute 2x2 matrix integer power M^k

    matrix2x2_trace

    fn matrix2x2_trace(m : Matrix2x2) -> Complex

    Compute trace of 2x2 matrix

    mul_complex_arrays

    fn mul_complex_arrays(a : Array[Complex], b : Array[Complex]) -> Array[Complex]

    mul_matrix2x2

    fn mul_matrix2x2(a : Matrix2x2, b : Matrix2x2) -> Matrix2x2

    Matrix multiplication of two 2x2 Jones matrices

    normalize_3d

    fn normalize_3d(v : Vector3D) -> Vector3D

    Normalize 3D vector to unit length

    omega_to_wavelength

    fn omega_to_wavelength(omega : Double) -> Double

    Convert angular frequency to wavelength in meters

    resample_grid

    fn resample_grid(x_old : Array[Double], y_old : Array[Double], x_new : Array[Double]) -> Array[Double]

    Resample array y defined on grid x onto a new target grid x_new

    scale_complex_array

    fn scale_complex_array(arr : Array[Complex], factor : Double) -> Unit

    solve_tridiagonal_sys

    fn solve_tridiagonal_sys(a : Array[Double], b : Array[Double], c : Array[Double], d : Array[Double]) -> Array[Double]

    Thomas algorithm (Tridiagonal Matrix Algorithm - TDMA) for solving A * x = d

    sub_complex_arrays

    fn sub_complex_arrays(a : Array[Complex], b : Array[Complex]) -> Array[Complex]

    tensor3d_frobenius_norm

    fn tensor3d_frobenius_norm(t : Tensor3D) -> Double

    Compute 3D tensor Frobenius norm

    tensor3d_inner_product

    fn tensor3d_inner_product(a : Tensor3D, b : Tensor3D) -> Complex

    Compute 3D tensor inner product sum(A_ijk * B_ijk)

    trapz_complex_power

    fn trapz_complex_power(field : Array[Complex], dt : Double) -> Double

    trapz_double

    fn trapz_double(y : Array[Double], dx : Double) -> Double

    unwrap_phase

    fn unwrap_phase(phase : Array[Double]) -> Array[Double]

    Unwrap phase array to eliminate 2*pi phase discontinuities

    watts_to_dbm

    fn watts_to_dbm(power_w : Double) -> Double

    Convert power in Watts to dBm (decibel-milliwatts)

    wavelength_to_omega

    fn wavelength_to_omega(wavelength : Double) -> Double

    Convert wavelength in meters to angular frequency omega0 (rad/s)

    zeros_complex

    fn zeros_complex(size : Int) -> Array[Complex]

    zeros_double

    fn zeros_double(size : Int) -> Array[Double]