@@ -3,7 +3,7 @@ extern crate libc;
33use array:: Array ;
44use defines:: { AfError , ConvDomain , ConvMode , InterpType } ;
55use error:: HANDLE_ERROR ;
6- use self :: libc:: { uint8_t, c_int, c_float, c_double, c_longlong} ;
6+ use self :: libc:: { uint8_t, c_int, c_float, c_double, c_longlong, size_t } ;
77
88type MutAfArray = * mut self :: libc:: c_longlong ;
99type AfArray = self :: libc:: c_longlong ;
@@ -16,6 +16,8 @@ extern {
1616 fn af_approx2 ( out : MutAfArray , inp : AfArray , pos0 : AfArray , pos1 : AfArray ,
1717 method : c_int , off_grid : c_float ) -> c_int ;
1818
19+ fn af_set_fft_plan_cache_size ( cache_size : size_t ) -> c_int ;
20+
1921 fn af_fft ( out : MutAfArray , arr : AfArray ,
2022 nfac : c_double , odim0 : c_longlong ) -> c_int ;
2123
@@ -115,6 +117,18 @@ pub fn approx2(input: &Array, pos0: &Array, pos1: &Array,
115117 }
116118}
117119
120+ /// Set fft plan cache size
121+ ///
122+ /// Though this is a low overhead function, it is advised not to change
123+ /// the fft plan cache size a mid program execution unless that is what
124+ /// you intend to do.
125+ pub fn set_fft_plan_cache_size ( cache_size : usize ) {
126+ unsafe {
127+ let err_val = af_set_fft_plan_cache_size ( cache_size as size_t ) ;
128+ HANDLE_ERROR ( AfError :: from ( err_val) ) ;
129+ }
130+ }
131+
118132/// Fast fourier transform for 1d signals
119133///
120134/// # Parameters
0 commit comments