import NumericPrelude hiding ( abs )
import Algebra.Absolute ( abs )
-import qualified Algebra.Absolute as Absolute
-import qualified Algebra.Algebraic as Algebraic
+import qualified Algebra.Absolute as Absolute ( C )
+import qualified Algebra.Algebraic as Algebraic ( C )
import Algebra.Algebraic ( root )
-import qualified Algebra.RealField as RealField
-import qualified Algebra.ToInteger as ToInteger
+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 (
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 Euclidean norm.
+ -- | The \"usual\" norm. Defaults to the 2-norm.
norm :: (Algebraic.C b, Absolute.C b) => a -> b
norm = norm_p (2 :: Integer)