X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FLinear%2FQR.hs;h=a4fb325f96d4b510401f79d8517b6beb48b8fc79;hb=38b68b8c9b83fc7bc9c6a2c9535a50a904d20b08;hp=8d9ea42a1e19bd880ffb9211238e53ba3d7b8c5b;hpb=a96be0c7818e0408b4aac9076df131c5b3ec6ff4;p=numerical-analysis.git diff --git a/src/Linear/QR.hs b/src/Linear/QR.hs index 8d9ea42..a4fb325 100644 --- a/src/Linear/QR.hs +++ b/src/Linear/QR.hs @@ -140,11 +140,14 @@ 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 Mat columns = transpose matrix + + initial_qr :: (Mat (S m) (S m) a, Mat (S m) (S n) a) initial_qr = (identity_matrix, matrix) -- | Process the column and spit out the current QR @@ -162,7 +165,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