Skip to content

Commit

Permalink
Add as_ptr for primitive enums
Browse files Browse the repository at this point in the history
  • Loading branch information
termoshtt committed Aug 31, 2022
1 parent ce962f1 commit 328abd3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lax/src/lib.rs
Expand Up @@ -141,6 +141,11 @@ impl UPLO {
UPLO::Lower => UPLO::Upper,
}
}

/// To use Fortran LAPACK API in lapack-sys crate
pub fn as_ptr(&self) -> *const i8 {
self as *const UPLO as *const i8
}
}

#[derive(Debug, Clone, Copy)]
Expand All @@ -151,6 +156,13 @@ pub enum Transpose {
Hermite = b'C',
}

impl Transpose {
/// To use Fortran LAPACK API in lapack-sys crate
pub fn as_ptr(&self) -> *const i8 {
self as *const Transpose as *const i8
}
}

#[derive(Debug, Clone, Copy)]
#[repr(u8)]
pub enum NormType {
Expand All @@ -167,6 +179,11 @@ impl NormType {
NormType::Frobenius => NormType::Frobenius,
}
}

/// To use Fortran LAPACK API in lapack-sys crate
pub fn as_ptr(&self) -> *const i8 {
self as *const NormType as *const i8
}
}

/// Create a vector without initialization
Expand Down

0 comments on commit 328abd3

Please sign in to comment.