-import NumericPrelude hiding (abs)
-import Algebra.Absolute
-import Algebra.Field
-import Algebra.Ring
-import Algebra.ToInteger
-
--- Since the norm is defined on a vector space, we should be able to
--- add and subtract anything on which a norm is defined. Of course
--- 'Num' is a bad choice here, but we really prefer to use the normal
--- addition and subtraction operators.
-class (Algebra.Ring.C a, Algebra.Absolute.C a) => Normed a where
- norm_p :: (Algebra.ToInteger.C c,
- Algebra.Field.C b,
- Algebra.Absolute.C b)
- => c -> a -> b
-
- norm_infty :: (Algebra.Field.C b,
- Algebra.Absolute.C b)
- => a -> b
-
- -- | The "usual" norm. Defaults to the Euclidean norm.
- norm :: (Algebra.Field.C b, Algebra.Absolute.C b) => a -> b
+import NumericPrelude hiding ( abs )
+import Algebra.Absolute ( abs )
+import qualified Algebra.Absolute as Absolute ( C )
+import qualified Algebra.Algebraic as Algebraic ( C )
+import Algebra.Algebraic ( root )
+import qualified Algebra.RealField as RealField ( C )
+import qualified Algebra.ToInteger as ToInteger ( C )
+import qualified Algebra.ToRational as ToRational ( C )
+import Data.Vector.Fixed ( S, Z )
+import qualified Data.Vector.Fixed as V (
+ Arity,
+ map,
+ maximum )
+import Data.Vector.Fixed.Boxed ( Vec )
+
+import Linear.Vector ( element_sum )
+
+
+-- | Instances of the 'Normed' class know how to compute their own
+-- p-norms for p=1,2,...,infinity.
+--
+class Normed a where
+ norm_p :: (ToInteger.C c, Algebraic.C b, Absolute.C b) => c -> a -> b
+ norm_infty :: (RealField.C b) => a -> b
+
+ -- | The \"usual\" norm. Defaults to the 2-norm.
+ norm :: (Algebraic.C b, Absolute.C b) => a -> b