Copyright | (c) Alberto Ruiz 2009 |
---|---|
License | BSD3 |
Maintainer | Alberto Ruiz |
Stability | provisional |
Safe Haskell | None |
Language | Haskell98 |
Simple multidimensional array with useful numeric instances.
Contractions only require equal dimension.
- data None = None
- type Array t = NArray None t
- listArray :: Coord t => [Int] -> [t] -> Array t
- scalar :: Coord t => t -> NArray i t
- index :: Coord t => Name -> [Array t] -> Array t
- (!) :: (Compat i, Coord t) => NArray i t -> [Char] -> NArray i t
- (!>) :: (Compat i, Coord t) => NArray i t -> [Char] -> NArray i t
- (~>) :: Coord t => NArray i t -> String -> NArray i t
- (.*) :: (Coord a, Compat i) => NArray i a -> NArray i a -> NArray i a
- printA :: (Coord t, Compat i, PrintfArg t) => String -> NArray i t -> IO ()
Documentation
Unespecified coordinate type. Contractions only require equal dimension.
Construction of an Array
from a list of dimensions and a list of elements in left to right order.
(!) :: (Compat i, Coord t) => NArray i t -> [Char] -> NArray i t infixl 9 Source #
Rename indices in alphabetical order (renameO
) using single letter names.
(!>) :: (Compat i, Coord t) => NArray i t -> [Char] -> NArray i t infixl 9 Source #
Explicit renaming of single letter index names.
For instance, t >@> "pi qj"
changes index "p" to "i" and "q" to "j".
(~>) :: Coord t => NArray i t -> String -> NArray i t infixl 8 Source #
reorder
(transpose) dimensions of the array (with single letter names).
Operations are defined by named indices, so the transposed array is operationally equivalent to the original one.
(.*) :: (Coord a, Compat i) => NArray i a -> NArray i a -> NArray i a infixl 7 Source #
Element by element product.
printA :: (Coord t, Compat i, PrintfArg t) => String -> NArray i t -> IO () Source #
Print the array as a nested table with the desired format (e.g. %7.2f) (see also formatArray
, and formatScaled
).
Orphan instances
(Eq t, Coord t, Compat i) => Eq (NArray i t) Source # | |
(Coord t, Compat i, Fractional (NArray i t), Floating t, Floating (Vector t)) => Floating (NArray i t) Source # | |
(Fractional t, Coord t, Compat i, Num (NArray i t)) => Fractional (NArray i t) Source # | |
(Show (NArray i t), Coord t, Compat i) => Num (NArray i t) Source # | |