Trait lax::solve::SolveImpl

source ·
pub trait SolveImpl: Scalar {
    // Required method
    fn solve(
        l: MatrixLayout,
        t: Transpose,
        a: &[Self],
        p: &Pivot,
        b: &mut [Self],
    ) -> Result<()>;
}
Expand description

Helper trait to abstract *getrs LAPACK routines for implementing Lapack::solve

If the array has C layout, then it needs to be handled specially, since LAPACK expects a Fortran-layout array. Reinterpreting a C layout array as Fortran layout is equivalent to transposing it. So, we can handle the “no transpose” and “transpose” cases by swapping to “transpose” or “no transpose”, respectively. For the “Hermite” case, we can take advantage of the following:

$$ \begin{align*} A^H x &= b \\ \Leftrightarrow \overline{A^T} x &= b \\ \Leftrightarrow \overline{\overline{A^T} x} &= \overline{b} \\ \Leftrightarrow \overline{\overline{A^T}} \overline{x} &= \overline{b} \\ \Leftrightarrow A^T \overline{x} &= \overline{b} \end{align*} $$

So, we can handle this case by switching to “no transpose” (which is equivalent to transposing the array since it will be reinterpreted as Fortran layout) and applying the elementwise conjugate to x and b.

Required Methods§

source

fn solve( l: MatrixLayout, t: Transpose, a: &[Self], p: &Pivot, b: &mut [Self], ) -> Result<()>

§LAPACK correspondance
f32f64c32c64
sgetrsdgetrscgetrszgetrs

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl SolveImpl for f32

source§

fn solve( l: MatrixLayout, t: Transpose, a: &[Self], ipiv: &Pivot, b: &mut [Self], ) -> Result<()>

source§

impl SolveImpl for f64

source§

fn solve( l: MatrixLayout, t: Transpose, a: &[Self], ipiv: &Pivot, b: &mut [Self], ) -> Result<()>

source§

impl SolveImpl for c32

source§

fn solve( l: MatrixLayout, t: Transpose, a: &[Self], ipiv: &Pivot, b: &mut [Self], ) -> Result<()>

source§

impl SolveImpl for c64

source§

fn solve( l: MatrixLayout, t: Transpose, a: &[Self], ipiv: &Pivot, b: &mut [Self], ) -> Result<()>

Implementors§