Language.Paraiso.Tensor
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 :: Failure StringException 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 :: Failure StringException 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
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) | |
| (Ord a, Ord (n a)) => Ord (:~ n a) | |
| (Read a, Read (n a)) => Read (:~ n a) | |
| (Show a, Show (n a)) => Show (:~ 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
| :: Failure StringException f | |
| => Axis v | the axis of the component you want |
| -> v a | the target vector |
| -> f a | the component, obtained within a |
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 :: Failure StringException 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 |