| NumericPrelude-0.0: An experimental alternative hierarchy of numeric type classes | Contents | Index |
|
Number.Physical.UnitDatabase | Portability | portable | Stability | provisional | Maintainer | numericprelude@henning-thielemann.de |
|
|
|
|
|
Description |
Tools for creating a data base of physical units
and for extracting data from it
|
|
Synopsis |
|
type T i a = [UnitSet i a] | | data InitUnitSet i a = InitUnitSet {} | | data InitScale a = InitScale {} | | data UnitSet i a = UnitSet {} | | data Scale a = Scale {} | | extractOne :: [a] -> a | | initScale :: String -> a -> Bool -> Bool -> InitScale a | | initUnitSet :: T i -> Bool -> [InitScale a] -> InitUnitSet i a | | createScale :: InitScale a -> Scale a | | createUnitSet :: InitUnitSet i a -> UnitSet i a | | showableUnit :: InitUnitSet i a -> Maybe (InitUnitSet i a) | | powerOfUnitSet :: (Ord i, C a) => Int -> UnitSet i a -> UnitSet i a | | powerOfScale :: C a => Int -> Scale a -> Scale a | | showExp :: Int -> String | | positiveToFront :: [UnitSet i a] -> [UnitSet i a] | | decompose :: (Ord i, C a) => T i -> T i a -> [UnitSet i a] | | findIndep :: Eq i => T i -> T i a -> Maybe (UnitSet i a) | | findClosest :: (Ord i, C a) => T i -> T i a -> UnitSet i a | | evalDist :: (Ord i, C a) => T i -> T i a -> [(UnitSet i a, Int)] | | findBestExp :: Ord i => T i -> T i -> (Int, Int) | | findMinExp :: [(Int, Int)] -> (Int, Int) | | distLE :: (Int, Int) -> (Int, Int) -> Bool | | distances :: Ord i => T i -> [(Int, T i)] -> [(Int, Int)] | | listMultiples :: (T i -> T i) -> Int -> [(Int, T i)] |
|
|
Documentation |
|
type T i a = [UnitSet i a] |
|
data InitUnitSet i a |
|
|
data InitScale a |
|
|
data UnitSet i a |
An entry for a unit and there scalings.
| Constructors | UnitSet | | unit :: (T i) | | independent :: Bool | | defScaleIx :: Int | | reciprocal :: Bool | If True the symbols must be preceded with a /.
Though it sounds like an attribute of Scale
it must be the same for all scales and we need it
to sort positive powered unitsets to the front
of the list of unit components.
| scales :: [Scale a] | |
|
| Instances | |
|
|
data Scale a |
A common scaling for a unit.
| Constructors | Scale | | symbol :: String | | magnitude :: a | |
|
| Instances | |
|
|
extractOne :: [a] -> a |
|
initScale :: String -> a -> Bool -> Bool -> InitScale a |
|
initUnitSet :: T i -> Bool -> [InitScale a] -> InitUnitSet i a |
|
createScale :: InitScale a -> Scale a |
|
createUnitSet :: InitUnitSet i a -> UnitSet i a |
|
showableUnit :: InitUnitSet i a -> Maybe (InitUnitSet i a) |
|
powerOfUnitSet :: (Ord i, C a) => Int -> UnitSet i a -> UnitSet i a |
Raise all scales of a unit and the unit itself to the n-th power
|
|
powerOfScale :: C a => Int -> Scale a -> Scale a |
|
showExp :: Int -> String |
|
positiveToFront :: [UnitSet i a] -> [UnitSet i a] |
Reorder the unit components in a way
that the units with positive exponents lead the list.
|
|
decompose :: (Ord i, C a) => T i -> T i a -> [UnitSet i a] |
Decompose a complex unit into common ones
|
|
findIndep :: Eq i => T i -> T i a -> Maybe (UnitSet i a) |
|
findClosest :: (Ord i, C a) => T i -> T i a -> UnitSet i a |
|
evalDist |
:: (Ord i, C a) | | => T i | | -> T i a | | -> [(UnitSet i a, Int)] | (UnitSet,distance) the UnitSet may contain powered units
|
|
|
findBestExp :: Ord i => T i -> T i -> (Int, Int) |
|
findMinExp :: [(Int, Int)] -> (Int, Int) |
Find the exponent that lead to minimal distance
Since the list is infinite maximum will fail
but the sequence is convex
and thus we can abort when the distance stop falling
|
|
distLE :: (Int, Int) -> (Int, Int) -> Bool |
|
distances :: Ord i => T i -> [(Int, T i)] -> [(Int, Int)] |
|
listMultiples :: (T i -> T i) -> Int -> [(Int, T i)] |
|
Produced by Haddock version 0.7 |