fftw

fftw/c++ computes fft wrong, compared to matlab

末鹿安然 提交于 2019-12-06 10:31:35
I am trying fftw with c++. I want to test that it works correct. I implemented a simple ifft(fft(shift(data)) - data == 0 test, that fails completely. The testdata is a rect function, with amplitude and phase 1. The matlab code for comparison works perfectly with the same test. The basic question is: what am I doing wrong? Here the matlab code (which is also using fftw...) FFTW dll/.h is latest. data = zeros(1, 64); halfsize = numel(data)/2; data(halfsize-10:halfsize+10) = 1; phase = ones(size(data)); data = data.*exp(phase*sqrt(-1)); Ft = fft(fftshift(data)); In C++ the code is (not complete)

Compiling FFTW3 for IOS 5.1 on OSX 10.7

扶醉桌前 提交于 2019-12-06 04:21:03
问题 A similar version of this question has been asked before (how to compile fftw3 on iOS) about previous versions of IOS and/or OSX, but I am unable to get fftw3 working on a actual IOS device. (Though it works fine in the simulator using the MacPorts "universal" distribution). If anyone has had any success using fftw3 please let me know how you were able to get it working! I am using OSX 10.7 and am trying specifically to run fftw on an iPad3 with IOS 5.1 installed. Thanks. 来源: https:/

Integrating fftw C function calls inside system verilog code

北战南征 提交于 2019-12-06 04:06:18
I have installed fftw C library succefully on my linux system. Here is more info about fftw c => http://www.fftw.org/ I have a sample C code which can call fftw C functions successfully. Below is a C ccode and command to run the C code: Code: #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <math.h> #include <fftw3.h> int main(void) { double FFT_in[] = {0.1, 0.6, 0.1, 0.4, 0.5, 0, 0.8, 0.7, 0.8, 0.6, 0.1,0}; double *IFFT_out; int i,size = 12; fftw_complex *middle; fftw_plan fft; fftw_plan ifft; middle = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*size); IFFT_out =

Where to center the kernel when using FFTW for image convolution?

て烟熏妆下的殇ゞ 提交于 2019-12-06 01:00:35
问题 I am trying to use FFTW for image convolution. At first just to test if the system is working properly, I performed the fft, then the inverse fft, and could get the exact same image returned. Then a small step forward, I used the identity kernel(i.e., kernel[0][0] = 1 whereas all the other components equal 0). I took the component-wise product between the image and kernel(both in the frequency domain), then did the inverse fft. Theoretically I should be able to get the identical image back.

AudioRecord : How can I use a common buffer to use it for processing and storing?

此生再无相见时 提交于 2019-12-05 20:17:44
I have an AudioRecord thread that writes to database. Now I want to use some audio data in buffer at some intervals and process it using FFT . I want to send audio buffer to FFT as parameter. When I am trying to use a common buffer then its giving me libc error. How can I use a common buffer to pass it to FFT and also write it to a storage? When I tried using different read calls there was situation of data loss and hence cant use that. Following is my code public void start() { startRecording(); _isRecording = true; _recordingThread = new Thread(new Runnable() { public void run() {

fftw c2c: missing symmetry in transformed real data

故事扮演 提交于 2019-12-05 18:26:05
recently I faced some problems concerning the use of fftw and it's c2c transformation (see: 3d c2c fft with fftw library ). As I located my problems in the use of the fftw lib I created a new Question in order to discus this situation in a more concrete way. Since I am doing a complex to complex transform with real data my transformed data in fourier space is supposed to be symmetric: F[n] = con(F[N-n]) Now I did some transformations with small blocks of test-data to check the transformed data for this symmetry. For 1D transform at every things worked as expected, but for higher dimensions I

Thread IDs with PPL and Parallel Memory Allocation

♀尐吖头ヾ 提交于 2019-12-05 17:01:23
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_malloc, is it possible that excessive locking is occurring which is preventing full usage? In light of this,

Linking FFTW into an Android NDK application

不想你离开。 提交于 2019-12-05 09:07:24
I am currently writing a genre classification application as my final year project in Computer Engineering. I initially wrote the feature extraction code (implementing FFTW) in C and now I need to implement it on Android via the NDK. This is my first NDK project so I'm still getting the hang of things but I have compiled the FFTW3 library for Android according to this guide . I didn't do the very last step because I didn't think it was right for what I need. My question is how do I, after the compile step, use the library in the main NDK application that calls on it? Do I everything normally

How to do inverse real to real FFT in FFTW library

别等时光非礼了梦想. 提交于 2019-12-05 08:24:15
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); // spectrum to signal (inverse FFT) fftw_destroy_plan(plan); } Am I doing all the things right? I'm

FFTW: Inverse of forward fft not equal to original function

妖精的绣舞 提交于 2019-12-05 03:21:31
问题 I'm trying to use FFTW to compute fast summations, and I've run into an issue: int numFreq3 = numFreq*numFreq*numFreq; FFTW_complex* dummy_sq_fft = (FFTW_complex*)FFTW_malloc( sizeof(FFTW_complex)*numFreq3 ); FFTW_complex* dummy_sq = (FFTW_complex*)FFTW_malloc( sizeof(FFTW_complex)*numFreq3 ); FFTW_complex* orig = (FFTW_complex*)FFTW_malloc( sizeof(FFTW_complex)*numFreq3 ); FFTW_plan dummyPlan = FFTW_plan_dft_3d( numFreq, numFreq, numFreq, orig, dummy_sq_fft, FFTW_FORWARD, FFTW_MEASURE );