fftw

Poisson equation using FFTW with rectanguar domain

天大地大妈咪最大 提交于 2019-12-08 19:15:40
I am trying to solve Poisson equation by using FFTW library with rectangular domain(-4<=x<=4 and -2<=y<=2). I have correct result if domain is square and it is wrong if domain is rectangular. Please give me some suggestion. Thank you so much. Here is my code. #include <stdio.h> #include <math.h> #include <cmath> #include <fftw3.h> #include <iostream> #include <vector> using namespace std; int main() { int N1=64; int N2=32; double pi = 3.141592653589793; double L1 = 8.0; double dx = L1/(double)(N1-1); double L2= 4.0; double dy=L2/(double)(N2-1); std::vector<double> in1(N1*N2,0.0); std::vector

FFTW fftwf_plan_r2r_2d() with FFTW_REDFT01 equivalent

别来无恙 提交于 2019-12-08 11:52:29
问题 I am trying to port code that uses FFTW to use KissFFT. The code uses fftwf_plan_r2r_2d() with FFTW_REDFT01. What would be the equivalent call in KissFFT? If this call (with FFTW_REDFT01 ) is equivalent to a DCT, could I just use a direct DCT transform instead, e.g. such as OpenCV cv::dct? Is there some input data modification I'd need to do, like reflections and symmetrizations? 回答1: Answering my own question... With the help of these two references, I ended up not using DFT at all, but

High Pass Filter using FFTW in C

不羁的心 提交于 2019-12-08 07:42:29
问题 I have a question regarding FFT. I already manage to do FFT forward and backward using FFTW in C. Now, I want to apply high pass filter for edge detection, some of my source said that just zeroing the centre of the magnitude. This is my input image http://i62.tinypic.com/2wnxvfl.jpg Basically what I do are : Forward FFT Convert the output to 2D array Do forward FFT shifting Make the real and imag value to 0 when the distance from the centre is 25% of the height Generate the magnitude Do

Poisson equation using FFTW with rectanguar domain

北城余情 提交于 2019-12-08 06:54:53
问题 I am trying to solve Poisson equation by using FFTW library with rectangular domain(-4<=x<=4 and -2<=y<=2). I have correct result if domain is square and it is wrong if domain is rectangular. Please give me some suggestion. Thank you so much. Here is my code. #include <stdio.h> #include <math.h> #include <cmath> #include <fftw3.h> #include <iostream> #include <vector> using namespace std; int main() { int N1=64; int N2=32; double pi = 3.141592653589793; double L1 = 8.0; double dx = L1/(double

Computing the discrete fourier transform of audio data with FFTW

穿精又带淫゛_ 提交于 2019-12-08 04:32:07
问题 I am quite new to signal processing so forgive me if I rant on a bit. I have download and installed FFTW for windows. The documentation is ok but I still have queries. My overall aim is to capture raw audio data sampled at 44100 samps/sec from the sound card on the computer (this task is already implemented using libraries and my code), and then perform the DFT on blocks of this audio data. I am only interested in finding a range of frequency components in the audio and I will not be

running FFTW on GPU vs using CUFFT

心已入冬 提交于 2019-12-08 02:51:35
问题 I have a basic C++ FFTW implementation that looks like this: for (int i = 0; i < N; i++){ // declare pointers and plan fftw_complex *in, *out; fftw_plan p; // allocate in = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N); out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * N); // initialize "in" ... // create plan p = fftw_plan_dft_1d(N, in, out, FFTW_FORWARD, FFTW_ESTIMATE); // execute plan fftw_execute(p); // clean up fftw_destroy_plan(p); fftw_free(in); fftw_free(out); } I'm

Thread IDs with PPL and Parallel Memory Allocation

落爺英雄遲暮 提交于 2019-12-07 09:30:20
问题 I have a question about the Microsoft PPL library, and parallel programming in general. I am using FFTW to perform a large set (100,000) of 64 x 64 x 64 FFTs and inverse FFTs. In my current implementation, I use a parallel for loop and allocate the storage arrays within the loop. I have noticed that my CPU usage only tops out at about 60-70% in these cases. (Note this is still better utilization than the built in threaded FFTs provided by FFTW which I have tested). Since I am using fftw

How to do inverse real to real FFT in FFTW library

久未见 提交于 2019-12-07 05:19:39
问题 I'm trying to do some filtering with FFT. I'm using r2r_1d plan and I have no idea how to do the inverse transform... void PerformFiltering(double* data, int n) { /* FFT */ double* spectrum = new double[n]; fftw_plan plan; plan = fftw_plan_r2r_1d(n, data, spectrum, FFTW_REDFT00, FFTW_ESTIMATE); fftw_execute(plan); // signal to spectrum fftw_destroy_plan(plan); /* some filtering here */ /* Inverse FFT */ plan = fftw_plan_r2r_1d(n, spectrum, data, FFTW_REDFT00, FFTW_ESTIMATE); fftw_execute(plan

How to compile the FFTW libraries with correct architecture?

◇◆丶佛笑我妖孽 提交于 2019-12-06 16:09:12
问题 I followed the script on Compiling fftw-3.3.4. But I am getting all the libraries of architecture x86_64. Thats why I cannot lipo them. ( libfftw3f_armv7.a, libfftw3f_x86_64.a, libfftw3f_arm64.a, libfftw3f_i386.a) So any idea how to update this script to get the correct architecture? P.s., by config. : ./configure --host=arm-apple-darwin --target=arm-apple-darwin --enable-float --enable-neon I am getting the error : configure: error: Need a version of gcc with -mfpu=neon So I just delete -

Undefine symbols for architecture x86_64 using FFTW

我是研究僧i 提交于 2019-12-06 14:11:28
问题 Ceeloss-MacBook-Pro:desktop ceelos$ gcc -o prog -I/usr/local/include test.c Undefined symbols for architecture x86_64: "_fftw_destroy_plan", referenced from: _main in test-IBqBdS.o "_fftw_execute", referenced from: _main in test-IBqBdS.o "_fftw_plan_dft_1d", referenced from: _main in test-IBqBdS.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Ceeloss-MacBook-Pro:desktop ceelos$ What's this telling me? 回答1: It's