what4-1.6.3: Solver-agnostic symbolic values support for issuing queries

Copyright | (c) Galois Inc 2014-2020
License | BSD3
Maintainer | Joe Hendrix <jhendrix@galois.com>
Stability | provisional
Safe Haskell | Safe-Inferred
Language | Haskell2010

What4.Utils.Complex

Description

This module provides complex numbers without the RealFloat constraints that Data.Complex has. This is useful for representing various intermediate symbolic representations of complex numbers that are not literally number representations.

Synopsis

- data Complex a = !a :+ !a
- realPart :: Complex a -> a
- imagPart :: Complex a -> a
- magnitude :: Floating a => Complex a -> a
- magnitudeSq :: Num a => Complex a -> a
- complexNegate :: Num a => Complex a -> Complex a
- complexAdd :: Num a => Complex a -> Complex a -> Complex a
- complexSub :: Num a => Complex a -> Complex a -> Complex a
- complexMul :: Num a => Complex a -> Complex a -> Complex a
- complexDiv :: Fractional a => Complex a -> Complex a -> Complex a
- complexRecip :: Fractional a => Complex a -> Complex a
- tryComplexSqrt :: (Ord a, Fractional a, Monad m) => (a -> m a) -> Complex a -> m (Complex a)
- tryMagnitude :: Num a => (a -> b) -> Complex a -> b
- complexAsRational :: Complex Rational -> Maybe Rational

# Documentation

data Complex a Source #

A complex pair over an arbitrary type.

Constructors

!a :+ !a infix 6 |

#### Instances

Instances details

Functor Complex Source # |
Instance details Defined in What4.Utils.Complex Methods fmap :: (a -> b) -> Complex a -> Complex b Source # (<$) :: a -> Complex b -> Complex a Source #
Foldable Complex Source # |

Instance details

Defined in What4.Utils.Complex

Methods

fold :: Monoid m => Complex m -> m Source #

foldMap :: Monoid m => (a -> m) -> Complex a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Complex a -> m Source #

foldr :: (a -> b -> b) -> b -> Complex a -> b Source #

foldr' :: (a -> b -> b) -> b -> Complex a -> b Source #

foldl :: (b -> a -> b) -> b -> Complex a -> b Source #

foldl' :: (b -> a -> b) -> b -> Complex a -> b Source #

foldr1 :: (a -> a -> a) -> Complex a -> a Source #

foldl1 :: (a -> a -> a) -> Complex a -> a Source #

toList :: Complex a -> [a] Source #

null :: Complex a -> Bool Source #

length :: Complex a -> Int Source #

elem :: Eq a => a -> Complex a -> Bool Source #

maximum :: Ord a => Complex a -> a Source #

minimum :: Ord a => Complex a -> a Source #

sum :: Num a => Complex a -> a Source #

product :: Num a => Complex a -> a Source #

Traversable Complex Source # |
Instance details Defined in What4.Utils.Complex Methods traverse :: Applicative f => (a -> f b) -> Complex a -> f (Complex b) Source # sequenceA :: Applicative f => Complex (f a) -> f (Complex a) Source # mapM :: Monad m => (a -> m b) -> Complex a -> m (Complex b) Source # sequence :: Monad m => Complex (m a) -> m (Complex a) Source #
RealFloat a => Floating (Complex a) Source # |

Instance details

Defined in What4.Utils.Complex

Methods

pi :: Complex a Source #

exp :: Complex a -> Complex a Source #

log :: Complex a -> Complex a Source #

sqrt :: Complex a -> Complex a Source #

(**) :: Complex a -> Complex a -> Complex a Source #

logBase :: Complex a -> Complex a -> Complex a Source #

sin :: Complex a -> Complex a Source #

cos :: Complex a -> Complex a Source #

tan :: Complex a -> Complex a Source #

asin :: Complex a -> Complex a Source #

acos :: Complex a -> Complex a Source #

atan :: Complex a -> Complex a Source #

sinh :: Complex a -> Complex a Source #

cosh :: Complex a -> Complex a Source #

tanh :: Complex a -> Complex a Source #

asinh :: Complex a -> Complex a Source #

acosh :: Complex a -> Complex a Source #

atanh :: Complex a -> Complex a Source #

log1p :: Complex a -> Complex a Source #

expm1 :: Complex a -> Complex a Source #

log1pexp :: Complex a -> Complex a Source #

log1mexp :: Complex a -> Complex a Source #

Generic (Complex a) Source # |

Instance details

Defined in What4.Utils.Complex

Associated Types

type Rep (Complex a) |

Instance details

Defined in What4.Utils.Complex

