⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fft2.cpp

📁 c++的数学物理方程数值算法源程序。这是"Numerical Methods for Physics"第二版的源程序。
💻 CPP
字号:
#include "NumMeth.h"void fft( Matrix& RealA, Matrix& ImagA);void fft2( Matrix& RealA, Matrix& ImagA) {// Routine to compute two dimensional Fourier transform // using FFT algorithm// Inputs//    RealA, ImagA         Real and imaginary parts of data array// Outputs//    RealA, ImagA         Real and imaginary parts of transform  int i, j, N = RealA.nRow();  Matrix RealT(N), ImagT(N);  // Temporary work vector
  //* Loop over the columns of the matrix  for( j=1; j<=N; j++ ) {
	//* Copy out a column into a vector    for( i=1; i<=N; i++ ) {      RealT(i) = RealA(i,j);        ImagT(i) = ImagA(i,j);    }
	//* Take FFT of the vector    fft(RealT,ImagT);         
	//* Copy the transformed vector back into the column    for( i=1; i<=N; i++ ) {      RealA(i,j) = RealT(i);       ImagA(i,j) = ImagT(i);    }  }  //* Loop over the rows of the matrix
  for( i=1; i<=N; i++ ) {	//* Copy out a row into a vector
    for( j=1; j<=N; j++ ) {      RealT(j) = RealA(i,j);        ImagT(j) = ImagA(i,j);    }	//* Take FFT of the vector
    fft(RealT,ImagT);         	//* Copy the transformed vector back into the row
    for( j=1; j<=N; j++ ) {      RealA(i,j) = RealT(j);        ImagA(i,j) = ImagT(j);    }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -