Beispiel #1
0
        public void TestCrossCovariance()
        {
            var tss = new float[, ] {
                { 0, 1, 2, 3 }, { 10, 11, 12, 13 }
            };
            var tss2 = new float[, ] {
                { 4, 6, 8, 10, 12 }, { 14, 16, 18, 20, 22 }
            };

            using (KhivaArray xss = KhivaArray.Create(tss),
                   yss = KhivaArray.Create(tss2),
                   approximateEntropy = Features.CrossCovariance(xss, yss, false))
            {
                var result  = approximateEntropy.GetData3D <float>();
                var flatten = new float[result.Length];
                Flatten3D(ref flatten, result);
                for (var i = 0; i < 4; i++)
                {
                    Assert.AreEqual(2.5, flatten[i * 5], Delta);
                    Assert.AreEqual(2.5, flatten[i * 5 + 1], Delta);
                    Assert.AreEqual(0.25, flatten[i * 5 + 2], Delta);
                    Assert.AreEqual(-1.25, flatten[i * 5 + 3], Delta);
                    Assert.AreEqual(-1.5, flatten[i * 5 + 4], Delta);
                }
            }
        }