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

[FIX/FEAT] Order 2 improvement

parent fd82ee9c
...@@ -204,7 +204,7 @@ logDistributional' n m' = trace ("logDistributional'") result ...@@ -204,7 +204,7 @@ logDistributional' n m' = trace ("logDistributional'") result
-- m_{i,j} = 0 if n_{i,j} = 0 or i = j, -- m_{i,j} = 0 if n_{i,j} = 0 or i = j,
-- m_{i,j} = log(to * n_{i,j} / s_{i,j}) otherwise. -- m_{i,j} = log(to * n_{i,j} / s_{i,j}) otherwise.
mi = (.*) (matrixEye n) mi = (.*) (matrixEye n)
(map (lift1 (\x -> cond (x == 0) 0 (log (x * to)))) ((./) m ss)) (map (lift1 (\x -> cond (x == 0) 0 (log (1 + x * to)))) ((./) m ss))
-- mi_nnz :: Int -- mi_nnz :: Int
-- mi_nnz = flip indexArray Z . run $ -- mi_nnz = flip indexArray Z . run $
-- foldAll (+) 0 $ map (\a -> ifThenElse (abs a < 10^(-6 :: Exp Int)) 0 1) mi -- foldAll (+) 0 $ map (\a -> ifThenElse (abs a < 10^(-6 :: Exp Int)) 0 1) mi
......
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