Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synapse.Tensors.Vec
Description
Synopsis
- newtype Vec a = Vec {
- unVec :: Vector a
- size :: Vec a -> Int
- empty :: Vec a
- singleton :: SingletonOps f => DType f -> f
- fromList :: [a] -> Vec a
- generate :: Int -> (Int -> a) -> Vec a
- replicate :: Int -> a -> Vec a
- cons :: a -> Vec a -> Vec a
- snoc :: Vec a -> a -> Vec a
- (++) :: Vec a -> Vec a -> Vec a
- concat :: [Vec a] -> Vec a
- splitAt :: Int -> Vec a -> (Vec a, Vec a)
- map :: (a -> b) -> Vec a -> Vec b
- imap :: (Int -> a -> b) -> Vec a -> Vec b
- for :: Vec a -> (a -> b) -> Vec b
- zipWith :: (a -> b -> c) -> Vec a -> Vec b -> Vec c
- zip :: Vec a -> Vec b -> Vec (a, b)
- zeroes :: Num a => Int -> Vec a
- ones :: Num a => Int -> Vec a
- squaredMagnitude :: Num a => Vec a -> a
- magnitude :: Floating a => Vec a -> a
- clampMagnitude :: (Floating a, Ord a) => a -> Vec a -> Vec a
- normalized :: Floating a => Vec a -> Vec a
- linearCombination :: Num a => [(a, Vec a)] -> Vec a
- dot :: (VecOps f, Num (DType f)) => f -> f -> f
- angleBetween :: Floating a => Vec a -> Vec a -> a
- lerp :: (Floating a, Ord a) => a -> Vec a -> Vec a -> Vec a
Vec
datatype and simple getters.
Mathematical vector (collection of elements).
Instances
Constructors
singleton :: SingletonOps f => DType f -> f Source #
Initializes singleton container.
generate :: Int -> (Int -> a) -> Vec a Source #
Creates Vec
of given length using generating function.
Concatenation and splitting
Combining
imap :: (Int -> a -> b) -> Vec a -> Vec b Source #
Apply a function to every element of a Vec
and its index.