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
.