]> gitweb.michael.orlitzky.com - numerical-analysis.git/blobdiff - src/Linear/QR.hs
src/Linear/QR.hs: fix monomorphism restriction warning.
[numerical-analysis.git] / src / Linear / QR.hs
index 8d9ea42a1e19bd880ffb9211238e53ba3d7b8c5b..a4fb325f96d4b510401f79d8517b6beb48b8fc79 100644 (file)
@@ -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