accelerate-1.3.0.0: An embedded language for accelerated array processing

Copyright[2015..2020] The Accelerate Team
LicenseBSD3
MaintainerTrevor L. McDonell <trevor.mcdonell@gmail.com>
Stabilityexperimental
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Data.Array.Accelerate.Data.Complex

Contents

Description

Complex numbers, stored in the usual C-style array-of-struct representation, for easy interoperability.

Synopsis

Rectangular from

data Complex a #

Complex numbers are an algebraic type.

For a complex number z, abs z is a number with the magnitude of z, but oriented in the positive real direction, whereas signum z has the phase of z, but unit magnitude.

The Foldable and Traversable instances traverse the real part first.

Note that Complex's instances inherit the deficiencies from the type parameter's. For example, Complex Float's Ord instance has similar problems to Float's.

Constructors

!a :+ !a infix 6

forms a complex number from its real and imaginary rectangular components.

Instances
Monad Complex

Since: base-4.9.0.0

Instance details

Defined in Data.Complex

Methods

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

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

return :: a -> Complex a #

fail :: String -> Complex a #

Functor Complex

Since: base-4.9.0.0

Instance details

Defined in Data.Complex

Methods

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

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

Applicative Complex

Since: base-4.9.0.0

Instance details

Defined in Data.Complex

Methods

pure :: a -> Complex a #

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

liftA2 :: (a -> b -> c) -> Complex a -> Complex b -> Complex c #

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

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

Foldable Complex

Since: base-4.9.0.0

Instance details

Defined in Data.Complex

Methods

fold :: Monoid m => Complex m -> 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

Since: base-4.9.0.0

Instance details

Defined in Data.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) #

Representable Complex 
Instance details

Defined in Data.Functor.Rep

Associated Types

type Rep Complex :: Type #

Methods

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

index :: Complex a -> Rep Complex -> a #

Hashable1 Complex 
Instance details

Defined in Data.Hashable.Class

Methods

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

Traversable1 Complex 
Instance details

Defined in Data.Semigroup.Traversable.Class

Methods

traverse1 :: Apply f => (a -> f b) -> Complex a -> f (Complex b) #

sequence1 :: Apply f => Complex (f b) -> f (Complex b) #

Functor Complex Source #

Since: 1.2.0.0

Instance details

Defined in Data.Array.Accelerate.Data.Complex

Methods

fmap :: (Elt a, Elt b, Elt (Complex a), Elt (Complex b)) => (Exp a -> Exp b) -> Exp (Complex a) -> Exp (Complex b) Source #

(<$) :: (Elt a, Elt b, Elt (Complex a), Elt (Complex b)) => Exp a -> Exp (Complex b) -> Exp (Complex a) Source #

Unbox a => Vector Vector (Complex a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Unbox a => MVector MVector (Complex a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Elt a => Unlift Exp (Complex (Exp a)) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Complex

Methods

unlift :: Exp (Plain (Complex (Exp a))) -> Complex (Exp a) Source #

(Lift Exp a, Elt (Plain a)) => Lift Exp (Complex a) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Complex

Associated Types

type Plain (Complex a) :: Type Source #

Methods

lift :: Complex a -> Exp (Plain (Complex a)) Source #

(FromIntegral a b, Num b, Elt (Complex b)) => FromIntegral a (Complex b) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Complex

Methods

fromIntegral :: Exp a -> Exp (Complex b) Source #

Eq a => Eq (Complex a)

Since: base-2.1

Instance details

Defined in Data.Complex

Methods

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

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

RealFloat a => Floating (Complex a)

Since: base-2.1

Instance details

Defined in Data.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 #

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

Defined in Data.Array.Accelerate.Data.Complex

Methods

pi :: Exp (Complex a) #

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

RealFloat a => Fractional (Complex a)

Since: base-2.1

Instance details

Defined in Data.Complex

Methods

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

recip :: Complex a -> Complex a #

fromRational :: Rational -> Complex a #

RealFloat a => Fractional (Exp (Complex a)) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Complex

Methods

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

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

fromRational :: Rational -> Exp (Complex a) #

Data a => Data (Complex a)

Since: base-2.1

Instance details

Defined in Data.Complex

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Complex a -> c (Complex a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Complex a) #

toConstr :: Complex a -> Constr #

dataTypeOf :: Complex a -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Complex a)) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Complex a)) #

