numeric-prelude-0.4.3.2: An experimental alternative hierarchy of numeric type classes

Safe HaskellNone
LanguageHaskell98

Algebra.Units

Contents

Synopsis

Class

class C a => C a Source #

This class lets us deal with the units in a ring. isUnit tells whether an element is a unit. The other operations let us canonically write an element as a unit times another element. Two elements a, b of a ring R are _associates_ if a=b*u for a unit u. For an element a, we want to write it as a=b*u where b is an associate of a. The map (a->b) is called StandardAssociate by Gap, "unitCanonical" by Axiom, and "canAssoc" by DoCon. The map (a->u) is called "canInv" by DoCon and "unitNormal(x).unit" by Axiom.

The laws are

  stdAssociate x * stdUnit x === x
    stdUnit x * stdUnitInv x === 1
 isUnit u ==> stdAssociate x === stdAssociate (x*u)

Currently some algorithms assume

 stdAssociate(x*y) === stdAssociate x * stdAssociate y

Minimal definition: isUnit and (stdUnit or stdUnitInv) and optionally stdAssociate

Minimal complete definition

isUnit, (stdUnit | stdUnitInv)

Instances
C Int Source # 
Instance details

Defined in Algebra.Units

C Int8 Source # 
Instance details

Defined in Algebra.Units

C Int16 Source # 
Instance details

Defined in Algebra.Units

C Int32 Source # 
Instance details

Defined in Algebra.Units

C Int64 Source # 
Instance details

Defined in Algebra.Units

C Integer Source # 
Instance details

Defined in Algebra.Units

C T Source # 
Instance details

Defined in Number.Peano

Integral a => C (T a) Source # 
Instance details

Defined in MathObj.Wrapper.Haskell98

Methods

isUnit :: T a -> Bool Source #

stdAssociate :: T a -> T a Source #

stdUnit :: T a -> T a Source #

stdUnitInv :: T a -> T a Source #

(C a, C a) => C (T a) Source # 
Instance details

Defined in MathObj.Polynomial

Methods

isUnit :: T a -> Bool Source #

stdAssociate :: T a -> T a Source #

stdUnit :: T a -> T a Source #

stdUnitInv :: T a -> T a Source #

(Ord a, C a) => C (T a) Source # 
Instance details

Defined in Number.Complex

Methods

isUnit :: T a -> Bool Source #

stdAssociate :: T a -> T a Source #

stdUnit :: T a -> T a Source #

stdUnitInv :: T a -> T a Source #

C a => C (T a) Source # 
Instance details

Defined in MathObj.Wrapper.NumericPrelude

Methods

isUnit :: T a -> Bool Source #

stdAssociate :: T a -> T a Source #

stdUnit :: T a -> T a Source #

stdUnitInv :: T a -> T a Source #

isUnit :: C a => a -> Bool Source #

Standard implementations for instances

intQuery :: (Integral a, C a) => a -> Bool Source #

intAssociate :: (Integral a, C a, C a) => a -> a Source #

intStandard :: (Integral a, C a, C a) => a -> a Source #

intStandardInverse :: (Integral a, C a, C a) => a -> a Source #

Properties

propComposition :: (Eq a, C a) => a -> Bool Source #

propInverseUnit :: (Eq a, C a) => a -> Bool Source #

propUniqueAssociate :: (Eq a, C a) => a -> a -> Property Source #

propAssociateProduct :: (Eq a, C a) => a -> a -> Bool Source #

Currently some algorithms assume this property.