Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
A simple HxW matrix backed by a vector, mainly for binary exponention.
The matrix is a left semigroup action: \(m_2 (m_1 v) = (m_2 \circ m_1) v\).
Since: 1.1.0.0
Synopsis
- data Matrix a = Matrix {}
- new :: (HasCallStack, Unbox a) => Int -> Int -> Vector a -> Matrix a
- zero :: (Unbox a, Num a) => Int -> Matrix a
- ident :: (Unbox a, Num a) => Int -> Matrix a
- diag :: (Unbox a, Num a) => Int -> Vector a -> Matrix a
- map :: (Unbox a, Unbox b) => (a -> b) -> Matrix a -> Matrix b
- mulToCol :: (Num a, Unbox a) => Matrix a -> Col a -> Col a
- mul :: (Num e, Unbox e) => Matrix e -> Matrix e -> Matrix e
- mulMod :: Int -> Matrix Int -> Matrix Int -> Matrix Int
- mulMint :: forall a. KnownNat a => Matrix (ModInt a) -> Matrix (ModInt a) -> Matrix (ModInt a)
- pow :: Int -> Matrix Int -> Matrix Int
- powMod :: Int -> Int -> Matrix Int -> Matrix Int
- powMint :: forall m. KnownNat m => Int -> Matrix (ModInt m) -> Matrix (ModInt m)
Matrix
A simple HxW matrix backed by a vector, mainly for binary exponention.
The matrix is a left semigroup action: \(m_2 (m_1 v) = (m_2 \circ m_1) v\).
Since: 1.1.0.0
Constructors
new :: (HasCallStack, Unbox a) => Int -> Int -> Vector a -> Matrix a Source #
\(O(hw)\) Creates an HxW matrix.
Since: 1.1.0.0
zero :: (Unbox a, Num a) => Int -> Matrix a Source #
\(O(n^2)\) Creates an NxN zero matrix.
Since: 1.1.0.0
ident :: (Unbox a, Num a) => Int -> Matrix a Source #
\(O(n^2)\) Creates an NxN identity matrix.
Since: 1.1.0.0
diag :: (Unbox a, Num a) => Int -> Vector a -> Matrix a Source #
\(O(n^2)\) Creates an NxN diagonal matrix.
Since: 1.1.0.0
Mapping
map :: (Unbox a, Unbox b) => (a -> b) -> Matrix a -> Matrix b Source #
\(O(n^2)\) Maps the Matrix
.
Since: 1.1.0.0
Multiplications
mulToCol :: (Num a, Unbox a) => Matrix a -> Col a -> Col a Source #
\(O(hw)\) Multiplies HxW matrix to a Hx1 column vector.
Since: 1.1.0.0
mul :: (Num e, Unbox e) => Matrix e -> Matrix e -> Matrix e Source #
\(O(h_1 K w_2)\) Multiplies H1xK matrix to a KxW2 matrix.
Since: 1.1.0.0
mulMod :: Int -> Matrix Int -> Matrix Int -> Matrix Int Source #
\(O(h_1 w_2 K)\) Multiplies H1xK matrix to a KxW2 matrix, taking the mod.
Since: 1.1.0.0
mulMint :: forall a. KnownNat a => Matrix (ModInt a) -> Matrix (ModInt a) -> Matrix (ModInt a) Source #