|
Numeric.LinearAlgebra.Array.Util | |
|
|
Description |
Additional tools for manipulation of multidimensional arrays.
|
|
Synopsis |
|
class (Num (Vector t), Field t, Storable t) => Coord t | | class (Eq a, Show (Idx a)) => Compat a where | | | data NArray i t | | data Idx i = Idx {} | | type Name = String | | scalar :: Coord t => t -> NArray i t | | order :: NArray i t -> Int | | names :: NArray i t -> [Name] | | size :: Name -> NArray i t -> Int | | sizes :: NArray i t -> [Int] | | typeOf :: Compat i => Name -> NArray i t -> i | | dims :: NArray i t -> [Idx i] | | coords :: NArray i t -> Vector t | | renameExplicit :: (Compat i, Coord t) => [(Name, Name)] -> NArray i t -> NArray i t | | (!>) :: (Compat i, Coord t) => NArray i t -> [Char] -> NArray i t | | renameO :: (Coord t, Compat i) => NArray i t -> [Name] -> NArray i t | | (!) :: (Compat i, Coord t) => NArray i t -> [Char] -> NArray i t | | parts :: Coord t => NArray i t -> Name -> [NArray i t] | | newIndex :: (Coord t, Compat i) => i -> Name -> [NArray i t] -> NArray i t | | mapArray :: Coord b => (Vector a -> Vector b) -> NArray i a -> NArray i b | | zipArray :: (Coord a, Coord b, Compat i) => (Vector a -> Vector b -> Vector c) -> NArray i a -> NArray i b -> NArray i c | | (|*|) :: (Coord t, Compat i) => NArray i t -> NArray i t -> NArray i t | | smartProduct :: (Coord t, Compat i, Num (NArray i t)) => [NArray i t] -> NArray i t | | outers :: (Coord a, Compat i) => [NArray i a] -> NArray i a | | extract :: (Compat i, Coord t) => (Int -> NArray i t -> Bool) -> Name -> NArray i t -> NArray i t | | onIndex :: (Coord a, Coord b, Compat i) => ([NArray i a] -> [NArray i b]) -> Name -> NArray i a -> NArray i b | | mapTat :: (Coord a, Coord b, Compat i) => (NArray i a -> NArray i b) -> [Name] -> NArray i a -> NArray i b | | reorder :: Coord t => [Name] -> NArray i t -> NArray i t | | (~>) :: Coord t => NArray i t -> String -> NArray i t | | formatArray :: (Coord t, Compat i) => (t -> String) -> NArray i t -> String | | formatFixed :: Compat i => Int -> NArray i Double -> String | | formatScaled :: Compat i => Int -> NArray i Double -> String | | dummyAt :: Coord t => Int -> NArray i t -> NArray i t | | noIdx :: Compat i => NArray i t -> NArray i t | | conformable :: Compat i => [[Idx i]] -> Maybe [Idx i] | | sameStructure :: Eq i => NArray i t1 -> NArray i t2 -> Bool | | makeConformant :: (Coord t, Compat i) => [NArray i t] -> [NArray i t] | | basisOf :: Coord t => NArray i t -> [NArray i t] | | atT :: (Compat i, Coord t) => NArray i t -> [Int] -> NArray i t | | takeDiagT :: (Compat i, Coord t) => NArray i t -> [t] | | diagT :: [Double] -> Int -> Array Double | | mkFun :: [Int] -> ([Int] -> Double) -> Array Double | | mkAssoc :: [Int] -> [([Int], Double)] -> Array Double | | setType :: (Compat i, Coord t) => Name -> i -> NArray i t -> NArray i t | | renameParts :: (Compat i, Coord t) => Name -> NArray i t -> Name -> String -> [NArray i t] | | asScalar :: Coord t => NArray i t -> t | | asVector :: Coord t => NArray i t -> Vector t | | asMatrix :: Coord t => NArray i t -> Matrix t | | applyAsMatrix :: (Coord t, Compat i) => (Matrix t -> Matrix t) -> NArray i t -> NArray i t | | fibers :: Coord t => Name -> NArray i t -> Matrix t | | matrixator :: Coord t => NArray i t -> [Name] -> [Name] -> Matrix t | | matrixatorFree :: Coord t => NArray i t -> [Name] -> (Matrix t, [Name]) | | analyzeProduct :: (Coord t, Compat i) => NArray i t -> NArray i t -> Maybe (NArray i t, Int) | | fromVector :: (Coord t, Compat i) => i -> Vector t -> NArray i t | | fromMatrix :: (Compat i, Coord t) => i -> i -> Matrix t -> NArray i t | | class Element e => Container c e where | |
|
|
Documentation |
|
|
Types that can be elements of the multidimensional arrays.
| | Instances | |
|
|
|
Class of compatible indices for contractions.
| | Methods | | | Instances | |
|
|
|
A multidimensional array with index type i and elements t.
| Instances | (Coord t, Coord (Complex t), Compat i, Container Vector t) => Container (NArray i) t | (Coord t, Compat i) => Eq (NArray i t) | (Coord t, Compat i, Fractional (NArray i t), Floating (Vector t)) => Floating (NArray i t) | (Coord t, Compat i, Num (NArray i t)) => Fractional (NArray i t) | (Show (NArray i t), Coord t, Compat i) => Num (NArray i t) |
|
|
|
|
Dimension descriptor.
| Constructors | | Instances | |
|
|
|
indices are denoted by strings, (frequently single-letter)
|
|
|
Create a 0-dimensional structure.
|
|
|
The number of dimensions of a multidimensional array.
|
|
|
Index names.
|
|
|
Dimension of given index.
|
|
|
|
|
Type of given index.
|
|
|
Get detailed dimension information about the array.
|
|
|
Get the coordinates of an array as a
flattened structure (in the order specified by dims).
|
|
|
Rename indices using an association list.
|
|
|
Explicit renaming of single letter index names.
For instance, t >@> "pi qj" changes index "p" to "i" and "q" to "j".
|
|
|
Rename indices in alphabetical order. Equal indices of compatible type are contracted out.
|
|
|
Rename indices in alphabetical order (renameO) using single letter names.
|
|
|
:: Coord t | | => NArray i t | | -> Name | index to expand
| -> [NArray i t] | | Create a list of the substructures at the given level.
|
|
|
|
|
|
|
Apply a function (defined on hmatrix Vectors) to all elements of a structure.
Use mapArray (mapVector f) for general functions.
|
|
|
|
|
|
Tensor product with automatic contraction of repeated indices, following Einstein summation convention.
|
|
|
This is equivalent to the regular product, but in the order that minimizes the size of the
intermediate factors.
|
|
|
Outer product of a list of arrays along the common indices.
|
|
|
Select some parts of an array, taking into account position and value.
|
|
|
Apply a list function to the parts of an array at a given index.
|
|
|
Map a function at the internal level selected by a set of indices
|
|
|
Change the internal layout of coordinates.
The array, considered as an abstract object, does not change.
|
|
|
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 t, Compat i) | | => t -> String | format function (eg. printf "5.2f")
| -> NArray i t | | -> String | | Show a multidimensional array as a nested 2D table.
|
|
|
|
:: Compat i | | => Int | number of of decimal places
| -> NArray i Double | | -> String | | Show the array as a nested table with a "%.nf" format. If all entries
are approximate integers the array is shown without the .00.. digits.
|
|
|
|
|
|
|
Insert a dummy index of dimension 1 at a given level (for formatting purposes).
|
|
|
Rename indices so that they are not shown in formatted output.
|
|
|
Obtains most general structure of a list of dimension specifications
|
|
|
Check if two arrays have the same structure.
|
|
|
Converts a list of arrays to a common structure.
|
|
|
Obtain a canonical base for the array.
|
|
|
|
|
|
|
Multidimensional diagonal of given order.
|
|
|
Define an array using a function.
|
|
|
Define an array using an association list.
|
|
|
Change type of index.
|
|
|
:: (Compat i, Coord t) | | => Name | index of the parts to extract
| -> NArray i t | input array
| -> Name | index to renameRaw
| -> String | prefix for the new names
| -> [NArray i t] | list or results
| Extract the parts of an array, and renameRaw one of the remaining indices
with succesive integers.
|
|
|
|
Extract the scalar element corresponding to a 0-dimensional array.
|
|
|
Extract the Vector corresponding to a one-dimensional array.
|
|
|
Extract the Matrix corresponding to a two-dimensional array,
in the rows,cols order.
|
|
|
|
|
Obtain a matrix whose columns are the fibers of the array in the given dimension. The column order depends on the selected index (see matrixator).
|
|
|
:: Coord t | | => NArray i t | input array
| -> [Name] | row dimensions
| -> [Name] | column dimensions
| -> Matrix t | result
| Reshapes an array as a matrix with the desired dimensions as flattened rows and flattened columns.
|
|
|
|
:: Coord t | | => NArray i t | input array
| -> [Name] | row dimensions
| -> (Matrix t, [Name]) | (result, column dimensions)
| Reshapes an array as a matrix with the desired dimensions as flattened rows and flattened columns. We do not force the order of the columns.
|
|
|
|
|
|
Create a 1st order array from a Vector.
|
|
|
Create a 2nd order array from a Matrix.
|
|
|
conversion utilities
| | Methods | | | Instances | |
|
|
Produced by Haddock version 2.6.1 |