hmatrix-static-0.2: hmatrix with vector and matrix sizes encoded in typesSource codeContentsIndex
Data.Packed.Static.Shapes
Portabilityportable
Stabilityexperimental
MaintainerReiner Pope <reiner.pope@gmail.com>
Description
Shape-based functionality, common for matrices and vectors
Synopsis
data Unknown
class ShapedContainer a where
type Unwrapped a :: * -> *
type UnknownShape a
unWrap :: a s t -> Unwrapped a t
wrapU :: Unwrapped a t -> a (UnknownShape a) t
unsafeReshape :: a s t -> a s' t
atShape :: a s t -> s -> a s t
shapeOf :: a s t -> s
forgetShapeU :: ShapedContainer a => a s t -> a (UnknownShape a) t
unsafeWrap :: ShapedContainer a => Unwrapped a t -> a s t
Documentation
data Unknown Source
Uninhabited type. Represents unknown lengths. Instances of ShapedContainer use Unknown for the UnknownShape type.
class ShapedContainer a whereSource
Associated Types
type Unwrapped a :: * -> *Source
Less-typed, hmatrix representation
type UnknownShape a Source
standard 'unknown' shape. For vectors, Unknown; for matrices, (Unknown,Unknown).
Methods
unWrap :: a s t -> Unwrapped a tSource
Convert to hmatrix representation
wrapU :: Unwrapped a t -> a (UnknownShape a) tSource
Convert from hmatrix representation
unsafeReshape :: a s t -> a s' tSource
Coerce the static shape. Unsafe; the user of this function has an obligation to prove that the object's dynamic shape is the same as that represented by s'.
show/hide Instances
atShape :: a s t -> s -> a s tSource

For type hints.

> constant (5::Double) atShape d4
 [$vec| 5.0, 5.0, 5.0, 5.0 |] :: Vector D4 Double

Implementation:

atShape = const.

shapeOf :: a s t -> sSource

For type hints.

> constant (5::Double) atShape shapeOf [$vec|1|]
 [$vec| 5.0 |]

Implementation:

shapeOf _ = undefined
forgetShapeU :: ShapedContainer a => a s t -> a (UnknownShape a) tSource
Changes the static shape to the UnknownShape. Dynamic representation is unchanged.
unsafeWrap :: ShapedContainer a => Unwrapped a t -> a s tSource
unsafeWrap = unsafeReshape . wrapU.
Produced by Haddock version 2.4.2