Пример #1
0
 public virtual void update(Transform transform, ClusteredDensityFileData clusters)
 {
     for (int i = 0; i < this.meansPool.size(); i++)
     {
         int     classIndex = clusters.getClassIndex(i);
         float[] array      = new float[this.getVectorLength()[0]];
         float[] array2     = (float[])this.meansPool.get(i);
         for (int j = 0; j < this.numStreams; j++)
         {
             for (int k = 0; k < this.getVectorLength()[j]; k++)
             {
                 array[k] = 0f;
                 int     num;
                 float[] array4;
                 for (int l = 0; l < this.getVectorLength()[j]; l++)
                 {
                     float[] array3 = array;
                     num          = k;
                     array4       = array3;
                     array4[num] += transform.getAs()[classIndex][j][k][l] * array2[l];
                 }
                 float[] array5 = array;
                 num          = k;
                 array4       = array5;
                 array4[num] += transform.getBs()[classIndex][j][k];
             }
             ByteCodeHelper.arraycopy_primitive_4(array, 0, array2, 0, array.Length);
         }
     }
 }
Пример #2
0
 private void copyVector(float[] array, float[] array2)
 {
     if (!HMMPoolManager.assertionsDisabled && array.Length != array2.Length)
     {
         throw new AssertionError();
     }
     ByteCodeHelper.arraycopy_primitive_4(array, 0, array2, 0, array.Length);
 }
Пример #3
0
        public virtual GMMDiag getGauss(int i)
        {
            GMMDiag gmmdiag = new GMMDiag(1, this.getNcoefs());

            ByteCodeHelper.arraycopy_primitive_4(this.means[i], 0, gmmdiag.means[0], 0, this.getNcoefs());
            ByteCodeHelper.arraycopy_primitive_4(this.covar[i], 0, gmmdiag.covar[0], 0, this.getNcoefs());
            gmmdiag.setWeight(0, 1f);
            gmmdiag.precomputeDistance();
            return(gmmdiag);
        }
Пример #4
0
        public virtual GMMDiag merge(GMMDiag g, float w1)
        {
            GMMDiag gmmdiag = new GMMDiag(this.getNgauss() + g.getNgauss(), this.getNcoefs());

            for (int i = 0; i < this.getNgauss(); i++)
            {
                ByteCodeHelper.arraycopy_primitive_4(this.means[i], 0, gmmdiag.means[i], 0, this.getNcoefs());
                ByteCodeHelper.arraycopy_primitive_4(this.covar[i], 0, gmmdiag.covar[i], 0, this.getNcoefs());
                gmmdiag.setWeight(i, this.getWeight(i) * w1);
            }
            for (int i = 0; i < g.getNgauss(); i++)
            {
                ByteCodeHelper.arraycopy_primitive_4(g.means[i], 0, gmmdiag.means[this.ngauss + i], 0, this.getNcoefs());
                ByteCodeHelper.arraycopy_primitive_4(g.covar[i], 0, gmmdiag.covar[this.ngauss + i], 0, this.getNcoefs());
                gmmdiag.setWeight(this.ngauss + i, g.getWeight(i) * (1f - w1));
            }
            gmmdiag.precomputeDistance();
            return(gmmdiag);
        }
Пример #5
0
        private void updateScores(float[] array)
        {
            int num  = array.Length;
            int num2 = this.numStreams;
            int num3 = (num2 != -1) ? (num / num2) : (-num);

            float[] array2 = new float[num3];
            for (int i = 0; i < this.numStreams; i++)
            {
                ByteCodeHelper.arraycopy_primitive_4(array, i * num3, array2, 0, num3);
                PrunableMixtureComponent[] array3 = (PrunableMixtureComponent[])this.components.get(i);
                int num4 = array3.Length;
                for (int j = 0; j < num4; j++)
                {
                    PrunableMixtureComponent prunableMixtureComponent = array3[j];
                    prunableMixtureComponent.updateScore(array2);
                }
            }
        }
