functions
Usefull calculation functions.
The functions in this module are supposed to be used in various other modules. They can be called by
the prefix tunax.functions. or directly by tunax..
- tridiag_solve(a, b, c, f)[source]
Solve a trigiagonal problem.
The tridiagonal problem can be written \(\mathbb MX = F\) where \(\mathbb M = \begin{pmatrix} b_1 & c_1 & & \\ a_2 & \ddots & \ddots & \\ & \ddots & \ddots & c_{n-1} \\ & & a_n & b_n \end{pmatrix}\) and \(F = \begin{pmatrix} f_1 \\ \vdots \\ f_n \end{pmatrix}\). The problem is solved by recurrence using
jax.lax.scan- Parameters:
a (float
Arrayof shape (n)) – Left diagonal of \(\mathbb M\), the first element is not used.b (float
Arrayof shape (n)) – Middle diagonal of \(\mathbb M\).c (float
Arrayof shape (n)) – Right diagonal of \(\mathbb M\), the last element is not used.f (float
Arrayof shape (n)) – Right hand of the equation \(F\).
- Returns:
x – Solution \(X\) of tridiagonal problem.
- Return type:
float
Arrayof shape (n)