nalgebra_lapack/
lapack_terminology.rs

1/// Indicates the side from which a matrix multiplication is to be performed.
2#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
3pub enum Side {
4    /// Perform multiplication from the left.
5    Left,
6    /// Perform multiplication from the right.
7    Right,
8}
9
10/// Indicates whether or not to transpose a matrix during a matrix
11/// operation.
12// @note(geo-ant) once we add complex, we can refactor this
13// to conjugate transpose (or hermitian transpose).
14#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
15pub enum Transposition {
16    /// Don't transpose, i.e. leave the matrix as is.
17    No,
18    /// Transpose the matrix.
19    Transpose,
20}
21
22/// Describes the type of a triangular matrix.
23#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
24pub enum TriangularStructure {
25    /// Upper triangular.
26    Upper,
27    /// Lower triangular.
28    Lower,
29}
30
31/// Property of the diagonal of a triangular matrix.
32#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
33pub enum DiagonalKind {
34    /// Diagonal entries all have value of 1.
35    Unit,
36    /// Diagonal elements are arbitrary.
37    NonUnit,
38}
39
40impl Side {
41    pub(crate) fn into_lapack_side_character(self) -> u8 {
42        match self {
43            Side::Left => b'L',
44            Side::Right => b'R',
45        }
46    }
47}
48
49impl TriangularStructure {
50    pub(crate) fn into_lapack_uplo_character(self) -> u8 {
51        match self {
52            Self::Upper => b'U',
53            Self::Lower => b'L',
54        }
55    }
56}
57
58impl DiagonalKind {
59    pub(crate) fn into_lapack_diag_character(self) -> u8 {
60        match self {
61            DiagonalKind::Unit => b'U',
62            DiagonalKind::NonUnit => b'N',
63        }
64    }
65}