Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data BoxMode = BoxMode {
- _bmBars, _bmUnicode, _bmHeader :: Bool
- type ShapeL = [Int]
- data T v a = T {}
- type N = Int
- class None a
- class Vector v where
- type VecElem v :: Type -> Constraint
- vIndex :: VecElem v a => v a -> Int -> a
- vLength :: VecElem v a => v a -> Int
- vToList :: VecElem v a => v a -> [a]
- vFromList :: VecElem v a => [a] -> v a
- vSingleton :: VecElem v a => a -> v a
- vReplicate :: VecElem v a => Int -> a -> v a
- vMap :: (VecElem v a, VecElem v b) => (a -> b) -> v a -> v b
- vZipWith :: (VecElem v a, VecElem v b, VecElem v c) => (a -> b -> c) -> v a -> v b -> v c
- 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
- 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
- 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
- vAppend :: VecElem v a => v a -> v a -> v a
- vConcat :: VecElem v a => [v a] -> v a
- vFold :: VecElem v a => (a -> a -> a) -> a -> v a -> a
- vSlice :: VecElem v a => Int -> Int -> v a -> v a
- vSum :: (VecElem v a, Num a) => v a -> a
- vProduct :: (VecElem v a, Num a) => v a -> a
- vMaximum :: (VecElem v a, Ord a) => v a -> a
- vMinimum :: (VecElem v a, Ord a) => v a -> a
- vUpdate :: VecElem v a => v a -> [(Int, a)] -> v a
- vGenerate :: VecElem v a => Int -> (Int -> a) -> v a
- vAll :: VecElem v a => (a -> Bool) -> v a -> Bool
- vAny :: VecElem v a => (a -> Bool) -> v a -> Bool
- prettyShowL :: Pretty a => PrettyLevel -> a -> String
- badShape :: ShapeL -> Bool
- equalT :: (Vector v, VecElem v a, Eq a, Eq (v a)) => ShapeL -> T v a -> T v a -> Bool
- compareT :: (Vector v, VecElem v a, Ord a, Ord (v a)) => ShapeL -> T v a -> T v a -> Ordering
- getStridesT :: ShapeL -> [N]
- toListT :: (Vector v, VecElem v a) => ShapeL -> T v a -> [a]
- isCanonicalT :: (Vector v, VecElem v a) => [N] -> T v a -> Bool
- scalarT :: (Vector v, VecElem v a) => a -> T v a
- unScalarT :: (Vector v, VecElem v a) => T v a -> a
- constantT :: (Vector v, VecElem v a) => ShapeL -> a -> T v a
- toVectorT :: (Vector v, VecElem v a) => ShapeL -> T v a -> v a
- toUnorderedVectorT :: (Vector v, VecElem v a) => ShapeL -> T v a -> v a
- fromVectorT :: ShapeL -> v a -> T v a
- fromListT :: (Vector v, VecElem v a) => [N] -> [a] -> T v a
- indexT :: T v a -> N -> T v a
- stretchT :: [Bool] -> T v a -> T v a
- mapT :: (Vector v, VecElem v a, VecElem v b) => ShapeL -> (a -> b) -> T v a -> T v b
- 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
- 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
- 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
- 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
- transposeT :: [Int] -> T v a -> T v a
- subArraysT :: ShapeL -> T v a -> [T v a]
- reverseT :: [N] -> ShapeL -> T v a -> T v a
- reduceT :: (Vector v, VecElem v a) => ShapeL -> (a -> a -> a) -> a -> T v a -> T v a
- foldrT :: (Vector v, VecElem v a) => ShapeL -> (a -> b -> b) -> b -> T v a -> b
- traverseT :: (Vector v, VecElem v a, VecElem v b, Applicative f) => ShapeL -> (a -> f b) -> T v a -> f (T v b)
- allSameT :: (Vector v, VecElem v a, Eq a) => ShapeL -> T v a -> Bool
- ppT :: (Vector v, VecElem v a, Pretty a) => PrettyLevel -> Rational -> ShapeL -> T v a -> Doc
- ppT_ :: (Vector v, VecElem v a) => (a -> String) -> ShapeL -> T v a -> String
- showsT :: [N] -> T [] String -> ShowS
- prettyBoxMode :: BoxMode
- box :: BoxMode -> String -> [String]
- zipWithLong2 :: (a -> b -> b) -> [a] -> [b] -> [b]
- padT :: forall v a. (Vector v, VecElem v a) => a -> [(Int, Int)] -> ShapeL -> T v a -> ([Int], T v a)
- simpleReshape :: [N] -> ShapeL -> ShapeL -> Maybe [N]
- sumT :: (Vector v, VecElem v a, Num a) => ShapeL -> T v a -> a
- productT :: (Vector v, VecElem v a, Num a) => ShapeL -> T v a -> a
- maximumT :: (Vector v, VecElem v a, Ord a) => ShapeL -> T v a -> a
- minimumT :: (Vector v, VecElem v a, Ord a) => ShapeL -> T v a -> a
- anyT :: (Vector v, VecElem v a) => ShapeL -> (a -> Bool) -> T v a -> Bool
- allT :: (Vector v, VecElem v a) => ShapeL -> (a -> Bool) -> T v a -> Bool
- updateT :: (Vector v, VecElem v a) => ShapeL -> T v a -> [([Int], a)] -> T v a
- generateT :: (Vector v, VecElem v a) => ShapeL -> ([Int] -> a) -> T v a
- iterateNT :: (Vector v, VecElem v a) => Int -> (a -> a) -> a -> T v a
- iotaT :: (Vector v, VecElem v a, Enum a, Num a) => Int -> T v a
- permute :: [Int] -> [a] -> [a]
- revDropWhile :: (a -> Bool) -> [a] -> [a]
- allSame :: Eq a => [a] -> Bool
- valueOf :: forall n i. (KnownNat n, Num i) => i
Documentation
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.
Instances
(Typeable v, Typeable a, Data (v a)) => Data (T v a) Source # | |
Defined in Data.Array.Internal 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) # 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 # | |
Generic (T v a) Source # | |
NFData (v a) => NFData (T v a) Source # | |
Defined in Data.Array.Internal | |
type Rep (T v a) Source # | |
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))))) |
The Vector
class is the interface to the underlying storage for the arrays.
The operations map straight to operations for Vector
.
type VecElem v :: Type -> Constraint Source #
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 #
Instances
prettyShowL :: Pretty a => PrettyLevel -> a -> String Source #
compareT :: (Vector v, VecElem v a, Ord a, Ord (v a)) => ShapeL -> T v a -> T v a -> Ordering Source #
getStridesT :: ShapeL -> [N] 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.
fromVectorT :: ShapeL -> v a -> T v a 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 #
traverseT :: (Vector v, VecElem v a, VecElem v b, Applicative f) => ShapeL -> (a -> f b) -> T v a -> f (T v b) Source #
ppT :: (Vector v, VecElem v a, Pretty a) => PrettyLevel -> Rational -> ShapeL -> T v a -> Doc 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 #
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.