IFFTSample.java
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  @author koga
17  @version $Revision: 1.15 $, 2004/05/07
18  */
19 public class IFFTSample {
20 
21   /**
22    * メインメソッド
23    
24    @param args コマンドライン引数
25    */
26   @SuppressWarnings("nls")
27   public static void main(String[] args) {
28     DoubleMatrix x = new DoubleMatrix(new double[] {548, -82000}).transpose();
29     DoubleComplexMatrix xx = x.fft();
30     DoubleComplexMatrix x2 = (DoubleComplexMatrix)xx.ifft();
31     DoubleComplexMatrix x3 = (DoubleComplexMatrix)x2.roundToZeroElementWise(DoubleNumberUtil.EPS * ((DoubleNumber)x2.frobNorm()).doubleValue());
32     x3.print("ifft(fft(x))");
33   }
34 }