Compute fft with Armadillo using FFTW3 bib

106 Views Asked by At

I want to compute fft with armadillo, to improve performance, I have activated the use of the FFTW3 bib.

Here is the code:

#define ARMA_USE_FFTW3
#include <armadillo>

int main()
{
    arma::vec X(100, arma::fill::randu);

    arma::cx_vec Y = arma::fft(X, 128);

    return 0;
}

Error:

Error LNK2019 unresolved external symbol fftwf_destroy_plan referenced in function void arma::fftw3::destroy_plan.

I did linked the armadillo bib and FFTW3 successfully. separately armadillo and fftw3 compile successfully.

I'm using :

  • armadillo 12.4.1
  • fftw 3.3.10
  • c++20
  • project cmake
  • Visual Studio

cmakelist.txt

set(INC_DIR D:/fftw-3.3.10.tar/fftw-3.3.10/fftw-3.3.10/api/)
set(LINK_DIR D:/fftw-3.3.10.tar/fftw-3.3.10/fftw-3.3.10/build/Release/)
include_directories(${INC_DIR})  
link_directories(${LINK_DIR})
link_libraries(fftw3)

# include armandilo
set(INC_DIR_arma D:/EndusV3/code/libExtern/armadillo-12.4.1/include)
set(LINK_DIR_arma D:/EndusV3/code/libExtern/armadillo-12.4.1/lib_win64)
include_directories(${INC_DIR_arma})  
link_directories(${LINK_DIR_arma})
link_libraries(libopenblas)

Thanks for considering my request.

I tried to compile armadillo and fftw3 separately, and its compile successfully.

I think there is an incompatibility in versions between armadillo and fftw3.

1

There are 1 best solutions below

0
Azar On

I managed to fix the link error. I found the solution in the fftw3 site. : http://www.fftw.org/install/windows.html

The problem was that there was libs missing (float and double precision version of fftw3).