2 * PROJECT: NyARToolkit
\r
3 * --------------------------------------------------------------------------------
\r
4 * This work is based on the original ARToolKit developed by
\r
7 * HITLab, University of Washington, Seattle
\r
8 * http://www.hitl.washington.edu/artoolkit/
\r
10 * The NyARToolkit is Java version ARToolkit class library.
\r
11 * Copyright (C)2008 R.Iizuka
\r
13 * This program is free software; you can redistribute it and/or
\r
14 * modify it under the terms of the GNU General Public License
\r
15 * as published by the Free Software Foundation; either version 2
\r
16 * of the License, or (at your option) any later version.
\r
18 * This program is distributed in the hope that it will be useful,
\r
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
21 * GNU General Public License for more details.
\r
23 * You should have received a copy of the GNU General Public License
\r
24 * along with this framework; if not, write to the Free Software
\r
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
27 * For further information please contact.
\r
28 * http://nyatla.jp/nyatoolkit/
\r
29 * <airmail(at)ebony.plala.or.jp>
\r
32 package jp.nyatla.nyartoolkit.sandbox.x2;
\r
34 import jp.nyatla.nyartoolkit.NyARException;
\r
39 * ARMat構造体に対応するクラス typedef struct { double *m; int row; int clm; }ARMat;
\r
42 public class NyARFixedFloat16Mat
\r
45 * 配列サイズと行列サイズは必ずしも一致しないことに注意 返された配列のサイズを行列の大きさとして使わないこと!
\r
48 protected long[][] m;
\r
49 private int clm, row;
\r
52 * デフォルトコンストラクタは機能しません。
\r
54 * @throws NyARException
\r
56 protected NyARFixedFloat16Mat() throws NyARException
\r
58 throw new NyARException();
\r
61 public NyARFixedFloat16Mat(int i_row, int i_clm)
\r
63 this.m = new long[i_row][i_clm];
\r
79 public void zeroClear()
\r
83 for (i = row - 1; i >= 0; i--) {
\r
84 for (i2 = clm - 1; i2 >= 0; i2--) {
\r
89 public long[][] getArray()
\r
93 // public void getRowVec(int i_row,NyARVec o_vec)
\r
95 // o_vec.set(this.m[i_row],this.clm);
\r
98 * aとbの積を自分自身に格納する。arMatrixMul()の代替品
\r
102 * @throws NyARException
\r
104 public void matrixMul(NyARFixedFloat16Mat a, NyARFixedFloat16Mat b) throws NyARException
\r
106 if (a.clm != b.row || this.row != a.row || this.clm != b.clm) {
\r
107 throw new NyARException();
\r
111 long[][] am = a.m, bm = b.m, dm = this.m;
\r
113 for (r = 0; r < this.row; r++) {
\r
114 for (c = 0; c < this.clm; c++) {
\r
115 w = 0L;// dest.setARELEM0(r, c,0.0);
\r
116 for (i = 0; i < a.clm; i++) {
\r
117 w += (am[r][i] * bm[i][c])>>16;// ARELEM0(dest, r, c) +=ARELEM0(a, r, i) * ARELEM0(b,i, c);
\r