|
| Data.Matrix.Dense.Class | | Stability | experimental | | Maintainer | Patrick Perry <patperry@stanford.edu> |
|
|
|
|
|
| Description |
|
|
| Synopsis |
|
| class (BaseMatrix a, BaseVector x) => BaseMatrix a x | a -> x where | | | | class (UnsafeIOToM m, ReadTensor a (Int, Int) m, BaseMatrix a x, ReadVector x m) => ReadMatrix a x m | a -> x | | | class (WriteTensor a (Int, Int) m, WriteVector x m, ReadMatrix a x m) => WriteMatrix a x m | a -> m, m -> a, a -> x | | | module BLAS.Tensor.Base | | | module BLAS.Matrix.Base | | | coerceMatrix :: BaseMatrix a x => a mn e -> a mn' e | | | newMatrix_ :: (WriteMatrix a x m, Elem e) => (Int, Int) -> m (a mn e) | | | newMatrix :: (WriteMatrix a x m, Elem e) => (Int, Int) -> [((Int, Int), e)] -> m (a mn e) | | | newListMatrix :: (WriteMatrix a x m, Elem e) => (Int, Int) -> [e] -> m (a mn e) | | | newRowsMatrix :: (ReadVector x m, WriteMatrix a y m, BLAS1 e) => (Int, Int) -> [x l e] -> m (a (k, l) e) | | | newColsMatrix :: (ReadVector x m, WriteMatrix a y m, BLAS1 e) => (Int, Int) -> [x k e] -> m (a (k, l) e) | | | newRowMatrix :: (ReadVector x m, WriteMatrix a y m, BLAS1 e) => x l e -> m (a (one, l) e) | | | newColMatrix :: (ReadVector x m, WriteMatrix a y m, BLAS1 e) => x k e -> m (a (k, one) e) | | | unsafeNewMatrix :: (WriteMatrix a x m, Elem e) => (Int, Int) -> [((Int, Int), e)] -> m (a mn e) | | | module BLAS.Tensor.Read | | | module BLAS.Tensor.Write | | | newZeroMatrix :: (WriteMatrix a x m, Elem e) => (Int, Int) -> m (a mn e) | | | setZeroMatrix :: (WriteMatrix a x m, Elem e) => a mn e -> m () | | | newConstantMatrix :: (WriteMatrix a x m, Elem e) => (Int, Int) -> e -> m (a mn e) | | | setConstantMatrix :: (WriteMatrix a x m, Elem e) => e -> a mn e -> m () | | | newIdentityMatrix :: (WriteMatrix a x m, Elem e) => (Int, Int) -> m (a mn e) | | | setIdentityMatrix :: (WriteMatrix a x m, Elem e) => a mn e -> m () | | | submatrixView :: (BaseMatrix a x, Storable e) => a mn e -> (Int, Int) -> (Int, Int) -> a mn' e | | | splitRowsAt :: (BaseMatrix a x, Storable e) => Int -> a (m, n) e -> (a (m1, n) e, a (m2, n) e) | | | splitColsAt :: (BaseMatrix a x, Storable e) => Int -> a (m, n) e -> (a (m, n1) e, a (m, n2) e) | | | unsafeSubmatrixView :: (BaseMatrix a x, Storable e) => a mn e -> (Int, Int) -> (Int, Int) -> a mn' e | | | unsafeSplitRowsAt :: (BaseMatrix a x, Storable e) => Int -> a (m, n) e -> (a (m1, n) e, a (m2, n) e) | | | unsafeSplitColsAt :: (BaseMatrix a x, Storable e) => Int -> a (m, n) e -> (a (m, n1) e, a (m, n2) e) | | | rowViews :: (BaseMatrix a x, Storable e) => a (m, n) e -> [x n e] | | | colViews :: (BaseMatrix a x, Storable e) => a (m, n) e -> [x m e] | | | rowView :: (BaseMatrix a x, Storable e) => a (m, n) e -> Int -> x n e | | | colView :: (BaseMatrix a x, Storable e) => a (m, n) e -> Int -> x m e | | | diagView :: (BaseMatrix a x, Storable e) => a mn e -> Int -> x k e | | | unsafeRowView :: (BaseMatrix a x, Storable e) => a (k, l) e -> Int -> x l e | | | unsafeColView :: (BaseMatrix a x, Storable e) => a (k, l) e -> Int -> x k e | | | unsafeDiagView :: (BaseMatrix a x, Storable e) => a mn e -> Int -> x k e | | | getDiag :: (ReadMatrix a x m, WriteVector y m, BLAS1 e) => a mn e -> Int -> m (y k e) | | | unsafeGetDiag :: (ReadMatrix a x m, WriteVector y m, BLAS1 e) => a mn e -> Int -> m (y k e) | | | newCopyMatrix :: (BLAS1 e, ReadMatrix a x m, WriteMatrix b y m) => a mn e -> m (b mn e) | | | copyMatrix :: (WriteMatrix b y m, ReadMatrix a x m, BLAS1 e) => b mn e -> a mn e -> m () | | | swapMatrix :: (WriteMatrix a x m, BLAS1 e) => a mn e -> a mn e -> m () | | | unsafeCopyMatrix :: (BLAS1 e, WriteMatrix b y m, ReadMatrix a x m) => b mn e -> a mn e -> m () | | | unsafeSwapMatrix :: (WriteMatrix a x m, BLAS1 e) => a mn e -> a mn e -> m () | | | swapRows :: (WriteMatrix a x m, BLAS1 e) => a (r, s) e -> Int -> Int -> m () | | | swapCols :: (WriteMatrix a x m, BLAS1 e) => a (r, s) e -> Int -> Int -> m () | | | unsafeSwapRows :: (WriteMatrix a x m, BLAS1 e) => a (r, s) e -> Int -> Int -> m () | | | unsafeSwapCols :: (WriteMatrix a x m, BLAS1 e) => a (r, s) e -> Int -> Int -> m () | | | getConjMatrix :: (ReadMatrix a x m, WriteMatrix b y m, BLAS1 e) => a mn e -> m (b mn e) | | | getScaledMatrix :: (ReadMatrix a x m, WriteMatrix b y m, BLAS1 e) => e -> a mn e -> m (b mn e) | | | getShiftedMatrix :: (ReadMatrix a x m, WriteMatrix b y m, BLAS1 e) => e -> a mn e -> m (b mn e) | | | getAddMatrix :: (ReadMatrix a x m, ReadMatrix b x m, WriteMatrix c z m, BLAS1 e) => a mn e -> b mn e -> m (c mn e) | | | getSubMatrix :: (ReadMatrix a x m, ReadMatrix b x m, WriteMatrix c z m, BLAS1 e) => a mn e -> b mn e -> m (c mn e) | | | getMulMatrix :: (ReadMatrix a x m, ReadMatrix b x m, WriteMatrix c z m, BLAS1 e) => a mn e -> b mn e -> m (c mn e) | | | getDivMatrix :: (ReadMatrix a x m, ReadMatrix b x m, WriteMatrix c z m, BLAS1 e) => a mn e -> b mn e -> m (c mn e) | | | addMatrix :: (WriteMatrix b y m, ReadMatrix a x m, BLAS1 e) => b n e -> a n e -> m () | | | subMatrix :: (WriteMatrix b y m, ReadMatrix a x m, BLAS1 e) => b n e -> a n e -> m () | | | axpyMatrix :: (ReadMatrix a x m, WriteMatrix b y m, BLAS1 e) => e -> a n e -> b n e -> m () | | | mulMatrix :: (WriteMatrix b y m, ReadMatrix a x m, BLAS1 e) => b n e -> a n e -> m () | | | divMatrix :: (WriteMatrix b y m, ReadMatrix a x m, BLAS1 e) => b n e -> a n e -> m () | | | unsafeGetAddMatrix :: (ReadMatrix a x m, ReadMatrix b x m, WriteMatrix c z m, BLAS1 e) => a mn e -> b mn e -> m (c mn e) | | | unsafeGetSubMatrix :: (ReadMatrix a x m, ReadMatrix b x m, WriteMatrix c z m, BLAS1 e) => a mn e -> b mn e -> m (c mn e) | | | unsafeGetMulMatrix :: (ReadMatrix a x m, ReadMatrix b x m, WriteMatrix c z m, BLAS1 e) => a mn e -> b mn e -> m (c mn e) | | | unsafeGetDivMatrix :: (ReadMatrix a x m, ReadMatrix b x m, WriteMatrix c z m, BLAS1 e) => a mn e -> b mn e -> m (c mn e) | | | unsafeAddMatrix :: (WriteMatrix b y m, ReadMatrix a x m, BLAS1 e) => b n e -> a n e -> m () | | | unsafeSubMatrix :: (WriteMatrix b y m, ReadMatrix a x m, BLAS1 e) => b n e -> a n e -> m () | | | unsafeAxpyMatrix :: (ReadMatrix a x m, WriteMatrix b y m, BLAS1 e) => e -> a mn e -> b mn e -> m () | | | unsafeMulMatrix :: (WriteMatrix b y m, ReadMatrix a x m, BLAS1 e) => b mn e -> a mn e -> m () | | | unsafeDivMatrix :: (WriteMatrix b y m, ReadMatrix a x m, BLAS1 e) => b mn e -> a mn e -> m () | | | module BLAS.Matrix.Mutable | | | ldaOfMatrix :: BaseMatrix a x => a mn e -> Int | | | isHermMatrix :: BaseMatrix a x => a mn e -> Bool | | | withMatrixPtr :: BaseMatrix a x => a mn e -> (Ptr e -> IO b) -> IO b |
|
|
|
| The dense matrix type classes
|
|
|
| | Methods | | | Instances | |
|
|
|
| Instances | |
|
|
|
| Instances | |
|
|
| Matrix shape
|
|
| module BLAS.Tensor.Base |
|
| module BLAS.Matrix.Base |
|
|
| Cast the shape type of the matrix.
|
|
| Creating matrices
|
|
|
| Create a new matrix of given shape, but do not initialize the elements.
|
|
|
| Creates a new matrix with the given association list. Unspecified
indices will get initialized to zero.
|
|
|
| Create a new matrix with the given elements in column-major order.
|
|
|
| Form a matrix from a list of row vectors.
|
|
|
| Form a matrix from a list of column vectors.
|
|
|
| Create a new matrix from a row vector.
|
|
|
| Create a new matrix from a column vector.
|
|
|
| Same as newMatrix but indices are not range-checked.
|
|
| Reading and writing matrixelements
|
|
| module BLAS.Tensor.Read |
|
| module BLAS.Tensor.Write |
|
| Special matrices
|
|
|
| Create a zero matrix of the specified shape.
|
|
|
|
|
| Create a constant matrix of the specified shape.
|
|
|
|
|
| Create a new matrix of the given shape with ones along the diagonal,
and zeros everywhere else.
|
|
|
| Set diagonal elements to one and all other elements to zero.
|
|
| Matrix views
|
|
|
| submatrixView a ij mn returns a view of the submatrix of a with element (0,0)
being element ij in a, and having shape mn.
|
|
|
|
|
|
|
| Same as submatrixView but indices are not range-checked.
|
|
|
|
|
|
| Row and Column views
|
|
|
| Get a list of vector views of the rows of the matrix.
|
|
|
| Get a list of vector views of the columns of the matrix.
|
|
|
| Get a vector view of the given row in a matrix.
|
|
|
| Get a vector view of the given column in a matrix.
|
|
|
| Get a vector view of the given diagonal in a matrix.
|
|
|
|
|
|
|
|
| Getting rows and columns
|
|
|
| Get the given diagonal in a matrix. Negative indices correspond
to sub-diagonals.
|
|
|
| Same as getDiag but not range-checked.
|
|
| Copying matrices
|
|
|
|
|
| copyMatrix dst src replaces the values in dst with those in
source. The operands must be the same shape.
|
|
|
| swapMatrix x y swaps the values stored in two matrices.
|
|
|
|
|
|
| Swapping rows and columns
|
|
|
|
|
|
|
|
|
|
| Matrix operations
|
|
| Unsary
|
|
|
| Get a new matrix with elements with the conjugates of the elements
of the given matrix.
|
|
|
| Get a new matrix by scaling the elements of another matrix
by a given value.
|
|
|
| Get a new matrix by shifting the elements of another matrix
by a given value.
|
|
| Binary
|
|
|
| getAddMatrix a b creates a new matrix equal to the sum a+b. The
operands must have the same shape.
|
|
|
| getSubMatrix a b creates a new matrix equal to the difference a-b. The
operands must have the same shape.
|
|
|
| getMulMatrix a b creates a new matrix equal to the elementwise product
a*b. The operands must have the same shape.
|
|
|
| getDivMatrix a b creates a new matrix equal to the elementwise ratio
a/b. The operands must have the same shape.
|
|
|
|
|
|
|
|
|
|
|
|
| Unsafe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| module BLAS.Matrix.Mutable |
|
| Low-level functions
|
|
|
|
|
|
|
|
| Produced by Haddock version 2.3.0 |