Exemple #1
0
        }//Init

        public void FindBMU()
        {
            //Useful locals
            int alen = m_Height * m_Width;

            //Compute the distances from pattern to code vectors
            FPA a    = PA.AddDimension(m_CurrentPatternGPU, 1);
            FPA x    = PA.Stretch(a, 1, alen);
            FPA pol  = PA.Subtract(m_Weights, x);
            FPA pol2 = PA.Multiply(pol, pol);
            FPA pol3 = PA.Sum(pol2, 0);

            m_Distances = PA.Sqrt(pol3);

            //Find the minimal distance
            FPA dist2  = PA.AddDimension(m_Distances, 1);
            FPA minval = PA.MinVal(dist2, 0);

            FPA xxx = PA.Stretch(minval, alen);

            //Prepare trigger array
            BPA trigger = PA.CompareEqual(xxx, m_Distances);

            //BMU Coord ZEROS
            BPA trigger2 = PA.AddDimension(trigger, 0);
            BPA trigger3 = PA.Stretch(trigger2, 2, 1);

            //Extract BMU Coord
            FPA lol = PA.Cond(trigger3, m_Shape, zeros);

            m_BMUCoord = PA.Sum(lol, 1);
            //m_BMUCoord = PA.Evaluate(m_BMUCoord);

            //BMU Code Vector ZEROS
            BPA triggercv2 = PA.AddDimension(trigger, 0);
            BPA triggercv3 = PA.Stretch(triggercv2, m_PatternLength, 1);

            //Extract BMU code vector
            FPA mdr = PA.Cond(triggercv3, m_Weights, zeroscv);

            m_BMUCodeVector = PA.Sum(mdr, 1);
            //m_BMUCodeVector = PA.Evaluate(m_BMUCodeVector);


            //Begin computation ! ^^ AND OUTPUT
            PA.Evaluate(m_BMUCodeVector);
            PA.Evaluate(m_BMUCoord);
        }