orthotope-0.1.1.0: Multidimensional arrays inspired by APL
Safe HaskellNone
LanguageHaskell2010

Data.Array.Internal

Synopsis

Documentation

data BoxMode Source #

Constructors

BoxMode 

type ShapeL = [Int] Source #

The shape of an array is a list of its dimensions.

data T v a Source #

The type T is the internal type of arrays. In general, operations on T do no sanity checking as that should be done at the point of call.

To avoid manipulating the data the indexing into the vector containing the data is somewhat complex. To find where item i of the outermost dimension starts you calculate vector index offset + i*strides[0]. To find where item i,j of the two outermost dimensions is you calculate vector index offset + i*strides[0] + j*strides[1], etc.

Constructors

T 

Fields

Instances

Instances details
(Typeable v, Typeable a, Data (v a)) => Data (T v a) Source # 
Instance details

Defined in Data.Array.Internal

Methods

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

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

toConstr :: T v a -> Constr #

dataTypeOf :: T v a -> DataType #

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

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

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

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

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

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

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

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

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

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

Show (v a) => Show (T v a) Source # 
Instance details

Defined in Data.Array.Internal

Methods

showsPrec :: Int -> T v a -> ShowS #

show :: T v a -> String #

showList :: [T v a] -> ShowS #

Generic (T v a) Source # 
Instance details

Defined in Data.Array.Internal

Associated Types

type Rep (T v a) :: Type -> Type #

Methods

from :: T v a -> Rep (T v a) x #

to :: Rep (T v a) x -> T v a #

NFData (v a) => NFData (T v a) Source # 
Instance details

Defined in Data.Array.Internal

Methods

rnf :: T v a -> () #

type Rep (T v a) Source # 
Instance details

Defined in Data.Array.Internal

