X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FTwoTuple.hs;h=becb11eb05435f5a3b45223a5d718475f32e9878;hb=e73e40c515938df4de629dbc88463c5d88bca7c8;hp=3950fee9afeabd5bfb8d884ca6543c4689873c24;hpb=e15cc4256054bfaa60cd7ed167c0448957c85ed2;p=numerical-analysis.git diff --git a/src/TwoTuple.hs b/src/TwoTuple.hs index 3950fee..becb11e 100644 --- a/src/TwoTuple.hs +++ b/src/TwoTuple.hs @@ -6,7 +6,7 @@ module TwoTuple where -import Vector +import Normed data TwoTuple a = TwoTuple a a @@ -18,10 +18,10 @@ instance (Show a) => Show (TwoTuple a) where instance Functor TwoTuple where f `fmap` (TwoTuple x1 y1) = TwoTuple (f x1) (f y1) -instance (RealFloat a) => Vector (TwoTuple a) where +instance (RealFloat a) => Normed (TwoTuple a) where -- The standard Euclidean 2-norm. We need RealFloat for the square -- root. - norm_2 (TwoTuple x y) = fromRational $ toRational (sqrt(x^2 + y^2)) + norm (TwoTuple x y) = fromRational $ toRational (sqrt(x^2 + y^2)) -- The infinity norm, i.e. the maximum entry. norm_infty (TwoTuple x y) =