01 /*
02 * $Id: IFFTSample.java,v 1.15 2008/02/02 03:29:45 koga Exp $
03 *
04 * Copyright (C) 2004 Koga Laboratory. All rights reserved.
05 *
06 */
07 package matxbook.chap20;
08
09 import org.mklab.nfc.matrix.DoubleComplexMatrix;
10 import org.mklab.nfc.matrix.DoubleMatrix;
11 import org.mklab.nfc.scalar.DoubleNumber;
12 import org.mklab.nfc.scalar.DoubleNumberUtil;
13
14
15 /**
16 * 高速逆フーリエ変換のサンプルです。
17 * @author koga
18 * @version $Revision: 1.15 $, 2004/05/07
19 */
20 public class IFFTSample {
21
22 /**
23 * メインメソッド
24 *
25 * @param args コマンドライン引数
26 */
27 @SuppressWarnings("nls")
28 public static void main(String[] args) {
29 DoubleMatrix x = new DoubleMatrix(new double[] {5, 4, 8, -8, 2, 0, 0, 0}).transpose();
30 DoubleComplexMatrix xx = x.fft();
31 DoubleComplexMatrix x2 = (DoubleComplexMatrix)xx.ifft();
32 DoubleComplexMatrix x3 = (DoubleComplexMatrix)x2.roundToZeroElementWise(DoubleNumberUtil.EPS * ((DoubleNumber)x2.frobNorm()).doubleValue());
33 x3.print("ifft(fft(x))");
34 }
35 }
|