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

[FEAT] Distributional, before last step (WIP)

parent e741619e
......@@ -57,17 +57,22 @@ distributional'' :: ( P.Num (Exp a)
, Elt a
)
=> Matrix a -> Matrix a
distributional'' m' = run $ mi
distributional'' m' = run $ mi_d_mi
where
m = use m'
n = dim m'
d_m = (.*) (matrixIdentity n) m
d_m = (.*) (matrixIdentity n) m
o_d_m = (#*#) (matrixOne n) d_m
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
-- | Test perfermance with this matrix
-- TODO : add this in a benchmark folder
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)
-> 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 (-)
(.+) :: ( 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)
......@@ -364,11 +385,11 @@ p_ m = zipWith (/) m (n_ m)
) m
-}
theMatrix' :: Int -> Matrix Double
theMatrix' n = run $ map fromIntegral (use $ theMatrix n)
theMatrixDouble :: Int -> Matrix Double
theMatrixDouble n = run $ map fromIntegral (use $ theMatrixInt n)
theMatrix :: Int -> Matrix Int
theMatrix n = matrix n (dataMatrix n)
theMatrixInt :: Int -> Matrix Int
theMatrixInt n = matrix n (dataMatrix n)
where
dataMatrix :: Int -> [Int]
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