Commit e510b73c authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FEAT] Distributional, before last step (WIP)

parent e741619e
...@@ -57,7 +57,7 @@ distributional'' :: ( P.Num (Exp a) ...@@ -57,7 +57,7 @@ distributional'' :: ( P.Num (Exp a)
, Elt a , Elt a
) )
=> Matrix a -> Matrix a => Matrix a -> Matrix a
distributional'' m' = run $ mi distributional'' m' = run $ mi_d_mi
where where
m = use m' m = use m'
n = dim m' n = dim m'
...@@ -67,8 +67,13 @@ distributional'' m' = run $ mi ...@@ -67,8 +67,13 @@ distributional'' m' = run $ mi
o_d_m = (#*#) (matrixOne n) d_m o_d_m = (#*#) (matrixOne n) d_m
d_m_o = (#*#) d_m (matrixOne n) d_m_o = (#*#) d_m (matrixOne n)
mi = (.*) ((./) m o_d_m) ((./) m o_d_m) mi = (.*) ((./) m o_d_m) ((./) m o_d_m)
d_mi = (.*) (matrixIdentity n) mi
mi_d_mi = (.-) mi d_mi
...@@ -151,6 +156,6 @@ rIJ n m = matMiniMax $ divide a b ...@@ -151,6 +156,6 @@ rIJ n m = matMiniMax $ divide a b
-- | Test perfermance with this matrix -- | Test perfermance with this matrix
-- TODO : add this in a benchmark folder -- TODO : add this in a benchmark folder
distriTest :: Int -> Matrix Double distriTest :: Int -> Matrix Double
distriTest n = distributional (theMatrix n) distriTest n = distributional (theMatrixInt n)
...@@ -75,6 +75,27 @@ import Data.Array.Accelerate.LinearAlgebra hiding (Matrix, transpose, Vector) ...@@ -75,6 +75,27 @@ import Data.Array.Accelerate.LinearAlgebra hiding (Matrix, transpose, Vector)
-> Acc (Array ((ix :. Int) :. Int) a) -> Acc (Array ((ix :. Int) :. Int) a)
(./) = zipWith (/) (./) = zipWith (/)
(.-) :: ( Shape ix
, Slice ix
, Elt a
, P.Num (Exp a)
, P.Fractional (Exp a)
)
=> Acc (Array ((ix :. Int) :. Int) a)
-> Acc (Array ((ix :. Int) :. Int) a)
-> Acc (Array ((ix :. Int) :. Int) a)
(.-) = zipWith (-)
(.+) :: ( Shape ix
, Slice ix
, Elt a
, P.Num (Exp a)
, P.Fractional (Exp a)
)
=> Acc (Array ((ix :. Int) :. Int) a)
-> Acc (Array ((ix :. Int) :. Int) a)
-> Acc (Array ((ix :. Int) :. Int) a)
(.+) = zipWith (+)
----------------------------------------------------------------------- -----------------------------------------------------------------------
matrixOne :: Num a => Dim -> Acc (Matrix a) matrixOne :: Num a => Dim -> Acc (Matrix a)
...@@ -364,11 +385,11 @@ p_ m = zipWith (/) m (n_ m) ...@@ -364,11 +385,11 @@ p_ m = zipWith (/) m (n_ m)
) m ) m
-} -}
theMatrix' :: Int -> Matrix Double theMatrixDouble :: Int -> Matrix Double
theMatrix' n = run $ map fromIntegral (use $ theMatrix n) theMatrixDouble n = run $ map fromIntegral (use $ theMatrixInt n)
theMatrix :: Int -> Matrix Int theMatrixInt :: Int -> Matrix Int
theMatrix n = matrix n (dataMatrix n) theMatrixInt n = matrix n (dataMatrix n)
where where
dataMatrix :: Int -> [Int] dataMatrix :: Int -> [Int]
dataMatrix x | (P.==) x 2 = [ 1, 1 dataMatrix x | (P.==) x 2 = [ 1, 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment