Пример #1
0
        // public void getRowVec(int i_row,NyARVec o_vec)
        // {
        // o_vec.set(this.m[i_row],this.clm);
        // }

        /**
         * aとbの積を自分自身に格納する。arMatrixMul()の代替品
         *
         * @param a
         * @param b
         * @throws NyARException
         */
        public void matrixMul(NyARFixedFloat16Mat a, NyARFixedFloat16Mat b)
        {
            if (a.clm != b.row || this.row != a.row || this.clm != b.clm)
            {
                throw new NyARException();
            }
            long w;
            int  r, c, i;

            long[][] am = a.m, bm = b.m, dm = this.m;
            // For順変更禁止
            for (r = 0; r < this.row; r++)
            {
                for (c = 0; c < this.clm; c++)
                {
                    w = 0L;// dest.setARELEM0(r, c,0.0);
                    for (i = 0; i < a.clm; i++)
                    {
                        w += (am[r][i] * bm[i][c]) >> 16;// ARELEM0(dest, r, c) +=ARELEM0(a, r, i) * ARELEM0(b,i, c);
                    }
                    dm[r][c] = w;
                }
            }
        }
 // public void getRowVec(int i_row,NyARVec o_vec)
 // {
 // o_vec.set(this.m[i_row],this.clm);
 // }
 /**
  * aとbの積を自分自身に格納する。arMatrixMul()の代替品
  *
  * @param a
  * @param b
  * @throws NyARException
  */
 public void matrixMul(NyARFixedFloat16Mat a, NyARFixedFloat16Mat b)
 {
     if (a.clm != b.row || this.row != a.row || this.clm != b.clm)
     {
         throw new NyARException();
     }
     long w;
     int r, c, i;
     long[][] am = a.m, bm = b.m, dm = this.m;
     // For順変更禁止
     for (r = 0; r < this.row; r++)
     {
         for (c = 0; c < this.clm; c++)
         {
             w = 0L;// dest.setARELEM0(r, c,0.0);
             for (i = 0; i < a.clm; i++)
             {
                 w += (am[r][i] * bm[i][c]) >> 16;// ARELEM0(dest, r, c) +=ARELEM0(a, r, i) * ARELEM0(b,i, c);
             }
             dm[r][c] = w;
         }
     }
 }