-
| Hello, extern crate arrayfire as af;
use af::*;
fn main() {
    let num_rows: u64 = 4;
    let num_cols: u64 = 1;
    let dims = Dim4::new(&[num_rows, num_cols, 1, 1]);
    let dims1 = Dim4::new(&[1, 1, 1, 1]);
    set_backend(Backend::AF_BACKEND_CPU);
    let a = iota(dims, dims1, Aftype::F32).unwrap();
    println!("a:");
    print(&a);
    let b = fft(&a, 1.0, num_rows as i64).unwrap();
    println!("b:");
    print(&b);
    let c = ifft(&b, 1.0, num_rows as i64).unwrap();
    println!("c:");
    print(&c);
}I get the following:      Running `target/debug/af_fft`                                                                         
a:                                                                                                         
No Name Array                                                                                              
[4 1 1 1]                                                                                                  
    0.0000                                                                                                 
    1.0000                                                                                                 
    2.0000                                                                                                 
    3.0000                                                                                                 
b:
No Name Array
[4 1 1 1]
(6.0000,0.0000)
(-2.0000,2.0000)
(-2.0000,0.0000)
(-2.0000,-2.0000)
c:
No Name Array
[4 1 1 1]
(0.0000,0.0000)
(4.0000,0.0000)
(8.0000,0.0000)
(12.0000,0.0000)That is instead of the original  julia> a = [1, 2, 3, 4]
4-element Array{Int64,1}:
 1
 2
 3
 4
julia> b = fft(a)
4-element Array{Complex{Float64},1}:
 10.0+0.0im
 -2.0+2.0im
 -2.0+0.0im
 -2.0-2.0im
julia> c = ifft(b)
4-element Array{Complex{Float64},1}:
 1.0+0.0im
 2.0+0.0im
 3.0+0.0im
 4.0+0.0imThanks! | 
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
| @alsam As of now, the second parameter in those functions  In this situation (1D Array), norm_factor would be number of elements in the Array i.e. 4. | 
Beta Was this translation helpful? Give feedback.
-
| Thanks @9prady9 for clarification. | 
Beta Was this translation helpful? Give feedback.
-
| Sure, we can add examples. I have created a issue for this. You can follow the progress over here. You may close this issue if all your questions are answered. Thank you for the feedback. | 
Beta Was this translation helpful? Give feedback.
-
| Great, thanks! | 
Beta Was this translation helpful? Give feedback.
-
| Closing as the question answered. | 
Beta Was this translation helpful? Give feedback.
@alsam As of now, the second parameter in those functions
norm_factorshould be used by caller for scaling/normalizing the Arrays. Hence, the output is appearing to be like what it is now.In this situation (1D Array), norm_factor would be number of elements in the Array i.e. 4.