| Safe Haskell | None |
|---|
Data.Tensor.TypeLevel
Description
- data n :~ a = (n a) :~ a
- data Vec a = Vec
- newtype Axis v = Axis {}
- (!) :: Vector v => v a -> Axis v -> a
- class Traversable v => Vector v where
- componentF :: Alternative f => Axis v -> v a -> f a
- component :: Axis v -> v a -> a
- dimension :: v a -> Int
- compose :: (Axis v -> a) -> v a
- class (Vector v, C a) => VectorRing v a where
- unitVectorF :: Alternative f => Axis v -> f (v a)
- unitVector :: Axis v -> v a
- contract :: (Vector v, C a) => (Axis v -> a) -> a
- type Vec0 = Vec
- type Vec1 = :~ Vec0
- type Vec2 = :~ Vec1
- type Vec3 = :~ Vec2
- type Vec4 = :~ Vec3
- type Vec5 = :~ Vec4
- type Vec6 = :~ Vec5
- type Vec7 = :~ Vec6
- type Vec8 = :~ Vec7
- type Vec9 = :~ Vec8
- type Vec10 = :~ Vec9
- vec0 :: Vec0 a
- vec1 :: a -> Vec1 a
- vec2 :: a -> a -> Vec2 a
- vec3 :: a -> a -> a -> Vec3 a
- vec4 :: a -> a -> a -> a -> Vec4 a
- vec5 :: a -> a -> a -> a -> a -> Vec5 a
- vec6 :: a -> a -> a -> a -> a -> a -> Vec6 a
- vec7 :: a -> a -> a -> a -> a -> a -> a -> Vec7 a
- vec8 :: a -> a -> a -> a -> a -> a -> a -> a -> Vec8 a
- vec9 :: a -> a -> a -> a -> a -> a -> a -> a -> a -> Vec9 a
- vec10 :: a -> a -> a -> a -> a -> a -> a -> a -> a -> a -> Vec10 a
Documentation
data constructor for constructing n+1-dimensional tensor from n-dimensional tensor.
Constructors
| (n a) :~ a |
Instances
| Traversable n => Functor (:~ n) | |
| (Applicative n, Traversable n) => Applicative (:~ n) | |
| Traversable n => Foldable (:~ n) | |
| Traversable n => Traversable (:~ n) | |
| Vector v => Vector (:~ v) | |
| (C a, VectorRing v a, C (v a)) => VectorRing (:~ v) a | |
| (Eq a, Eq (n a)) => Eq (:~ n a) | |
| (Vector v, Num a) => Num (:~ v a) | |
| (Ord (n a), Ord a) => Ord (:~ n a) | the last component contributes the most to the ordering |
| (Read a, Vector (:~ n)) => Read (:~ n a) | |
| (Show a, Traversable (:~ n)) => Show (:~ n a) | |
| (Arbitrary a, Arbitrary (n a), Traversable n) => Arbitrary (:~ n a) | |
| (Vector v, C a) => C (:~ v a) |
data constructor for 0-dimensional tensor.
Constructors
| Vec |
An coordinate Axis , labeled by an integer.
Axis also carries v, the container type for its corresponding
vector. Therefore, An axis of one type can access only vectors
of a fixed dimension, but of arbitrary type.
class Traversable v => Vector v whereSource
An object that allows component-wise access.
Methods
Arguments
| :: Alternative f | |
| => Axis v | the axis of the component you want |
| -> v a | the target vector |
| -> f a | the component, obtained within a failure |
Get a component within f, a context which allows failure.
component :: Axis v -> v a -> aSource
Get a component. This computation may result in a runtime error,
though, as long as the Axis is generated from library functions
such as compose, there will be no error.
The dimension of the vector.
compose :: (Axis v -> a) -> v aSource
Create a Vector from a function that maps
axis to components.
class (Vector v, C a) => VectorRing v a whereSource
VectorRing is a Vector whose components belongs to C,
thus providing unit vectors.
Methods
unitVectorF :: Alternative f => Axis v -> f (v a)Source
A vector where Axisth component is unity but others are zero.
unitVector :: Axis v -> v aSource
pure but unsafe version means of obtaining a unitVector
Instances
| C a => VectorRing Vec a | |
| (C a, VectorRing v a, C (v a)) => VectorRing (:~ v) a |