From 293655b31e3255f6b3926fb5c6330d72fa63d42e Mon Sep 17 00:00:00 2001 From: Michael Kefeder Date: Fri, 5 May 2023 14:17:00 +0200 Subject: [PATCH 1/3] use platform dependent c_char instead of hardcoded i8 --- lax/Cargo.toml | 1 + lax/src/flags.rs | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lax/Cargo.toml b/lax/Cargo.toml index 2f095ea8..f8813329 100644 --- a/lax/Cargo.toml +++ b/lax/Cargo.toml @@ -34,6 +34,7 @@ cauchy = "0.4.0" num-traits = "0.2.14" lapack-sys = "0.14.0" katexit = "0.1.2" +libc = "0.2.142" [dependencies.intel-mkl-src] version = "0.8.1" diff --git a/lax/src/flags.rs b/lax/src/flags.rs index dd9dde3d..951cb2c5 100644 --- a/lax/src/flags.rs +++ b/lax/src/flags.rs @@ -17,8 +17,8 @@ impl UPLO { } /// To use Fortran LAPACK API in lapack-sys crate - pub fn as_ptr(&self) -> *const i8 { - self as *const UPLO as *const i8 + pub fn as_ptr(&self) -> *const libc::c_char { + self as *const UPLO as *const libc::c_char } } @@ -32,8 +32,8 @@ pub enum Transpose { 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 + pub fn as_ptr(&self) -> *const libc::c_char { + self as *const Transpose as *const libc::c_char } } @@ -55,8 +55,8 @@ impl NormType { } /// To use Fortran LAPACK API in lapack-sys crate - pub fn as_ptr(&self) -> *const i8 { - self as *const NormType as *const i8 + pub fn as_ptr(&self) -> *const libc::c_char { + self as *const NormType as *const libc::c_char } } @@ -87,8 +87,8 @@ impl JobEv { } /// To use Fortran LAPACK API in lapack-sys crate - pub fn as_ptr(&self) -> *const i8 { - self as *const JobEv as *const i8 + pub fn as_ptr(&self) -> *const libc::c_char { + self as *const JobEv as *const libc::c_char } } @@ -117,8 +117,8 @@ impl JobSvd { } } - pub fn as_ptr(&self) -> *const i8 { - self as *const JobSvd as *const i8 + pub fn as_ptr(&self) -> *const libc::c_char { + self as *const JobSvd as *const libc::c_char } } @@ -133,7 +133,7 @@ pub enum Diag { } impl Diag { - pub fn as_ptr(&self) -> *const i8 { - self as *const Diag as *const i8 + pub fn as_ptr(&self) -> *const libc::c_char { + self as *const Diag as *const libc::c_char } } From cef6aa5e95d8d595e546fe82d09e83d1e1861f5a Mon Sep 17 00:00:00 2001 From: Michael Kefeder Date: Tue, 12 Mar 2024 09:08:18 +0100 Subject: [PATCH 2/3] remove dependency on libc --- lax/Cargo.toml | 1 - lax/src/flags.rs | 25 +++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lax/Cargo.toml b/lax/Cargo.toml index f8813329..2f095ea8 100644 --- a/lax/Cargo.toml +++ b/lax/Cargo.toml @@ -34,7 +34,6 @@ cauchy = "0.4.0" num-traits = "0.2.14" lapack-sys = "0.14.0" katexit = "0.1.2" -libc = "0.2.142" [dependencies.intel-mkl-src] version = "0.8.1" diff --git a/lax/src/flags.rs b/lax/src/flags.rs index 951cb2c5..60364d5e 100644 --- a/lax/src/flags.rs +++ b/lax/src/flags.rs @@ -1,4 +1,5 @@ //! Charactor flags, e.g. `'T'`, used in LAPACK API +use std::ffi::c_char; /// Upper/Lower specification for seveal usages #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -17,8 +18,8 @@ impl UPLO { } /// To use Fortran LAPACK API in lapack-sys crate - pub fn as_ptr(&self) -> *const libc::c_char { - self as *const UPLO as *const libc::c_char + pub fn as_ptr(&self) -> *const c_char { + self as *const UPLO as *const c_char } } @@ -32,8 +33,8 @@ pub enum Transpose { impl Transpose { /// To use Fortran LAPACK API in lapack-sys crate - pub fn as_ptr(&self) -> *const libc::c_char { - self as *const Transpose as *const libc::c_char + pub fn as_ptr(&self) -> *const c_char { + self as *const Transpose as *const c_char } } @@ -55,8 +56,8 @@ impl NormType { } /// To use Fortran LAPACK API in lapack-sys crate - pub fn as_ptr(&self) -> *const libc::c_char { - self as *const NormType as *const libc::c_char + pub fn as_ptr(&self) -> *const c_char { + self as *const NormType as *const c_char } } @@ -87,8 +88,8 @@ impl JobEv { } /// To use Fortran LAPACK API in lapack-sys crate - pub fn as_ptr(&self) -> *const libc::c_char { - self as *const JobEv as *const libc::c_char + pub fn as_ptr(&self) -> *const c_char { + self as *const JobEv as *const c_char } } @@ -117,8 +118,8 @@ impl JobSvd { } } - pub fn as_ptr(&self) -> *const libc::c_char { - self as *const JobSvd as *const libc::c_char + pub fn as_ptr(&self) -> *const c_char { + self as *const JobSvd as *const c_char } } @@ -133,7 +134,7 @@ pub enum Diag { } impl Diag { - pub fn as_ptr(&self) -> *const libc::c_char { - self as *const Diag as *const libc::c_char + pub fn as_ptr(&self) -> *const c_char { + self as *const Diag as *const c_char } } From 7213ae839d533c8c25dadf90c0a70034248dfbee Mon Sep 17 00:00:00 2001 From: Michael Kefeder Date: Mon, 11 Nov 2024 18:45:25 +0100 Subject: [PATCH 3/3] use core instead of std --- lax/src/flags.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lax/src/flags.rs b/lax/src/flags.rs index 60364d5e..f9dea20d 100644 --- a/lax/src/flags.rs +++ b/lax/src/flags.rs @@ -1,5 +1,5 @@ //! Charactor flags, e.g. `'T'`, used in LAPACK API -use std::ffi::c_char; +use core::ffi::c_char; /// Upper/Lower specification for seveal usages #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]