Exemple #1
0
        public static void Shuffle <T>(Narray <T> values)
        {
            Floatarray temp  = new Floatarray(values.Length());
            Intarray   index = new Intarray();

            for (int i = 0; i < temp.Length(); i++)
            {
                temp.UnsafePut1d(i, DRandomizer.Default.drand());
            }
            Quicksort(index, temp);
            Permute(values, index);
        }
Exemple #2
0
        public static float Fractile(Narray <float> a, double f)
        {
            Floatarray temp = new Floatarray();

            if (!(f >= 0 && f <= 1))
            {
                throw new Exception("CHECK: f >= 0 && f <= 1");
            }
            temp.Copy(a);
            temp.Reshape(temp.Length1d());
            Quicksort(temp);
            return(temp[(int)(f * temp.Length())]);
        }