Пример #6
0
        protected internal virtual void ExpandBuff(bool wrapAround)
        {
            char[] array  = new char[this.bufsize + 2048];
            int[]  array2 = new int[this.bufsize + 2048];
            int[]  array3 = new int[this.bufsize + 2048];
            try
            {
                if (wrapAround)
                {
                    ByteCodeHelper.arraycopy_primitive_2(this.buffer, this.tokenBegin, array, 0, this.bufsize - this.tokenBegin);
                    ByteCodeHelper.arraycopy_primitive_2(this.buffer, 0, array, this.bufsize - this.tokenBegin, this.bufpos);
                    this.buffer = array;
                    ByteCodeHelper.arraycopy_primitive_4(this.bufline, this.tokenBegin, array2, 0, this.bufsize - this.tokenBegin);
                    ByteCodeHelper.arraycopy_primitive_4(this.bufline, 0, array2, this.bufsize - this.tokenBegin, this.bufpos);
                    this.bufline = array2;
                    ByteCodeHelper.arraycopy_primitive_4(this.bufcolumn, this.tokenBegin, array3, 0, this.bufsize - this.tokenBegin);
                    ByteCodeHelper.arraycopy_primitive_4(this.bufcolumn, 0, array3, this.bufsize - this.tokenBegin, this.bufpos);
                    this.bufcolumn = array3;
                    this.bufpos   += this.bufsize - this.tokenBegin;
                }
                else
                {
                    ByteCodeHelper.arraycopy_primitive_2(this.buffer, this.tokenBegin, array, 0, this.bufsize - this.tokenBegin);
                    this.buffer = array;
                    ByteCodeHelper.arraycopy_primitive_4(this.bufline, this.tokenBegin, array2, 0, this.bufsize - this.tokenBegin);
                    this.bufline = array2;
                    ByteCodeHelper.arraycopy_primitive_4(this.bufcolumn, this.tokenBegin, array3, 0, this.bufsize - this.tokenBegin);
                    this.bufcolumn = array3;
                    this.bufpos   -= this.tokenBegin;
                }
            }
            catch (System.Exception ex)
            {
                throw new Error(Throwable.instancehelper_getMessage(ex), ex);
            }
            int num  = this.bufsize + 2048;
            int num2 = num;

            this.bufsize    = num;
            this.available  = num2;
            this.tokenBegin = 0;
        }
Пример #7
0
        private void updateTopScores(float[] array)
        {
            int num  = array.Length;
            int num2 = this.numStreams;
            int num3 = (num2 != -1) ? (num / num2) : (-num);

            float[] array2 = new float[num3];
            for (int i = 0; i < this.numStreams; i++)
            {
                ByteCodeHelper.arraycopy_primitive_4(array, i * num3, array2, 0, num3);
                PrunableMixtureComponent[] array3 = (PrunableMixtureComponent[])this.topComponents.get(i);
                PrunableMixtureComponent[] array4 = (PrunableMixtureComponent[])this.components.get(i);
                PrunableMixtureComponent[] array5 = array3;
                int num4 = array5.Length;
                int j;
                for (j = 0; j < num4; j++)
                {
                    PrunableMixtureComponent prunableMixtureComponent = array5[j];
                    prunableMixtureComponent.updateScore(array2);
                }
                Arrays.sort(array3, this.componentComparator);
                float partialScore = array3[0].getPartialScore();
                PrunableMixtureComponent[] array6 = array4;
                j = array6.Length;
                for (int k = 0; k < j; k++)
                {
                    PrunableMixtureComponent prunableMixtureComponent2 = array6[k];
                    if (!this.isInTopComponents(array3, prunableMixtureComponent2))
                    {
                        if (prunableMixtureComponent2.isTopComponent(array2, partialScore))
                        {
                            this.insertTopComponent(array3, prunableMixtureComponent2);
                            partialScore = array3[0].getPartialScore();
                        }
                    }
                }
            }
        }