matrix-accelerate-0.1.0.0: An accelerate library that adds dependently typed matrices.
Copyright(c) Noah Martin Williams 2024
LicenseBSD-3-Clause
Maintainernoahmartinwilliams@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Data.Array.Accelerate.Matrix

Description

This module contains functions for doing matrix math such as addition, subtraction, and multiplication for both plain and dependently typed matrices.

Synopsis

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

data Mat e a b where Source #

Dependent type for plain matrices.

Constructors

Mat :: (Elt e, Num e) => Matrix e -> a -> b -> Mat e a b

Dependently typed plain matrix for passing to compiled functions.

data AccMat e a b where Source #

Dependent type for accelerate matrices.

Constructors

AccMat :: (Elt e, Num e) => Acc (Matrix e) -> a -> b -> AccMat e a b

Dependently typed accelerated matrix which forces two types to line up.

matTransp :: AccMat e a b -> AccMat e b a Source #

Transpose a dependently typed matrix.

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.

useMat :: Mat e a b -> AccMat e a b Source #

Change the type of a dependently typed matrix from AccMat to Mat.

matScale :: Num e => Exp e -> AccMat e a b -> AccMat e a b Source #

Scale a dependently typed matrix.