Esempio n. 1
0
        public void TestExceptionMultipliationStrassenNonConsistent()
        {
            var m1Data = new int[5, 4] {
                { 1, 2, 3, 4 }, { 5, 3, 2, 4 }, { 5, 4, 2, 2 }, { 34, 5, 5, 5 }, { 6, 7, 2, 5 }
            };
            var m2Data = new int[, ] {
                { 1, 2 }, { 3, 4 }
            };

            Assert.Throws <ArgumentException>(() => MultiplicationAlgoritm.Strassen(m1Data, m2Data));
        }
Esempio n. 2
0
        public void TestExceptionMultipliationStrassenNonSquare()
        {
            var m1Data = new int[4, 2] {
                { 1, 2 }, { 3, 4 }, { 5, 3 }, { 7, 9 }
            };
            var m2Data = new int[2, 3] {
                { 1, 2, 3 }, { 3, 4, 6 }
            };

            Assert.Throws <ArgumentException>(() => MultiplicationAlgoritm.Strassen(m1Data, m2Data));
        }
Esempio n. 3
0
        public void TestStrassenMultiplicationNon2Degree()
        {
            var m1Data = new int[3, 3] {
                { 1, 2, 7 }, { 3, 4, 8 }, { 5, 3, 3 }
            };
            var m2Data = new int[3, 3] {
                { 1, 2, 3 }, { 3, 4, 6 }, { 3, 9, 4 }
            };
            var resultData = MultiplicationAlgoritm.Strassen(m1Data, m2Data);

            var correctData = new int[, ] {
                { 28, 73, 43 }, { 39, 94, 65 }, { 23, 49, 45 }
            };

            Assert.That(resultData.CompareContent(correctData));
        }
Esempio n. 4
0
        public void TestStrassenMultiplication2Degree()
        {
            var m1Data = new int[4, 4] {
                { 1, 2, 7, 9 }, { 3, 4, 8, 0 }, { 5, 3, 3, 6 }, { 3, 4, 6, 5 }
            };
            var m2Data = new int[4, 4] {
                { 1, 2, 3, 7 }, { 3, 4, 6, 1 }, { 3, 9, 4, 4 }, { 4, 6, 3, 7 }
            };
            var resultData = MultiplicationAlgoritm.Strassen(m1Data, m2Data);

            var correctData = new int[, ] {
                { 64, 127, 70, 100 }, { 39, 94, 65, 57 }, { 47, 85, 63, 92 }, { 53, 106, 72, 84 }
            };

            Assert.That(resultData.CompareContent(correctData));
        }