| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Numeric.LAPACK.Shape
Synopsis
- class C shape => Permutable shape
- newtype IntIndexed sh = IntIndexed {
- deconsIntIndexed :: sh
- shapeInt :: C sh => sh -> ZeroBased Int
Documentation
class C shape => Permutable shape Source #
Class of shapes where indices still make sense if we permute elements. We use this for all matrix factorisations involving permutations or more generally orthogonal transformations, e.g. eigenvalue and singular value, LU and QR decompositions. E.g. say, we have a square matrix with dimension 'Shape.Enumeration Ordering'. Its vector of eigenvalues has the same dimension, but it does not make sense to access the eigenvalues with indices like LT or EQ. Thus Enumeration is no instance of Permutable (and you should not add an orphan instance).
If you want to factor a matrix with a non-permutable shape, you should convert it temporarily to a permutable one, like ZeroBased (i.e. ShapeInt) or IntIndexed.
The Permutable class has no method, so you could add any shape to it. However, you should use good taste when adding an instance. There is no strict criterion which shape type to add.
We tried to use ShapeInt for eigenvalue vectors and LiberalSquares as transformation matrices of eigenvalue decompositions. However, this way, the type checker cannot infer that the product of the factorisation is a strict square.
We also tried to use IntIndexed for eigenvalue vectors with according LiberalSquares transformations. This has also the problem of inferring squares. Additionally, more such transformations lead to nested IntIndexed wrappers and for ShapeInt even the first wrapper is unnecessary.
Instances
| Permutable () Source # | |
Defined in Numeric.LAPACK.Shape | |
| Permutable Zero Source # | |
Defined in Numeric.LAPACK.Shape | |
| Integral n => Permutable (ZeroBased n) Source # | |
Defined in Numeric.LAPACK.Shape | |
| Integral n => Permutable (OneBased n) Source # | |
Defined in Numeric.LAPACK.Shape | |
| Ix n => Permutable (Range n) Source # | |
Defined in Numeric.LAPACK.Shape | |
| Integral n => Permutable (Shifted n) Source # | |
Defined in Numeric.LAPACK.Shape | |
| Permutable sh => Permutable (Deferred sh) Source # | |
Defined in Numeric.LAPACK.Shape | |
| Integral n => Permutable (Cyclic n) Source # | |
Defined in Numeric.LAPACK.Shape | |
| C sh => Permutable (IntIndexed sh) Source # | |
Defined in Numeric.LAPACK.Shape | |
| Permutable sh => Permutable (Tagged s sh) Source # | |
Defined in Numeric.LAPACK.Shape | |
newtype IntIndexed sh Source #
This shape type wraps any other array shape type. However, its Indexed instance just uses zero-based Int indices. Thus it can turn any shape type into a Indexed one. The main usage is to make an arbitrary shape Permutable.
Constructors
| IntIndexed | |
Fields
| |