Copyright | (c) Noah Martin Williams 2024 |
---|---|
License | BSD-3-Clause |
Maintainer | noahmartinwilliams@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
This module contains functions for doing matrix math such as addition, subtraction, and multiplication for both plain and dependently typed matrices.
Synopsis
- mMul :: Num e => Acc (Matrix e) -> Acc (Matrix e) -> Acc (Matrix e)
- matMul :: Num e => AccMat e a b -> AccMat e b c -> AccMat e a c
- identMat :: Exp Int -> Acc (Matrix Int)
- data Mat e a b where
- data AccMat e a b where
- matTransp :: AccMat e a b -> AccMat e b a
- matAdd :: Num e => AccMat e a b -> AccMat e a b -> AccMat e a b
- mAdd :: Num e => Acc (Matrix e) -> Acc (Matrix e) -> Acc (Matrix e)
- mSub :: Num e => Acc (Matrix e) -> Acc (Matrix e) -> Acc (Matrix e)
- matSub :: Num e => AccMat e a b -> AccMat e a b -> AccMat e a b
- useMat :: Mat e a b -> AccMat e a b
- matScale :: Num e => Exp e -> AccMat e a b -> AccMat e a b
Documentation
mMul :: Num e => Acc (Matrix e) -> Acc (Matrix e) -> Acc (Matrix e) Source #
Multiply two matrices together without dependent types.
matMul :: Num e => AccMat e a b -> AccMat e b c -> AccMat e a c Source #
Multiply two dependently typed matrices together. |For example:
@ data A = A data B = B data C = C
let m1 = AccMat (use (fromList (Z:.10:.12) [0..] :: Matrix Int)) A B
let m2 = AccMat (use (fromList (Z:.12:.13) [0..] :: Matrix Int)) B C
let mResult = m1 matMul
m2
identMat :: Exp Int -> Acc (Matrix Int) Source #
Creat an identity matrix with the dimension provided
Dependent type for plain matrices.
matAdd :: Num e => AccMat e a b -> AccMat e a b -> AccMat e a b Source #
Add two dependently typed matrices.
mAdd :: Num e => Acc (Matrix e) -> Acc (Matrix e) -> Acc (Matrix e) Source #
Add two matrices without dependent types.
mSub :: Num e => Acc (Matrix e) -> Acc (Matrix e) -> Acc (Matrix e) Source #
Subtract one matrix from another without dependent types.
matSub :: Num e => AccMat e a b -> AccMat e a b -> AccMat e a b Source #
Subtract one dependently typed matrix from another.