1use core::ffi::c_char;
3
4#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
6#[repr(u8)]
7pub enum UPLO {
8 Upper = b'U',
9 Lower = b'L',
10}
11
12impl UPLO {
13 pub fn t(self) -> Self {
14 match self {
15 UPLO::Upper => UPLO::Lower,
16 UPLO::Lower => UPLO::Upper,
17 }
18 }
19
20 pub fn as_ptr(&self) -> *const c_char {
22 self as *const UPLO as *const c_char
23 }
24}
25
26#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
27#[repr(u8)]
28pub enum Transpose {
29 No = b'N',
30 Transpose = b'T',
31 Hermite = b'C',
32}
33
34impl Transpose {
35 pub fn as_ptr(&self) -> *const c_char {
37 self as *const Transpose as *const c_char
38 }
39}
40
41#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
42#[repr(u8)]
43pub enum NormType {
44 One = b'O',
45 Infinity = b'I',
46 Frobenius = b'F',
47}
48
49impl NormType {
50 pub fn transpose(self) -> Self {
51 match self {
52 NormType::One => NormType::Infinity,
53 NormType::Infinity => NormType::One,
54 NormType::Frobenius => NormType::Frobenius,
55 }
56 }
57
58 pub fn as_ptr(&self) -> *const c_char {
60 self as *const NormType as *const c_char
61 }
62}
63
64#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
66#[repr(u8)]
67pub enum JobEv {
68 All = b'V',
70 None = b'N',
72}
73
74impl JobEv {
75 pub fn is_calc(&self) -> bool {
76 match self {
77 JobEv::All => true,
78 JobEv::None => false,
79 }
80 }
81
82 pub fn then<T, F: FnOnce() -> T>(&self, f: F) -> Option<T> {
83 if self.is_calc() {
84 Some(f())
85 } else {
86 None
87 }
88 }
89
90 pub fn as_ptr(&self) -> *const c_char {
92 self as *const JobEv as *const c_char
93 }
94}
95
96#[cfg_attr(doc, katexit::katexit)]
101#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
102#[repr(u8)]
103pub enum JobSvd {
104 All = b'A',
106 Some = b'S',
108 None = b'N',
110}
111
112impl JobSvd {
113 pub fn from_bool(calc_uv: bool) -> Self {
114 if calc_uv {
115 JobSvd::All
116 } else {
117 JobSvd::None
118 }
119 }
120
121 pub fn as_ptr(&self) -> *const c_char {
122 self as *const JobSvd as *const c_char
123 }
124}
125
126#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
128#[repr(u8)]
129pub enum Diag {
130 Unit = b'U',
132 NonUnit = b'N',
134}
135
136impl Diag {
137 pub fn as_ptr(&self) -> *const c_char {
138 self as *const Diag as *const c_char
139 }
140}