type Rep (T v a) = D1 ('MetaData "T" "Data.Array.Internal" "orthotope-0.1.1.0-8N9XOymS4o4K1BvtpFJxFr" 'False) (C1 ('MetaCons "T" 'PrefixI 'True) (S1 ('MetaSel ('Just "strides") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [N]) :*: (S1 ('MetaSel ('Just "offset") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 N) :*: S1 ('MetaSel ('Just "values") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (v a)))))

type N = Int Source #

class None a Source #

Instances

Instances details
None a Source # 
Instance details

Defined in Data.Array.Internal

class Vector v where Source #

The Vector class is the interface to the underlying storage for the arrays. The operations map straight to operations for Vector.

Associated Types

type VecElem v :: Type -> Constraint Source #

Methods

vIndex :: VecElem v a => v a -> Int -> a Source #

vLength :: VecElem v a => v a -> Int Source #

vToList :: VecElem v a => v a -> [a] Source #

vFromList :: VecElem v a => [a] -> v a Source #

vSingleton :: VecElem v a => a -> v a Source #

vReplicate :: VecElem v a => Int -> a -> v a Source #

vMap :: (VecElem v a, VecElem v b) => (a -> b) -> v a -> v b Source #

vZipWith :: (VecElem v a, VecElem v b, VecElem v c) => (a -> b -> c) -> v a -> v b -> v c Source #

vZipWith3 :: (VecElem v a, VecElem v b, VecElem v c, VecElem v d) => (a -> b -> c -> d) -> v a -> v b -> v c -> v d Source #

vZipWith4 :: (VecElem v a, VecElem v b, VecElem v c, VecElem v d, VecElem v e) => (a -> b -> c -> d -> e) -> v a -> v b -> v c -> v d -> v e Source #

vZipWith5 :: (VecElem v a, VecElem v b, VecElem v c, VecElem v d, VecElem v e, VecElem v f) => (a -> b -> c -> d -> e -> f) -> v a -> v b -> v c -> v d -> v e -> v f Source #

vAppend :: VecElem v a => v a -> v a -> v a Source #

vConcat :: VecElem v a => [v a] -> v a Source #

vFold :: VecElem v a => (a -> a -> a) -> a -> v a -> a Source #

vSlice :: VecElem v a => Int -> Int -> v a -> v a Source #

vSum :: (VecElem v a, Num a) => v a -> a Source #

vProduct :: (VecElem v a, Num a) => v a -> a Source #

vMaximum :: (VecElem v a, Ord a) => v a -> a Source #

vMinimum :: (VecElem v a, Ord a) => v a -> a Source #

vUpdate :: VecElem v a => v a -> [(Int, a)] -> v a Source #

vGenerate :: VecElem v a => Int -> (Int -> a) -> v a Source #

vAll :: VecElem v a => (a -> Bool) -> v a -> Bool Source #

vAny :: VecElem v a => (a -> Bool) -> v a -> Bool Source #

Instances

Instances details
Vector [] Source # 
Instance details

Defined in Data.Array.Internal

Associated Types

type VecElem [] :: Type -> Constraint Source #

Methods

vIndex :: VecElem [] a => [a] -> Int -> a Source #

vLength :: VecElem [] a => [a] -> Int Source #

vToList :: VecElem [] a => [a] -> [a] Source #

vFromList :: VecElem [] a => [a] -> [a] Source #

vSingleton :: VecElem [] a => a -> [a] Source #

vReplicate :: VecElem [] a => Int -> a -> [a] Source #

vMap :: (VecElem [] a, VecElem [] b) => (a -> b) -> [a] -> [b] Source #

vZipWith :: (VecElem [] a, VecElem [] b, VecElem [] c) => (a -> b -> c) -> [a] -> [b] -> [c] Source #

vZipWith3 :: (VecElem [] a, VecElem [] b, VecElem [] c, VecElem [] d) => (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d] Source #

vZipWith4 :: (VecElem [] a, VecElem [] b, VecElem [] c, VecElem [] d, VecElem [] e) => (a -> b -> c -> d -> e) -> [a] -> [b] -> [c] -> [d] -> [e] Source #

vZipWith5 :: (VecElem [] a, VecElem [] b, VecElem [] c, VecElem [] d, VecElem [] e, VecElem [] f) => (a -> b -> c -> d -> e -> f) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f] Source #

vAppend :: VecElem [] a => [a] -> [a] -> [a] Source #

vConcat :: VecElem [] a => [[a]] -> [a] Source #

vFold :: VecElem [] a => (a -> a -> a) -> a -> [a] -> a Source #

vSlice :: VecElem [] a => Int -> Int -> [a] -> [a] Source #

vSum :: (VecElem [] a, Num a) => [a] -> a Source #

vProduct :: (VecElem [] a, Num a) => [a] -> a Source #

vMaximum :: (VecElem [] a, Ord a) => [a] -> a Source #

vMinimum :: (VecElem [] a, Ord a) => [a] -> a Source #

vUpdate :: VecElem [] a => [a] -> [(Int, a)] -> [a] Source #

vGenerate :: VecElem [] a => Int -> (Int -> a) -> [a] Source #

vAll :: VecElem [] a => (a -> Bool) -> [a] -> Bool Source #

vAny :: VecElem [] a => (a -> Bool) -> [a] -> Bool Source #

Vector Vector Source # 
Instance details

Defined in Data.Array.Internal.DynamicU

Associated Types

type VecElem Vector :: Type -> Constraint Source #

Methods

vIndex :: VecElem Vector a => Vector a -> Int -> a Source #

vLength :: VecElem Vector a => Vector a -> Int Source #

vToList :: VecElem Vector a => Vector a -> [a] Source #

vFromList :: VecElem Vector a => [a] -> Vector a Source #

vSingleton :: VecElem Vector a => a -> Vector a Source #

vReplicate :: VecElem Vector a => Int -> a -> Vector a Source #

vMap :: (VecElem Vector a, VecElem Vector b) => (a -> b) -> Vector a -> Vector b Source #

vZipWith :: (VecElem Vector a, VecElem Vector b, VecElem Vector c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c Source #

vZipWith3 :: (VecElem Vector a, VecElem Vector b, VecElem Vector c, VecElem Vector d) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d Source #

vZipWith4 :: (VecElem Vector a, VecElem Vector b, VecElem Vector c, VecElem Vector d, VecElem Vector e) => (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e Source #

vZipWith5 :: (VecElem Vector a, VecElem Vector b, VecElem Vector c, VecElem Vector d, VecElem Vector e, VecElem Vector f) => (a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f Source #

vAppend :: VecElem Vector a => Vector a -> Vector a -> Vector a Source #

vConcat :: VecElem Vector a => [Vector a] -> Vector a Source #

vFold :: VecElem Vector a => (a -> a -> a) -> a -> Vector a -> a Source #

vSlice :: VecElem Vector a => Int -> Int -> Vector a -> Vector a Source #

vSum :: (VecElem Vector a, Num a) => Vector a -> a Source #

vProduct :: (VecElem Vector a, Num a) => Vector a -> a Source #

vMaximum :: (VecElem Vector a, Ord a) => Vector a -> a Source #

vMinimum :: (VecElem Vector a, Ord a) => Vector a -> a Source #

vUpdate :: VecElem Vector a => Vector a -> [(Int, a)] -> Vector a Source #

vGenerate :: VecElem Vector a => Int -> (Int -> a) -> Vector a Source #

vAll :: VecElem Vector a => (a -> Bool) -> Vector a -> Bool Source #

vAny :: VecElem Vector a => (a -> Bool) -> Vector a -> Bool Source #

Vector Vector Source # 
Instance details

Defined in Data.Array.Internal.DynamicS

Associated Types

type VecElem Vector :: Type -> Constraint Source #

Methods

vIndex :: VecElem Vector a => Vector a -> Int -> a Source #

vLength :: VecElem Vector a => Vector a -> Int Source #

vToList :: VecElem Vector a => Vector a -> [a] Source #

vFromList :: VecElem Vector a => [a] -> Vector a Source #

vSingleton :: VecElem Vector a => a -> Vector a Source #

vReplicate :: VecElem Vector a => Int -> a -> Vector a Source #

vMap :: (VecElem Vector a, VecElem Vector b) => (a -> b) -> Vector a -> Vector b Source #

vZipWith :: (VecElem Vector a, VecElem Vector b, VecElem Vector c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c Source #

vZipWith3 :: (VecElem Vector a, VecElem Vector b, VecElem Vector c, VecElem Vector d) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d Source #

vZipWith4 :: (VecElem Vector a, VecElem Vector b, VecElem Vector c, VecElem Vector d, VecElem Vector e) => (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e Source #

vZipWith5 :: (VecElem Vector a, VecElem Vector b, VecElem Vector c, VecElem Vector d, VecElem Vector e, VecElem Vector f) => (a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f Source #

vAppend :: VecElem Vector a => Vector a -> Vector a -> Vector a Source #

vConcat :: VecElem Vector a => [Vector a] -> Vector a Source #

vFold :: VecElem Vector a => (a -> a -> a) -> a -> Vector a -> a Source #

vSlice :: VecElem Vector a => Int -> Int -> Vector a -> Vector a Source #

vSum :: (VecElem Vector a, Num a) => Vector a -> a Source #

vProduct :: (VecElem Vector a, Num a) => Vector a -> a Source #

vMaximum :: (VecElem Vector a, Ord a) => Vector a -> a Source #

vMinimum :: (VecElem Vector a, Ord a) => Vector a -> a Source #

vUpdate :: VecElem Vector a => Vector a -> [(Int, a)] -> Vector a Source #

vGenerate :: VecElem Vector a => Int -> (Int -> a) -> Vector a Source #

vAll :: VecElem Vector a => (a -> Bool) -> Vector a -> Bool Source #

vAny :: VecElem Vector a => (a -> Bool) -> Vector a -> Bool Source #

Vector Vector Source # 
Instance details

Defined in Data.Array.Internal.Dynamic

Associated Types

type VecElem Vector :: Type -> Constraint Source #

Methods

vIndex :: VecElem Vector a => Vector a -> Int -> a Source #

vLength :: VecElem Vector a => Vector a -> Int Source #

vToList :: VecElem Vector a => Vector a -> [a] Source #

vFromList :: VecElem Vector a => [a] -> Vector a Source #

vSingleton :: VecElem Vector a => a -> Vector a Source #

vReplicate :: VecElem Vector a => Int -> a -> Vector a Source #

vMap :: (VecElem Vector a, VecElem Vector b) => (a -> b) -> Vector a -> Vector b Source #

vZipWith :: (VecElem Vector a, VecElem Vector b, VecElem Vector c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c Source #

vZipWith3 :: (VecElem Vector a, VecElem Vector b, VecElem Vector c, VecElem Vector d) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d Source #

vZipWith4 :: (VecElem Vector a, VecElem Vector b, VecElem Vector c, VecElem Vector d, VecElem Vector e) => (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e Source #

vZipWith5 :: (VecElem Vector a, VecElem Vector b, VecElem Vector c, VecElem Vector d, VecElem Vector e, VecElem Vector f) => (a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f Source #

vAppend :: VecElem Vector a => Vector a -> Vector a -> Vector a Source #

vConcat :: VecElem Vector a => [Vector a] -> Vector a Source #

vFold :: VecElem Vector a => (a -> a -> a) -> a -> Vector a -> a Source #

vSlice :: VecElem Vector a => Int -> Int -> Vector a -> Vector a Source #

vSum :: (VecElem Vector a, Num a) => Vector a -> a Source #

vProduct :: (VecElem Vector a, Num a) => Vector a -> a Source #

vMaximum :: (VecElem Vector a, Ord a) => Vector a -> a Source #

vMinimum :: (VecElem Vector a, Ord a) => Vector a -> a Source #

vUpdate :: VecElem Vector a => Vector a -> [(Int, a)] -> Vector a Source #

vGenerate :: VecElem Vector a => Int -> (Int -> a) -> Vector a Source #

vAll :: VecElem Vector a => (a -> Bool) -> Vector a -> Bool Source #

vAny :: VecElem Vector a => (a -> Bool) -> Vector a -> Bool Source #

equalT :: (Vector v, VecElem v a, Eq a, Eq (v a)) => ShapeL -> T v a -> T v a -> Bool Source #

compareT :: (Vector v, VecElem v a, Ord a, Ord (v a)) => ShapeL -> T v a -> T v a -> Ordering Source #

toListT :: (Vector v, VecElem v a) => ShapeL -> T v a -> [a] Source #

isCanonicalT :: (Vector v, VecElem v a) => [N] -> T v a -> Bool Source #

Check if the strides are canonical, i.e., if the vector have the natural layout. XXX Copy special cases from Tensor.

scalarT :: (Vector v, VecElem v a) => a -> T v a Source #

unScalarT :: (Vector v, VecElem v a) => T v a -> a Source #

constantT :: (Vector v, VecElem v a) => ShapeL -> a -> T v a Source #

toVectorT :: (Vector v, VecElem v a) => ShapeL -> T v a -> v a Source #

toUnorderedVectorT :: (Vector v, VecElem v a) => ShapeL -> T v a -> v a Source #

fromVectorT :: ShapeL -> v a -> T v a Source #

fromListT :: (Vector v, VecElem v a) => [N] -> [a] -> T v a Source #

indexT :: T v a -> N -> T v a Source #

stretchT :: [Bool] -> T v a -> T v a Source #

mapT :: (Vector v, VecElem v a, VecElem v b) => ShapeL -> (a -> b) -> T v a -> T v b Source #

zipWithT :: (Vector v, VecElem v a, VecElem v b, VecElem v c) => ShapeL -> (a -> b -> c) -> T v a -> T v b -> T v c Source #

zipWith3T :: (Vector v, VecElem v a, VecElem v b, VecElem v c, VecElem v d) => ShapeL -> (a -> b -> c -> d) -> T v a -> T v b -> T v c -> T v d Source #

zipWith4T :: (Vector v, VecElem v a, VecElem v b, VecElem v c, VecElem v d, VecElem v e) => ShapeL -> (a -> b -> c -> d -> e) -> T v a -> T v b -> T v c -> T v d -> T v e Source #

zipWith5T :: (Vector v, VecElem v a, VecElem v b, VecElem v c, VecElem v d, VecElem v e, VecElem v f) => ShapeL -> (a -> b -> c -> d -> e -> f) -> T v a -> T v b -> T v c -> T v d -> T v e -> T v f Source #

transposeT :: [Int] -> T v a -> T v a Source #

subArraysT :: ShapeL -> T v a -> [T v a] Source #

reverseT :: [N] -> ShapeL -> T v a -> T v a Source #

reduceT :: (Vector v, VecElem v a) => ShapeL -> (a -> a -> a) -> a -> T v a -> T v a Source #

foldrT :: (Vector v, VecElem v a) => ShapeL -> (a -> b -> b) -> b -> T v a -> b Source #

traverseT :: (Vector v, VecElem v a, VecElem v b, Applicative f) => ShapeL -> (a -> f b) -> T v a -> f (T v b) Source #

allSameT :: (Vector v, VecElem v a, Eq a) => ShapeL -> T v a -> Bool Source #

ppT :: (Vector v, VecElem v a, Pretty a) => PrettyLevel -> Rational -> ShapeL -> T v a -> Doc Source #

ppT_ :: (Vector v, VecElem v a) => (a -> String) -> ShapeL -> T v a -> String Source #

showsT :: [N] -> T [] String -> ShowS Source #

zipWithLong2 :: (a -> b -> b) -> [a] -> [b] -> [b] Source #

padT :: forall v a. (Vector v, VecElem v a) => a -> [(Int, Int)] -> ShapeL -> T v a -> ([Int], T v a) Source #

sumT :: (Vector v, VecElem v a, Num a) => ShapeL -> T v a -> a Source #

productT :: (Vector v, VecElem v a, Num a) => ShapeL -> T v a -> a Source #

maximumT :: (Vector v, VecElem v a, Ord a) => ShapeL -> T v a -> a Source #

minimumT :: (Vector v, VecElem v a, Ord a) => ShapeL -> T v a -> a Source #

anyT :: (Vector v, VecElem v a) => ShapeL -> (a -> Bool) -> T v a -> Bool Source #

allT :: (Vector v, VecElem v a) => ShapeL -> (a -> Bool) -> T v a -> Bool Source #

updateT :: (Vector v, VecElem v a) => ShapeL -> T v a -> [([Int], a)] -> T v a Source #

generateT :: (Vector v, VecElem v a) => ShapeL -> ([Int] -> a) -> T v a Source #

iterateNT :: (Vector v, VecElem v a) => Int -> (a -> a) -> a -> T v a Source #

iotaT :: (Vector v, VecElem v a, Enum a, Num a) => Int -> T v a Source #

permute :: [Int] -> [a] -> [a] Source #

Permute the elements of a list, the first argument is indices into the original list.

revDropWhile :: (a -> Bool) -> [a] -> [a] Source #

Like dropWhile but at the end of the list.

allSame :: Eq a => [a] -> Bool Source #

valueOf :: forall n i. (KnownNat n, Num i) => i Source #

Get the value of a type level Nat. Use with explicit type application, i.e., valueOf @42