gmapT :: (forall b. Data b => b -> b) -> Complex a -> Complex a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Complex a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Complex a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Complex a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Complex a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Complex a -> m (Complex a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Complex a -> m (Complex a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Complex a -> m (Complex a) #

RealFloat a => Num (Complex a)

Since: base-2.1

Instance details

Defined in Data.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 #

RealFloat a => Num (Exp (Complex a)) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Complex

Methods

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

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

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

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

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

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

fromInteger :: Integer -> Exp (Complex a) #

Read a => Read (Complex a)

Since: base-2.1

Instance details

Defined in Data.Complex

Show a => Show (Complex a)

Since: base-2.1

Instance details

Defined in Data.Complex

Methods

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

show :: Complex a -> String #

showList :: [Complex a] -> ShowS #

Generic (Complex a) 
Instance details

Defined in Data.Complex

Associated Types

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

Methods

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

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

Storable a => Storable (Complex a)

Since: base-4.8.0.0

Instance details

Defined in Data.Complex

Methods

sizeOf :: Complex a -> Int #

alignment :: Complex a -> Int #

peekElemOff :: Ptr (Complex a) -> Int -> IO (Complex a) #

pokeElemOff :: Ptr (Complex a) -> Int -> Complex a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (Complex a) #

pokeByteOff :: Ptr b -> Int -> Complex a -> IO () #

peek :: Ptr (Complex a) -> IO (Complex a) #

poke :: Ptr (Complex a) -> Complex a -> IO () #

NFData a => NFData (Complex a) 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Complex a -> () #

Hashable a => Hashable (Complex a) 
Instance details

Defined in Data.Hashable.Class

Methods

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

hash :: Complex a -> Int #

Unbox a => Unbox (Complex a) 
Instance details

Defined in Data.Vector.Unboxed.Base

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

Defined in Data.Array.Accelerate.Data.Complex

Associated Types

type EltR (Complex a) :: Type

Methods

eltR :: TypeR (EltR (Complex a))

tagsR :: [TagR (EltR (Complex a))]

fromElt :: Complex a -> EltR (Complex a)

toElt :: EltR (Complex a) -> Complex a

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

Defined in Data.Array.Accelerate.Data.Complex

Methods

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

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

Generic1 Complex 
Instance details

Defined in Data.Complex

Associated Types

type Rep1 Complex :: k -> Type #

Methods

from1 :: Complex a -> Rep1 Complex a #

to1 :: Rep1 Complex a -> Complex a #

Each (Complex a) (Complex b) a b
each :: (RealFloat a, RealFloat b) => Traversal (Complex a) (Complex b) a b
Instance details

Defined in Control.Lens.Each

Methods

each :: Traversal (Complex a) (Complex b) a b #

type Rep Complex 
Instance details

Defined in Data.Functor.Rep

newtype MVector s (Complex a) 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype MVector s (Complex a) = MV_Complex (MVector s (a, a))
type Rep (Complex a)

Since: base-4.9.0.0

Instance details

Defined in Data.Complex

newtype Vector (Complex a) 
Instance details

Defined in Data.Vector.Unboxed.Base

newtype Vector (Complex a) = V_Complex (Vector (a, a))
type Index (Complex a) 
Instance details

Defined in Control.Lens.At

type Index (Complex a) = Int
type Plain (Complex a) Source # 
Instance details

Defined in Data.Array.Accelerate.Data.Complex

type Plain (Complex a) = Complex (Plain a)
type Rep1 Complex

Since: base-4.9.0.0

Instance details

Defined in Data.Complex

pattern (::+) :: Elt a => Exp a -> Exp a -> Exp (Complex a) infix 6 Source #

real :: Elt a => Exp (Complex a) -> Exp a Source #

Return the real part of a complex number

imag :: Elt a => Exp (Complex a) -> Exp a Source #

Return the imaginary part of a complex number

Polar form

mkPolar :: forall a. Floating a => Exp a -> Exp a -> Exp (Complex a) Source #

Form a complex number from polar components of magnitude and phase.

cis :: forall a. Floating a => Exp a -> Exp (Complex a) Source #

cis t is a complex value with magnitude 1 and phase t (modulo 2*pi).

polar :: RealFloat a => Exp (Complex a) -> Exp (a, a) Source #

The function polar takes a complex number and returns a (magnitude, phase) pair in canonical form: the magnitude is non-negative, and the phase in the range (-pi, pi]; if the magnitude is zero, then so is the phase.

magnitude :: RealFloat a => Exp (Complex a) -> Exp a Source #

The non-negative magnitude of a complex number

magnitude' :: RealFloat a => Exp (Complex a) -> Exp a Source #

As magnitude, but ignore floating point rounding and use the traditional (simpler to evaluate) definition.

Since: 1.3.0.0

phase :: RealFloat a => Exp (Complex a) -> Exp a Source #

The phase of a complex number, in the range (-pi, pi]. If the magnitude is zero, then so is the phase.

Conjugate

conjugate :: Num a => Exp (Complex a) -> Exp (Complex a) Source #

Return the complex conjugate of a complex number, defined as

conjugate(Z) = X - iY

Orphan instances

Functor Complex Source #

Since: 1.2.0.0

Instance details

Methods

fmap :: (Elt a, Elt b, Elt (Complex a), Elt (Complex b)) => (Exp a -> Exp b) -> Exp (Complex a) -> Exp (Complex b) Source #

(<$) :: (Elt a, Elt b, Elt (Complex a), Elt (Complex b)) => Exp a -> Exp (Complex b) -> Exp (Complex a) Source #

Elt a => Unlift Exp (Complex (Exp a)) Source # 
Instance details

Methods

unlift :: Exp (Plain (Complex (Exp a))) -> Complex (Exp a) Source #

(Lift Exp a, Elt (Plain a)) => Lift Exp (Complex a) Source # 
Instance details

Associated Types

type Plain (Complex a) :: Type Source #

Methods

lift :: Complex a -> Exp (Plain (Complex a)) Source #

(FromIntegral a b, Num b, Elt (Complex b)) => FromIntegral a (Complex b) Source # 
Instance details

Methods

fromIntegral :: Exp a -> Exp (Complex b) Source #

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

Methods

pi :: Exp (Complex a) #

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

RealFloat a => Fractional (Exp (Complex a)) Source # 
Instance details

Methods

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

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

fromRational :: Rational -> Exp (Complex a) #

RealFloat a => Num (Exp (Complex a)) Source # 
Instance details

Methods

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

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

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

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

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

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

fromInteger :: Integer -> Exp (Complex a) #

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

Associated Types

type EltR (Complex a) :: Type

Methods

eltR :: TypeR (EltR (Complex a))

tagsR :: [TagR (EltR (Complex a))]

fromElt :: Complex a -> EltR (Complex a)

toElt :: EltR (Complex a) -> Complex a

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

Methods

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

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