dense-0.1.0.1: Mutable and immutable dense multidimensional arrays
Copyright(c) Christopher Chalmers
LicenseBSD3
MaintainerChristopher Chalmers
Stabilityprovisional
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Dense

Description

This module provides a large subset of the full functionality of "dense" without exporting names that conflict with names in prelude, so it can often be imported unqualified. It also includes reexported classes and data types from other modules. However it does not contain much functions necessary to construct arrays, for that see Data.Dense.Generic or one of the type specific modules intended to be imported qualified. Typical imports for shaped will look like this:

import           Data.Dense
import qualified Data.Dense.Unboxed as U

For boxed-specific arrays (a la Data.Vector) see Data.Dense.Boxed.

Synopsis

Array types

data Array v f a Source #

An Array is a vector with a shape.

Instances

Instances details
Shape f => HasLayout f (Array v f a) Source #

The size of the layout must remain the same or an error is thrown.

Instance details

Defined in Data.Dense.Base

Methods

layout :: Lens' (Array v f a) (Layout f) Source #

(Boxed v, Shape f) => FunctorWithIndex (f Int) (Array v f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

imap :: (f Int -> a -> b) -> Array v f a -> Array v f b #

imapped :: IndexedSetter (f Int) (Array v f a) (Array v f b) a b #

(Boxed v, Shape f) => FoldableWithIndex (f Int) (Array v f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

ifoldMap :: Monoid m => (f Int -> a -> m) -> Array v f a -> m #

ifolded :: IndexedFold (f Int) (Array v f a) a #

ifoldr :: (f Int -> a -> b -> b) -> b -> Array v f a -> b #

ifoldl :: (f Int -> b -> a -> b) -> b -> Array v f a -> b #

ifoldr' :: (f Int -> a -> b -> b) -> b -> Array v f a -> b #

ifoldl' :: (f Int -> b -> a -> b) -> b -> Array v f a -> b #

(Boxed v, Shape f) => TraversableWithIndex (f Int) (Array v f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

itraverse :: Applicative f0 => (f Int -> a -> f0 b) -> Array v f a -> f0 (Array v f b) #

itraversed :: IndexedTraversal (f Int) (Array v f a) (Array v f b) a b #

Boxed v => Functor (Array v f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

fmap :: (a -> b) -> Array v f a -> Array v f b #

(<$) :: a -> Array v f b -> Array v f a #

Boxed v => Foldable (Array v f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

fold :: Monoid m => Array v f m -> m #

foldMap :: Monoid m => (a -> m) -> Array v f a -> m #

foldMap' :: Monoid m => (a -> m) -> Array v f a -> m #

foldr :: (a -> b -> b) -> b -> Array v f a -> b #

foldr' :: (a -> b -> b) -> b -> Array v f a -> b #

foldl :: (b -> a -> b) -> b -> Array v f a -> b #

foldl' :: (b -> a -> b) -> b -> Array v f a -> b #

foldr1 :: (a -> a -> a) -> Array v f a -> a #

foldl1 :: (a -> a -> a) -> Array v f a -> a #

toList :: Array v f a -> [a] #

null :: Array v f a -> Bool #

length :: Array v f a -> Int #

elem :: Eq a => a -> Array v f a -> Bool #

maximum :: Ord a => Array v f a -> a #

minimum :: Ord a => Array v f a -> a #

sum :: Num a => Array v f a -> a #

product :: Num a => Array v f a -> a #

Boxed v => Traversable (Array v f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

traverse :: Applicative f0 => (a -> f0 b) -> Array v f a -> f0 (Array v f b) #

sequenceA :: Applicative f0 => Array v f (f0 a) -> f0 (Array v f a) #

mapM :: Monad m => (a -> m b) -> Array v f a -> m (Array v f b) #

sequence :: Monad m => Array v f (m a) -> m (Array v f a) #

(Boxed v, Eq1 f) => Eq1 (Array v f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

liftEq :: (a -> b -> Bool) -> Array v f a -> Array v f b -> Bool #

(Boxed v, Read1 f) => Read1 (Array v f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Array v f a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Array v f a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Array v f a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Array v f a] #

(Boxed v, Shape f, Serial1 f) => Serial1 (Array v f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

serializeWith :: MonadPut m => (a -> m ()) -> Array v f a -> m () #

deserializeWith :: MonadGet m => m a -> m (Array v f a) #

(Vector v a, f ~ V1) => Vector (Array v f) a Source #

1D Arrays can be used as a generic Vector.

Instance details

Defined in Data.Dense.Base

Methods

basicUnsafeFreeze :: PrimMonad m => Mutable (Array v f) (PrimState m) a -> m (Array v f a) #

basicUnsafeThaw :: PrimMonad m => Array v f a -> m (Mutable (Array v f) (PrimState m) a) #

basicLength :: Array v f a -> Int #

basicUnsafeSlice :: Int -> Int -> Array v f a -> Array v f a #

basicUnsafeIndexM :: Monad m => Array v f a -> Int -> m a #

basicUnsafeCopy :: PrimMonad m => Mutable (Array v f) (PrimState m) a -> Array v f a -> m () #

elemseq :: Array v f a -> a -> b -> b #

(Vector v a, Eq1 f, Eq a) => Eq (Array v f a) Source # 
Instance details

Defined in Data.Dense.Base

Methods

(==) :: Array v f a -> Array v f a -> Bool #

(/=) :: Array v f a -> Array v f a -> Bool #

(Typeable f, Typeable v, Typeable a, Data (f Int), Data (v a)) => Data (Array v f a) Source # 
Instance details

Defined in Data.Dense.Base

Methods

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

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

toConstr :: Array v f a -> Constr #

dataTypeOf :: Array v f a -> DataType #

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

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

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

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

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

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

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

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

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

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

(Vector v a, Read1 f, Read a) => Read (Array v f a) Source # 
Instance details

Defined in Data.Dense.Base

Methods

readsPrec :: Int -> ReadS (Array v f a) #

readList :: ReadS [Array v f a] #

readPrec :: ReadPrec (Array v f a) #

readListPrec :: ReadPrec [Array v f a] #

(Vector v a, Show1 f, Show a) => Show (Array v f a) Source # 
Instance details

Defined in Data.Dense.Base

Methods

showsPrec :: Int -> Array v f a -> ShowS #

show :: Array v f a -> String #

showList :: [Array v f a] -> ShowS #

(Vector v a, Shape f, Binary (f Int), Binary a) => Binary (Array v f a) Source # 
Instance details

Defined in Data.Dense.Base

Methods

put :: Array v f a -> Put #

get :: Get (Array v f a) #

putList :: [Array v f a] -> Put #

(Vector v a, Shape f, Serial1 f, Serial a) => Serial (Array v f a) Source # 
Instance details

Defined in Data.Dense.Base

Methods

serialize :: MonadPut m => Array v f a -> m () #

deserialize :: MonadGet m => m (Array v f a) #

(Vector v a, Shape f, Serialize (f Int), Serialize a) => Serialize (Array v f a) Source # 
Instance details

Defined in Data.Dense.Base

Methods

put :: Putter (Array v f a) #

get :: Get (Array v f a) #

(NFData (f Int), NFData (v a)) => NFData (Array v f a) Source # 
Instance details

Defined in Data.Dense.Base

Methods

rnf :: Array v f a -> () #

(Vector v a, Foldable f, Hashable a) => Hashable (Array v f a) Source # 
Instance details

Defined in Data.Dense.Base

Methods

hashWithSalt :: Int -> Array v f a -> Int #

hash :: Array v f a -> Int #

(Shape f, Vector v a) => Ixed (Array v f a) Source # 
Instance details

Defined in Data.Dense.Base

Methods

ix :: Index (Array v f a) -> Traversal' (Array v f a) (IxValue (Array v f a)) #

(Shape f, Vector v a) => AsEmpty (Array v f a) Source # 
Instance details

Defined in Data.Dense.Base

Methods

_Empty :: Prism' (Array v f a) () #

(Vector v a, Vector v b) => Each (Array v f a) (Array v f b) a b Source # 
Instance details

Defined in Data.Dense.Base

Methods

each :: Traversal (Array v f a) (Array v f b) a b #

type Mutable (Array v f) Source # 
Instance details

Defined in Data.Dense.Base

type Mutable (Array v f) = MArray (Mutable v) f
type Index (Array v f a) Source # 
Instance details

Defined in Data.Dense.Base

type Index (Array v f a) = f Int
type IxValue (Array v f a) Source # 
Instance details

Defined in Data.Dense.Base

type IxValue (Array v f a) = a

type UArray = Array Vector Source #

Unboxed array.

Indexing

type Layout f = f Int Source #

A Layout is the full size of an array. This alias is used to help distinguish between the layout of an array and an index (usually just l Int) in a type signature.

class Shape f => HasLayout f a | a -> f where Source #

Class of things that have a Layout. This means we can use the same functions for the various different arrays in the library.

Minimal complete definition

Nothing

Methods

layout :: Lens' a (Layout f) Source #

Lens onto the Layout of something.

default layout :: a ~ f Int => (Layout f -> g (Layout f)) -> a -> g a Source #

Instances

Instances details
i ~ Int => HasLayout V0 (V0 i) Source # 
Instance details

Defined in Data.Dense.Index

Methods

layout :: Lens' (V0 i) (Layout V0) Source #

i ~ Int => HasLayout V4 (V4 i) Source # 
Instance details

Defined in Data.Dense.Index

Methods

layout :: Lens' (V4 i) (Layout V4) Source #

i ~ Int => HasLayout V3 (V3 i) Source # 
Instance details

Defined in Data.Dense.Index

Methods

layout :: Lens' (V3 i) (Layout V3) Source #

i ~ Int => HasLayout V2 (V2 i) Source # 
Instance details

Defined in Data.Dense.Index

Methods

layout :: Lens' (V2 i) (Layout V2) Source #

i ~ Int => HasLayout V1 (V1 i) Source # 
Instance details

Defined in Data.Dense.Index

Methods

layout :: Lens' (V1 i) (Layout V1) Source #

Shape f => HasLayout f (Focused f a) Source #

The size of the layout must remain the same or an error is thrown.

Instance details

Defined in Data.Dense.Base

Methods

layout :: Lens' (Focused f a) (Layout f) Source #

Shape f => HasLayout f (Delayed f a) Source #

The size of the layout must remain the same or an error is thrown.

Instance details

Defined in Data.Dense.Base

Methods

layout :: Lens' (Delayed f a) (Layout f) Source #

Shape f => HasLayout f (Array v f a) Source #

The size of the layout must remain the same or an error is thrown.

Instance details

Defined in Data.Dense.Base

Methods

layout :: Lens' (Array v f a) (Layout f) Source #

Shape f => HasLayout f (MArray v f s a) Source # 
Instance details

Defined in Data.Dense.Mutable

Methods

layout :: Lens' (MArray v f s a) (Layout f) Source #

class (Eq1 f, Additive f, Traversable f) => Shape f Source #

Class for types that can be converted to and from linear indexes.

Instances

Instances details
Shape V0 Source # 
Instance details

Defined in Data.Dense.Index

Shape V4 Source # 
Instance details

Defined in Data.Dense.Index

Shape V3 Source # 
Instance details

Defined in Data.Dense.Index

Shape V2 Source # 
Instance details

Defined in Data.Dense.Index

Shape V1 Source # 
Instance details

Defined in Data.Dense.Index

extent :: HasLayout f a => a -> f Int Source #

Get the extent of an array.

extent :: Array v f a    -> f Int
extent :: MArray v f s a -> f Int
extent :: Delayed f a    -> f Int
extent :: Focused f a    -> f Int

size :: HasLayout f a => a -> Int Source #

Get the total number of elements in an array.

size :: Array v f a    -> Int
size :: MArray v f s a -> Int
size :: Delayed f a    -> Int
size :: Focused f a    -> Int

Folds over indexes

indexes :: HasLayout f a => IndexedFold Int a (f Int) Source #

Indexed fold for all the indexes in the layout.

indexesBetween :: HasLayout f a => f Int -> f Int -> IndexedFold Int a (f Int) Source #

Indexed fold between the two indexes where the index is the linear index for the original layout.

indexesFrom :: HasLayout f a => f Int -> IndexedFold Int a (f Int) Source #

Indexed fold starting starting from some point, where the index is the linear index for the original layout.

Lenses

vector :: (Vector v a, Vector w b) => IndexedLens (Layout f) (Array v f a) (Array w f b) (v a) (w b) Source #

Indexed lens over the underlying vector of an array. The index is the extent of the array. You must _not_ change the length of the vector, otherwise an error will be thrown (even for V1 layouts, use flat for V1).

Traversals

values :: (Shape f, Vector v a, Vector w b) => IndexedTraversal (f Int) (Array v f a) (Array w f b) a b Source #

Indexed traversal over the elements of an array. The index is the current position in the array.

values' :: (Shape f, Vector v a, Vector v b) => IndexedTraversal (f Int) (Array v f a) (Array v f b) a b Source #

Same as values but restrictive in the vector type.

valuesBetween :: (Shape f, Vector v a) => f Int -> f Int -> IndexedTraversal' (f Int) (Array v f a) a Source #

Traverse over the values between two indexes.

Construction

Flat arrays

flat :: Vector w b => Iso (Array v V1 a) (Array w V1 b) (v a) (w b) Source #

1D arrays are just vectors. You are free to change the length of the vector when going over this Iso (unlike linear).

Note that V1 arrays are an instance of Vector so you can use any of the functions in Data.Vector.Generic on them without needing to convert.

Shaped from lists

fromListInto :: (Shape f, Vector v a) => Layout f -> [a] -> Maybe (Array v f a) Source #

O(n) Convert the first n elements of a list to an Array with the given shape. Returns Nothing if there are not enough elements in the list.

fromListInto_ :: (Shape f, Vector v a) => Layout f -> [a] -> Array v f a Source #

O(n) Convert the first n elements of a list to an Array with the given shape. Throw an error if the list is not long enough.

Shaped from vectors

fromVectorInto :: (Shape f, Vector v a) => Layout f -> v a -> Maybe (Array v f a) Source #

Create an array from a vector and a layout. Return Nothing if the vector is not the right shape.

fromVectorInto_ :: (Shape f, Vector v a) => Layout f -> v a -> Array v f a Source #

Create an array from a vector and a layout. Throws an error if the vector is not the right shape.

Generating

Functions on arrays

Empty arrays

Indexing

See Ixed class.

Modifying arrays

Slices

Matrix

ixRow :: Vector v a => Int -> IndexedTraversal' Int (Array v V2 a) (v a) Source #

Affine traversal over a single row in a matrix.

>>> traverseOf_ rows print $ m & ixRow 1 . each *~ 2
[a,b,c,d]
[e * 2,f * 2,g * 2,h * 2]
[i,j,k,l]

The row vector should remain the same size to satisfy traversal laws but give reasonable behaviour if the size differs:

>>> traverseOf_ rows print $ m & ixRow 1 .~ B.fromList [0,1]
[a,b,c,d]
[0,1,g,h]
[i,j,k,l]
>>> traverseOf_ rows print $ m & ixRow 1 .~ B.fromList [0..100]
[a,b,c,d]
[0,1,2,3]
[i,j,k,l]

rows :: (Vector v a, Vector w b) => IndexedTraversal Int (Array v V2 a) (Array w V2 b) (v a) (w b) Source #

Indexed traversal over the rows of a matrix. Each row is an efficient slice of the original vector.

>>> traverseOf_ rows print m
[a,b,c,d]
[e,f,g,h]
[i,j,k,l]

ixColumn :: Vector v a => Int -> IndexedTraversal' Int (Array v V2 a) (v a) Source #

Affine traversal over a single column in a matrix.

>>> traverseOf_ rows print $ m & ixColumn 2 . each +~ 1
[a,b,c + 1,d]
[e,f,g + 1,h]
[i,j,k + 1,l]

columns :: (Vector v a, Vector w b) => IndexedTraversal Int (Array v V2 a) (Array w V2 b) (v a) (w b) Source #

Indexed traversal over the columns of a matrix. Unlike rows, each column is a new separate vector.

>>> traverseOf_ columns print m
[a,e,i]
[b,f,j]
[c,g,k]
[d,h,l]
>>> traverseOf_ rows print $ m & columns . indices odd . each .~ 0
[a,0,c,0]
[e,0,g,0]
[i,0,k,0]

The vectors should be the same size to be a valid traversal. If the vectors are different sizes, the number of rows in the new array will be the length of the smallest vector.

3D

ixPlane :: Vector v a => ALens' (V3 Int) (V2 Int) -> Int -> IndexedTraversal' Int (Array v V3 a) (Array v V2 a) Source #

Traversal over a single plane of a 3D array given a lens onto that plane (like _xy, _yz, _zx).

planes :: (Vector v a, Vector w b) => ALens' (V3 Int) (V2 Int) -> IndexedTraversal Int (Array v V3 a) (Array w V3 b) (Array v V2 a) (Array w V2 b) Source #

Traversal over all planes of 3D array given a lens onto that plane (like _xy, _yz, _zx).

flattenPlane :: (Vector v a, Vector w b) => ALens' (V3 Int) (V2 Int) -> (v a -> b) -> Array v V3 a -> Array w V2 b Source #

Flatten a plane by reducing a vector in the third dimension to a single value.

Mutable

data MArray v l s a Source #

A mutable array with a shape.

Instances

Instances details
Shape f => HasLayout f (MArray v f s a) Source # 
Instance details

Defined in Data.Dense.Mutable

Methods

layout :: Lens' (MArray v f s a) (Layout f) Source #

(MVector v a, f ~ V1) => MVector (MArray v f) a Source # 
Instance details

Defined in Data.Dense.Mutable

Methods

basicLength :: MArray v f s a -> Int #

basicUnsafeSlice :: Int -> Int -> MArray v f s a -> MArray v f s a #

basicOverlaps :: MArray v f s a -> MArray v f s a -> Bool #

basicUnsafeNew :: PrimMonad m => Int -> m (MArray v f (PrimState m) a) #

basicInitialize :: PrimMonad m => MArray v f (PrimState m) a -> m () #

basicUnsafeReplicate :: PrimMonad m => Int -> a -> m (MArray v f (PrimState m) a) #

basicUnsafeRead :: PrimMonad m => MArray v f (PrimState m) a -> Int -> m a #

basicUnsafeWrite :: PrimMonad m => MArray v f (PrimState m) a -> Int -> a -> m () #

basicClear :: PrimMonad m => MArray v f (PrimState m) a -> m () #

basicSet :: PrimMonad m => MArray v f (PrimState m) a -> a -> m () #

basicUnsafeCopy :: PrimMonad m => MArray v f (PrimState m) a -> MArray v f (PrimState m) a -> m () #

basicUnsafeMove :: PrimMonad m => MArray v f (PrimState m) a -> MArray v f (PrimState m) a -> m () #

basicUnsafeGrow :: PrimMonad m => MArray v f (PrimState m) a -> Int -> m (MArray v f (PrimState m) a) #

type BMArray = MArray MVector Source #

Boxed mutable array.

type UMArray = MArray MVector Source #

Unboxed mutable array.

type SMArray = MArray MVector Source #

Storable mutable array.

type PMArray = MArray MVector Source #

Primitive mutable array.

Delayed

data Delayed f a Source #

A delayed representation of an array. This useful for mapping over an array in parallel.

Instances

Instances details
Shape f => HasLayout f (Delayed f a) Source #

The size of the layout must remain the same or an error is thrown.

Instance details

Defined in Data.Dense.Base

Methods

layout :: Lens' (Delayed f a) (Layout f) Source #

Functor (Delayed f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

fmap :: (a -> b) -> Delayed f a -> Delayed f b #

(<$) :: a -> Delayed f b -> Delayed f a #

Shape f => Foldable (Delayed f) Source #

foldMap in parallel.

Instance details

Defined in Data.Dense.Base

Methods

fold :: Monoid m => Delayed f m -> m #

foldMap :: Monoid m => (a -> m) -> Delayed f a -> m #

foldMap' :: Monoid m => (a -> m) -> Delayed f a -> m #

foldr :: (a -> b -> b) -> b -> Delayed f a -> b #

foldr' :: (a -> b -> b) -> b -> Delayed f a -> b #

foldl :: (b -> a -> b) -> b -> Delayed f a -> b #

foldl' :: (b -> a -> b) -> b -> Delayed f a -> b #

foldr1 :: (a -> a -> a) -> Delayed f a -> a #

foldl1 :: (a -> a -> a) -> Delayed f a -> a #

toList :: Delayed f a -> [a] #

null :: Delayed f a -> Bool #

length :: Delayed f a -> Int #

elem :: Eq a => a -> Delayed f a -> Bool #

maximum :: Ord a => Delayed f a -> a #

minimum :: Ord a => Delayed f a -> a #

sum :: Num a => Delayed f a -> a #

product :: Num a => Delayed f a -> a #

Shape f => Traversable (Delayed f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

traverse :: Applicative f0 => (a -> f0 b) -> Delayed f a -> f0 (Delayed f b) #

sequenceA :: Applicative f0 => Delayed f (f0 a) -> f0 (Delayed f a) #

mapM :: Monad m => (a -> m b) -> Delayed f a -> m (Delayed f b) #

sequence :: Monad m => Delayed f (m a) -> m (Delayed f a) #

Shape f => Apply (Delayed f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

(<.>) :: Delayed f (a -> b) -> Delayed f a -> Delayed f b #

(.>) :: Delayed f a -> Delayed f b -> Delayed f b #

(<.) :: Delayed f a -> Delayed f b -> Delayed f a #

liftF2 :: (a -> b -> c) -> Delayed f a -> Delayed f b -> Delayed f c #

Shape f => Metric (Delayed f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

dot :: Num a => Delayed f a -> Delayed f a -> a #

quadrance :: Num a => Delayed f a -> a #

qd :: Num a => Delayed f a -> Delayed f a -> a #

distance :: Floating a => Delayed f a -> Delayed f a -> a #

norm :: Floating a => Delayed f a -> a #

signorm :: Floating a => Delayed f a -> Delayed f a #

Shape f => Additive (Delayed f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

zero :: Num a => Delayed f a #

(^+^) :: Num a => Delayed f a -> Delayed f a -> Delayed f a #

(^-^) :: Num a => Delayed f a -> Delayed f a -> Delayed f a #

lerp :: Num a => a -> Delayed f a -> Delayed f a -> Delayed f a #

liftU2 :: (a -> a -> a) -> Delayed f a -> Delayed f a -> Delayed f a #

liftI2 :: (a -> b -> c) -> Delayed f a -> Delayed f b -> Delayed f c #

FunctorWithIndex (f Int) (Delayed f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

imap :: (f Int -> a -> b) -> Delayed f a -> Delayed f b #

imapped :: IndexedSetter (f Int) (Delayed f a) (Delayed f b) a b #

Shape f => FoldableWithIndex (f Int) (Delayed f) Source #

ifoldMap in parallel.

Instance details

Defined in Data.Dense.Base

Methods

ifoldMap :: Monoid m => (f Int -> a -> m) -> Delayed f a -> m #

ifolded :: IndexedFold (f Int) (Delayed f a) a #

ifoldr :: (f Int -> a -> b -> b) -> b -> Delayed f a -> b #

ifoldl :: (f Int -> b -> a -> b) -> b -> Delayed f a -> b #

ifoldr' :: (f Int -> a -> b -> b) -> b -> Delayed f a -> b #

ifoldl' :: (f Int -> b -> a -> b) -> b -> Delayed f a -> b #

Shape f => TraversableWithIndex (f Int) (Delayed f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

itraverse :: Applicative f0 => (f Int -> a -> f0 b) -> Delayed f a -> f0 (Delayed f b) #

itraversed :: IndexedTraversal (f Int) (Delayed f a) (Delayed f b) a b #

(Shape f, Show1 f, Show a) => Show (Delayed f a) Source # 
Instance details

Defined in Data.Dense.Base

Methods

showsPrec :: Int -> Delayed f a -> ShowS #

show :: Delayed f a -> String #

showList :: [Delayed f a] -> ShowS #

Shape f => Ixed (Delayed f a) Source # 
Instance details

Defined in Data.Dense.Base

Methods

ix :: Index (Delayed f a) -> Traversal' (Delayed f a) (IxValue (Delayed f a)) #

Shape f => AsEmpty (Delayed f a) Source # 
Instance details

Defined in Data.Dense.Base

Methods

_Empty :: Prism' (Delayed f a) () #

Shape f => Each (Delayed f a) (Delayed f b) a b Source # 
Instance details

Defined in Data.Dense.Base

Methods

each :: Traversal (Delayed f a) (Delayed f b) a b #

type Index (Delayed f a) Source # 
Instance details

Defined in Data.Dense.Base

type Index (Delayed f a) = f Int
type IxValue (Delayed f a) Source # 
Instance details

Defined in Data.Dense.Base

type IxValue (Delayed f a) = a

Generating delayed

delayed :: (Vector v a, Vector w b, Shape f, Shape g) => Iso (Array v f a) (Array w g b) (Delayed f a) (Delayed g b) Source #

Isomorphism between an array and its delayed representation. Conversion to the array is done in parallel.

seqDelayed :: (Vector v a, Vector w b, Shape f, Shape g) => Iso (Array v f a) (Array w g b) (Delayed f a) (Delayed g b) Source #

Isomorphism between an array and its delayed representation. Conversion to the array is done in parallel.

delay :: (Vector v a, Shape f) => Array v f a -> Delayed f a Source #

Turn a material array into a delayed one with the same shape.

manifest :: (Vector v a, Shape f) => Delayed f a -> Array v f a Source #

Parallel manifestation of a delayed array into a material one.

seqManifest :: (Vector v a, Shape f) => Delayed f a -> Array v f a Source #

Sequential manifestation of a delayed array.

genDelayed :: Layout f -> (f Int -> a) -> Delayed f a Source #

Generate a Delayed array using the given Layout and construction function.

indexDelayed :: Shape f => Delayed f a -> f Int -> a Source #

Index a delayed array, returning a IndexOutOfBounds exception if the index is out of range.

affirm :: (Shape f, Unbox a) => Delayed f a -> Delayed f a Source #

manifest an array to a UArray and delay again. See Data.Dense.Boxed or Data.Dense.Storable to affirm for other types of arrays.

seqAffirm :: (Shape f, Unbox a) => Delayed f a -> Delayed f a Source #

seqManifest an array to a UArray and delay again. See Data.Dense.Boxed or Data.Dense.Storable to affirm for other types of arrays.

Helpful reexports

(*^) :: (Functor f, Num a) => a -> f a -> f a infixl 7 #

Compute the left scalar product

>>> 2 *^ V2 3 4
V2 6 8

(^*) :: (Functor f, Num a) => f a -> a -> f a infixl 7 #

Compute the right scalar product

>>> V2 3 4 ^* 2
V2 6 8

(^/) :: (Functor f, Fractional a) => f a -> a -> f a infixl 7 #

Compute division by a scalar on the right.

class Functor f => Additive (f :: Type -> Type) where #

A vector is an additive group with additional structure.

Minimal complete definition

Nothing

Methods

zero :: Num a => f a #

The zero vector

(^+^) :: Num a => f a -> f a -> f a infixl 6 #

Compute the sum of two vectors

>>> V2 1 2 ^+^ V2 3 4
V2 4 6

(^-^) :: Num a => f a -> f a -> f a infixl 6 #

Compute the difference between two vectors

>>> V2 4 5 ^-^ V2 3 1
V2 1 4

lerp :: Num a => a -> f a -> f a -> f a #

Linearly interpolate between two vectors.

liftU2 :: (a -> a -> a) -> f a -> f a -> f a #

Apply a function to merge the 'non-zero' components of two vectors, unioning the rest of the values.

  • For a dense vector this is equivalent to liftA2.
  • For a sparse vector this is equivalent to unionWith.

liftI2 :: (a -> b -> c) -> f a -> f b -> f c #

Apply a function to the components of two vectors.

Instances

Instances details
Additive [] 
Instance details

Defined in Linear.Vector

Methods

zero :: Num a => [a] #

(^+^) :: Num a => [a] -> [a] -> [a] #

(^-^) :: Num a => [a] -> [a] -> [a] #

lerp :: Num a => a -> [a] -> [a] -> [a] #

liftU2 :: (a -> a -> a) -> [a] -> [a] -> [a] #

liftI2 :: (a -> b -> c) -> [a] -> [b] -> [c] #

Additive Maybe 
Instance details

Defined in Linear.Vector

Methods

zero :: Num a => Maybe a #

(^+^) :: Num a => Maybe a -> Maybe a -> Maybe a #

(^-^) :: Num a => Maybe a -> Maybe a -> Maybe a #

lerp :: Num a => a -> Maybe a -> Maybe a -> Maybe a #

liftU2 :: (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a #

liftI2 :: (a -> b -> c) -> Maybe a -> Maybe b -> Maybe c #

Additive Complex 
Instance details

Defined in Linear.Vector

Methods

zero :: Num a => Complex a #

(^+^) :: Num a => Complex a -> Complex a -> Complex a #

(^-^) :: Num a => Complex a -> Complex a -> Complex a #

lerp :: Num a => a -> Complex a -> Complex a -> Complex a #

liftU2 :: (a -> a -> a) -> Complex a -> Complex a -> Complex a #

liftI2 :: (a -> b -> c) -> Complex a -> Complex b -> Complex c #

Additive ZipList 
Instance details

Defined in Linear.Vector

Methods

zero :: Num a => ZipList a #

(^+^) :: Num a => ZipList a -> ZipList a -> ZipList a #

(^-^) :: Num a => ZipList a -> ZipList a -> ZipList a #

lerp :: Num a => a -> ZipList a -> ZipList a -> ZipList a #

liftU2 :: (a -> a -> a) -> ZipList a -> ZipList a -> ZipList a #

liftI2 :: (a -> b -> c) -> ZipList a -> ZipList b -> ZipList c #

Additive Identity 
Instance details

Defined in Linear.Vector

Methods

zero :: Num a => Identity a #

(^+^) :: Num a => Identity a -> Identity a -> Identity a #

(^-^) :: Num a => Identity a -> Identity a -> Identity a #

lerp :: Num a => a -> Identity a -> Identity a -> Identity a #

liftU2 :: (a -> a -> a) -> Identity a -> Identity a -> Identity a #

liftI2 :: (a -> b -> c) -> Identity a -> Identity b -> Identity c #

Additive IntMap 
Instance details

Defined in Linear.Vector

Methods

zero :: Num a => IntMap a #

(^+^) :: Num a => IntMap a -> IntMap a -> IntMap a #

(^-^) :: Num a => IntMap a -> IntMap a -> IntMap a #

lerp :: Num a => a -> IntMap a -> IntMap a -> IntMap a #

liftU2 :: (a -> a -> a) -> IntMap a -> IntMap a -> IntMap a #

liftI2 :: (a -> b -> c) -> IntMap a -> IntMap b -> IntMap c #

Additive Vector 
Instance details

Defined in Linear.Vector

Methods

zero :: Num a => Vector a #

(^+^) :: Num a => Vector a -> Vector a -> Vector a #

(^-^) :: Num a => Vector a -> Vector a -> Vector a #

lerp :: Num a => a -> Vector a -> Vector a -> Vector a #

liftU2 :: (a -> a -> a) -> Vector a -> Vector a -> Vector a #

liftI2 :: (a -> b -> c) -> Vector a -> Vector b -> Vector c #

Additive Plucker 
Instance details

Defined in Linear.Plucker

Methods

zero :: Num a => Plucker a #

(^+^) :: Num a => Plucker a -> Plucker a -> Plucker a #

(^-^) :: Num a => Plucker a -> Plucker a -> Plucker a #

lerp :: Num a => a -> Plucker a -> Plucker a -> Plucker a #

liftU2 :: (a -> a -> a) -> Plucker a -> Plucker a -> Plucker a #

liftI2 :: (a -> b -> c) -> Plucker a -> Plucker b -> Plucker c #

Additive Quaternion 
Instance details

Defined in Linear.Quaternion

Methods

zero :: Num a => Quaternion a #

(^+^) :: Num a => Quaternion a -> Quaternion a -> Quaternion a #

(^-^) :: Num a => Quaternion a -> Quaternion a -> Quaternion a #

lerp :: Num a => a -> Quaternion a -> Quaternion a -> Quaternion a #

liftU2 :: (a -> a -> a) -> Quaternion a -> Quaternion a -> Quaternion a #

liftI2 :: (a -> b -> c) -> Quaternion a -> Quaternion b -> Quaternion c #

Additive V0 
Instance details

Defined in Linear.V0

Methods

zero :: Num a => V0 a #

(^+^) :: Num a => V0 a -> V0 a -> V0 a #

(^-^) :: Num a => V0 a -> V0 a -> V0 a #

lerp :: Num a => a -> V0 a -> V0 a -> V0 a #

liftU2 :: (a -> a -> a) -> V0 a -> V0 a -> V0 a #

liftI2 :: (a -> b -> c) -> V0 a -> V0 b -> V0 c #

Additive V4 
Instance details

Defined in Linear.V4

Methods

zero :: Num a => V4 a #

(^+^) :: Num a => V4 a -> V4 a -> V4 a #

(^-^) :: Num a => V4 a -> V4 a -> V4 a #

lerp :: Num a => a -> V4 a -> V4 a -> V4 a #

liftU2 :: (a -> a -> a) -> V4 a -> V4 a -> V4 a #

liftI2 :: (a -> b -> c) -> V4 a -> V4 b -> V4 c #

Additive V3 
Instance details

Defined in Linear.V3

Methods

zero :: Num a => V3 a #

(^+^) :: Num a => V3 a -> V3 a -> V3 a #

(^-^) :: Num a => V3 a -> V3 a -> V3 a #

lerp :: Num a => a -> V3 a -> V3 a -> V3 a #

liftU2 :: (a -> a -> a) -> V3 a -> V3 a -> V3 a #

liftI2 :: (a -> b -> c) -> V3 a -> V3 b -> V3 c #

Additive V2 
Instance details

Defined in Linear.V2

Methods

zero :: Num a => V2 a #

(^+^) :: Num a => V2 a -> V2 a -> V2 a #

(^-^) :: Num a => V2 a -> V2 a -> V2 a #

lerp :: Num a => a -> V2 a -> V2 a -> V2 a #

liftU2 :: (a -> a -> a) -> V2 a -> V2 a -> V2 a #

liftI2 :: (a -> b -> c) -> V2 a -> V2 b -> V2 c #

Additive V1 
Instance details

Defined in Linear.V1

Methods

zero :: Num a => V1 a #

(^+^) :: Num a => V1 a -> V1 a -> V1 a #

(^-^) :: Num a => V1 a -> V1 a -> V1 a #

lerp :: Num a => a -> V1 a -> V1 a -> V1 a #

liftU2 :: (a -> a -> a) -> V1 a -> V1 a -> V1 a #

liftI2 :: (a -> b -> c) -> V1 a -> V1 b -> V1 c #

Ord k => Additive (Map k) 
Instance details

Defined in Linear.Vector

Methods

zero :: Num a => Map k a #

(^+^) :: Num a => Map k a -> Map k a -> Map k a #

(^-^) :: Num a => Map k a -> Map k a -> Map k a #

lerp :: Num a => a -> Map k a -> Map k a -> Map k a #

liftU2 :: (a -> a -> a) -> Map k a -> Map k a -> Map k a #

liftI2 :: (a -> b -> c) -> Map k a -> Map k b -> Map k c #

(Eq k, Hashable k) => Additive (HashMap k) 
Instance details

Defined in Linear.Vector

Methods

zero :: Num a => HashMap k a #

(^+^) :: Num a => HashMap k a -> HashMap k a -> HashMap k a #

(^-^) :: Num a => HashMap k a -> HashMap k a -> HashMap k a #

lerp :: Num a => a -> HashMap k a -> HashMap k a -> HashMap k a #

liftU2 :: (a -> a -> a) -> HashMap k a -> HashMap k a -> HashMap k a #

liftI2 :: (a -> b -> c) -> HashMap k a -> HashMap k b -> HashMap k c #

Shape f => Additive (Delayed f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

zero :: Num a => Delayed f a #

(^+^) :: Num a => Delayed f a -> Delayed f a -> Delayed f a #

(^-^) :: Num a => Delayed f a -> Delayed f a -> Delayed f a #

lerp :: Num a => a -> Delayed f a -> Delayed f a -> Delayed f a #

liftU2 :: (a -> a -> a) -> Delayed f a -> Delayed f a -> Delayed f a #

liftI2 :: (a -> b -> c) -> Delayed f a -> Delayed f b -> Delayed f c #

Dim n => Additive (V n) 
Instance details

Defined in Linear.V

Methods

zero :: Num a => V n a #

(^+^) :: Num a => V n a -> V n a -> V n a #

(^-^) :: Num a => V n a -> V n a -> V n a #

lerp :: Num a => a -> V n a -> V n a -> V n a #

liftU2 :: (a -> a -> a) -> V n a -> V n a -> V n a #

liftI2 :: (a -> b -> c) -> V n a -> V n b -> V n c #

Additive ((->) b :: Type -> Type) 
Instance details

Defined in Linear.Vector

Methods

zero :: Num a => b -> a #

(^+^) :: Num a => (b -> a) -> (b -> a) -> b -> a #

(^-^) :: Num a => (b -> a) -> (b -> a) -> b -> a #

lerp :: Num a => a -> (b -> a) -> (b -> a) -> b -> a #

liftU2 :: (a -> a -> a) -> (b -> a) -> (b -> a) -> b -> a #

liftI2 :: (a -> b0 -> c) -> (b -> a) -> (b -> b0) -> b -> c #

(Additive f, Additive g) => Additive (Product f g) 
Instance details

Defined in Linear.Vector

Methods

zero :: Num a => Product f g a #

(^+^) :: Num a => Product f g a -> Product f g a -> Product f g a #

(^-^) :: Num a => Product f g a -> Product f g a -> Product f g a #

lerp :: Num a => a -> Product f g a -> Product f g a -> Product f g a #

liftU2 :: (a -> a -> a) -> Product f g a -> Product f g a -> Product f g a #

liftI2 :: (a -> b -> c) -> Product f g a -> Product f g b -> Product f g c #

(Additive f, Additive g) => Additive (Compose f g) 
Instance details

Defined in Linear.Vector

Methods

zero :: Num a => Compose f g a #

(^+^) :: Num a => Compose f g a -> Compose f g a -> Compose f g a #

(^-^) :: Num a => Compose f g a -> Compose f g a -> Compose f g a #

lerp :: Num a => a -> Compose f g a -> Compose f g a -> Compose f g a #

liftU2 :: (a -> a -> a) -> Compose f g a -> Compose f g a -> Compose f g a #

liftI2 :: (a -> b -> c) -> Compose f g a -> Compose f g b -> Compose f g c #

class Additive f => Metric (f :: Type -> Type) where #

Free and sparse inner product/metric spaces.

Minimal complete definition

Nothing

Methods

dot :: Num a => f a -> f a -> a #

Compute the inner product of two vectors or (equivalently) convert a vector f a into a covector f a -> a.

>>> V2 1 2 `dot` V2 3 4
11

quadrance :: Num a => f a -> a #

Compute the squared norm. The name quadrance arises from Norman J. Wildberger's rational trigonometry.

qd :: Num a => f a -> f a -> a #

Compute the quadrance of the difference

distance :: Floating a => f a -> f a -> a #

Compute the distance between two vectors in a metric space

norm :: Floating a => f a -> a #

Compute the norm of a vector in a metric space

signorm :: Floating a => f a -> f a #

Convert a non-zero vector to unit vector.

Instances

Instances details
Metric [] 
Instance details

Defined in Linear.Metric

Methods

dot :: Num a => [a] -> [a] -> a #

quadrance :: Num a => [a] -> a #

qd :: Num a => [a] -> [a] -> a #

distance :: Floating a => [a] -> [a] -> a #

norm :: Floating a => [a] -> a #

signorm :: Floating a => [a] -> [a] #

Metric Maybe 
Instance details

Defined in Linear.Metric

Methods

dot :: Num a => Maybe a -> Maybe a -> a #

quadrance :: Num a => Maybe a -> a #

qd :: Num a => Maybe a -> Maybe a -> a #

distance :: Floating a => Maybe a -> Maybe a -> a #

norm :: Floating a => Maybe a -> a #

signorm :: Floating a => Maybe a -> Maybe a #

Metric ZipList 
Instance details

Defined in Linear.Metric

Methods

dot :: Num a => ZipList a -> ZipList a -> a #

quadrance :: Num a => ZipList a -> a #

qd :: Num a => ZipList a -> ZipList a -> a #

distance :: Floating a => ZipList a -> ZipList a -> a #

norm :: Floating a => ZipList a -> a #

signorm :: Floating a => ZipList a -> ZipList a #

Metric Identity 
Instance details

Defined in Linear.Metric

Methods

dot :: Num a => Identity a -> Identity a -> a #

quadrance :: Num a => Identity a -> a #

qd :: Num a => Identity a -> Identity a -> a #

distance :: Floating a => Identity a -> Identity a -> a #

norm :: Floating a => Identity a -> a #

signorm :: Floating a => Identity a -> Identity a #

Metric IntMap 
Instance details

Defined in Linear.Metric

Methods

dot :: Num a => IntMap a -> IntMap a -> a #

quadrance :: Num a => IntMap a -> a #

qd :: Num a => IntMap a -> IntMap a -> a #

distance :: Floating a => IntMap a -> IntMap a -> a #

norm :: Floating a => IntMap a -> a #

signorm :: Floating a => IntMap a -> IntMap a #

Metric Vector 
Instance details

Defined in Linear.Metric

Methods

dot :: Num a => Vector a -> Vector a -> a #

quadrance :: Num a => Vector a -> a #

qd :: Num a => Vector a -> Vector a -> a #

distance :: Floating a => Vector a -> Vector a -> a #

norm :: Floating a => Vector a -> a #

signorm :: Floating a => Vector a -> Vector a #

Metric Plucker 
Instance details

Defined in Linear.Plucker

Methods

dot :: Num a => Plucker a -> Plucker a -> a #

quadrance :: Num a => Plucker a -> a #

qd :: Num a => Plucker a -> Plucker a -> a #

distance :: Floating a => Plucker a -> Plucker a -> a #

norm :: Floating a => Plucker a -> a #

signorm :: Floating a => Plucker a -> Plucker a #

Metric Quaternion 
Instance details

Defined in Linear.Quaternion

Methods

dot :: Num a => Quaternion a -> Quaternion a -> a #

quadrance :: Num a => Quaternion a -> a #

qd :: Num a => Quaternion a -> Quaternion a -> a #

distance :: Floating a => Quaternion a -> Quaternion a -> a #

norm :: Floating a => Quaternion a -> a #

signorm :: Floating a => Quaternion a -> Quaternion a #

Metric V0 
Instance details

Defined in Linear.V0

Methods

dot :: Num a => V0 a -> V0 a -> a #

quadrance :: Num a => V0 a -> a #

qd :: Num a => V0 a -> V0 a -> a #

distance :: Floating a => V0 a -> V0 a -> a #

norm :: Floating a => V0 a -> a #

signorm :: Floating a => V0 a -> V0 a #

Metric V4 
Instance details

Defined in Linear.V4

Methods

dot :: Num a => V4 a -> V4 a -> a #

quadrance :: Num a => V4 a -> a #

qd :: Num a => V4 a -> V4 a -> a #

distance :: Floating a => V4 a -> V4 a -> a #

norm :: Floating a => V4 a -> a #

signorm :: Floating a => V4 a -> V4 a #

Metric V3 
Instance details

Defined in Linear.V3

Methods

dot :: Num a => V3 a -> V3 a -> a #

quadrance :: Num a => V3 a -> a #

qd :: Num a => V3 a -> V3 a -> a #

distance :: Floating a => V3 a -> V3 a -> a #

norm :: Floating a => V3 a -> a #

signorm :: Floating a => V3 a -> V3 a #

Metric V2 
Instance details

Defined in Linear.V2

Methods

dot :: Num a => V2 a -> V2 a -> a #

quadrance :: Num a => V2 a -> a #

qd :: Num a => V2 a -> V2 a -> a #

distance :: Floating a => V2 a -> V2 a -> a #

norm :: Floating a => V2 a -> a #

signorm :: Floating a => V2 a -> V2 a #

Metric V1 
Instance details

Defined in Linear.V1

Methods

dot :: Num a => V1 a -> V1 a -> a #

quadrance :: Num a => V1 a -> a #

qd :: Num a => V1 a -> V1 a -> a #

distance :: Floating a => V1 a -> V1 a -> a #

norm :: Floating a => V1 a -> a #

signorm :: Floating a => V1 a -> V1 a #

Ord k => Metric (Map k) 
Instance details

Defined in Linear.Metric

Methods

dot :: Num a => Map k a -> Map k a -> a #

quadrance :: Num a => Map k a -> a #

qd :: Num a => Map k a -> Map k a -> a #

distance :: Floating a => Map k a -> Map k a -> a #

norm :: Floating a => Map k a -> a #

signorm :: Floating a => Map k a -> Map k a #

(Hashable k, Eq k) => Metric (HashMap k) 
Instance details

Defined in Linear.Metric

Methods

dot :: Num a => HashMap k a -> HashMap k a -> a #

quadrance :: Num a => HashMap k a -> a #

qd :: Num a => HashMap k a -> HashMap k a -> a #

distance :: Floating a => HashMap k a -> HashMap k a -> a #

norm :: Floating a => HashMap k a -> a #

signorm :: Floating a => HashMap k a -> HashMap k a #

Shape f => Metric (Delayed f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

dot :: Num a => Delayed f a -> Delayed f a -> a #

quadrance :: Num a => Delayed f a -> a #

qd :: Num a => Delayed f a -> Delayed f a -> a #

distance :: Floating a => Delayed f a -> Delayed f a -> a #

norm :: Floating a => Delayed f a -> a #

signorm :: Floating a => Delayed f a -> Delayed f a #

Dim n => Metric (V n) 
Instance details

Defined in Linear.V

Methods

dot :: Num a => V n a -> V n a -> a #

quadrance :: Num a => V n a -> a #

qd :: Num a => V n a -> V n a -> a #

distance :: Floating a => V n a -> V n a -> a #

norm :: Floating a => V n a -> a #

signorm :: Floating a => V n a -> V n a #

(Metric f, Metric g) => Metric (Product f g) 
Instance details

Defined in Linear.Metric

Methods

dot :: Num a => Product f g a -> Product f g a -> a #

quadrance :: Num a => Product f g a -> a #

qd :: Num a => Product f g a -> Product f g a -> a #

distance :: Floating a => Product f g a -> Product f g a -> a #

norm :: Floating a => Product f g a -> a #

signorm :: Floating a => Product f g a -> Product f g a #

(Metric f, Metric g) => Metric (Compose f g) 
Instance details

Defined in Linear.Metric

Methods

dot :: Num a => Compose f g a -> Compose f g a -> a #

quadrance :: Num a => Compose f g a -> a #

qd :: Num a => Compose f g a -> Compose f g a -> a #

distance :: Floating a => Compose f g a -> Compose f g a -> a #

norm :: Floating a => Compose f g a -> a #

signorm :: Floating a => Compose f g a -> Compose f g a #

Focused

data Focused f a Source #

A delayed representation of an array with a focus on a single element. This element is the target of extract.

Instances

Instances details
Shape f => HasLayout f (Focused f a) Source #

The size of the layout must remain the same or an error is thrown.

Instance details

Defined in Data.Dense.Base

Methods

layout :: Lens' (Focused f a) (Layout f) Source #

Functor (Focused f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

fmap :: (a -> b) -> Focused f a -> Focused f b #

(<$) :: a -> Focused f b -> Focused f a #

Shape f => Foldable (Focused f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

fold :: Monoid m => Focused f m -> m #

foldMap :: Monoid m => (a -> m) -> Focused f a -> m #

foldMap' :: Monoid m => (a -> m) -> Focused f a -> m #

foldr :: (a -> b -> b) -> b -> Focused f a -> b #

foldr' :: (a -> b -> b) -> b -> Focused f a -> b #

foldl :: (b -> a -> b) -> b -> Focused f a -> b #

foldl' :: (b -> a -> b) -> b -> Focused f a -> b #

foldr1 :: (a -> a -> a) -> Focused f a -> a #

foldl1 :: (a -> a -> a) -> Focused f a -> a #

toList :: Focused f a -> [a] #

null :: Focused f a -> Bool #

length :: Focused f a -> Int #

elem :: Eq a => a -> Focused f a -> Bool #

maximum :: Ord a => Focused f a -> a #

minimum :: Ord a => Focused f a -> a #

sum :: Num a => Focused f a -> a #

product :: Num a => Focused f a -> a #

Shape f => Traversable (Focused f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

traverse :: Applicative f0 => (a -> f0 b) -> Focused f a -> f0 (Focused f b) #

sequenceA :: Applicative f0 => Focused f (f0 a) -> f0 (Focused f a) #

mapM :: Monad m => (a -> m b) -> Focused f a -> m (Focused f b) #

sequence :: Monad m => Focused f (m a) -> m (Focused f a) #

Shape f => Comonad (Focused f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

extract :: Focused f a -> a #

duplicate :: Focused f a -> Focused f (Focused f a) #

extend :: (Focused f a -> b) -> Focused f a -> Focused f b #

Shape f => Extend (Focused f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

duplicated :: Focused f a -> Focused f (Focused f a) #

extended :: (Focused f a -> b) -> Focused f a -> Focused f b #

Shape f => ComonadStore (f Int) (Focused f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

pos :: Focused f a -> f Int #

peek :: f Int -> Focused f a -> a #

peeks :: (f Int -> f Int) -> Focused f a -> a #

seek :: f Int -> Focused f a -> Focused f a #

seeks :: (f Int -> f Int) -> Focused f a -> Focused f a #

experiment :: Functor f0 => (f Int -> f0 (f Int)) -> Focused f a -> f0 a #

Shape f => FunctorWithIndex (f Int) (Focused f) Source #

Index relative to focus.

Instance details

Defined in Data.Dense.Base

Methods

imap :: (f Int -> a -> b) -> Focused f a -> Focused f b #

imapped :: IndexedSetter (f Int) (Focused f a) (Focused f b) a b #

Shape f => FoldableWithIndex (f Int) (Focused f) Source #

Index relative to focus.

Instance details

Defined in Data.Dense.Base

Methods

ifoldMap :: Monoid m => (f Int -> a -> m) -> Focused f a -> m #

ifolded :: IndexedFold (f Int) (Focused f a) a #

ifoldr :: (f Int -> a -> b -> b) -> b -> Focused f a -> b #

ifoldl :: (f Int -> b -> a -> b) -> b -> Focused f a -> b #

ifoldr' :: (f Int -> a -> b -> b) -> b -> Focused f a -> b #

ifoldl' :: (f Int -> b -> a -> b) -> b -> Focused f a -> b #

Shape f => TraversableWithIndex (f Int) (Focused f) Source #

Index relative to focus.

Instance details

Defined in Data.Dense.Base

Methods

itraverse :: Applicative f0 => (f Int -> a -> f0 b) -> Focused f a -> f0 (Focused f b) #

itraversed :: IndexedTraversal (f Int) (Focused f a) (Focused f b) a b #

(Shape f, Show1 f, Show a) => Show (Focused f a) Source # 
Instance details

Defined in Data.Dense.Base

Methods

showsPrec :: Int -> Focused f a -> ShowS #

show :: Focused f a -> String #

showList :: [Focused f a] -> ShowS #

Shape f => Ixed (Focused f a) Source #

Index relative to focus.

Instance details

Defined in Data.Dense.Base

Methods

ix :: Index (Focused f a) -> Traversal' (Focused f a) (IxValue (Focused f a)) #

type Index (Focused f a) Source # 
Instance details

Defined in Data.Dense.Base

type Index (Focused f a) = f Int
type IxValue (Focused f a) Source # 
Instance details

Defined in Data.Dense.Base

type IxValue (Focused f a) = a

Generating focused

focusOn :: f Int -> Delayed f a -> Focused f a Source #

Focus on a particular element of a delayed array.

unfocus :: Focused f a -> Delayed f a Source #

Discard the focus to retrieve the delayed array.

unfocused :: IndexedLens (f Int) (Focused f a) (Focused f b) (Delayed f a) (Delayed f b) Source #

Indexed lens onto the delayed array, indexed at the focus.

extendFocus :: Shape f => (Focused f a -> b) -> Delayed f a -> Delayed f b Source #

Modify a Delayed array by extracting a value from a Focused each point.

Focus location

locale :: ComonadStore s w => Lens' (w a) s Source #

Lens onto the position of a ComonadStore.

locale :: Lens' (Focused l a) (l Int)

shiftFocus :: Applicative f => f Int -> Focused f a -> Focused f a Source #

Focus on a neighbouring element, relative to the current focus.

Boundary

data Boundary Source #

The boundary condition used for indexing relative elements in a Focused.

Constructors

Clamp

clamp coordinates to the extent of the array

Mirror

mirror coordinates beyond the array extent

Wrap

wrap coordinates around on each dimension

Instances

Instances details
Read Boundary Source # 
Instance details

Defined in Data.Dense.Generic

Show Boundary Source # 
Instance details

Defined in Data.Dense.Generic

peekB :: Shape f => Boundary -> f Int -> Focused f a -> a Source #

Index a focused using a Boundary condition.

peeksB :: Shape f => Boundary -> (f Int -> f Int) -> Focused f a -> a Source #

Index an element by applying a function the current position, using a boundary condition.

peekRelativeB :: Shape f => Boundary -> f Int -> Focused f a -> a Source #

Index an element relative to the current focus using a Boundary condition.

Helpful reexports

class Functor w => Comonad (w :: Type -> Type) where #

There are two ways to define a comonad:

I. Provide definitions for extract and extend satisfying these laws:

extend extract      = id
extract . extend f  = f
extend f . extend g = extend (f . extend g)

In this case, you may simply set fmap = liftW.

These laws are directly analogous to the laws for monads and perhaps can be made clearer by viewing them as laws stating that Cokleisli composition must be associative, and has extract for a unit:

f =>= extract   = f
extract =>= f   = f
(f =>= g) =>= h = f =>= (g =>= h)

II. Alternately, you may choose to provide definitions for fmap, extract, and duplicate satisfying these laws:

extract . duplicate      = id
fmap extract . duplicate = id
duplicate . duplicate    = fmap duplicate . duplicate

In this case you may not rely on the ability to define fmap in terms of liftW.

You may of course, choose to define both duplicate and extend. In that case you must also satisfy these laws:

extend f  = fmap f . duplicate
duplicate = extend id
fmap f    = extend (f . extract)

These are the default definitions of extend and duplicate and the definition of liftW respectively.

Minimal complete definition

extract, (duplicate | extend)

Methods

extract :: w a -> a #

extract . fmap f = f . extract

duplicate :: w a -> w (w a) #

extend :: (w a -> b) -> w a -> w b #

Instances

Instances details
Comonad Identity 
Instance details

Defined in Control.Comonad

Methods

extract :: Identity a -> a #

duplicate :: Identity a -> Identity (Identity a) #

extend :: (Identity a -> b) -> Identity a -> Identity b #

Comonad NonEmpty 
Instance details

Defined in Control.Comonad

Methods

extract :: NonEmpty a -> a #

duplicate :: NonEmpty a -> NonEmpty (NonEmpty a) #

extend :: (NonEmpty a -> b) -> NonEmpty a -> NonEmpty b #

Comonad Tree 
Instance details

Defined in Control.Comonad

Methods

extract :: Tree a -> a #

duplicate :: Tree a -> Tree (Tree a) #

extend :: (Tree a -> b) -> Tree a -> Tree b #

Comonad ((,) e) 
Instance details

Defined in Control.Comonad

Methods

extract :: (e, a) -> a #

duplicate :: (e, a) -> (e, (e, a)) #

extend :: ((e, a) -> b) -> (e, a) -> (e, b) #

(Representable f, Monoid (Rep f)) => Comonad (Co f) 
Instance details

Defined in Data.Functor.Rep

Methods

extract :: Co f a -> a #

duplicate :: Co f a -> Co f (Co f a) #

extend :: (Co f a -> b) -> Co f a -> Co f b #

Comonad (Arg e) 
Instance details

Defined in Control.Comonad

Methods

extract :: Arg e a -> a #

duplicate :: Arg e a -> Arg e (Arg e a) #

extend :: (Arg e a -> b) -> Arg e a -> Arg e b #

Functor f => Comonad (Cofree f) 
Instance details

Defined in Control.Comonad.Cofree

Methods

extract :: Cofree f a -> a #

duplicate :: Cofree f a -> Cofree f (Cofree f a) #

extend :: (Cofree f a -> b) -> Cofree f a -> Cofree f b #

Comonad w => Comonad (Yoneda w) 
Instance details

Defined in Data.Functor.Yoneda

Methods

extract :: Yoneda w a -> a #

duplicate :: Yoneda w a -> Yoneda w (Yoneda w a) #

extend :: (Yoneda w a -> b) -> Yoneda w a -> Yoneda w b #

Monoid s => Comonad (ReifiedGetter s) 
Instance details

Defined in Control.Lens.Reified

Comonad f => Comonad (MaybeApply f) 
Instance details

Defined in Data.Functor.Bind.Class

Methods

extract :: MaybeApply f a -> a #

duplicate :: MaybeApply f a -> MaybeApply f (MaybeApply f a) #

extend :: (MaybeApply f a -> b) -> MaybeApply f a -> MaybeApply f b #

Shape f => Comonad (Focused f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

extract :: Focused f a -> a #

duplicate :: Focused f a -> Focused f (Focused f a) #

extend :: (Focused f a -> b) -> Focused f a -> Focused f b #

(Comonad w, Monoid m) => Comonad (TracedT m w) 
Instance details

Defined in Control.Comonad.Trans.Traced

Methods

extract :: TracedT m w a -> a #

duplicate :: TracedT m w a -> TracedT m w (TracedT m w a) #

extend :: (TracedT m w a -> b) -> TracedT m w a -> TracedT m w b #

Comonad w => Comonad (StoreT s w) 
Instance details

Defined in Control.Comonad.Trans.Store

Methods

extract :: StoreT s w a -> a #

duplicate :: StoreT s w a -> StoreT s w (StoreT s w a) #

extend :: (StoreT s w a -> b) -> StoreT s w a -> StoreT s w b #

Comonad w => Comonad (EnvT e w) 
Instance details

Defined in Control.Comonad.Trans.Env

Methods

extract :: EnvT e w a -> a #

duplicate :: EnvT e w a -> EnvT e w (EnvT e w a) #

extend :: (EnvT e w a -> b) -> EnvT e w a -> EnvT e w b #

Comonad w => Comonad (IdentityT w) 
Instance details

Defined in Control.Comonad

Methods

extract :: IdentityT w a -> a #

duplicate :: IdentityT w a -> IdentityT w (IdentityT w a) #

extend :: (IdentityT w a -> b) -> IdentityT w a -> IdentityT w b #

(Functor f, Comonad w) => Comonad (CofreeT f w) 
Instance details

Defined in Control.Comonad.Trans.Cofree

Methods

extract :: CofreeT f w a -> a #

duplicate :: CofreeT f w a -> CofreeT f w (CofreeT f w a) #

extend :: (CofreeT f w a -> b) -> CofreeT f w a -> CofreeT f w b #

(Comonad f, Comonad g) => Comonad (Day f g) 
Instance details

Defined in Data.Functor.Day

Methods

extract :: Day f g a -> a #

duplicate :: Day f g a -> Day f g (Day f g a) #

extend :: (Day f g a -> b) -> Day f g a -> Day f g b #

Comonad (Tagged s) 
Instance details

Defined in Control.Comonad

Methods

extract :: Tagged s a -> a #

duplicate :: Tagged s a -> Tagged s (Tagged s a) #

extend :: (Tagged s a -> b) -> Tagged s a -> Tagged s b #

a ~ b => Comonad (Context a b) 
Instance details

Defined in Control.Lens.Internal.Context

Methods

extract :: Context a b a0 -> a0 #

duplicate :: Context a b a0 -> Context a b (Context a b a0) #

extend :: (Context a b a0 -> b0) -> Context a b a0 -> Context a b b0 #

Monoid m => Comonad ((->) m :: Type -> Type) 
Instance details

Defined in Control.Comonad

Methods

extract :: (m -> a) -> a #

duplicate :: (m -> a) -> m -> (m -> a) #

extend :: ((m -> a) -> b) -> (m -> a) -> m -> b #

(Comonad f, Comonad g) => Comonad (Sum f g) 
Instance details

Defined in Control.Comonad

Methods

extract :: Sum f g a -> a #

duplicate :: Sum f g a -> Sum f g (Sum f g a) #

extend :: (Sum f g a -> b) -> Sum f g a -> Sum f g b #

a ~ b => Comonad (Molten i a b) 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

extract :: Molten i a b a0 -> a0 #

duplicate :: Molten i a b a0 -> Molten i a b (Molten i a b a0) #

extend :: (Molten i a b a0 -> b0) -> Molten i a b a0 -> Molten i a b b0 #

(a ~ b, Conjoined p) => Comonad (Bazaar p a b) 
Instance details

Defined in Control.Lens.Internal.Bazaar

Methods

extract :: Bazaar p a b a0 -> a0 #

duplicate :: Bazaar p a b a0 -> Bazaar p a b (Bazaar p a b a0) #

extend :: (Bazaar p a b a0 -> b0) -> Bazaar p a b a0 -> Bazaar p a b b0 #

(a ~ b, Conjoined p) => Comonad (Bazaar1 p a b) 
Instance details

Defined in Control.Lens.Internal.Bazaar

Methods

extract :: Bazaar1 p a b a0 -> a0 #

duplicate :: Bazaar1 p a b a0 -> Bazaar1 p a b (Bazaar1 p a b a0) #

extend :: (Bazaar1 p a b a0 -> b0) -> Bazaar1 p a b a0 -> Bazaar1 p a b b0 #

(a ~ b, Conjoined p) => Comonad (Pretext p a b) 
Instance details

Defined in Control.Lens.Internal.Context

Methods

extract :: Pretext p a b a0 -> a0 #

duplicate :: Pretext p a b a0 -> Pretext p a b (Pretext p a b a0) #

extend :: (Pretext p a b a0 -> b0) -> Pretext p a b a0 -> Pretext p a b b0 #

(a ~ b, Conjoined p) => Comonad (BazaarT p g a b) 
Instance details

Defined in Control.Lens.Internal.Bazaar

Methods

extract :: BazaarT p g a b a0 -> a0 #

duplicate :: BazaarT p g a b a0 -> BazaarT p g a b (BazaarT p g a b a0) #

extend :: (BazaarT p g a b a0 -> b0) -> BazaarT p g a b a0 -> BazaarT p g a b b0 #

(a ~ b, Conjoined p) => Comonad (BazaarT1 p g a b) 
Instance details

Defined in Control.Lens.Internal.Bazaar

Methods

extract :: BazaarT1 p g a b a0 -> a0 #

duplicate :: BazaarT1 p g a b a0 -> BazaarT1 p g a b (BazaarT1 p g a b a0) #

extend :: (BazaarT1 p g a b a0 -> b0) -> BazaarT1 p g a b a0 -> BazaarT1 p g a b b0 #

(a ~ b, Conjoined p) => Comonad (PretextT p g a b) 
Instance details

Defined in Control.Lens.Internal.Context

Methods

extract :: PretextT p g a b a0 -> a0 #

duplicate :: PretextT p g a b a0 -> PretextT p g a b (PretextT p g a b a0) #

extend :: (PretextT p g a b a0 -> b0) -> PretextT p g a b a0 -> PretextT p g a b b0 #

class Comonad w => ComonadStore s (w :: Type -> Type) | w -> s where #

Minimal complete definition

pos, peek

Methods

pos :: w a -> s #

peek :: s -> w a -> a #

peeks :: (s -> s) -> w a -> a #

seek :: s -> w a -> w a #

seeks :: (s -> s) -> w a -> w a #

experiment :: Functor f => (s -> f s) -> w a -> f a #

Instances

Instances details
ComonadStore s w => ComonadStore s (Cofree w) 
Instance details

Defined in Control.Comonad.Cofree

Methods

pos :: Cofree w a -> s #

peek :: s -> Cofree w a -> a #

peeks :: (s -> s) -> Cofree w a -> a #

seek :: s -> Cofree w a -> Cofree w a #

seeks :: (s -> s) -> Cofree w a -> Cofree w a #

experiment :: Functor f => (s -> f s) -> Cofree w a -> f a #

(ComonadStore s w, Monoid m) => ComonadStore s (TracedT m w) 
Instance details

Defined in Control.Comonad.Store.Class

Methods

pos :: TracedT m w a -> s #

peek :: s -> TracedT m w a -> a #

peeks :: (s -> s) -> TracedT m w a -> a #

seek :: s -> TracedT m w a -> TracedT m w a #

seeks :: (s -> s) -> TracedT m w a -> TracedT m w a #

experiment :: Functor f => (s -> f s) -> TracedT m w a -> f a #

Comonad w => ComonadStore s (StoreT s w) 
Instance details

Defined in Control.Comonad.Store.Class

Methods

pos :: StoreT s w a -> s #

peek :: s -> StoreT s w a -> a #

peeks :: (s -> s) -> StoreT s w a -> a #

seek :: s -> StoreT s w a -> StoreT s w a #

seeks :: (s -> s) -> StoreT s w a -> StoreT s w a #

experiment :: Functor f => (s -> f s) -> StoreT s w a -> f a #

ComonadStore s w => ComonadStore s (IdentityT w) 
Instance details

Defined in Control.Comonad.Store.Class

Methods

pos :: IdentityT w a -> s #

peek :: s -> IdentityT w a -> a #

peeks :: (s -> s) -> IdentityT w a -> a #

seek :: s -> IdentityT w a -> IdentityT w a #

seeks :: (s -> s) -> IdentityT w a -> IdentityT w a #

experiment :: Functor f => (s -> f s) -> IdentityT w a -> f a #

ComonadStore s w => ComonadStore s (EnvT e w) 
Instance details

Defined in Control.Comonad.Store.Class

Methods

pos :: EnvT e w a -> s #

peek :: s -> EnvT e w a -> a #

peeks :: (s -> s) -> EnvT e w a -> a #

seek :: s -> EnvT e w a -> EnvT e w a #

seeks :: (s -> s) -> EnvT e w a -> EnvT e w a #

experiment :: Functor f => (s -> f s) -> EnvT e w a -> f a #

a ~ b => ComonadStore a (Context a b) 
Instance details

Defined in Control.Lens.Internal.Context

Methods

pos :: Context a b a0 -> a #

peek :: a -> Context a b a0 -> a0 #

peeks :: (a -> a) -> Context a b a0 -> a0 #

seek :: a -> Context a b a0 -> Context a b a0 #

seeks :: (a -> a) -> Context a b a0 -> Context a b a0 #

experiment :: Functor f => (a -> f a) -> Context a b a0 -> f a0 #

(a ~ b, Conjoined p) => ComonadStore a (Pretext p a b) 
Instance details

Defined in Control.Lens.Internal.Context

Methods

pos :: Pretext p a b a0 -> a #

peek :: a -> Pretext p a b a0 -> a0 #

peeks :: (a -> a) -> Pretext p a b a0 -> a0 #

seek :: a -> Pretext p a b a0 -> Pretext p a b a0 #

seeks :: (a -> a) -> Pretext p a b a0 -> Pretext p a b a0 #

experiment :: Functor f => (a -> f a) -> Pretext p a b a0 -> f a0 #

(a ~ b, Conjoined p) => ComonadStore a (PretextT p g a b) 
Instance details

Defined in Control.Lens.Internal.Context

Methods

pos :: PretextT p g a b a0 -> a #

peek :: a -> PretextT p g a b a0 -> a0 #

peeks :: (a -> a) -> PretextT p g a b a0 -> a0 #

seek :: a -> PretextT p g a b a0 -> PretextT p g a b a0 #

seeks :: (a -> a) -> PretextT p g a b a0 -> PretextT p g a b a0 #

experiment :: Functor f => (a -> f a) -> PretextT p g a b a0 -> f a0 #

Shape f => ComonadStore (f Int) (Focused f) Source # 
Instance details

Defined in Data.Dense.Base

Methods

pos :: Focused f a -> f Int #

peek :: f Int -> Focused f a -> a #

peeks :: (f Int -> f Int) -> Focused f a -> a #

seek :: f Int -> Focused f a -> Focused f a #

seeks :: (f Int -> f Int) -> Focused f a -> Focused f a #

experiment :: Functor f0 => (f Int -> f0 (f Int)) -> Focused f a -> f0 a #

Stencils

data Stencil f a Source #

Stencils are used to fold over neighbouring array sites. To construct a stencil use mkStencil, mkStencilUnboxed. For static sized stencils you can use the quasiquoter stencil.

To use a stencil you can use stencilSum or use the Foldable and FoldableWithIndex instances.

Instances

Instances details
Functor (Stencil f) Source # 
Instance details

Defined in Data.Dense.Stencil

Methods

fmap :: (a -> b) -> Stencil f a -> Stencil f b #

(<$) :: a -> Stencil f b -> Stencil f a #

Foldable (Stencil f) Source # 
Instance details

Defined in Data.Dense.Stencil

Methods

fold :: Monoid m => Stencil f m -> m #

foldMap :: Monoid m => (a -> m) -> Stencil f a -> m #

foldMap' :: Monoid m => (a -> m) -> Stencil f a -> m #

foldr :: (a -> b -> b) -> b -> Stencil f a -> b #

foldr' :: (a -> b -> b) -> b -> Stencil f a -> b #

foldl :: (b -> a -> b) -> b -> Stencil f a -> b #

foldl' :: (b -> a -> b) -> b -> Stencil f a -> b #

foldr1 :: (a -> a -> a) -> Stencil f a -> a #

foldl1 :: (a -> a -> a) -> Stencil f a -> a #

toList :: Stencil f a -> [a] #

null :: Stencil f a -> Bool #

length :: Stencil f a -> Int #

elem :: Eq a => a -> Stencil f a -> Bool #

maximum :: Ord a => Stencil f a -> a #

minimum :: Ord a => Stencil f a -> a #

sum :: Num a => Stencil f a -> a #

product :: Num a => Stencil f a -> a #

FoldableWithIndex (f Int) (Stencil f) Source # 
Instance details

Defined in Data.Dense.Stencil

Methods

ifoldMap :: Monoid m => (f Int -> a -> m) -> Stencil f a -> m #

ifolded :: IndexedFold (f Int) (Stencil f a) a #

ifoldr :: (f Int -> a -> b -> b) -> b -> Stencil f a -> b #

ifoldl :: (f Int -> b -> a -> b) -> b -> Stencil f a -> b #

ifoldr' :: (f Int -> a -> b -> b) -> b -> Stencil f a -> b #

ifoldl' :: (f Int -> b -> a -> b) -> b -> Stencil f a -> b #

(Show1 f, Show a) => Show (Stencil f a) Source # 
Instance details

Defined in Data.Dense.Stencil

Methods

showsPrec :: Int -> Stencil f a -> ShowS #

show :: Stencil f a -> String #

showList :: [Stencil f a] -> ShowS #

Constructing stencils

stencil :: QuasiQuoter Source #

QuasiQuoter for producing a static stencil definition. This is a versatile parser for 1D, 2D and 3D stencils. The parsing is similar to dense but stencil also supports _, which means ignore this element. Also, stencils should have an odd length in all dimensions so there is always a center element (which is used as zero).

Examples

Expand
  • 1D stencils are of the form
[stencil| 5 -3 1 -3 5 |] :: Num a => Stencil V1 a
  • 2D stencils are of the form
myStencil2 :: Num a => Stencil V2 a
myStencil2 = [stencil|
  0 1 0
  1 0 1
  0 1 0
|]
  • 3D stencils have gaps between planes.
myStencil3 :: Fractional a => Stencil V3 a
myStencil3 :: [stencil|
  1/20 3/10 1/20
  3/10  1   3/10
  1/20 3/10 1/20

  3/10  1   3/10
   1    _    1
  3/10  1   3/10

  1/20 3/10 1/20
  3/10  1   3/10
  1/20 3/10 1/20
|]

Variables can also be used

myStencil2' :: a -> a -> a -> Stencil V2 a
myStencil2' a b c = [stencil|
  c b c
  b a b
  c b c
|]

mkStencil :: [(f Int, a)] -> Stencil f a Source #

Make a stencil folding over a list.

If the list is staticlly known this should expand at compile time via rewrite rules, similar to makeStencilTH but less reliable. If that does not happen the resulting could be slow. If the list is not know at compile time, mkStencilUnboxed can be signifcantly faster (but isn't subject expending via rewrite rules).

mkStencilTH :: (ShapeLift f, Lift a) => [(f Int, a)] -> Q Exp Source #

Construct a Stencil by unrolling the list at compile time. For example

ifoldr f b $(mkStencilTH [(V1 (-1), 5), (V1 0, 3), (V1 1, 5)])

will be get turned into

f (V1 (-1)) 5 (f (V1 0) 3 (f (V1 1) 5 b))

at compile time. Since there are no loops and all target indexes are known at compile time, this can lead to more optimisations and faster execution times. This can lead to around a 2x speed up compared to folding over unboxed vectors.

myStencil = $(mkStencilTH (as :: [(f Int, a)])) :: Stencil f a

Using stencils

stencilSum :: (Shape f, Num a) => Boundary -> Stencil f a -> Focused f a -> a Source #

Sum the elements around a Focused using a Boundary condition and a Stencil.

This is often used in conjunction with extendFocus.

Common shapes

newtype V1 a #

A 1-dimensional vector

>>> pure 1 :: V1 Int
V1 1
>>> V1 2 + V1 3
V1 5
>>> V1 2 * V1 3
V1 6
>>> sum (V1 2)
2

Constructors

V1 a 

Instances

Instances details
Monad V1 
Instance details

Defined in Linear.V1

Methods

(>>=) :: V1 a -> (a -> V1 b) -> V1 b #

(>>) :: V1 a -> V1 b -> V1 b #

return :: a -> V1 a #

Functor V1 
Instance details

Defined in Linear.V1

Methods

fmap :: (a -> b) -> V1 a -> V1 b #

(<$) :: a -> V1 b -> V1 a #

MonadFix V1 
Instance details

Defined in Linear.V1

Methods

mfix :: (a -> V1 a) -> V1 a #

Applicative V1 
Instance details

Defined in Linear.V1

Methods

pure :: a -> V1 a #

(<*>) :: V1 (a -> b) -> V1 a -> V1 b #

liftA2 :: (a -> b -> c) -> V1 a -> V1 b -> V1 c #

(*>) :: V1 a -> V1 b -> V1 b #

(<*) :: V1 a -> V1 b -> V1 a #

Foldable V1 
Instance details

Defined in Linear.V1

Methods

fold :: Monoid m => V1 m -> m #

foldMap :: Monoid m => (a -> m) -> V1 a -> m #

foldMap' :: Monoid m => (a -> m) -> V1 a -> m #

foldr :: (a -> b -> b) -> b -> V1 a -> b #

foldr' :: (a -> b -> b) -> b -> V1 a -> b #

foldl :: (b -> a -> b) -> b -> V1 a -> b #

foldl' :: (b -> a -> b) -> b -> V1 a -> b #

foldr1 :: (a -> a -> a) -> V1 a -> a #

foldl1 :: (a -> a -> a) -> V1 a -> a #

toList :: V1 a -> [a] #

null :: V1 a -> Bool #

length :: V1 a -> Int #

elem :: Eq a => a -> V1 a -> Bool #

maximum :: Ord a => V1 a -> a #

minimum :: Ord a => V1 a -> a #

sum :: Num a => V1 a -> a #

product :: Num a => V1 a -> a #

Traversable V1 
Instance details

Defined in Linear.V1

Methods

traverse :: Applicative f => (a -> f b) -> V1 a -> f (V1 b) #

sequenceA :: Applicative f => V1 (f a) -> f (V1 a) #

mapM :: Monad m => (a -> m b) -> V1 a -> m (V1 b) #

sequence :: Monad m => V1 (m a) -> m (V1 a) #

Distributive V1 
Instance details

Defined in Linear.V1

Methods

distribute :: Functor f => f (V1 a) -> V1 (f a) #

collect :: Functor f => (a -> V1 b) -> f a -> V1 (f b) #

distributeM :: Monad m => m (V1 a) -> V1 (m a) #

collectM :: Monad m => (a -> V1 b) -> m a -> V1 (m b) #

Representable V1 
Instance details

Defined in Linear.V1

Associated Types

type Rep V1 #

Methods

tabulate :: (Rep V1 -> a) -> V1 a #

index :: V1 a -> Rep V1 -> a #

Eq1 V1 
Instance details

Defined in Linear.V1

Methods

liftEq :: (a -> b -> Bool) -> V1 a -> V1 b -> Bool #

Ord1 V1 
Instance details

Defined in Linear.V1

Methods

liftCompare :: (a -> b -> Ordering) -> V1 a -> V1 b -> Ordering #

Read1 V1 
Instance details

Defined in Linear.V1

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (V1 a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [V1 a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (V1 a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [V1 a] #

Show1 V1 
Instance details

Defined in Linear.V1

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> V1 a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [V1 a] -> ShowS #

MonadZip V1 
Instance details

Defined in Linear.V1

Methods

mzip :: V1 a -> V1 b -> V1 (a, b) #

mzipWith :: (a -> b -> c) -> V1 a -> V1 b -> V1 c #

munzip :: V1 (a, b) -> (V1 a, V1 b) #

Serial1 V1 
Instance details

Defined in Linear.V1

Methods

serializeWith :: MonadPut m => (a -> m ()) -> V1 a -> m () #

deserializeWith :: MonadGet m => m a -> m (V1 a) #

Hashable1 V1 
Instance details

Defined in Linear.V1

Methods

liftHashWithSalt :: (Int -> a -> Int) -> Int -> V1 a -> Int #

Apply V1 
Instance details

Defined in Linear.V1

Methods

(<.>) :: V1 (a -> b) -> V1 a -> V1 b #

(.>) :: V1 a -> V1 b -> V1 b #

(<.) :: V1 a -> V1 b -> V1 a #

liftF2 :: (a -> b -> c) -> V1 a -> V1 b -> V1 c #

Traversable1 V1 
Instance details

Defined in Linear.V1

Methods

traverse1 :: Apply f => (a -> f b) -> V1 a -> f (V1 b) #

sequence1 :: Apply f => V1 (f b) -> f (V1 b) #

Trace V1 
Instance details

Defined in Linear.Trace

Methods

trace :: Num a => V1 (V1 a) -> a #

diagonal :: V1 (V1 a) -> V1 a #

R1 V1 
Instance details

Defined in Linear.V1

Methods

_x :: Lens' (V1 a) a #

Finite V1 
Instance details

Defined in Linear.V1

Associated Types

type Size V1 :: Nat #

Methods

toV :: V1 a -> V (Size V1) a #

fromV :: V (Size V1) a -> V1 a #

Metric V1 
Instance details

Defined in Linear.V1

Methods

dot :: Num a => V1 a -> V1 a -> a #

quadrance :: Num a => V1 a -> a #

qd :: Num a => V1 a -> V1 a -> a #

distance :: Floating a => V1 a -> V1 a -> a #

norm :: Floating a => V1 a -> a #

signorm :: Floating a => V1 a -> V1 a #

Additive V1 
Instance details

Defined in Linear.V1

Methods

zero :: Num a => V1 a #

(^+^) :: Num a => V1 a -> V1 a -> V1 a #

(^-^) :: Num a => V1 a -> V1 a -> V1 a #

lerp :: Num a => a -> V1 a -> V1 a -> V1 a #

liftU2 :: (a -> a -> a) -> V1 a -> V1 a -> V1 a #

liftI2 :: (a -> b -> c) -> V1 a -> V1 b -> V1 c #

Foldable1 V1 
Instance details

Defined in Linear.V1

Methods

fold1 :: Semigroup m => V1 m -> m #

foldMap1 :: Semigroup m => (a -> m) -> V1 a -> m #

toNonEmpty :: V1 a -> NonEmpty a #

Bind V1 
Instance details

Defined in Linear.V1

Methods

(>>-) :: V1 a -> (a -> V1 b) -> V1 b #

join :: V1 (V1 a) -> V1 a #

Shape V1 Source # 
Instance details

Defined in Data.Dense.Index

ShapeLift V1 Source # 
Instance details

Defined in Data.Dense.TH

Methods

liftShape :: Lift a => V1 a -> Q Exp Source #

liftShape' :: Lift a => V1 a -> Q Exp Source #

Lift a => Lift (V1 a :: Type) 
Instance details

Defined in Linear.V1

Methods

lift :: V1 a -> Q Exp #

liftTyped :: V1 a -> Q (TExp (V1 a)) #

Unbox a => Vector Vector (V1 a) 
Instance details

Defined in Linear.V1

Methods

basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (V1 a) -> m (Vector (V1 a)) #

basicUnsafeThaw :: PrimMonad m => Vector (V1 a) -> m (Mutable Vector (PrimState m) (V1 a)) #

basicLength :: Vector (V1 a) -> Int #

basicUnsafeSlice :: Int -> Int -> Vector (V1 a) -> Vector (V1 a) #

basicUnsafeIndexM :: Monad m => Vector (V1 a) -> Int -> m (V1 a) #

basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (V1 a) -> Vector (V1 a) -> m () #

elemseq :: Vector (V1 a) -> V1 a -> b -> b #

Num r => Algebra r (E V1) 
Instance details

Defined in Linear.Algebra

Methods

mult :: (E V1 -> E V1 -> r) -> E V1 -> r #

unital :: r -> E V1 -> r #

Num r => Coalgebra r (E V1) 
Instance details

Defined in Linear.Algebra

Methods

comult :: (E V1 -> r) -> E V1 -> E V1 -> r #

counital :: (E V1 -> r) -> r #

Unbox a => MVector MVector (V1 a) 
Instance details

Defined in Linear.V1

Methods

basicLength :: MVector s (V1 a) -> Int #

basicUnsafeSlice :: Int -> Int -> MVector s (V1 a) -> MVector s (V1 a) #

basicOverlaps :: MVector s (V1 a) -> MVector s (V1 a) -> Bool #

basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (V1 a)) #

basicInitialize :: PrimMonad m => MVector (PrimState m) (V1 a) -> m () #

basicUnsafeReplicate :: PrimMonad m => Int -> V1 a -> m (MVector (PrimState m) (V1 a)) #

basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (V1 a) -> Int -> m (V1 a) #

basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (V1 a) -> Int -> V1 a -> m () #

basicClear :: PrimMonad m => MVector (PrimState m) (V1 a) -> m () #

basicSet :: PrimMonad m => MVector (PrimState m) (V1 a) -> V1 a -> m () #

basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (V1 a) -> MVector (PrimState m) (V1 a) -> m () #

basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (V1 a) -> MVector (PrimState m) (V1 a) -> m () #

basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (V1 a) -> Int -> m (MVector (PrimState m) (V1 a)) #

i ~ Int => HasLayout V1 (V1 i) Source # 
Instance details

Defined in Data.Dense.Index

Methods

layout :: Lens' (V1 i) (Layout V1) Source #

Bounded a => Bounded (V1 a) 
Instance details

Defined in Linear.V1

Methods

minBound :: V1 a #

maxBound :: V1 a #

Eq a => Eq (V1 a) 
Instance details

Defined in Linear.V1

Methods

(==) :: V1 a -> V1 a -> Bool #

(/=) :: V1 a -> V1 a -> Bool #

Floating a => Floating (V1 a) 
Instance details

Defined in Linear.V1

Methods

pi :: V1 a #

exp :: V1 a -> V1 a #

log :: V1 a -> V1 a #

sqrt :: V1 a -> V1 a #

(**) :: V1 a -> V1 a -> V1 a #

logBase :: V1 a -> V1 a -> V1 a #

sin :: V1 a -> V1 a #

cos :: V1 a -> V1 a #

tan :: V1 a -> V1 a #

asin :: V1 a -> V1 a #

acos :: V1 a -> V1 a #

atan :: V1 a -> V1 a #

sinh :: V1 a -> V1 a #

cosh :: V1 a -> V1 a #

tanh :: V1 a -> V1 a #

asinh :: V1 a -> V1 a #

acosh :: V1 a -> V1 a #

atanh :: V1 a -> V1 a #

log1p :: V1 a -> V1 a #

expm1 :: V1 a -> V1 a #

log1pexp :: V1 a -> V1 a #

log1mexp :: V1 a -> V1 a #

Fractional a => Fractional (V1 a) 
Instance details

Defined in Linear.V1

Methods

(/) :: V1 a -> V1 a -> V1 a #

recip :: V1 a -> V1 a #

fromRational :: Rational -> V1 a #

Data a => Data (V1 a) 
Instance details

Defined in Linear.V1

Methods

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

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

toConstr :: V1 a -> Constr #

dataTypeOf :: V1 a -> DataType #

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

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

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

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

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

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

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

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

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

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

Num a => Num (V1 a) 
Instance details

Defined in Linear.V1

Methods

(+) :: V1 a -> V1 a -> V1 a #

(-) :: V1 a -> V1 a -> V1 a #

(*) :: V1 a -> V1 a -> V1 a #

negate :: V1 a -> V1 a #

abs :: V1 a -> V1 a #

signum :: V1 a -> V1 a #

fromInteger :: Integer -> V1 a #

Ord a => Ord (V1 a) 
Instance details

Defined in Linear.V1

Methods

compare :: V1 a -> V1 a -> Ordering #

(<) :: V1 a -> V1 a -> Bool #

(<=) :: V1 a -> V1 a -> Bool #

(>) :: V1 a -> V1 a -> Bool #

(>=) :: V1 a -> V1 a -> Bool #

max :: V1 a -> V1 a -> V1 a #

min :: V1 a -> V1 a -> V1 a #

Read a => Read (V1 a) 
Instance details

Defined in Linear.V1

Show a => Show (V1 a) 
Instance details

Defined in Linear.V1

Methods

showsPrec :: Int -> V1 a -> ShowS #

show :: V1 a -> String #

showList :: [V1 a] -> ShowS #

Ix a => Ix (V1 a) 
Instance details

Defined in Linear.V1

Methods

range :: (V1 a, V1 a) -> [V1 a] #

index :: (V1 a, V1 a) -> V1 a -> Int #

unsafeIndex :: (V1 a, V1 a) -> V1 a -> Int #

inRange :: (V1 a, V1 a) -> V1 a -> Bool #

rangeSize :: (V1 a, V1 a) -> Int #

unsafeRangeSize :: (V1 a, V1 a) -> Int #

Generic (V1 a) 
Instance details

Defined in Linear.V1

Associated Types

type Rep (V1 a) :: Type -> Type #

Methods

from :: V1 a -> Rep (V1 a) x #

to :: Rep (V1 a) x -> V1 a #

Semigroup a => Semigroup (V1 a) 
Instance details

Defined in Linear.V1

Methods

(<>) :: V1 a -> V1 a -> V1 a #

sconcat :: NonEmpty (V1 a) -> V1 a #

stimes :: Integral b => b -> V1 a -> V1 a #

Monoid a => Monoid (V1 a) 
Instance details

Defined in Linear.V1

Methods

mempty :: V1 a #

mappend :: V1 a -> V1 a -> V1 a #

mconcat :: [V1 a] -> V1 a #

Storable a => Storable (V1 a) 
Instance details

Defined in Linear.V1

Methods

sizeOf :: V1 a -> Int #

alignment :: V1 a -> Int #

peekElemOff :: Ptr (V1 a) -> Int -> IO (V1 a) #

pokeElemOff :: Ptr (V1 a) -> Int -> V1 a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (V1 a) #

pokeByteOff :: Ptr b -> Int -> V1 a -> IO () #

peek :: Ptr (V1 a) -> IO (V1 a) #

poke :: Ptr (V1 a) -> V1 a -> IO () #

Binary a => Binary (V1 a) 
Instance details

Defined in Linear.V1

Methods

put :: V1 a -> Put #

get :: Get (V1 a) #

putList :: [V1 a] -> Put #

Serial a => Serial (V1 a) 
Instance details

Defined in Linear.V1

Methods

serialize :: MonadPut m => V1 a -> m () #

deserialize :: MonadGet m => m (V1 a) #

Serialize a => Serialize (V1 a) 
Instance details

Defined in Linear.V1

Methods

put :: Putter (V1 a) #

get :: Get (V1 a) #

NFData a => NFData (V1 a) 
Instance details

Defined in Linear.V1

Methods

rnf :: V1 a -> () #

Hashable a => Hashable (V1 a) 
Instance details

Defined in Linear.V1

Methods

hashWithSalt :: Int -> V1 a -> Int #

hash :: V1 a -> Int #

Unbox a => Unbox (V1 a) 
Instance details

Defined in Linear.V1

Ixed (V1 a) 
Instance details

Defined in Linear.V1

Methods

ix :: Index (V1 a) -> Traversal' (V1 a) (IxValue (V1 a)) #

Epsilon a => Epsilon (V1 a) 
Instance details

Defined in Linear.V1

Methods

nearZero :: V1 a -> Bool #

Random a => Random (V1 a) 
Instance details

Defined in Linear.V1

Methods

randomR :: RandomGen g => (V1 a, V1 a) -> g -> (V1 a, g) #

random :: RandomGen g => g -> (V1 a, g) #

randomRs :: RandomGen g => (V1 a, V1 a) -> g -> [V1 a] #

randoms :: RandomGen g => g -> [V1 a] #

randomRIO :: (V1 a, V1 a) -> IO (V1 a) #

randomIO :: IO (V1 a) #

Generic1 V1 
Instance details

Defined in Linear.V1

Associated Types

type Rep1 V1 :: k -> Type #

Methods

from1 :: forall (a :: k). V1 a -> Rep1 V1 a #

to1 :: forall (a :: k). Rep1 V1 a -> V1 a #

FunctorWithIndex (E V1) V1 
Instance details

Defined in Linear.V1

Methods

imap :: (E V1 -> a -> b) -> V1 a -> V1 b #

imapped :: IndexedSetter (E V1) (V1 a) (V1 b) a b #

FoldableWithIndex (E V1) V1 
Instance details

Defined in Linear.V1

Methods

ifoldMap :: Monoid m => (E V1 -> a -> m) -> V1 a -> m #

ifolded :: IndexedFold (E V1) (V1 a) a #

ifoldr :: (E V1 -> a -> b -> b) -> b -> V1 a -> b #

ifoldl :: (E V1 -> b -> a -> b) -> b -> V1 a -> b #

ifoldr' :: (E V1 -> a -> b -> b) -> b -> V1 a -> b #

ifoldl' :: (E V1 -> b -> a -> b) -> b -> V1 a -> b #

TraversableWithIndex (E V1) V1 
Instance details

Defined in Linear.V1

Methods

itraverse :: Applicative f => (E V1 -> a -> f b) -> V1 a -> f (V1 b) #

itraversed :: IndexedTraversal (E V1) (V1 a) (V1 b) a b #

Each (V1 a) (V1 b) a b 
Instance details

Defined in Linear.V1

Methods

each :: Traversal (V1 a) (V1 b) a b #

Field1 (V1 a) (V1 b) a b 
Instance details

Defined in Linear.V1

Methods

_1 :: Lens (V1 a) (V1 b) a b #

type Rep V1 
Instance details

Defined in Linear.V1

type Rep V1 = E V1
type Size V1 
Instance details

Defined in Linear.V1

type Size V1 = 1
newtype MVector s (V1 a) 
Instance details

Defined in Linear.V1

newtype MVector s (V1 a) = MV_V1 (MVector s a)
type Rep (V1 a) 
Instance details

Defined in Linear.V1

type Rep (V1 a) = D1 ('MetaData "V1" "Linear.V1" "linear-1.21.1-8shKxkKQUSF4N39Qjrte3Y" 'True) (C1 ('MetaCons "V1" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
newtype Vector (V1 a) 
Instance details

Defined in Linear.V1

newtype Vector (V1 a) = V_V1 (Vector a)
type Index (V1 a) 
Instance details

Defined in Linear.V1

type Index (V1 a) = E V1
type IxValue (V1 a) 
Instance details

Defined in Linear.V1

type IxValue (V1 a) = a
type Rep1 V1 
Instance details

Defined in Linear.V1

type Rep1 V1 = D1 ('MetaData "V1" "Linear.V1" "linear-1.21.1-8shKxkKQUSF4N39Qjrte3Y" 'True) (C1 ('MetaCons "V1" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1))

data V2 a #

A 2-dimensional vector

>>> pure 1 :: V2 Int
V2 1 1
>>> V2 1 2 + V2 3 4
V2 4 6
>>> V2 1 2 * V2 3 4
V2 3 8
>>> sum (V2 1 2)
3

Constructors

V2 !a !a 

Instances

Instances details
Monad V2 
Instance details

Defined in Linear.V2

Methods

(>>=) :: V2 a -> (a -> V2 b) -> V2 b #

(>>) :: V2 a -> V2 b -> V2 b #

return :: a -> V2 a #

Functor V2 
Instance details

Defined in Linear.V2

Methods

fmap :: (a -> b) -> V2 a -> V2 b #

(<$) :: a -> V2 b -> V2 a #

MonadFix V2 
Instance details

Defined in Linear.V2

Methods

mfix :: (a -> V2 a) -> V2 a #

Applicative V2 
Instance details

Defined in Linear.V2

Methods

pure :: a -> V2 a #

(<*>) :: V2 (a -> b) -> V2 a -> V2 b #

liftA2 :: (a -> b -> c) -> V2 a -> V2 b -> V2 c #

(*>) :: V2 a -> V2 b -> V2 b #

(<*) :: V2 a -> V2 b -> V2 a #

Foldable V2 
Instance details

Defined in Linear.V2

Methods

fold :: Monoid m => V2 m -> m #

foldMap :: Monoid m => (a -> m) -> V2 a -> m #

foldMap' :: Monoid m => (a -> m) -> V2 a -> m #

foldr :: (a -> b -> b) -> b -> V2 a -> b #

foldr' :: (a -> b -> b) -> b -> V2 a -> b #

foldl :: (b -> a -> b) -> b -> V2 a -> b #

foldl' :: (b -> a -> b) -> b -> V2 a -> b #

foldr1 :: (a -> a -> a) -> V2 a -> a #

foldl1 :: (a -> a -> a) -> V2 a -> a #

toList :: V2 a -> [a] #

null :: V2 a -> Bool #

length :: V2 a -> Int #

elem :: Eq a => a -> V2 a -> Bool #

maximum :: Ord a => V2 a -> a #

minimum :: Ord a => V2 a -> a #

sum :: Num a => V2 a -> a #

product :: Num a => V2 a -> a #

Traversable V2 
Instance details

Defined in Linear.V2

Methods

traverse :: Applicative f => (a -> f b) -> V2 a -> f (V2 b) #

sequenceA :: Applicative f => V2 (f a) -> f (V2 a) #

mapM :: Monad m => (a -> m b) -> V2 a -> m (V2 b) #

sequence :: Monad m => V2 (m a) -> m (V2 a) #

Distributive V2 
Instance details

Defined in Linear.V2

Methods

distribute :: Functor f => f (V2 a) -> V2 (f a) #

collect :: Functor f => (a -> V2 b) -> f a -> V2 (f b) #

distributeM :: Monad m => m (V2 a) -> V2 (m a) #

collectM :: Monad m => (a -> V2 b) -> m a -> V2 (m b) #

Representable V2 
Instance details

Defined in Linear.V2

Associated Types

type Rep V2 #

Methods

tabulate :: (Rep V2 -> a) -> V2 a #

index :: V2 a -> Rep V2 -> a #

Eq1 V2 
Instance details

Defined in Linear.V2

Methods

liftEq :: (a -> b -> Bool) -> V2 a -> V2 b -> Bool #

Ord1 V2 
Instance details

Defined in Linear.V2

Methods

liftCompare :: (a -> b -> Ordering) -> V2 a -> V2 b -> Ordering #

Read1 V2 
Instance details

Defined in Linear.V2

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (V2 a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [V2 a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (V2 a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [V2 a] #

Show1 V2 
Instance details

Defined in Linear.V2

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> V2 a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [V2 a] -> ShowS #

MonadZip V2 
Instance details

Defined in Linear.V2

Methods

mzip :: V2 a -> V2 b -> V2 (a, b) #

mzipWith :: (a -> b -> c) -> V2 a -> V2 b -> V2 c #

munzip :: V2 (a, b) -> (V2 a, V2 b) #

Serial1 V2 
Instance details

Defined in Linear.V2

Methods

serializeWith :: MonadPut m => (a -> m ()) -> V2 a -> m () #

deserializeWith :: MonadGet m => m a -> m (V2 a) #

Hashable1 V2 
Instance details

Defined in Linear.V2

Methods

liftHashWithSalt :: (Int -> a -> Int) -> Int -> V2 a -> Int #

Apply V2 
Instance details

Defined in Linear.V2

Methods

(<.>) :: V2 (a -> b) -> V2 a -> V2 b #

(.>) :: V2 a -> V2 b -> V2 b #

(<.) :: V2 a -> V2 b -> V2 a #

liftF2 :: (a -> b -> c) -> V2 a -> V2 b -> V2 c #

Traversable1 V2 
Instance details

Defined in Linear.V2

Methods

traverse1 :: Apply f => (a -> f b) -> V2 a -> f (V2 b) #

sequence1 :: Apply f => V2 (f b) -> f (V2 b) #

Trace V2 
Instance details

Defined in Linear.Trace

Methods

trace :: Num a => V2 (V2 a) -> a #

diagonal :: V2 (V2 a) -> V2 a #

R2 V2 
Instance details

Defined in Linear.V2

Methods

_y :: Lens' (V2 a) a #

_xy :: Lens' (V2 a) (V2 a) #

R1 V2 
Instance details

Defined in Linear.V2

Methods

_x :: Lens' (V2 a) a #

Finite V2 
Instance details

Defined in Linear.V2

Associated Types

type Size V2 :: Nat #

Methods

toV :: V2 a -> V (Size V2) a #

fromV :: V (Size V2) a -> V2 a #

Metric V2 
Instance details

Defined in Linear.V2

Methods

dot :: Num a => V2 a -> V2 a -> a #

quadrance :: Num a => V2 a -> a #

qd :: Num a => V2 a -> V2 a -> a #

distance :: Floating a => V2 a -> V2 a -> a #

norm :: Floating a => V2 a -> a #

signorm :: Floating a => V2 a -> V2 a #

Additive V2 
Instance details

Defined in Linear.V2

Methods

zero :: Num a => V2 a #

(^+^) :: Num a => V2 a -> V2 a -> V2 a #

(^-^) :: Num a => V2 a -> V2 a -> V2 a #

lerp :: Num a => a -> V2 a -> V2 a -> V2 a #

liftU2 :: (a -> a -> a) -> V2 a -> V2 a -> V2 a #

liftI2 :: (a -> b -> c) -> V2 a -> V2 b -> V2 c #

Foldable1 V2 
Instance details

Defined in Linear.V2

Methods

fold1 :: Semigroup m => V2 m -> m #

foldMap1 :: Semigroup m => (a -> m) -> V2 a -> m #

toNonEmpty :: V2 a -> NonEmpty a #

Bind V2 
Instance details

Defined in Linear.V2

Methods

(>>-) :: V2 a -> (a -> V2 b) -> V2 b #

join :: V2 (V2 a) -> V2 a #

Shape V2 Source # 
Instance details

Defined in Data.Dense.Index

ShapeLift V2 Source # 
Instance details

Defined in Data.Dense.TH

Methods

liftShape :: Lift a => V2 a -> Q Exp Source #

liftShape' :: Lift a => V2 a -> Q Exp Source #

Lift a => Lift (V2 a :: Type) 
Instance details

Defined in Linear.V2

Methods

lift :: V2 a -> Q Exp #

liftTyped :: V2 a -> Q (TExp (V2 a)) #

Unbox a => Vector Vector (V2 a) 
Instance details

Defined in Linear.V2

Methods

basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (V2 a) -> m (Vector (V2 a)) #

basicUnsafeThaw :: PrimMonad m => Vector (V2 a) -> m (Mutable Vector (PrimState m) (V2 a)) #

basicLength :: Vector (V2 a) -> Int #

basicUnsafeSlice :: Int -> Int -> Vector (V2 a) -> Vector (V2 a) #

basicUnsafeIndexM :: Monad m => Vector (V2 a) -> Int -> m (V2 a) #

basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (V2 a) -> Vector (V2 a) -> m () #

elemseq :: Vector (V2 a) -> V2 a -> b -> b #

Num r => Coalgebra r (E V2) 
Instance details

Defined in Linear.Algebra

Methods

comult :: (E V2 -> r) -> E V2 -> E V2 -> r #

counital :: (E V2 -> r) -> r #

Unbox a => MVector MVector (V2 a) 
Instance details

Defined in Linear.V2

Methods

basicLength :: MVector s (V2 a) -> Int #

basicUnsafeSlice :: Int -> Int -> MVector s (V2 a) -> MVector s (V2 a) #

basicOverlaps :: MVector s (V2 a) -> MVector s (V2 a) -> Bool #

basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (V2 a)) #

basicInitialize :: PrimMonad m => MVector (PrimState m) (V2 a) -> m () #

basicUnsafeReplicate :: PrimMonad m => Int -> V2 a -> m (MVector (PrimState m) (V2 a)) #

basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (V2 a) -> Int -> m (V2 a) #

basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (V2 a) -> Int -> V2 a -> m () #

basicClear :: PrimMonad m => MVector (PrimState m) (V2 a) -> m () #

basicSet :: PrimMonad m => MVector (PrimState m) (V2 a) -> V2 a -> m () #

basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (V2 a) -> MVector (PrimState m) (V2 a) -> m () #

basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (V2 a) -> MVector (PrimState m) (V2 a) -> m () #

basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (V2 a) -> Int -> m (MVector (PrimState m) (V2 a)) #

i ~ Int => HasLayout V2 (V2 i) Source # 
Instance details

Defined in Data.Dense.Index

Methods

layout :: Lens' (V2 i) (Layout V2) Source #

Bounded a => Bounded (V2 a) 
Instance details

Defined in Linear.V2

Methods

minBound :: V2 a #

maxBound :: V2 a #

Eq a => Eq (V2 a) 
Instance details

Defined in Linear.V2

Methods

(==) :: V2 a -> V2 a -> Bool #

(/=) :: V2 a -> V2 a -> Bool #

Floating a => Floating (V2 a) 
Instance details

Defined in Linear.V2

Methods

pi :: V2 a #

exp :: V2 a -> V2 a #

log :: V2 a -> V2 a #

sqrt :: V2 a -> V2 a #

(**) :: V2 a -> V2 a -> V2 a #

logBase :: V2 a -> V2 a -> V2 a #

sin :: V2 a -> V2 a #

cos :: V2 a -> V2 a #

tan :: V2 a -> V2 a #

asin :: V2 a -> V2 a #

acos :: V2 a -> V2 a #

atan :: V2 a -> V2 a #

sinh :: V2 a -> V2 a #

cosh :: V2 a -> V2 a #

tanh :: V2 a -> V2 a #

asinh :: V2 a -> V2 a #

acosh :: V2 a -> V2 a #

atanh :: V2 a -> V2 a #

log1p :: V2 a -> V2 a #

expm1 :: V2 a -> V2 a #

log1pexp :: V2 a -> V2 a #

log1mexp :: V2 a -> V2 a #

Fractional a => Fractional (V2 a) 
Instance details

Defined in Linear.V2

Methods

(/) :: V2 a -> V2 a -> V2 a #

recip :: V2 a -> V2 a #

fromRational :: Rational -> V2 a #

Data a => Data (V2 a) 
Instance details

Defined in Linear.V2

Methods

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

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

toConstr :: V2 a -> Constr #

dataTypeOf :: V2 a -> DataType #

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

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

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

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

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

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

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

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

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

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

Num a => Num (V2 a) 
Instance details

Defined in Linear.V2

Methods

(+) :: V2 a -> V2 a -> V2 a #

(-) :: V2 a -> V2 a -> V2 a #

(*) :: V2 a -> V2 a -> V2 a #

negate :: V2 a -> V2 a #

abs :: V2 a -> V2 a #

signum :: V2 a -> V2 a #

fromInteger :: Integer -> V2 a #

Ord a => Ord (V2 a) 
Instance details

Defined in Linear.V2

Methods

compare :: V2 a -> V2 a -> Ordering #

(<) :: V2 a -> V2 a -> Bool #

(<=) :: V2 a -> V2 a -> Bool #

(>) :: V2 a -> V2 a -> Bool #

(>=) :: V2 a -> V2 a -> Bool #

max :: V2 a -> V2 a -> V2 a #

min :: V2 a -> V2 a -> V2 a #

Read a => Read (V2 a) 
Instance details

Defined in Linear.V2

Show a => Show (V2 a) 
Instance details

Defined in Linear.V2

Methods

showsPrec :: Int -> V2 a -> ShowS #

show :: V2 a -> String #

showList :: [V2 a] -> ShowS #

Ix a => Ix (V2 a) 
Instance details

Defined in Linear.V2

Methods

range :: (V2 a, V2 a) -> [V2 a] #

index :: (V2 a, V2 a) -> V2 a -> Int #

unsafeIndex :: (V2 a, V2 a) -> V2 a -> Int #

inRange :: (V2 a, V2 a) -> V2 a -> Bool #

rangeSize :: (V2 a, V2 a) -> Int #

unsafeRangeSize :: (V2 a, V2 a) -> Int #

Generic (V2 a) 
Instance details

Defined in Linear.V2

Associated Types

type Rep (V2 a) :: Type -> Type #

Methods

from :: V2 a -> Rep (V2 a) x #

to :: Rep (V2 a) x -> V2 a #

Semigroup a => Semigroup (V2 a) 
Instance details

Defined in Linear.V2

Methods

(<>) :: V2 a -> V2 a -> V2 a #

sconcat :: NonEmpty (V2 a) -> V2 a #

stimes :: Integral b => b -> V2 a -> V2 a #

Monoid a => Monoid (V2 a) 
Instance details

Defined in Linear.V2

Methods

mempty :: V2 a #

mappend :: V2 a -> V2 a -> V2 a #

mconcat :: [V2 a] -> V2 a #

Storable a => Storable (V2 a) 
Instance details

Defined in Linear.V2

Methods

sizeOf :: V2 a -> Int #

alignment :: V2 a -> Int #

peekElemOff :: Ptr (V2 a) -> Int -> IO (V2 a) #

pokeElemOff :: Ptr (V2 a) -> Int -> V2 a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (V2 a) #

pokeByteOff :: Ptr b -> Int -> V2 a -> IO () #

peek :: Ptr (V2 a) -> IO (V2 a) #

poke :: Ptr (V2 a) -> V2 a -> IO () #

Binary a => Binary (V2 a) 
Instance details

Defined in Linear.V2

Methods

put :: V2 a -> Put #

get :: Get (V2 a) #

putList :: [V2 a] -> Put #

Serial a => Serial (V2 a) 
Instance details

Defined in Linear.V2

Methods

serialize :: MonadPut m => V2 a -> m () #

deserialize :: MonadGet m => m (V2 a) #

Serialize a => Serialize (V2 a) 
Instance details

Defined in Linear.V2

Methods

put :: Putter (V2 a) #

get :: Get (V2 a) #

NFData a => NFData (V2 a) 
Instance details

Defined in Linear.V2

Methods

rnf :: V2 a -> () #

Hashable a => Hashable (V2 a) 
Instance details

Defined in Linear.V2

Methods

hashWithSalt :: Int -> V2 a -> Int #

hash :: V2 a -> Int #

Unbox a => Unbox (V2 a) 
Instance details

Defined in Linear.V2

Ixed (V2 a) 
Instance details

Defined in Linear.V2

Methods

ix :: Index (V2 a) -> Traversal' (V2 a) (IxValue (V2 a)) #

Epsilon a => Epsilon (V2 a) 
Instance details

Defined in Linear.V2

Methods

nearZero :: V2 a -> Bool #

Random a => Random (V2 a) 
Instance details

Defined in Linear.V2

Methods

randomR :: RandomGen g => (V2 a, V2 a) -> g -> (V2 a, g) #

random :: RandomGen g => g -> (V2 a, g) #

randomRs :: RandomGen g => (V2 a, V2 a) -> g -> [V2 a] #

randoms :: RandomGen g => g -> [V2 a] #

randomRIO :: (V2 a, V2 a) -> IO (V2 a) #

randomIO :: IO (V2 a) #

Generic1 V2 
Instance details

Defined in Linear.V2

Associated Types

type Rep1 V2 :: k -> Type #

Methods

from1 :: forall (a :: k). V2 a -> Rep1 V2 a #

to1 :: forall (a :: k). Rep1 V2 a -> V2 a #

FunctorWithIndex (E V2) V2 
Instance details

Defined in Linear.V2

Methods

imap :: (E V2 -> a -> b) -> V2 a -> V2 b #

imapped :: IndexedSetter (E V2) (V2 a) (V2 b) a b #

FoldableWithIndex (E V2) V2 
Instance details

Defined in Linear.V2

Methods

ifoldMap :: Monoid m => (E V2 -> a -> m) -> V2 a -> m #

ifolded :: IndexedFold (E V2) (V2 a) a #

ifoldr :: (E V2 -> a -> b -> b) -> b -> V2 a -> b #

ifoldl :: (E V2 -> b -> a -> b) -> b -> V2 a -> b #

ifoldr' :: (E V2 -> a -> b -> b) -> b -> V2 a -> b #

ifoldl' :: (E V2 -> b -> a -> b) -> b -> V2 a -> b #

TraversableWithIndex (E V2) V2 
Instance details

Defined in Linear.V2

Methods

itraverse :: Applicative f => (E V2 -> a -> f b) -> V2 a -> f (V2 b) #

itraversed :: IndexedTraversal (E V2) (V2 a) (V2 b) a b #

Each (V2 a) (V2 b) a b 
Instance details

Defined in Linear.V2

Methods

each :: Traversal (V2 a) (V2 b) a b #

Field1 (V2 a) (V2 a) a a 
Instance details

Defined in Linear.V2

Methods

_1 :: Lens (V2 a) (V2 a) a a #

Field2 (V2 a) (V2 a) a a 
Instance details

Defined in Linear.V2

Methods

_2 :: Lens (V2 a) (V2 a) a a #

type Rep V2 
Instance details

Defined in Linear.V2

type Rep V2 = E V2
type Size V2 
Instance details

Defined in Linear.V2

type Size V2 = 2
data MVector s (V2 a) 
Instance details

Defined in Linear.V2

data MVector s (V2 a) = MV_V2 !Int !(MVector s a)
type Rep (V2 a) 
Instance details

Defined in Linear.V2

type Rep (V2 a) = D1 ('MetaData "V2" "Linear.V2" "linear-1.21.1-8shKxkKQUSF4N39Qjrte3Y" 'False) (C1 ('MetaCons "V2" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a)))
data Vector (V2 a) 
Instance details

Defined in Linear.V2

data Vector (V2 a) = V_V2 !Int !(Vector a)
type Index (V2 a) 
Instance details

Defined in Linear.V2

type Index (V2 a) = E V2
type IxValue (V2 a) 
Instance details

Defined in Linear.V2

type IxValue (V2 a) = a
type Rep1 V2 
Instance details

Defined in Linear.V2

type Rep1 V2 = D1 ('MetaData "V2" "Linear.V2" "linear-1.21.1-8shKxkKQUSF4N39Qjrte3Y" 'False) (C1 ('MetaCons "V2" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1))

data V3 a #

A 3-dimensional vector

Constructors

V3 !a !a !a 

Instances

Instances details
Monad V3 
Instance details

Defined in Linear.V3

Methods

(>>=) :: V3 a -> (a -> V3 b) -> V3 b #

(>>) :: V3 a -> V3 b -> V3 b #

return :: a -> V3 a #

Functor V3 
Instance details

Defined in Linear.V3

Methods

fmap :: (a -> b) -> V3 a -> V3 b #

(<$) :: a -> V3 b -> V3 a #

MonadFix V3 
Instance details

Defined in Linear.V3

Methods

mfix :: (a -> V3 a) -> V3 a #

Applicative V3 
Instance details

Defined in Linear.V3

Methods

pure :: a -> V3 a #

(<*>) :: V3 (a -> b) -> V3 a -> V3 b #

liftA2 :: (a -> b -> c) -> V3 a -> V3 b -> V3 c #

(*>) :: V3 a -> V3 b -> V3 b #

(<*) :: V3 a -> V3 b -> V3 a #

Foldable V3 
Instance details

Defined in Linear.V3

Methods

fold :: Monoid m => V3 m -> m #

foldMap :: Monoid m => (a -> m) -> V3 a -> m #

foldMap' :: Monoid m => (a -> m) -> V3 a -> m #

foldr :: (a -> b -> b) -> b -> V3 a -> b #

foldr' :: (a -> b -> b) -> b -> V3 a -> b #

foldl :: (b -> a -> b) -> b -> V3 a -> b #

foldl' :: (b -> a -> b) -> b -> V3 a -> b #

foldr1 :: (a -> a -> a) -> V3 a -> a #

foldl1 :: (a -> a -> a) -> V3 a -> a #

toList :: V3 a -> [a] #

null :: V3 a -> Bool #

length :: V3 a -> Int #

elem :: Eq a => a -> V3 a -> Bool #

maximum :: Ord a => V3 a -> a #

minimum :: Ord a => V3 a -> a #

sum :: Num a => V3 a -> a #

product :: Num a => V3 a -> a #

Traversable V3 
Instance details

Defined in Linear.V3

Methods

traverse :: Applicative f => (a -> f b) -> V3 a -> f (V3 b) #

sequenceA :: Applicative f => V3 (f a) -> f (V3 a) #

mapM :: Monad m => (a -> m b) -> V3 a -> m (V3 b) #

sequence :: Monad m => V3 (m a) -> m (V3 a) #

Distributive V3 
Instance details

Defined in Linear.V3

Methods

distribute :: Functor f => f (V3 a) -> V3 (f a) #

collect :: Functor f => (a -> V3 b) -> f a -> V3 (f b) #

distributeM :: Monad m => m (V3 a) -> V3 (m a) #

collectM :: Monad m => (a -> V3 b) -> m a -> V3 (m b) #

Representable V3 
Instance details

Defined in Linear.V3

Associated Types

type Rep V3 #

Methods

tabulate :: (Rep V3 -> a) -> V3 a #

index :: V3 a -> Rep V3 -> a #

Eq1 V3 
Instance details

Defined in Linear.V3

Methods

liftEq :: (a -> b -> Bool) -> V3 a -> V3 b -> Bool #

Ord1 V3 
Instance details

Defined in Linear.V3

Methods

liftCompare :: (a -> b -> Ordering) -> V3 a -> V3 b -> Ordering #

Read1 V3 
Instance details

Defined in Linear.V3

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (V3 a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [V3 a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (V3 a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [V3 a] #

Show1 V3 
Instance details

Defined in Linear.V3

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> V3 a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [V3 a] -> ShowS #

MonadZip V3 
Instance details

Defined in Linear.V3

Methods

mzip :: V3 a -> V3 b -> V3 (a, b) #

mzipWith :: (a -> b -> c) -> V3 a -> V3 b -> V3 c #

munzip :: V3 (a, b) -> (V3 a, V3 b) #

Serial1 V3 
Instance details

Defined in Linear.V3

Methods

serializeWith :: MonadPut m => (a -> m ()) -> V3 a -> m () #

deserializeWith :: MonadGet m => m a -> m (V3 a) #

Hashable1 V3 
Instance details

Defined in Linear.V3

Methods

liftHashWithSalt :: (Int -> a -> Int) -> Int -> V3 a -> Int #

Apply V3 
Instance details

Defined in Linear.V3

Methods

(<.>) :: V3 (a -> b) -> V3 a -> V3 b #

(.>) :: V3 a -> V3 b -> V3 b #

(<.) :: V3 a -> V3 b -> V3 a #

liftF2 :: (a -> b -> c) -> V3 a -> V3 b -> V3 c #

Traversable1 V3 
Instance details

Defined in Linear.V3

Methods

traverse1 :: Apply f => (a -> f b) -> V3 a -> f (V3 b) #

sequence1 :: Apply f => V3 (f b) -> f (V3 b) #

Trace V3 
Instance details

Defined in Linear.Trace

Methods

trace :: Num a => V3 (V3 a) -> a #

diagonal :: V3 (V3 a) -> V3 a #

R3 V3 
Instance details

Defined in Linear.V3

Methods

_z :: Lens' (V3 a) a #

_xyz :: Lens' (V3 a) (V3 a) #

R2 V3 
Instance details

Defined in Linear.V3

Methods

_y :: Lens' (V3 a) a #

_xy :: Lens' (V3 a) (V2 a) #

R1 V3 
Instance details

Defined in Linear.V3

Methods

_x :: Lens' (V3 a) a #

Finite V3 
Instance details

Defined in Linear.V3

Associated Types

type Size V3 :: Nat #

Methods

toV :: V3 a -> V (Size V3) a #

fromV :: V (Size V3) a -> V3 a #

Metric V3 
Instance details

Defined in Linear.V3

Methods

dot :: Num a => V3 a -> V3 a -> a #

quadrance :: Num a => V3 a -> a #

qd :: Num a => V3 a -> V3 a -> a #

distance :: Floating a => V3 a -> V3 a -> a #

norm :: Floating a => V3 a -> a #

signorm :: Floating a => V3 a -> V3 a #

Additive V3 
Instance details

Defined in Linear.V3

Methods

zero :: Num a => V3 a #

(^+^) :: Num a => V3 a -> V3 a -> V3 a #

(^-^) :: Num a => V3 a -> V3 a -> V3 a #

lerp :: Num a => a -> V3 a -> V3 a -> V3 a #

liftU2 :: (a -> a -> a) -> V3 a -> V3 a -> V3 a #

liftI2 :: (a -> b -> c) -> V3 a -> V3 b -> V3 c #

Foldable1 V3 
Instance details

Defined in Linear.V3

Methods

fold1 :: Semigroup m => V3 m -> m #

foldMap1 :: Semigroup m => (a -> m) -> V3 a -> m #

toNonEmpty :: V3 a -> NonEmpty a #

Bind V3 
Instance details

Defined in Linear.V3

Methods

(>>-) :: V3 a -> (a -> V3 b) -> V3 b #

join :: V3 (V3 a) -> V3 a #

Shape V3 Source # 
Instance details

Defined in Data.Dense.Index

ShapeLift V3 Source # 
Instance details

Defined in Data.Dense.TH

Methods

liftShape :: Lift a => V3 a -> Q Exp Source #

liftShape' :: Lift a => V3 a -> Q Exp Source #

Lift a => Lift (V3 a :: Type) 
Instance details

Defined in Linear.V3

Methods

lift :: V3 a -> Q Exp #

liftTyped :: V3 a -> Q (TExp (V3 a)) #

Unbox a => Vector Vector (V3 a) 
Instance details

Defined in Linear.V3

Methods

basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (V3 a) -> m (Vector (V3 a)) #

basicUnsafeThaw :: PrimMonad m => Vector (V3 a) -> m (Mutable Vector (PrimState m) (V3 a)) #

basicLength :: Vector (V3 a) -> Int #

basicUnsafeSlice :: Int -> Int -> Vector (V3 a) -> Vector (V3 a) #

basicUnsafeIndexM :: Monad m => Vector (V3 a) -> Int -> m (V3 a) #

basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (V3 a) -> Vector (V3 a) -> m () #

elemseq :: Vector (V3 a) -> V3 a -> b -> b #

Num r => Coalgebra r (E V3) 
Instance details

Defined in Linear.Algebra

Methods

comult :: (E V3 -> r) -> E V3 -> E V3 -> r #

counital :: (E V3 -> r) -> r #

Unbox a => MVector MVector (V3 a) 
Instance details

Defined in Linear.V3

Methods

basicLength :: MVector s (V3 a) -> Int #

basicUnsafeSlice :: Int -> Int -> MVector s (V3 a) -> MVector s (V3 a) #

basicOverlaps :: MVector s (V3 a) -> MVector s (V3 a) -> Bool #

basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (V3 a)) #

basicInitialize :: PrimMonad m => MVector (PrimState m) (V3 a) -> m () #

basicUnsafeReplicate :: PrimMonad m => Int -> V3 a -> m (MVector (PrimState m) (V3 a)) #

basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (V3 a) -> Int -> m (V3 a) #

basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (V3 a) -> Int -> V3 a -> m () #

basicClear :: PrimMonad m => MVector (PrimState m) (V3 a) -> m () #

basicSet :: PrimMonad m => MVector (PrimState m) (V3 a) -> V3 a -> m () #

basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (V3 a) -> MVector (PrimState m) (V3 a) -> m () #

basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (V3 a) -> MVector (PrimState m) (V3 a) -> m () #

basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (V3 a) -> Int -> m (MVector (PrimState m) (V3 a)) #

i ~ Int => HasLayout V3 (V3 i) Source # 
Instance details

Defined in Data.Dense.Index

Methods

layout :: Lens' (V3 i) (Layout V3) Source #

Bounded a => Bounded (V3 a) 
Instance details

Defined in Linear.V3

Methods

minBound :: V3 a #

maxBound :: V3 a #

Eq a => Eq (V3 a) 
Instance details

Defined in Linear.V3

Methods

(==) :: V3 a -> V3 a -> Bool #

(/=) :: V3 a -> V3 a -> Bool #

Floating a => Floating (V3 a) 
Instance details

Defined in Linear.V3

Methods

pi :: V3 a #

exp :: V3 a -> V3 a #

log :: V3 a -> V3 a #

sqrt :: V3 a -> V3 a #

(**) :: V3 a -> V3 a -> V3 a #

logBase :: V3 a -> V3 a -> V3 a #

sin :: V3 a -> V3 a #

cos :: V3 a -> V3 a #

tan :: V3 a -> V3 a #

asin :: V3 a -> V3 a #

acos :: V3 a -> V3 a #

atan :: V3 a -> V3 a #

sinh :: V3 a -> V3 a #

cosh :: V3 a -> V3 a #

tanh :: V3 a -> V3 a #

asinh :: V3 a -> V3 a #

acosh :: V3 a -> V3 a #

atanh :: V3 a -> V3 a #

log1p :: V3 a -> V3 a #

expm1 :: V3 a -> V3 a #

log1pexp :: V3 a -> V3 a #

log1mexp :: V3 a -> V3 a #

Fractional a => Fractional (V3 a) 
Instance details

Defined in Linear.V3

Methods

(/) :: V3 a -> V3 a -> V3 a #

recip :: V3 a -> V3 a #

fromRational :: Rational -> V3 a #

Data a => Data (V3 a) 
Instance details

Defined in Linear.V3

Methods

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

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

toConstr :: V3 a -> Constr #

dataTypeOf :: V3 a -> DataType #

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

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

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

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

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

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

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

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

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

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

Num a => Num (V3 a) 
Instance details

Defined in Linear.V3

Methods

(+) :: V3 a -> V3 a -> V3 a #

(-) :: V3 a -> V3 a -> V3 a #

(*) :: V3 a -> V3 a -> V3 a #

negate :: V3 a -> V3 a #

abs :: V3 a -> V3 a #

signum :: V3 a -> V3 a #

fromInteger :: Integer -> V3 a #

Ord a => Ord (V3 a) 
Instance details

Defined in Linear.V3

Methods

compare :: V3 a -> V3 a -> Ordering #

(<) :: V3 a -> V3 a -> Bool #

(<=) :: V3 a -> V3 a -> Bool #

(>) :: V3 a -> V3 a -> Bool #

(>=) :: V3 a -> V3 a -> Bool #

max :: V3 a -> V3 a -> V3 a #

min :: V3 a -> V3 a -> V3 a #

Read a => Read (V3 a) 
Instance details

Defined in Linear.V3

Show a => Show (V3 a) 
Instance details

Defined in Linear.V3

Methods

showsPrec :: Int -> V3 a -> ShowS #

show :: V3 a -> String #

showList :: [V3 a] -> ShowS #

Ix a => Ix (V3 a) 
Instance details

Defined in Linear.V3

Methods

range :: (V3 a, V3 a) -> [V3 a] #

index :: (V3 a, V3 a) -> V3 a -> Int #

unsafeIndex :: (V3 a, V3 a) -> V3 a -> Int #

inRange :: (V3 a, V3 a) -> V3 a -> Bool #

rangeSize :: (V3 a, V3 a) -> Int #

unsafeRangeSize :: (V3 a, V3 a) -> Int #

Generic (V3 a) 
Instance details

Defined in Linear.V3

Associated Types

type Rep (V3 a) :: Type -> Type #

Methods

from :: V3 a -> Rep (V3 a) x #

to :: Rep (V3 a) x -> V3 a #

Semigroup a => Semigroup (V3 a) 
Instance details

Defined in Linear.V3

Methods

(<>) :: V3 a -> V3 a -> V3 a #

sconcat :: NonEmpty (V3 a) -> V3 a #

stimes :: Integral b => b -> V3 a -> V3 a #

Monoid a => Monoid (V3 a) 
Instance details

Defined in Linear.V3

Methods

mempty :: V3 a #

mappend :: V3 a -> V3 a -> V3 a #

mconcat :: [V3 a] -> V3 a #

Storable a => Storable (V3 a) 
Instance details

Defined in Linear.V3

Methods

sizeOf :: V3 a -> Int #

alignment :: V3 a -> Int #

peekElemOff :: Ptr (V3 a) -> Int -> IO (V3 a) #

pokeElemOff :: Ptr (V3 a) -> Int -> V3 a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (V3 a) #

pokeByteOff :: Ptr b -> Int -> V3 a -> IO () #

peek :: Ptr (V3 a) -> IO (V3 a) #

poke :: Ptr (V3 a) -> V3 a -> IO () #

Binary a => Binary (V3 a) 
Instance details

Defined in Linear.V3

Methods

put :: V3 a -> Put #

get :: Get (V3 a) #

putList :: [V3 a] -> Put #

Serial a => Serial (V3 a) 
Instance details

Defined in Linear.V3

Methods

serialize :: MonadPut m => V3 a -> m () #

deserialize :: MonadGet m => m (V3 a) #

Serialize a => Serialize (V3 a) 
Instance details

Defined in Linear.V3

Methods

put :: Putter (V3 a) #

get :: Get (V3 a) #

NFData a => NFData (V3 a) 
Instance details

Defined in Linear.V3

Methods

rnf :: V3 a -> () #

Hashable a => Hashable (V3 a) 
Instance details

Defined in Linear.V3

Methods

hashWithSalt :: Int -> V3 a -> Int #

hash :: V3 a -> Int #

Unbox a => Unbox (V3 a) 
Instance details

Defined in Linear.V3

Ixed (V3 a) 
Instance details

Defined in Linear.V3

Methods

ix :: Index (V3 a) -> Traversal' (V3 a) (IxValue (V3 a)) #

Epsilon a => Epsilon (V3 a) 
Instance details

Defined in Linear.V3

Methods

nearZero :: V3 a -> Bool #

Random a => Random (V3 a) 
Instance details

Defined in Linear.V3

Methods

randomR :: RandomGen g => (V3 a, V3 a) -> g -> (V3 a, g) #

random :: RandomGen g => g -> (V3 a, g) #

randomRs :: RandomGen g => (V3 a, V3 a) -> g -> [V3 a] #

randoms :: RandomGen g => g -> [V3 a] #

randomRIO :: (V3 a, V3 a) -> IO (V3 a) #

randomIO :: IO (V3 a) #

Generic1 V3 
Instance details

Defined in Linear.V3

Associated Types

type Rep1 V3 :: k -> Type #

Methods

from1 :: forall (a :: k). V3 a -> Rep1 V3 a #

to1 :: forall (a :: k). Rep1 V3 a -> V3 a #

FunctorWithIndex (E V3) V3 
Instance details

Defined in Linear.V3

Methods

imap :: (E V3 -> a -> b) -> V3 a -> V3 b #

imapped :: IndexedSetter (E V3) (V3 a) (V3 b) a b #

FoldableWithIndex (E V3) V3 
Instance details

Defined in Linear.V3

Methods

ifoldMap :: Monoid m => (E V3 -> a -> m) -> V3 a -> m #

ifolded :: IndexedFold (E V3) (V3 a) a #

ifoldr :: (E V3 -> a -> b -> b) -> b -> V3 a -> b #

ifoldl :: (E V3 -> b -> a -> b) -> b -> V3 a -> b #

ifoldr' :: (E V3 -> a -> b -> b) -> b -> V3 a -> b #

ifoldl' :: (E V3 -> b -> a -> b) -> b -> V3 a -> b #

TraversableWithIndex (E V3) V3 
Instance details

Defined in Linear.V3

Methods

itraverse :: Applicative f => (E V3 -> a -> f b) -> V3 a -> f (V3 b) #

itraversed :: IndexedTraversal (E V3) (V3 a) (V3 b) a b #

Each (V3 a) (V3 b) a b 
Instance details

Defined in Linear.V3

Methods

each :: Traversal (V3 a) (V3 b) a b #

Field1 (V3 a) (V3 a) a a 
Instance details

Defined in Linear.V3

Methods

_1 :: Lens (V3 a) (V3 a) a a #

Field2 (V3 a) (V3 a) a a 
Instance details

Defined in Linear.V3

Methods

_2 :: Lens (V3 a) (V3 a) a a #

Field3 (V3 a) (V3 a) a a 
Instance details

Defined in Linear.V3

Methods

_3 :: Lens (V3 a) (V3 a) a a #

type Rep V3 
Instance details

Defined in Linear.V3

type Rep V3 = E V3
type Size V3 
Instance details

Defined in Linear.V3

type Size V3 = 3
data MVector s (V3 a) 
Instance details

Defined in Linear.V3

data MVector s (V3 a) = MV_V3 !Int !(MVector s a)
type Rep (V3 a) 
Instance details

Defined in Linear.V3

data Vector (V3 a) 
Instance details

Defined in Linear.V3

data Vector (V3 a) = V_V3 !Int !(Vector a)
type Index (V3 a) 
Instance details

Defined in Linear.V3

type Index (V3 a) = E V3
type IxValue (V3 a) 
Instance details

Defined in Linear.V3

type IxValue (V3 a) = a
type Rep1 V3 
Instance details

Defined in Linear.V3

data V4 a #

A 4-dimensional vector.

Constructors

V4 !a !a !a !a 

Instances

Instances details
Monad V4 
Instance details

Defined in Linear.V4

Methods

(>>=) :: V4 a -> (a -> V4 b) -> V4 b #

(>>) :: V4 a -> V4 b -> V4 b #

return :: a -> V4 a #

Functor V4 
Instance details

Defined in Linear.V4

Methods

fmap :: (a -> b) -> V4 a -> V4 b #

(<$) :: a -> V4 b -> V4 a #

MonadFix V4 
Instance details

Defined in Linear.V4

Methods

mfix :: (a -> V4 a) -> V4 a #

Applicative V4 
Instance details

Defined in Linear.V4

Methods

pure :: a -> V4 a #

(<*>) :: V4 (a -> b) -> V4 a -> V4 b #

liftA2 :: (a -> b -> c) -> V4 a -> V4 b -> V4 c #

(*>) :: V4 a -> V4 b -> V4 b #

(<*) :: V4 a -> V4 b -> V4 a #

Foldable V4 
Instance details

Defined in Linear.V4

Methods

fold :: Monoid m => V4 m -> m #

foldMap :: Monoid m => (a -> m) -> V4 a -> m #

foldMap' :: Monoid m => (a -> m) -> V4 a -> m #

foldr :: (a -> b -> b) -> b -> V4 a -> b #

foldr' :: (a -> b -> b) -> b -> V4 a -> b #

foldl :: (b -> a -> b) -> b -> V4 a -> b #

foldl' :: (b -> a -> b) -> b -> V4 a -> b #

foldr1 :: (a -> a -> a) -> V4 a -> a #

foldl1 :: (a -> a -> a) -> V4 a -> a #

toList :: V4 a -> [a] #

null :: V4 a -> Bool #

length :: V4 a -> Int #

elem :: Eq a => a -> V4 a -> Bool #

maximum :: Ord a => V4 a -> a #

minimum :: Ord a => V4 a -> a #

sum :: Num a => V4 a -> a #

product :: Num a => V4 a -> a #

Traversable V4 
Instance details

Defined in Linear.V4

Methods

traverse :: Applicative f => (a -> f b) -> V4 a -> f (V4 b) #

sequenceA :: Applicative f => V4 (f a) -> f (V4 a) #

mapM :: Monad m => (a -> m b) -> V4 a -> m (V4 b) #

sequence :: Monad m => V4 (m a) -> m (V4 a) #

Distributive V4 
Instance details

Defined in Linear.V4

Methods

distribute :: Functor f => f (V4 a) -> V4 (f a) #

collect :: Functor f => (a -> V4 b) -> f a -> V4 (f b) #

distributeM :: Monad m => m (V4 a) -> V4 (m a) #

collectM :: Monad m => (a -> V4 b) -> m a -> V4 (m b) #

Representable V4 
Instance details

Defined in Linear.V4

Associated Types

type Rep V4 #

Methods

tabulate :: (Rep V4 -> a) -> V4 a #

index :: V4 a -> Rep V4 -> a #

Eq1 V4 
Instance details

Defined in Linear.V4

Methods

liftEq :: (a -> b -> Bool) -> V4 a -> V4 b -> Bool #

Ord1 V4 
Instance details

Defined in Linear.V4

Methods

liftCompare :: (a -> b -> Ordering) -> V4 a -> V4 b -> Ordering #

Read1 V4 
Instance details

Defined in Linear.V4

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (V4 a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [V4 a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (V4 a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [V4 a] #

Show1 V4 
Instance details

Defined in Linear.V4

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> V4 a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [V4 a] -> ShowS #

MonadZip V4 
Instance details

Defined in Linear.V4

Methods

mzip :: V4 a -> V4 b -> V4 (a, b) #

mzipWith :: (a -> b -> c) -> V4 a -> V4 b -> V4 c #

munzip :: V4 (a, b) -> (V4 a, V4 b) #

Serial1 V4 
Instance details

Defined in Linear.V4

Methods

serializeWith :: MonadPut m => (a -> m ()) -> V4 a -> m () #

deserializeWith :: MonadGet m => m a -> m (V4 a) #

Hashable1 V4 
Instance details

Defined in Linear.V4

Methods

liftHashWithSalt :: (Int -> a -> Int) -> Int -> V4 a -> Int #

Apply V4 
Instance details

Defined in Linear.V4

Methods

(<.>) :: V4 (a -> b) -> V4 a -> V4 b #

(.>) :: V4 a -> V4 b -> V4 b #

(<.) :: V4 a -> V4 b -> V4 a #

liftF2 :: (a -> b -> c) -> V4 a -> V4 b -> V4 c #

Traversable1 V4 
Instance details

Defined in Linear.V4

Methods

traverse1 :: Apply f => (a -> f b) -> V4 a -> f (V4 b) #

sequence1 :: Apply f => V4 (f b) -> f (V4 b) #

Trace V4 
Instance details

Defined in Linear.Trace

Methods

trace :: Num a => V4 (V4 a) -> a #

diagonal :: V4 (V4 a) -> V4 a #

R4 V4 
Instance details

Defined in Linear.V4

Methods

_w :: Lens' (V4 a) a #

_xyzw :: Lens' (V4 a) (V4 a) #

R3 V4 
Instance details

Defined in Linear.V4

Methods

_z :: Lens' (V4 a) a #

_xyz :: Lens' (V4 a) (V3 a) #

R2 V4 
Instance details

Defined in Linear.V4

Methods

_y :: Lens' (V4 a) a #

_xy :: Lens' (V4 a) (V2 a) #

R1 V4 
Instance details

Defined in Linear.V4

Methods

_x :: Lens' (V4 a) a #

Finite V4 
Instance details

Defined in Linear.V4

Associated Types

type Size V4 :: Nat #

Methods

toV :: V4 a -> V (Size V4) a #

fromV :: V (Size V4) a -> V4 a #

Metric V4 
Instance details

Defined in Linear.V4

Methods

dot :: Num a => V4 a -> V4 a -> a #

quadrance :: Num a => V4 a -> a #

qd :: Num a => V4 a -> V4 a -> a #

distance :: Floating a => V4 a -> V4 a -> a #

norm :: Floating a => V4 a -> a #

signorm :: Floating a => V4 a -> V4 a #

Additive V4 
Instance details

Defined in Linear.V4

Methods

zero :: Num a => V4 a #

(^+^) :: Num a => V4 a -> V4 a -> V4 a #

(^-^) :: Num a => V4 a -> V4 a -> V4 a #

lerp :: Num a => a -> V4 a -> V4 a -> V4 a #

liftU2 :: (a -> a -> a) -> V4 a -> V4 a -> V4 a #

liftI2 :: (a -> b -> c) -> V4 a -> V4 b -> V4 c #

Foldable1 V4 
Instance details

Defined in Linear.V4

Methods

fold1 :: Semigroup m => V4 m -> m #

foldMap1 :: Semigroup m => (a -> m) -> V4 a -> m #

toNonEmpty :: V4 a -> NonEmpty a #

Bind V4 
Instance details

Defined in Linear.V4

Methods

(>>-) :: V4 a -> (a -> V4 b) -> V4 b #

join :: V4 (V4 a) -> V4 a #

Shape V4 Source # 
Instance details

Defined in Data.Dense.Index

ShapeLift V4 Source # 
Instance details

Defined in Data.Dense.TH

Methods

liftShape :: Lift a => V4 a -> Q Exp Source #

liftShape' :: Lift a => V4 a -> Q Exp Source #

Lift a => Lift (V4 a :: Type) 
Instance details

Defined in Linear.V4

Methods

lift :: V4 a -> Q Exp #

liftTyped :: V4 a -> Q (TExp (V4 a)) #

Unbox a => Vector Vector (V4 a) 
Instance details

Defined in Linear.V4

Methods

basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (V4 a) -> m (Vector (V4 a)) #

basicUnsafeThaw :: PrimMonad m => Vector (V4 a) -> m (Mutable Vector (PrimState m) (V4 a)) #

basicLength :: Vector (V4 a) -> Int #

basicUnsafeSlice :: Int -> Int -> Vector (V4 a) -> Vector (V4 a) #

basicUnsafeIndexM :: Monad m => Vector (V4 a) -> Int -> m (V4 a) #

basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (V4 a) -> Vector (V4 a) -> m () #

elemseq :: Vector (V4 a) -> V4 a -> b -> b #

Num r => Coalgebra r (E V4) 
Instance details

Defined in Linear.Algebra

Methods

comult :: (E V4 -> r) -> E V4 -> E V4 -> r #

counital :: (E V4 -> r) -> r #

Unbox a => MVector MVector (V4 a) 
Instance details

Defined in Linear.V4

Methods

basicLength :: MVector s (V4 a) -> Int #

basicUnsafeSlice :: Int -> Int -> MVector s (V4 a) -> MVector s (V4 a) #

basicOverlaps :: MVector s (V4 a) -> MVector s (V4 a) -> Bool #

basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (V4 a)) #

basicInitialize :: PrimMonad m => MVector (PrimState m) (V4 a) -> m () #

basicUnsafeReplicate :: PrimMonad m => Int -> V4 a -> m (MVector (PrimState m) (V4 a)) #

basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (V4 a) -> Int -> m (V4 a) #

basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (V4 a) -> Int -> V4 a -> m () #

basicClear :: PrimMonad m => MVector (PrimState m) (V4 a) -> m () #

basicSet :: PrimMonad m => MVector (PrimState m) (V4 a) -> V4 a -> m () #

basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (V4 a) -> MVector (PrimState m) (V4 a) -> m () #

basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (V4 a) -> MVector (PrimState m) (V4 a) -> m () #

basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (V4 a) -> Int -> m (MVector (PrimState m) (V4 a)) #

i ~ Int => HasLayout V4 (V4 i) Source # 
Instance details

Defined in Data.Dense.Index

Methods

layout :: Lens' (V4 i) (Layout V4) Source #

Bounded a => Bounded (V4 a) 
Instance details

Defined in Linear.V4

Methods

minBound :: V4 a #

maxBound :: V4 a #

Eq a => Eq (V4 a) 
Instance details

Defined in Linear.V4

Methods

(==) :: V4 a -> V4 a -> Bool #

(/=) :: V4 a -> V4 a -> Bool #

Floating a => Floating (V4 a) 
Instance details

Defined in Linear.V4

Methods

pi :: V4 a #

exp :: V4 a -> V4 a #

log :: V4 a -> V4 a #

sqrt :: V4 a -> V4 a #

(**) :: V4 a -> V4 a -> V4 a #

logBase :: V4 a -> V4 a -> V4 a #

sin :: V4 a -> V4 a #

cos :: V4 a -> V4 a #

tan :: V4 a -> V4 a #

asin :: V4 a -> V4 a #

acos :: V4 a -> V4 a #

atan :: V4 a -> V4 a #

sinh :: V4 a -> V4 a #

cosh :: V4 a -> V4 a #

tanh :: V4 a -> V4 a #

asinh :: V4 a -> V4 a #

acosh :: V4 a -> V4 a #

atanh :: V4 a -> V4 a #

log1p :: V4 a -> V4 a #

expm1 :: V4 a -> V4 a #

log1pexp :: V4 a -> V4 a #

log1mexp :: V4 a -> V4 a #

Fractional a => Fractional (V4 a) 
Instance details

Defined in Linear.V4

Methods

(/) :: V4 a -> V4 a -> V4 a #

recip :: V4 a -> V4 a #

fromRational :: Rational -> V4 a #

Data a => Data (V4 a) 
Instance details

Defined in Linear.V4

Methods

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

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

toConstr :: V4 a -> Constr #

dataTypeOf :: V4 a -> DataType #

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

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

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

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

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

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

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

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

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

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

Num a => Num (V4 a) 
Instance details

Defined in Linear.V4

Methods

(+) :: V4 a -> V4 a -> V4 a #

(-) :: V4 a -> V4 a -> V4 a #

(*) :: V4 a -> V4 a -> V4 a #

negate :: V4 a -> V4 a #

abs :: V4 a -> V4 a #

signum :: V4 a -> V4 a #

fromInteger :: Integer -> V4 a #

Ord a => Ord (V4 a) 
Instance details

Defined in Linear.V4

Methods

compare :: V4 a -> V4 a -> Ordering #

(<) :: V4 a -> V4 a -> Bool #

(<=) :: V4 a -> V4 a -> Bool #

(>) :: V4 a -> V4 a -> Bool #

(>=) :: V4 a -> V4 a -> Bool #

max :: V4 a -> V4 a -> V4 a #

min :: V4 a -> V4 a -> V4 a #

Read a => Read (V4 a) 
Instance details

Defined in Linear.V4

Show a => Show (V4 a) 
Instance details

Defined in Linear.V4

Methods

showsPrec :: Int -> V4 a -> ShowS #

show :: V4 a -> String #

showList :: [V4 a] -> ShowS #

Ix a => Ix (V4 a) 
Instance details

Defined in Linear.V4

Methods

range :: (V4 a, V4 a) -> [V4 a] #

index :: (V4 a, V4 a) -> V4 a -> Int #

unsafeIndex :: (V4 a, V4 a) -> V4 a -> Int #

inRange :: (V4 a, V4 a) -> V4 a -> Bool #

rangeSize :: (V4 a, V4 a) -> Int #

unsafeRangeSize :: (V4 a, V4 a) -> Int #

Generic (V4 a) 
Instance details

Defined in Linear.V4

Associated Types

type Rep (V4 a) :: Type -> Type #

Methods

from :: V4 a -> Rep (V4 a) x #

to :: Rep (V4 a) x -> V4 a #

Semigroup a => Semigroup (V4 a) 
Instance details

Defined in Linear.V4

Methods

(<>) :: V4 a -> V4 a -> V4 a #

sconcat :: NonEmpty (V4 a) -> V4 a #

stimes :: Integral b => b -> V4 a -> V4 a #

Monoid a => Monoid (V4 a) 
Instance details

Defined in Linear.V4

Methods

mempty :: V4 a #

mappend :: V4 a -> V4 a -> V4 a #

mconcat :: [V4 a] -> V4 a #

Storable a => Storable (V4 a) 
Instance details

Defined in Linear.V4

Methods

sizeOf :: V4 a -> Int #

alignment :: V4 a -> Int #

peekElemOff :: Ptr (V4 a) -> Int -> IO (V4 a) #

pokeElemOff :: Ptr (V4 a) -> Int -> V4 a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (V4 a) #

pokeByteOff :: Ptr b -> Int -> V4 a -> IO () #

peek :: Ptr (V4 a) -> IO (V4 a) #

poke :: Ptr (V4 a) -> V4 a -> IO () #

Binary a => Binary (V4 a) 
Instance details

Defined in Linear.V4

Methods

put :: V4 a -> Put #

get :: Get (V4 a) #

putList :: [V4 a] -> Put #

Serial a => Serial (V4 a) 
Instance details

Defined in Linear.V4

Methods

serialize :: MonadPut m => V4 a -> m () #

deserialize :: MonadGet m => m (V4 a) #

Serialize a => Serialize (V4 a) 
Instance details

Defined in Linear.V4

Methods

put :: Putter (V4 a) #

get :: Get (V4 a) #

NFData a => NFData (V4 a) 
Instance details

Defined in Linear.V4

Methods

rnf :: V4 a -> () #

Hashable a => Hashable (V4 a) 
Instance details

Defined in Linear.V4

Methods

hashWithSalt :: Int -> V4 a -> Int #

hash :: V4 a -> Int #

Unbox a => Unbox (V4 a) 
Instance details

Defined in Linear.V4

Ixed (V4 a) 
Instance details

Defined in Linear.V4

Methods

ix :: Index (V4 a) -> Traversal' (V4 a) (IxValue (V4 a)) #

Epsilon a => Epsilon (V4 a) 
Instance details

Defined in Linear.V4

Methods

nearZero :: V4 a -> Bool #

Random a => Random (V4 a) 
Instance details

Defined in Linear.V4

Methods

randomR :: RandomGen g => (V4 a, V4 a) -> g -> (V4 a, g) #

random :: RandomGen g => g -> (V4 a, g) #

randomRs :: RandomGen g => (V4 a, V4 a) -> g -> [V4 a] #

randoms :: RandomGen g => g -> [V4 a] #

randomRIO :: (V4 a, V4 a) -> IO (V4 a) #

randomIO :: IO (V4 a) #

Generic1 V4 
Instance details

Defined in Linear.V4

Associated Types

type Rep1 V4 :: k -> Type #

Methods

from1 :: forall (a :: k). V4 a -> Rep1 V4 a #

to1 :: forall (a :: k). Rep1 V4 a -> V4 a #

FunctorWithIndex (E V4) V4 
Instance details

Defined in Linear.V4

Methods

imap :: (E V4 -> a -> b) -> V4 a -> V4 b #

imapped :: IndexedSetter (E V4) (V4 a) (V4 b) a b #

FoldableWithIndex (E V4) V4 
Instance details

Defined in Linear.V4

Methods

ifoldMap :: Monoid m => (E V4 -> a -> m) -> V4 a -> m #

ifolded :: IndexedFold (E V4) (V4 a) a #

ifoldr :: (E V4 -> a -> b -> b) -> b -> V4 a -> b #

ifoldl :: (E V4 -> b -> a -> b) -> b -> V4 a -> b #

ifoldr' :: (E V4 -> a -> b -> b) -> b -> V4 a -> b #

ifoldl' :: (E V4 -> b -> a -> b) -> b -> V4 a -> b #

TraversableWithIndex (E V4) V4 
Instance details

Defined in Linear.V4

Methods

itraverse :: Applicative f => (E V4 -> a -> f b) -> V4 a -> f (V4 b) #

itraversed :: IndexedTraversal (E V4) (V4 a) (V4 b) a b #

Each (V4 a) (V4 b) a b 
Instance details

Defined in Linear.V4

Methods

each :: Traversal (V4 a) (V4 b) a b #

Field1 (V4 a) (V4 a) a a 
Instance details

Defined in Linear.V4

Methods

_1 :: Lens (V4 a) (V4 a) a a #

Field2 (V4 a) (V4 a) a a 
Instance details

Defined in Linear.V4

Methods

_2 :: Lens (V4 a) (V4 a) a a #

Field3 (V4 a) (V4 a) a a 
Instance details

Defined in Linear.V4

Methods

_3 :: Lens (V4 a) (V4 a) a a #

Field4 (V4 a) (V4 a) a a 
Instance details

Defined in Linear.V4

Methods

_4 :: Lens (V4 a) (V4 a) a a #

type Rep V4 
Instance details

Defined in Linear.V4

type Rep V4 = E V4
type Size V4 
Instance details

Defined in Linear.V4

type Size V4 = 4
data MVector s (V4 a) 
Instance details

Defined in Linear.V4

data MVector s (V4 a) = MV_V4 !Int !(MVector s a)
type Rep (V4 a) 
Instance details

Defined in Linear.V4

data Vector (V4 a) 
Instance details

Defined in Linear.V4

data Vector (V4 a) = V_V4 !Int !(Vector a)
type Index (V4 a) 
Instance details

Defined in Linear.V4

type Index (V4 a) = E V4
type IxValue (V4 a) 
Instance details

Defined in Linear.V4

type IxValue (V4 a) = a
type Rep1 V4 
Instance details

Defined in Linear.V4

class R1 (t :: Type -> Type) where #

A space that has at least 1 basis vector _x.

Methods

_x :: Lens' (t a) a #

>>> V1 2 ^._x
2
>>> V1 2 & _x .~ 3
V1 3

Instances

Instances details
R1 Identity 
Instance details

Defined in Linear.V1

Methods

_x :: Lens' (Identity a) a #

R1 Quaternion 
Instance details

Defined in Linear.Quaternion

Methods

_x :: Lens' (Quaternion a) a #

R1 V4 
Instance details

Defined in Linear.V4

Methods

_x :: Lens' (V4 a) a #

R1 V3 
Instance details

Defined in Linear.V3

Methods

_x :: Lens' (V3 a) a #

R1 V2 
Instance details

Defined in Linear.V2

Methods

_x :: Lens' (V2 a) a #

R1 V1 
Instance details

Defined in Linear.V1

Methods

_x :: Lens' (V1 a) a #

class R1 t => R2 (t :: Type -> Type) where #

A space that distinguishes 2 orthogonal basis vectors _x and _y, but may have more.

Minimal complete definition

_xy

Methods

_y :: Lens' (t a) a #

>>> V2 1 2 ^._y
2
>>> V2 1 2 & _y .~ 3
V2 1 3

_xy :: Lens' (t a) (V2 a) #

Instances

Instances details
R2 Quaternion 
Instance details

Defined in Linear.Quaternion

Methods

_y :: Lens' (Quaternion a) a #

_xy :: Lens' (Quaternion a) (V2 a) #

R2 V4 
Instance details

Defined in Linear.V4

Methods

_y :: Lens' (V4 a) a #

_xy :: Lens' (V4 a) (V2 a) #

R2 V3 
Instance details

Defined in Linear.V3

Methods

_y :: Lens' (V3 a) a #

_xy :: Lens' (V3 a) (V2 a) #

R2 V2 
Instance details

Defined in Linear.V2

Methods

_y :: Lens' (V2 a) a #

_xy :: Lens' (V2 a) (V2 a) #

class R2 t => R3 (t :: Type -> Type) where #

A space that distinguishes 3 orthogonal basis vectors: _x, _y, and _z. (It may have more)

Methods

_z :: Lens' (t a) a #

>>> V3 1 2 3 ^. _z
3

_xyz :: Lens' (t a) (V3 a) #

Instances

Instances details
R3 Quaternion 
Instance details

Defined in Linear.Quaternion

Methods

_z :: Lens' (Quaternion a) a #

_xyz :: Lens' (Quaternion a) (V3 a) #

R3 V4 
Instance details

Defined in Linear.V4

Methods

_z :: Lens' (V4 a) a #

_xyz :: Lens' (V4 a) (V3 a) #

R3 V3 
Instance details

Defined in Linear.V3

Methods

_z :: Lens' (V3 a) a #

_xyz :: Lens' (V3 a) (V3 a) #

class R3 t => R4 (t :: Type -> Type) where #

A space that distinguishes orthogonal basis vectors _x, _y, _z, _w. (It may have more.)

Methods

_w :: Lens' (t a) a #

>>> V4 1 2 3 4 ^._w
4

_xyzw :: Lens' (t a) (V4 a) #

Instances

Instances details
R4 Quaternion 
Instance details

Defined in Linear.Quaternion

Methods

_w :: Lens' (Quaternion a) a #

_xyzw :: Lens' (Quaternion a) (V4 a) #

R4 V4 
Instance details

Defined in Linear.V4

Methods

_w :: Lens' (V4 a) a #

_xyzw :: Lens' (V4 a) (V4 a) #

Extra planes

_xz :: forall (t :: Type -> Type) a. R3 t => Lens' (t a) (V2 a) #

_yz :: forall (t :: Type -> Type) a. R3 t => Lens' (t a) (V2 a) #

_yx :: forall (t :: Type -> Type) a. R2 t => Lens' (t a) (V2 a) #

>>> V2 1 2 ^. _yx
V2 2 1

_zy :: forall (t :: Type -> Type) a. R3 t => Lens' (t a) (V2 a) #

_zx :: forall (t :: Type -> Type) a. R3 t => Lens' (t a) (V2 a) #