Esempio n. 1
0
 public void NBestVPTree(Array <float> mb, double[] bestd, int[] bestw)
 {
     if (_vpTree == null)
     {
         _vpTree = new VPTree <Array <float> >(ArrayVectors(), MinusDotProduct);
     }
     _vpTree.Search(mb / NN.Norm(mb), bestw, bestd);
 }
Esempio n. 2
0
        public static void Normalize(Array <float> v)
        {
            var norm = NN.Norm(v);

            if (norm != 0)
            {
                v.Div(norm, result: v);
            }
        }
Esempio n. 3
0
        private Array <float>[] ArrayVectors()
        {
            var vectors = new Array <float> [Text.Length];

            for (int i = 0; i < vectors.Length; i++)
            {
                vectors[i] = this[Text[i]] / NN.Norm(this[Text[i]]);
            }
            return(vectors);
        }
Esempio n. 4
0
 public static Array <Real> Normalize(this Array <Real> a, Array <Real> result = null)
 {
     return(a.Scale(1 / NN.Norm(a), result: result));
 }