]> gitweb.michael.orlitzky.com - numerical-analysis.git/blobdiff - src/Vector.hs
Add the ODE.IVP module with Euler's method.
[numerical-analysis.git] / src / Vector.hs
index e608a509c505a35f1294618f5d83924a57d0ec30..6953031d10658a36a6f7da796d88a384458a18b9 100644 (file)
@@ -7,18 +7,23 @@ where
 
 import Data.Number.BigFloat
 
-class Vector a where
-  norm :: RealFrac b => a -> b
+class (Num a) => Vector a where
+  norm_2 :: RealFrac b => a -> b
+  norm_infty :: RealFrac b => a -> b
 
 -- Define instances for common numeric types.
 instance Vector Integer where
-  norm = fromInteger
+  norm_2 = fromInteger
+  norm_infty = fromInteger
 
 instance Vector Rational where
-  norm = fromRational
+  norm_2 = fromRational
+  norm_infty = fromRational
 
 instance Epsilon e => Vector (BigFloat e) where
-  norm = fromRational . toRational
+  norm_2 = fromRational . toRational
+  norm_infty = fromRational . toRational
 
 instance Vector Double where
-  norm = fromRational . toRational
+  norm_2 = fromRational . toRational
+  norm_infty = fromRational . toRational