public void RectangularQRDecomposition() { RectangularMatrix M = GenerateRandomMatrix(30, 10); QRDecomposition QRD = M.QRDecomposition(); Assert.IsTrue(QRD.RowCount == M.RowCount); Assert.IsTrue(QRD.ColumnCount == M.ColumnCount); SquareMatrix Q = QRD.QMatrix(); Assert.IsTrue(Q.Dimension == M.RowCount); Assert.IsTrue(TestUtilities.IsNearlyEqual(Q * Q.Transpose(), TestUtilities.CreateSquareUnitMatrix(Q.Dimension))); RectangularMatrix R = QRD.RMatrix(); Assert.IsTrue(R.RowCount == M.RowCount); Assert.IsTrue(R.ColumnCount == M.ColumnCount); RectangularMatrix QR = Q * R; Assert.IsTrue(TestUtilities.IsNearlyEqual(QR, M)); }