01 /*
02 * $Id: DiagSample.java,v 1.9 2008/02/02 03:06:24 koga Exp $
03 *
04 * Copyright (C) 2004 Koga Laboratory. All rights reserved.
05 *
06 */
07 package matxbook.chap07;
08
09 import org.mklab.nfc.matrix.DoubleMatrix;
10 import org.mklab.nfc.matrix.Matrix;
11 import org.mklab.nfc.matrix.misc.DiagonalMatrix;
12
13
14 /**
15 * @author koga
16 * @version $Revision: 1.9 $, 2004/04/15
17 */
18 public class DiagonalMatrixSample {
19
20 /**
21 * メインメソッド
22 *
23 * @param args コマンドライン引数
24 */
25 @SuppressWarnings("nls")
26 public static void main(String[] args) {
27 Matrix a = DiagonalMatrix.create(new double[] {1, 2, 3});
28 a.print("diag(1,2,3)");
29
30 Matrix b1 = new DoubleMatrix(new double[] {1});
31 Matrix b2 = new DoubleMatrix(new double[][] { {1, 2}, {3, 4}});
32 Matrix b3 = new DoubleMatrix(new double[] {5});
33 Matrix b = DiagonalMatrix.create(b1, b2, b3);
34 b.print("diag([1],[[1 2][3 4], [5])");
35 }
36 }
|