algebra-simple-0.1: An alternative mathematical interface to Num.
Safe HaskellNone
LanguageHaskell2010

Numeric.Algebra.Normed

Description

Provides the Normed typeclass.

Since: 0.1

Synopsis

Documentation

class Normed s where Source #

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

Methods

norm :: s -> s Source #

Returns the norm.

Since: 0.1

sgn :: s -> s Source #

Sign function. Notice that when norm is abs, this is the familiar signum function i.e.

sgn x
  | x < 0 = -1
  | x == 0 = 0
  | x > 0 = 1

Since: 0.1

Instances

Instances details
Normed Int16 Source #

Since: 0.1

Instance details

Defined in Numeric.Algebra.Normed

Normed Int32 Source #

Since: 0.1

Instance details

Defined in Numeric.Algebra.Normed

Normed Int64 Source #

Since: 0.1

Instance details

Defined in Numeric.Algebra.Normed

Normed Int8 Source #

Since: 0.1

Instance details

Defined in Numeric.Algebra.Normed

Methods

norm :: Int8 -> Int8 Source #

sgn :: Int8 -> Int8 Source #

Normed Word16 Source #

Since: 0.1

Instance details

Defined in Numeric.Algebra.Normed

Normed Word32 Source #

Since: 0.1

Instance details

Defined in Numeric.Algebra.Normed

Normed Word64 Source #

Since: 0.1

Instance details

Defined in Numeric.Algebra.Normed

Normed Word8 Source #

Since: 0.1

Instance details

Defined in Numeric.Algebra.Normed

Normed Integer Source #

Since: 0.1

Instance details

Defined in Numeric.Algebra.Normed

Normed Natural Source #

Since: 0.1

Instance details

Defined in Numeric.Algebra.Normed

Normed Double Source #

Since: 0.1

Instance details

Defined in Numeric.Algebra.Normed

Normed Float Source #

Since: 0.1

Instance details

Defined in Numeric.Algebra.Normed

Normed Int Source #

Since: 0.1

Instance details

Defined in Numeric.Algebra.Normed

Methods

norm :: Int -> Int Source #

sgn :: Int -> Int Source #

Normed Word Source #

Since: 0.1

Instance details

Defined in Numeric.Algebra.Normed

Methods

norm :: Word -> Word Source #

sgn :: Word -> Word Source #

RealFloat a => Normed (Complex a) Source #

Since: 0.1

Instance details

Defined in Numeric.Algebra.Normed

Methods

norm :: Complex a -> Complex a Source #

sgn :: Complex a -> Complex a Source #

Normed (Ratio Integer) Source #

Since: 0.1

Instance details

Defined in Numeric.Algebra.Normed

Normed (Ratio Natural) Source #

Since: 0.1

Instance details

Defined in Numeric.Algebra.Normed