public void TestTranspose(int size)
        {
            var A = MatrixLoader.A(size);

            var B = A.Transpose();
            var C = CreateSparse.Zeros(A.ColumnCount, A.RowCount, A.NonZerosCount);

            A.FastTranspose(C);

            Assert.IsTrue(MatrixComparer.Equals(B, C, EPS));
        }
        public void TestAddDiagonalMatrixNew()
        {
            var diag = DenseVector.Create(10, 1.0);

            var A = CreateSparse.Random(10, 10, 0.8);

            A.FastLowerTriangle();
            A.SetDiagonal(diag);

            var empty = CreateSparse.Zeros(A.RowCount, A.ColumnCount, A.NonZerosCount);

            // Add diagonal and save to new matrix.
            A.FastAddDiagonalMatrix(diag.Negate().ToArray(), empty);

            var d = empty.FastDiagonal();

            for (int i = 0; i < 10; i++)
            {
                Assert.AreEqual(d[i], 0.0);
            }
        }