instance (RealFloat a) => Vector (TwoTuple a) where
-- The standard Euclidean 2-norm. We need RealFloat for the square
-- root.
- norm (TwoTuple x1 y1) = fromRational $ toRational (sqrt(x1^2 + y1^2))
+ norm_2 (TwoTuple x y) = fromRational $ toRational (sqrt(x^2 + y^2))
+
+ -- The infinity norm, i.e. the maximum entry.
+ norm_infty (TwoTuple x y) =
+ fromRational $ max absx absy
+ where
+ absx = abs (toRational x)
+ absy = abs (toRational y)
-- | It's not correct to use Num here, but I really don't want to have
-- to define my own addition and subtraction.