File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -126,6 +126,31 @@ impl Lapack for f64 {}
126126impl Lapack for c32 { }
127127impl Lapack for c64 { }
128128
129+ /// Helper for getting pointer of slice
130+ pub ( crate ) trait AsPtr : Sized {
131+ type Elem ;
132+ fn as_ptr ( vec : & [ Self ] ) -> * const Self :: Elem ;
133+ fn as_mut_ptr ( vec : & mut [ Self ] ) -> * mut Self :: Elem ;
134+ }
135+
136+ macro_rules! impl_as_ptr {
137+ ( $target: ty, $elem: ty) => {
138+ impl AsPtr for $target {
139+ type Elem = $elem;
140+ fn as_ptr( vec: & [ Self ] ) -> * const Self :: Elem {
141+ vec. as_ptr( ) as * const _
142+ }
143+ fn as_mut_ptr( vec: & mut [ Self ] ) -> * mut Self :: Elem {
144+ vec. as_mut_ptr( ) as * mut _
145+ }
146+ }
147+ } ;
148+ }
149+ impl_as_ptr ! ( f32 , f32 ) ;
150+ impl_as_ptr ! ( f64 , f64 ) ;
151+ impl_as_ptr ! ( c32, lapack_sys:: __BindgenComplex<f32 >) ;
152+ impl_as_ptr ! ( c64, lapack_sys:: __BindgenComplex<f64 >) ;
153+
129154/// Upper/Lower specification for seveal usages
130155#[ derive( Debug , Clone , Copy ) ]
131156#[ repr( u8 ) ]
You can’t perform that action at this time.
0 commit comments