X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FVector.hs;h=6953031d10658a36a6f7da796d88a384458a18b9;hb=1832912058bfe274e1f049dae80ea05daa94a1a1;hp=97bb5d8aea2c94a8100ed981bff988d6a9df60ab;hpb=c5da1efa77844ae6159dfc781ed886fdffbbf4d1;p=numerical-analysis.git diff --git a/src/Vector.hs b/src/Vector.hs index 97bb5d8..6953031 100644 --- a/src/Vector.hs +++ b/src/Vector.hs @@ -8,17 +8,22 @@ where import Data.Number.BigFloat class (Num a) => Vector a where - norm :: RealFrac b => a -> b + 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