01 /*
02 * $Id: DataAnalysis.java,v 1.11 2008/02/02 03:06:26 koga Exp $
03 *
04 * Copyright (C) 2004 Koga Laboratory. All rights reserved.
05 *
06 */
07 package matxbook.chap20;
08
09 import java.io.IOException;
10
11 import org.mklab.nfc.matrix.DoubleMatrix;
12 import org.mklab.nfc.matrix.IntMatrix;
13 import org.mklab.nfc.matrix.Matrix;
14 import org.mklab.nfc.matx.MatxMatrix;
15
16
17 /**
18 * @author koga
19 * @version $Revision: 1.11 $, 2004/05/07
20 */
21 public class DataAnalysis {
22
23 /**
24 * メインメソッド
25 *
26 * @param args コマンドライン引数
27 * @throws IOException ファイルから読み込めない場合
28 */
29 @SuppressWarnings("nls")
30 public static void main(String[] args) throws IOException {
31 Matrix data = MatxMatrix.readMatFormat("data.mat");
32 Matrix grade = data.sumRowWise().multiply(5).addElementWise(60);
33 IntMatrix index = grade.compareElementWise(".>", 100).find();
34 grade.setSubVector(index, DoubleMatrix.ones(index).multiply(100));
35 grade = grade.roundElementWise();
36 System.out.println("平均点 = " + ((DoubleMatrix)grade).mean());
37 System.out.println("標準偏差 = " + ((DoubleMatrix)grade).std());
38 }
39 }
|