Copyright | (c) 2015-2019 Frederick Schneider |
---|---|
License | MIT |
Maintainer | Frederick Schneider <fws.nyc@gmail.com> |
Stability | Provisional |
Safe Haskell | None |
Language | Haskell2010 |
This a wrapper for the Canonical Representation type found in the Internals module. If you want to work with arbitrarily nested prime towers, you can use the Math.NumberTheory.Canon module.
Synopsis
- newtype SimpleCanon = MakeSC CR_
- type SC = SimpleCanon
- toSimpleCanon :: CanonConv a => a -> SimpleCanon
- toSC :: CanonConv c => c -> SimpleCanon
- toSimpleCanonViaUserFunc :: CR_ -> (Integer -> Bool) -> SimpleCanon
- fromSimpleCanon :: SimpleCanon -> CR_
- fromSC :: SimpleCanon -> CR_
- class CanonConv c
- scGCD :: SimpleCanon -> SimpleCanon -> SimpleCanon
- scLCM :: SimpleCanon -> SimpleCanon -> SimpleCanon
- scLog :: SimpleCanon -> Rational
- scLogDouble :: SimpleCanon -> Double
- scNegative :: SimpleCanon -> Bool
- scPositive :: SimpleCanon -> Bool
- scToInteger :: SimpleCanon -> Integer
- scToI :: SimpleCanon -> Integer
- newtype RationalSimpleCanon = MakeRC CR_
- type RC = RationalSimpleCanon
- toRationalSimpleCanon :: CanonConv a => a -> RationalSimpleCanon
- toRC :: CanonConv c => c -> RationalSimpleCanon
- toRationalSimpleCanonViaUserFunc :: CR_ -> (Integer -> Bool) -> RationalSimpleCanon
- fromRationalSimpleCanon :: RationalSimpleCanon -> CR_
- fromRC :: RationalSimpleCanon -> CR_
- rcNegative :: RationalSimpleCanon -> Bool
- rcPositive :: RationalSimpleCanon -> Bool
- getNumer :: RationalSimpleCanon -> SimpleCanon
- getDenom :: RationalSimpleCanon -> SimpleCanon
- getNumerDenom :: RationalSimpleCanon -> (SimpleCanon, SimpleCanon)
- getNumerAsRC :: RationalSimpleCanon -> RationalSimpleCanon
- getDenomAsRC :: RationalSimpleCanon -> RationalSimpleCanon
- getNumerDenomAsRCs :: RationalSimpleCanon -> (RationalSimpleCanon, RationalSimpleCanon)
- rcLog :: RationalSimpleCanon -> Rational
- rcLogDouble :: RationalSimpleCanon -> Double
- (>^) :: SimpleCanonRoot a b c => a -> b -> c
- (<^) :: SimpleCanonExpnt a b c => a -> b -> c
- (%) :: Integral a => a -> a -> a
- class SimpleCanonRoot a b c | a b -> c
- class SimpleCanonExpnt a b c | a b -> c
Documentation
newtype SimpleCanon Source #
SimpleCanon is a new type wrapping a canonical representation.
Instances
type SC = SimpleCanon Source #
Shorthand type declaration
toSimpleCanon :: CanonConv a => a -> SimpleCanon Source #
Convert CanonConv types to SimpleCanon.
toSC :: CanonConv c => c -> SimpleCanon Source #
Convert a type to a SimpleCanon.
toSimpleCanonViaUserFunc :: CR_ -> (Integer -> Bool) -> SimpleCanon Source #
This function allow you to specify a user function when converting a canon rep to an SC.
fromSimpleCanon :: SimpleCanon -> CR_ Source #
Grab the canon rep from a SimpleCanon.
fromSC :: SimpleCanon -> CR_ Source #
Grab the canon rep from a SimpleCanon.
Typeclass for converting to SimpleCanon and RationalSimpleCanon
Instances
CanonConv CR_ Source # | |
Defined in Math.NumberTheory.Canon.Simple toSC :: CR_ -> SimpleCanon Source # toRC :: CR_ -> RationalSimpleCanon Source # | |
CanonConv RationalSimpleCanon Source # | |
Defined in Math.NumberTheory.Canon.Simple | |
CanonConv SimpleCanon Source # | |
Defined in Math.NumberTheory.Canon.Simple toSC :: SimpleCanon -> SimpleCanon Source # | |
CanonConv Canon Source # | Instance of CanonConv class |
Defined in Math.NumberTheory.Canon toSC :: Canon -> SimpleCanon Source # toRC :: Canon -> RationalSimpleCanon Source # |
scGCD :: SimpleCanon -> SimpleCanon -> SimpleCanon Source #
SimpleCanon GCD and LCM functions
scLCM :: SimpleCanon -> SimpleCanon -> SimpleCanon Source #
SimpleCanon GCD and LCM functions
scLog :: SimpleCanon -> Rational Source #
Wrapper for underlying CR function
scLogDouble :: SimpleCanon -> Double Source #
Wrapper for underlying CR function
scNegative :: SimpleCanon -> Bool Source #
Wrappers for underlying canon rep functions
scPositive :: SimpleCanon -> Bool Source #
Wrappers for underlying canon rep functions
scToInteger :: SimpleCanon -> Integer Source #
Convert a SimpleCanon back to an Integer.
scToI :: SimpleCanon -> Integer Source #
Convert a SimpleCanon back to an Integer.
newtype RationalSimpleCanon Source #
Newtype for RationalSimpleCanon. The underlying canon rep is the same.
Instances
type RC = RationalSimpleCanon Source #
Shorthand type name
toRationalSimpleCanon :: CanonConv a => a -> RationalSimpleCanon Source #
Convert CanonConv types to RationalSimpleCanon.
toRC :: CanonConv c => c -> RationalSimpleCanon Source #
Convert a type to a RationalSimpleCanon.
toRationalSimpleCanonViaUserFunc :: CR_ -> (Integer -> Bool) -> RationalSimpleCanon Source #
Convert canon rep to RationalSimpleCanon via a user-supplied criterion function.
fromRationalSimpleCanon :: RationalSimpleCanon -> CR_ Source #
Convert RC back to underlying canon rep.
fromRC :: RationalSimpleCanon -> CR_ Source #
Convert RC back to underlying canon rep.
rcNegative :: RationalSimpleCanon -> Bool Source #
Wraps underlying canon rep functions.
rcPositive :: RationalSimpleCanon -> Bool Source #
Wraps underlying canon rep functions.
getNumer :: RationalSimpleCanon -> SimpleCanon Source #
Pulls numerator or denominator from RC and converts it to a SimpleCanon.
getDenom :: RationalSimpleCanon -> SimpleCanon Source #
Pulls numerator or denominator from RC and converts it to a SimpleCanon.
getNumerDenom :: RationalSimpleCanon -> (SimpleCanon, SimpleCanon) Source #
Wraps crSplit function and returns a pair of SimpleCanons.
getNumerAsRC :: RationalSimpleCanon -> RationalSimpleCanon Source #
Calls underlying canon rep function.
getDenomAsRC :: RationalSimpleCanon -> RationalSimpleCanon Source #
Calls underlying canon rep function.
getNumerDenomAsRCs :: RationalSimpleCanon -> (RationalSimpleCanon, RationalSimpleCanon) Source #
Wraps crSplit function and returns a pair of RationalSimpleCanons.
rcLog :: RationalSimpleCanon -> Rational Source #
Calls underlying canon rep function.
rcLogDouble :: RationalSimpleCanon -> Double Source #
Calls underlying canon rep function.
(>^) :: SimpleCanonRoot a b c => a -> b -> c infixr 9 Source #
Root Operator
(<^) :: SimpleCanonExpnt a b c => a -> b -> c infixr 9 Source #
Exponentiation Operator
class SimpleCanonRoot a b c | a b -> c Source #
Multi-param typeclass for radical/root operator
Instances
class SimpleCanonExpnt a b c | a b -> c Source #
Multi-param typeclass for exponentiation