Accord.Tests.Math.MatrixTest.insertion_sort_with_repetition C# (CSharp) Method

insertion_sort_with_repetition() private method

private insertion_sort_with_repetition ( ) : void
return void
        public void insertion_sort_with_repetition()
        {
            for (int n = 1; n < 100; n += 10)
            {
                for (int i = 0; i < 100; i++)
                {
                    int[] random = UniformDiscreteDistribution.Random(0, 10, n);
                    long[] idx = Vector.Range((long)n);
                    double[] expected = random.ToDouble();
                    double[] a = random.ToDouble();
                    long[] ai = Vector.Range((long)n);
                    double[] b = random.ToDouble();
                    long[] bi = Vector.Range((long)n);
                    double[] c = random.ToDouble();
                    long[] ci = Vector.Range((long)n);
                    double[] d = random.ToDouble();
                    long[] di = Vector.Range((long)n);
                    double[] e = random.ToDouble();
                    long[] ei = Vector.Range((long)n);

                    Array.Sort(expected, idx);
                    Sort.Insertion(a, ai);
                    Sort.Insertion(b, bi, asc: false);
                    b = b.Reversed();
                    bi = bi.Reversed();
                    Sort.Insertion(c, ci, asc: true);

                    Func<double, double, int> greater = (x, y) => -x.CompareTo(y);
                    Sort.Insertion(d, di, comparer: greater, asc: false);
                    Sort.Insertion(e, ei, comparer: greater, asc: true);
                    e = e.Reversed();
                    ei = ei.Reversed();

                    Assert.IsTrue(a.IsSorted());
                    Assert.IsTrue(a.IsSorted(ComparerDirection.Ascending));
                    Assert.IsTrue(expected.IsEqual(a));
                    Assert.IsTrue(expected.IsEqual(b));
                    Assert.IsTrue(expected.IsEqual(c));
                    Assert.IsTrue(expected.IsEqual(d));
                    Assert.IsTrue(expected.IsEqual(e));

                    Assert.IsTrue(ai.IsEqual(ci));
                    Assert.IsTrue(ai.IsEqual(di));
                    Assert.IsTrue(bi.IsEqual(ei));
                }
            }
        }
    }
MatrixTest