From: Michael Orlitzky Date: Wed, 19 Feb 2014 01:26:13 +0000 (-0500) Subject: Require a matrix to be nonempty if we're going to QR factorize it. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=14c40575357025bbc37e5111ee879ff7f95d6e6f;p=numerical-analysis.git Require a matrix to be nonempty if we're going to QR factorize it. --- diff --git a/src/Linear/QR.hs b/src/Linear/QR.hs index 8d9ea42..4c1c564 100644 --- a/src/Linear/QR.hs +++ b/src/Linear/QR.hs @@ -140,7 +140,8 @@ givens_rotator i j xi xj = -- True -- qr :: forall m n a. (Arity m, Arity n, Eq a, Algebraic.C a, Ring.C a) - => Mat m n a -> (Mat m m a, Mat m n a) + => Mat (S m) (S n) a + -> (Mat (S m) (S m) a, Mat (S m) (S n) a) qr matrix = ifoldl col_function initial_qr columns where @@ -162,7 +163,7 @@ qr matrix = | otherwise = (q*rotator, (transpose rotator)*r) where y = r !!! (idx, col_idx) - rotator :: Mat m m a + rotator :: Mat (S m) (S m) a rotator = givens_rotator col_idx idx (r !!! (col_idx, col_idx)) y