Method

NumCosmoMathSBesselOdeOperatorsolve

Declaration [src]

void
ncm_sbessel_ode_operator_solve (
  NcmSBesselOdeOperator* op,
  GArray* rhs,
  GArray** solution,
  gsize* solution_len
)

Description [src]

Solves the ODE using adaptive QR decomposition with ultraspherical spectral methods. The algorithm grows the matrix size until convergence is achieved (error < tolerance).

For operators with a single ell value, the solution array has length solution_len. For operators with multiple ell values (n_ell), the solution array has length solution_len * n_ell, with solutions stored contiguously: first solution at indices [0, solution_len), second at [solution_len, 2*solution_len), etc.

The solution parameter supports two usage patterns:

  • Python/convenience usage: Pass solution pointing to NULL (*solution == NULL). A new GArray will be allocated and returned. The (out callee-allocates) annotation ensures Python bindings automatically use this mode.

  • C optimization: Pass solution pointing to a pre-allocated GArray (*solution != NULL). The existing array will be reused (cleared and refilled), avoiding repeated allocation/deallocation in performance-critical loops.

Parameters

rhs

Type: An array of double

Right-hand side vector (Chebyshev coefficients of f(x)).

The data is owned by the caller of the method.
solution

Type: An array of double

Solution vector (Chebyshev coefficients).

The argument will be set by the function.
The caller of the method takes ownership of the returned data, and is responsible for freeing it.
solution_len

Type: gsize*

Length of solution per ell value.

The argument will be set by the function.