Exemplo n.º 1
0
        public void RectangularMatrixNorms()
        {
            RectangularMatrix Z = new RectangularMatrix(3, 4);

            Assert.IsTrue(Z.OneNorm() == 0.0);
            Assert.IsTrue(Z.InfinityNorm() == 0.0);
            Assert.IsTrue(Z.FrobeniusNorm() == 0.0);

            RectangularMatrix A = GenerateRandomMatrix(4, 5);

            Assert.IsTrue(A.OneNorm() > 0.0);
            Assert.IsTrue(A.InfinityNorm() > 0.0);
            Assert.IsTrue(A.FrobeniusNorm() > 0.0);

            RectangularMatrix B = GenerateRandomMatrix(5, 6);

            Assert.IsTrue(B.OneNorm() > 0.0);
            Assert.IsTrue(B.InfinityNorm() > 0.0);
            Assert.IsTrue(B.FrobeniusNorm() > 0.0);

            // Frobenius norm is sub-multiplicative
            RectangularMatrix P = A * B;

            Assert.IsTrue(P.FrobeniusNorm() <= A.FrobeniusNorm() * B.FrobeniusNorm());
        }