[graphql] remove ethercalc endpoint
[gargantext.git] / src / Gargantext / Core / Methods / Distances.hs
index 152bfdb667c8e6c1bfc41bb32800ed41758e4c4b..a42d76eec8cfa8c40c5d8a74d5765c333d31f32e 100644 (file)
@@ -14,30 +14,32 @@ Portability : POSIX
 module Gargantext.Core.Methods.Distances
   where
 
+import Debug.Trace (trace)
 import Data.Aeson
 import Data.Array.Accelerate (Matrix)
 import Data.Swagger
 import GHC.Generics (Generic)
-import Gargantext.Prelude (Ord, Eq, Int, Double)
-import Gargantext.Prelude (Show)
 import Gargantext.Core.Methods.Distances.Accelerate.Conditional (measureConditional)
-import Gargantext.Core.Methods.Distances.Accelerate.Distributional (distributional)
+import Gargantext.Core.Methods.Distances.Accelerate.Distributional (logDistributional)
+import Gargantext.Prelude (Ord, Eq, Int, Double, Show, ($), show)
 import Prelude (Enum, Bounded, minBound, maxBound)
 import Test.QuickCheck (elements)
 import Test.QuickCheck.Arbitrary
 
 ------------------------------------------------------------------------
 data Distance = Conditional | Distributional
-  deriving (Show)
+  deriving (Show, Eq)
 
 measure :: Distance -> Matrix Int -> Matrix Double
-measure Conditional    = measureConditional
-measure Distributional = distributional
-------------------------------------------------------------------------
+measure Conditional    x = measureConditional x
+measure Distributional x = trace (show y) $ y
+  where
+    y = logDistributional x
 
-withMetric :: GraphMetric -> Matrix Int -> Matrix Double
-withMetric Order1 = measureConditional
-withMetric Order2 = distributional
+------------------------------------------------------------------------
+withMetric :: GraphMetric -> Distance
+withMetric Order1 = Conditional
+withMetric Order2 = Distributional
 
 ------------------------------------------------------------------------
 data GraphMetric = Order1 | Order2
@@ -50,3 +52,6 @@ instance Arbitrary GraphMetric where
   arbitrary = elements [ minBound .. maxBound ]
 
 ------------------------------------------------------------------------
+
+
+