Safe Haskell | None |
---|---|
Language | Haskell2010 |
Provides the Normed
typeclass.
Since: 0.1
Documentation
Defines a "norm" on a given structure. We have the following laws:
- Positive definiteness:
norm x > 0 for x /= 0, norm 0 = 0
. - Subadditivity:
norm (x + y) <= norm x + norm y
. - Inversion :
norm x = norm (-x)
. - Sign :
sgn x = x / norm x
.
Notice these laws require various algebraic assumptions, from a semigroup up to a group structure. It is expected that types that implement the relevant typeclasses will follow the respective laws.
We do not require any of these typeclasses as constraints as it is possible that we may want to abstract over "positive" types with a type that does not have an additive semigroup instance (consider multiplicative groups).
Since: 0.1
Returns the norm.
Since: 0.1
Instances
Normed Int16 Source # | Since: 0.1 |
Normed Int32 Source # | Since: 0.1 |
Normed Int64 Source # | Since: 0.1 |
Normed Int8 Source # | Since: 0.1 |
Normed Word16 Source # | Since: 0.1 |
Normed Word32 Source # | Since: 0.1 |
Normed Word64 Source # | Since: 0.1 |
Normed Word8 Source # | Since: 0.1 |
Normed Integer Source # | Since: 0.1 |
Normed Natural Source # | Since: 0.1 |
Normed Double Source # | Since: 0.1 |
Normed Float Source # | Since: 0.1 |
Normed Int Source # | Since: 0.1 |
Normed Word Source # | Since: 0.1 |
RealFloat a => Normed (Complex a) Source # | Since: 0.1 |
Normed (Ratio Integer) Source # | Since: 0.1 |
Normed (Ratio Natural) Source # | Since: 0.1 |