type Rep (Complex a) = D1 ('MetaData "Complex" "What4.Utils.Complex" "what4-1.6.3-9uBVkRxr1Ru1evGDxWAmM9" 'False) (C1 ('MetaCons ":+" ('InfixI 'NotAssociative 6) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)))

Methods

from :: Complex a -> Rep (Complex a) x Source #

to :: Rep (Complex a) x -> Complex a Source #

Floating a => Num (Complex a) Source # |
Instance details Defined in What4.Utils.Complex Methods (+) :: Complex a -> Complex a -> Complex a Source # (-) :: Complex a -> Complex a -> Complex a Source # (*) :: Complex a -> Complex a -> Complex a Source # negate :: Complex a -> Complex a Source # abs :: Complex a -> Complex a Source # signum :: Complex a -> Complex a Source # fromInteger :: Integer -> Complex a Source #
Floating a => Fractional (Complex a) Source # |
Instance details Defined in What4.Utils.Complex Methods (/) :: Complex a -> Complex a -> Complex a Source # recip :: Complex a -> Complex a Source # fromRational :: Rational -> Complex a Source #
(Ord a, Floating a) => Real (Complex a) Source # |
Instance details Defined in What4.Utils.Complex Methods toRational :: Complex a -> Rational Source #
(Ord a, Floating a) => RealFrac (Complex a) Source # |
Instance details Defined in What4.Utils.Complex Methods properFraction :: Integral b => Complex a -> (b, Complex a) Source # truncate :: Integral b => Complex a -> b Source # round :: Integral b => Complex a -> b Source # ceiling :: Integral b => Complex a -> b Source # floor :: Integral b => Complex a -> b Source #
(Eq a, Num a, Show a) => Show (Complex a) Source # |
Instance details Defined in What4.Utils.Complex Methods showsPrec :: Int -> Complex a -> ShowS Source # show :: Complex a -> String Source # showList :: [Complex a] -> ShowS Source #
Eq a => Eq (Complex a) Source # |
Instance details Defined in What4.Utils.Complex Methods (==) :: Complex a -> Complex a -> Bool Source # (/=) :: Complex a -> Complex a -> Bool Source #
Ord a => Ord (Complex a) Source # |

Instance details

Defined in What4.Utils.Complex

Methods

compare :: Complex a -> Complex a -> Ordering Source #

(<) :: Complex a -> Complex a -> Bool Source #

(<=) :: Complex a -> Complex a -> Bool Source #

(>) :: Complex a -> Complex a -> Bool Source #

(>=) :: Complex a -> Complex a -> Bool Source #

max :: Complex a -> Complex a -> Complex a Source #

min :: Complex a -> Complex a -> Complex a Source #

Hashable a => Hashable (Complex a) Source # |
Instance details Defined in What4.Utils.Complex Methods hashWithSalt :: Int -> Complex a -> Int Source # hash :: Complex a -> Int Source #
PolyEq x y => PolyEq (Complex x) (Complex y) Source # |
Instance details Defined in What4.Utils.Complex Methods polyEqF :: Complex x -> Complex y -> Maybe (Complex x :~: Complex y) Source # polyEq :: Complex x -> Complex y -> Bool Source #
type Rep (Complex a) Source # |

Instance details

Defined in What4.Utils.Complex

type Rep (Complex a) = D1 ('MetaData "Complex" "What4.Utils.Complex" "what4-1.6.3-9uBVkRxr1Ru1evGDxWAmM9" 'False) (C1 ('MetaCons ":+" ('InfixI 'NotAssociative 6) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)))

realPart :: Complex a -> a Source #

imagPart :: Complex a -> a Source #

magnitude :: Floating a => Complex a -> a Source #

magnitudeSq :: Num a => Complex a -> a Source #

Returns square of magnitude.

complexNegate :: Num a => Complex a -> Complex a Source #

complexAdd :: Num a => Complex a -> Complex a -> Complex a Source #

complexSub :: Num a => Complex a -> Complex a -> Complex a Source #

complexMul :: Num a => Complex a -> Complex a -> Complex a Source #

complexDiv :: Fractional a => Complex a -> Complex a -> Complex a Source #

complexRecip :: Fractional a => Complex a -> Complex a Source #

tryComplexSqrt Source #

Arguments

:: (Ord a, Fractional a, Monad m) |
=> (a -> m a) | Square-root function defined for non-negative values a.
-> Complex a |
-> m (Complex a) |

tryMagnitude Source #

Arguments

:: Num a |
=> (a -> b) | Sqrt function
-> Complex a |
-> b |

complexAsRational :: Complex Rational -> Maybe Rational Source #