Copyright | (c) Artem Chirkin |
---|---|
License | BSD3 |
Maintainer | chirkin@arch.ethz.ch |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- type family Array (t :: Type) (ds :: [Nat]) = (v :: Type) | v -> t ds where ...
- newtype ScalarBase t = ScalarBase {
- _unScalarBase :: t
- data ArrayBase (t :: Type) (ds :: [Nat]) = ArrayBase (#t | (#Int#, Int#, ByteArray##)#)
- class ArraySingleton (t :: Type) (ds :: [Nat]) where
- data ArraySing t (ds :: [Nat]) where
- AScalar :: Array t ds ~ ScalarBase t => ArraySing t '[]
- AF2 :: Array t ds ~ FloatX2 => ArraySing Float '[2]
- AF3 :: Array t ds ~ FloatX3 => ArraySing Float '[3]
- AF4 :: Array t ds ~ FloatX4 => ArraySing Float '[4]
- AD2 :: Array t ds ~ DoubleX2 => ArraySing Double '[2]
- AD3 :: Array t ds ~ DoubleX3 => ArraySing Double '[3]
- AD4 :: Array t ds ~ DoubleX4 => ArraySing Double '[4]
- ABase :: (Array t ds ~ ArrayBase t ds, PrimBytes t) => ArraySing t ds
- aSingEv :: ArraySing t ds -> Evidence (ArraySingleton t ds)
- inferASing :: forall t ds. (PrimBytes t, Dimensions ds) => Evidence (ArraySingleton t ds)
- inferPrimElem :: forall t d ds. ArraySingleton t (d ': ds) => Evidence (PrimBytes t)
- inferPrim :: forall t ds. (PrimBytes t, ArraySingleton t ds, Dimensions ds) => Evidence (PrimBytes (Array t ds), PrimArray t (Array t ds))
- inferEq :: forall t ds. (Eq t, ArraySingleton t ds) => Evidence (Eq (Array t ds))
- inferShow :: forall t ds. (Show t, Dimensions ds, ArraySingleton t ds) => Evidence (Show (Array t ds))
- inferOrd :: forall t ds. (Ord t, ArraySingleton t ds) => Evidence (Ord (Array t ds))
- inferNum :: forall t ds. (Num t, ArraySingleton t ds) => Evidence (Num (Array t ds))
- inferFractional :: forall t ds. (Fractional t, ArraySingleton t ds) => Evidence (Fractional (Array t ds))
- inferFloating :: forall t ds. (Floating t, ArraySingleton t ds) => Evidence (Floating (Array t ds))
Documentation
type family Array (t :: Type) (ds :: [Nat]) = (v :: Type) | v -> t ds where ... Source #
This type family aggregates all types used for arrays with different dimensioinality. The family is injective; thus, it is possible to get type family instance given the data constructor (and vice versa). If GHC knows the dimensionality of an array at compile time, it chooses a more efficient specialized instance of Array, e.g. Scalar newtype wrapper. Otherwise, it falls back to the generic ArrayBase implementation.
Data family would not work here, because it would give overlapping instances.
newtype ScalarBase t Source #
Specialize ScalarBase type without any arrays
ScalarBase | |
|
Instances
data ArrayBase (t :: Type) (ds :: [Nat]) Source #
Generic Array implementation.
This array can reside in plain ByteArray#
and can share the ByteArray#
with other arrays.
However, byte offset in the ByteArray#
must be multiple of the element size.
ArrayBase (#t | (#Int#, Int#, ByteArray##)#) |
Instances
class ArraySingleton (t :: Type) (ds :: [Nat]) where Source #
A framework for using Array type family instances.
Instances
(Array t ds ~ ArrayBase t ds, PrimBytes t) => ArraySingleton t ds Source # | |
Defined in Numeric.DataFrame.Internal.Array.Family | |
ArraySingleton t ([] :: [Nat]) Source # | |
Defined in Numeric.DataFrame.Internal.Array.Family | |
ArraySingleton Double (2 ': ([] :: [Nat])) Source # | |
ArraySingleton Double (3 ': ([] :: [Nat])) Source # | |
ArraySingleton Double (4 ': ([] :: [Nat])) Source # | |
ArraySingleton Float (2 ': ([] :: [Nat])) Source # | |
ArraySingleton Float (3 ': ([] :: [Nat])) Source # | |
ArraySingleton Float (4 ': ([] :: [Nat])) Source # | |
data ArraySing t (ds :: [Nat]) where Source #
AScalar :: Array t ds ~ ScalarBase t => ArraySing t '[] | |
AF2 :: Array t ds ~ FloatX2 => ArraySing Float '[2] | |
AF3 :: Array t ds ~ FloatX3 => ArraySing Float '[3] | |
AF4 :: Array t ds ~ FloatX4 => ArraySing Float '[4] | |
AD2 :: Array t ds ~ DoubleX2 => ArraySing Double '[2] | |
AD3 :: Array t ds ~ DoubleX3 => ArraySing Double '[3] | |
AD4 :: Array t ds ~ DoubleX4 => ArraySing Double '[4] | |
ABase :: (Array t ds ~ ArrayBase t ds, PrimBytes t) => ArraySing t ds |
Instances
Eq (ArraySing t ds) Source # | |
Ord (ArraySing t ds) Source # | |
Defined in Numeric.DataFrame.Internal.Array.Family compare :: ArraySing t ds -> ArraySing t ds -> Ordering # (<) :: ArraySing t ds -> ArraySing t ds -> Bool # (<=) :: ArraySing t ds -> ArraySing t ds -> Bool # (>) :: ArraySing t ds -> ArraySing t ds -> Bool # (>=) :: ArraySing t ds -> ArraySing t ds -> Bool # | |
Show (ArraySing t ds) Source # | |
aSingEv :: ArraySing t ds -> Evidence (ArraySingleton t ds) Source #
Use ArraySing
GADT to construct an ArraySingleton
dictionary.
In other words, bring an evidence of ArraySingleton
instance into
a scope at runtime.
inferASing :: forall t ds. (PrimBytes t, Dimensions ds) => Evidence (ArraySingleton t ds) Source #
Use ArraySing
GADT to construct an ArraySingleton
dictionary.
The same as aSingEv
, but relies on PrimBytes
and Dimensions
.
inferPrimElem :: forall t d ds. ArraySingleton t (d ': ds) => Evidence (PrimBytes t) Source #
This is a special function, because Scalar does not require PrimBytes. That is why the dimension list in the argument is not empty.
inferPrim :: forall t ds. (PrimBytes t, ArraySingleton t ds, Dimensions ds) => Evidence (PrimBytes (Array t ds), PrimArray t (Array t ds)) Source #
inferShow :: forall t ds. (Show t, Dimensions ds, ArraySingleton t ds) => Evidence (Show (Array t ds)) Source #
inferFractional :: forall t ds. (Fractional t, ArraySingleton t ds) => Evidence (Fractional (Array t ds)) Source #
inferFloating :: forall t ds. (Floating t, ArraySingleton t ds) => Evidence (Floating (Array t ds)) Source #