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 * ブロック対角行列のサンプルです。
16 * @author koga
17 * @version $Revision: 1.9 $, 2004/04/15
18 */
19 public class DiagonalMatrixSample {
20
21 /**
22 * メインメソッド
23 *
24 * @param args コマンドライン引数
25 */
26 @SuppressWarnings("nls")
27 public static void main(String[] args) {
28 Matrix a = DiagonalMatrix.create(new double[] {1, 2, 3});
29 a.print("diag(1,2,3)");
30
31 Matrix b1 = new DoubleMatrix(new double[] {1});
32 Matrix b2 = new DoubleMatrix(new double[][] { {1, 2}, {3, 4}});
33 Matrix b3 = new DoubleMatrix(new double[] {5});
34 Matrix b = DiagonalMatrix.create(b1, b2, b3);
35 b.print("diag([1],[[1 2][3 4], [5])");
36 }
37 }
|