|
|
|
Description |
Class interface to different free module implementations.
Free modules are like maps from a base type to a numeric type,
with the additional invariant that the values are never zero.
|
|
Synopsis |
|
|
|
Documentation |
|
baseMap :: (FreeModule x, FreeModule y, Coeff x ~ Coeff y) => (Base x -> Base y) -> x -> y |
generic baseMap implementation, converts to list and back.
|
|
coeffMap :: (FreeModule x, FreeModule y, Base x ~ Base y) => (Coeff x -> Coeff y) -> x -> y |
generic coeffMap implementation, converts to list and back.
|
|
class (Ord (Base a), Num (Coeff a)) => FreeModule a where |
| Associated Types | type Base a :: * | | type Coeff a :: * |
| | Methods | isZero :: a -> Bool | | zero :: a | | fromBase :: Base a -> a | | fromTerm :: Base a -> Coeff a -> a | | (^+^) :: a -> a -> a | | (^-^) :: a -> a -> a | | neg :: a -> a | | scalarMul :: Coeff a -> a -> a | | unionWith :: (Coeff a -> Coeff a -> Coeff a) -> a -> a -> a | We should call the function even when the given base is present
only in one of the arguments! So that unionWith (-) works correctly.
| | coeff :: a -> Base a -> Coeff a | | size :: a -> Int | | minTerm :: a -> (Base a, Coeff a) | | maxTerm :: a -> (Base a, Coeff a) | | split :: a -> (a, a) | split into two approximately equal parts x and y, such that
maxTerm x < minTerm y
| | unsafeJoin :: a -> a -> a | we assume that maxTerm x < minTerm y
| | toList :: a -> [(Base a, Coeff a)] | | fromList :: [(Base a, Coeff a)] -> a | | fromAscendingList :: [(Base a, Coeff a)] -> a |
| | Instances | |
|
|
(*^) :: FreeModule a => Coeff a -> a -> a |
|
(^*) :: FreeModule a => a -> Coeff a -> a |
|
minTermMaybe :: FreeModule a => a -> Maybe (Base a, Coeff a) |
|
maxTermMaybe :: FreeModule a => a -> Maybe (Base a, Coeff a) |
|
Produced by Haddock version 2.4.1 |