Exemplo n.º 1
0
        /**
         * ノイズレベルを指定して、ノイズ(だと思われる)ベクトルを削除します。
         */
        /**
         * 大きさ(sq_dist)が0のベクトルを削除して、要素を前方に詰めます。
         */
        public void removeZeroDistItem()
        {
            //前方詰め
            int idx = 0;
            int len = this.length;

            for (int i = 0; i < len; i++)
            {
                if (this.items[i].scalar != 0)
                {
                    idx++;
                    continue;
                }
                for (i = i + 1; i < len; i++)
                {
                    if (this.items[i].scalar != 0)
                    {
                        VecLinearCoordinatePoint temp = this.items[i];
                        this.items[i]   = this.items[idx];
                        this.items[idx] = temp;
                        idx++;
                        i--;
                        break;
                    }
                }
            }
            this.length = idx;
            return;
        }
		    public new static VecLinearCoordinatePoint[] createArray(int i_length)
		    {
			    VecLinearCoordinatePoint[] r=new VecLinearCoordinatePoint[i_length];
			    for(int i=0;i<i_length;i++){
				    r[i]=new VecLinearCoordinatePoint();
			    }
			    return r;
		    }
Exemplo n.º 3
0
 public new static VecLinearCoordinatePoint[] createArray(int i_length)
 {
     VecLinearCoordinatePoint[] r = new VecLinearCoordinatePoint[i_length];
     for (int i = 0; i < i_length; i++)
     {
         r[i] = new VecLinearCoordinatePoint();
     }
     return(r);
 }
Exemplo n.º 4
0
        public void getKeyCoord(VecLinearCoordinatePoint[] o_index)
        {
            VecLinearCoordinatePoint[] vp = this.items;
            Debug.Assert(o_index.Length <= this.length);
            int i;
            int out_len   = o_index.Length;
            int out_len_1 = out_len - 1;

            for (i = out_len - 1; i >= 0; i--)
            {
                o_index[i] = vp[i];
            }
            // sqdistでソートする(B->S)
            for (i = 0; i < out_len_1;)
            {
                if (o_index[i].scalar < o_index[i + 1].scalar)
                {
                    VecLinearCoordinatePoint t = o_index[i];
                    o_index[i]     = o_index[i + 1];
                    o_index[i + 1] = t;
                    i = 0;
                    continue;
                }
                i++;
            }
            // 先に4個をsq_distでソートしながら格納
            for (i = out_len; i < this.length; i++)
            {
                // 配列の値と比較
                for (int i2 = 0; i2 < out_len; i2++)
                {
                    if (vp[i].scalar > o_index[i2].scalar)
                    {
                        // 値挿入の為のシフト
                        for (int i3 = out_len - 1; i3 > i2; i3--)
                        {
                            o_index[i3] = o_index[i3 - 1];
                        }
                        // 設定
                        o_index[i2] = vp[i];
                        break;
                    }
                }
            }
            return;
        }
 public void getKeyCoord(VecLinearCoordinatePoint[] o_index)
 {
     VecLinearCoordinatePoint[] vp = this.items;
     Debug.Assert(o_index.Length <= this.length);
     int i;
     int out_len = o_index.Length;
     int out_len_1 = out_len - 1;
     for (i = out_len - 1; i >= 0; i--) {
         o_index[i] = vp[i];
     }
     // sqdistでソートする(B->S)
     for (i = 0; i < out_len_1;) {
         if (o_index[i].scalar < o_index[i + 1].scalar) {
             VecLinearCoordinatePoint t = o_index[i];
             o_index[i] = o_index[i + 1];
             o_index[i + 1] = t;
             i = 0;
             continue;
         }
         i++;
     }
     // 先に4個をsq_distでソートしながら格納
     for (i = out_len; i < this.length; i++) {
         // 配列の値と比較
         for (int i2 = 0; i2 < out_len; i2++) {
             if (vp[i].scalar > o_index[i2].scalar) {
                 // 値挿入の為のシフト
                 for (int i3 = out_len - 1; i3 > i2; i3--) {
                     o_index[i3] = o_index[i3 - 1];
                 }
                 // 設定
                 o_index[i2] = vp[i];
                 break;
             }
         }
     }
     return;
 }
Exemplo n.º 6
0
 public VecLinearCoordinates(int i_length)
 {
     this.length = 0;
     this.items  = VecLinearCoordinatePoint.createArray(i_length);
 }