Rodas5P

Contents

Rodas5P#

The linearly implicit method, for stiff systems, and modax.solve()’s default. Pass method=modax.Rodas5P(...) to set its options.

class modax.Rodas5P(lu_precision: Literal['fp32', 'fp64'] | None = None, gains: PIDGains | None = None, ordering: Literal['amd', 'natural'] | None = None, stage_loop: bool | None = None, fuse_stages: bool | None = None)[source]#

Bases: object

Rodas5P, the linearly implicit Rosenbrock-W method of order 5, for stiff systems.

Every step builds the Jacobian by forward-mode AD of the right-hand side and factorises the iteration matrix in the thread’s own memory.

Parameters:
  • lu_precision – "fp32" (the default) or "fp64", the precision of the iteration matrix’s factorisation. Single precision halves the LU’s footprint. As a W-method, Rodas5P stays convergent with an inexact matrix and the step controller absorbs the difference.

  • gains – The step controller’s PIDGains. The default is the integral controller (0, 1, 0).

  • ordering – The sparse LU’s fill-reducing permutation when modax.solve() has a sparsity pattern. "amd" (the default) or "natural", which keeps the pattern’s own order.

  • stage_loop – Step through the eight stages in a loop with one call of the right-hand side (True) instead of unrolling them, which inlines the right-hand side eight times (False, the default). For a long right-hand side over a small state, such as a chemical reaction network, the loop keeps the step within the instruction cache and halves its compile time. For a large state with a short right-hand side the unrolled stages run faster.

  • fuse_stages – Evaluate each unrolled stage’s right-hand side straight into the stage’s rows, every index a literal, instead of through a buffer (True). With every access to the stage vectors a literal, the compiler keeps them in registers and ptxas spills what it must, in place of arrays in local memory: ensembles of 128 large stiff systems ran 20 to 35 percent faster. The build takes a few seconds longer. Without sensitivities and stage_loop only.

Raises:

ValueError – If lu_precision or ordering is not one of the values above.