what4-1.1: Solver-agnostic symbolic values support for issuing queries
Copyright(c) Galois Inc 2014-2020
LicenseBSD3
MaintainerJoe Hendrix <jhendrix@galois.com>
Stabilityprovisional
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

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 #

(<$) :: a -> Complex b -> Complex a #

Foldable Complex Source # 
Instance details

Defined in What4.Utils.Complex

Methods

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

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

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

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

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

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

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

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

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

toList :: Complex a -> [a] #

null :: Complex a -> Bool #

length :: Complex a -> Int #

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

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

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

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

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

Traversable Complex Source # 
Instance details

Defined in What4.Utils.Complex

Methods

traverse :: Applicative f => (a -> f b) -> Complex a -> f (Complex b) #

sequenceA :: Applicative f => Complex (f a) -> f (Complex a) #

mapM :: Monad m => (a -> m b) -> Complex a -> m (Complex b) #

sequence :: Monad m => Complex (m a) -> m (Complex a) #

Eq a => Eq (Complex a) Source # 
Instance details

Defined in What4.Utils.Complex

Methods

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

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

RealFloat a => Floating (Complex a) Source # 
Instance details

Defined in What4.Utils.Complex

Methods

pi :: Complex a #

exp :: Complex a -> Complex a #

log :: Complex a -> Complex a #

sqrt :: Complex a -> Complex a #

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

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

sin :: Complex a -> Complex a #

cos :: Complex a -> Complex a #

tan :: Complex a -> Complex a #

asin :: Complex a -> Complex a #

acos :: Complex a -> Complex a #

atan :: Complex a -> Complex a #

sinh :: Complex a -> Complex a #

cosh :: Complex a -> Complex a #

tanh :: Complex a -> Complex a #

asinh :: Complex a -> Complex a #

acosh :: Complex a -> Complex a #

atanh :: Complex a -> Complex a #

log1p :: Complex a -> Complex a #

expm1 :: Complex a -> Complex a #

log1pexp :: Complex a -> Complex a #

log1mexp :: Complex a -> Complex a #

Floating a => Fractional (Complex a) Source # 
Instance details

Defined in What4.Utils.Complex

Methods

(/) :: Complex a -> Complex a -> Complex a #

recip :: Complex a -> Complex a #

fromRational :: Rational -> Complex a #

Floating a => Num (Complex a) Source # 
Instance details

Defined in What4.Utils.Complex

Methods

(+) :: Complex a -> Complex a -> Complex a #

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

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

negate :: Complex a -> Complex a #

abs :: Complex a -> Complex a #

signum :: Complex a -> Complex a #

fromInteger :: Integer -> Complex a #

Ord a => Ord (Complex a) Source # 
Instance details

Defined in What4.Utils.Complex

Methods

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

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

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

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

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

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

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

(Ord a, Floating a) => Real (Complex a) Source # 
Instance details

Defined in What4.Utils.Complex

Methods

toRational :: Complex a -> Rational #

(Ord a, Floating a) => RealFrac (Complex a) Source # 
Instance details

Defined in What4.Utils.Complex

Methods

properFraction :: Integral b => Complex a -> (b, Complex a) #

truncate :: Integral b => Complex a -> b #

round :: Integral b => Complex a -> b #

ceiling :: Integral b => Complex a -> b #

floor :: Integral b => Complex a -> b #

(Eq a, Num a, Show a) => Show (Complex a) Source # 
Instance details

Defined in What4.Utils.Complex

Methods

showsPrec :: Int -> Complex a -> ShowS #

show :: Complex a -> String #

showList :: [Complex a] -> ShowS #

Generic (Complex a) Source # 
Instance details

Defined in What4.Utils.Complex

Associated Types

type Rep (Complex a) :: Type -> Type #

Methods

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

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

Hashable a => Hashable (Complex a) Source # 
Instance details

Defined in What4.Utils.Complex

Methods

hashWithSalt :: Int -> Complex a -> Int #

hash :: Complex a -> Int #

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) #

polyEq :: Complex x -> Complex y -> Bool #

type Rep (Complex a) Source # 
Instance details

Defined in What4.Utils.Complex

type Rep (Complex a) = D1 ('MetaData "Complex" "What4.Utils.Complex" "what4-1.1-F6JmVDCUG2e4tsAmUzrLc2" '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)))

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

Returns square of magnitude.

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