예제 #1
0
        // This checks the conditions of S. Theorem 23 (except the approximation condition)
        // Compresses an expansion
        int Compress_Checked(int elen, double[] e, double[] h)
        {
            NUnit.Framework.Assert.IsTrue(e.Length >= elen);
            NUnit.Framework.Assert.IsTrue(e.Take(elen).IsNonOverlapping());
            NUnit.Framework.Assert.IsTrue(e.Take(elen).IsSorted());

            int hlen = EA.Compress(elen, e, h);

            NUnit.Framework.Assert.IsTrue(h.Take(hlen).IsNonOverlapping());
            NUnit.Framework.Assert.IsTrue(h.Take(hlen).IsNonAdjacent());
            NUnit.Framework.Assert.IsTrue(h.Take(hlen).IsSorted());
            NUnit.Framework.Assert.IsTrue(h.Take(hlen).IsZeroElim());

            return(hlen);
        }