From 7638f1a379035c045185e25cacf0ea2d9d257265 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sat, 15 Feb 2014 21:26:46 -0500 Subject: [PATCH] Define Col6...Col9 types in Linear.Matrix. --- src/Linear/Matrix.hs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/Linear/Matrix.hs b/src/Linear/Matrix.hs index 2fe5340..2422eef 100644 --- a/src/Linear/Matrix.hs +++ b/src/Linear/Matrix.hs @@ -19,13 +19,6 @@ import Data.List (intercalate) import Data.Vector.Fixed ( (!), - N1, - N2, - N3, - N4, - N5, - S, - Z, generate, mk1, mk2, @@ -47,6 +40,7 @@ import qualified Data.Vector.Fixed as V ( zipWith ) import Data.Vector.Fixed.Cont ( Arity, arity ) import Linear.Vector ( Vec, delete, element_sum ) +import Naturals ( N1, N2, N3, N4, N5, N6, N7, N8, N9, N10, S, Z ) import Normed ( Normed(..) ) import NumericPrelude hiding ( (*), abs ) @@ -95,10 +89,11 @@ type Col2 a = Col N2 a type Col3 a = Col N3 a type Col4 a = Col N4 a type Col5 a = Col N5 a - --- We need a big column for Gaussian quadrature. -type N10 = S (S (S (S (S N5)))) -type Col10 a = Col N10 a +type Col6 a = Col N6 a +type Col7 a = Col N7 a +type Col8 a = Col N8 a +type Col9 a = Col N9 a +type Col10 a = Col N10 a -- We need a big column for Gaussian quadrature. instance (Eq a) => Eq (Mat m n a) where @@ -307,7 +302,6 @@ identity_matrix = -- >>> is_upper_triangular r -- True -- --- >>> import Naturals ( N7 ) -- >>> let k1 = [6, -3, 0, 0, 0, 0, 0] :: [Double] -- >>> let k2 = [-3, 10.5, -7.5, 0, 0, 0, 0] :: [Double] -- >>> let k3 = [0, -7.5, 12.5, 0, 0, 0, 0] :: [Double] @@ -674,6 +668,7 @@ vec4d (w,x,y,z) = Mat (mk4 (mk1 w) (mk1 x) (mk1 y) (mk1 z)) vec5d :: (a,a,a,a,a) -> Col5 a vec5d (v,w,x,y,z) = Mat (mk5 (mk1 v) (mk1 w) (mk1 x) (mk1 y) (mk1 z)) + -- Since we commandeered multiplication, we need to create 1x1 -- matrices in order to multiply things. scalar :: a -> Mat1 a -- 2.43.2