Commit 28cfe091 authored by Alexandre Delanoë's avatar Alexandre Delanoë

fix tests + dep + FIXME

parent 7664c2ef
...@@ -35,7 +35,7 @@ import Data.Proxy (Proxy(Proxy)) ...@@ -35,7 +35,7 @@ import Data.Proxy (Proxy(Proxy))
import Data.Reflection import Data.Reflection
import Eigen.Internal (CTriplet(..), Elem(..), toC, fromC, C(..), natToInt, Row(..), Col(..)) import Eigen.Internal (CTriplet(..), Elem(..), toC, fromC, C(..), natToInt, Row(..), Col(..))
import Eigen.Matrix (sum, unsafeCoeff) import Eigen.Matrix (sum, unsafeCoeff)
import Eigen.SparseMatrix (SparseMatrix, SparseMatrixXd, (!), toMatrix, _unsafeCoeff) import Eigen.SparseMatrix (SparseMatrix, SparseMatrixXd, (!), toMatrix)
import GHC.TypeLits (KnownNat, Nat, SomeNat(SomeNat), type(+), natVal, sameNat, someNatVal) import GHC.TypeLits (KnownNat, Nat, SomeNat(SomeNat), type(+), natVal, sameNat, someNatVal)
import Graph.FGL import Graph.FGL
import Prelude (String, readLn) import Prelude (String, readLn)
...@@ -117,6 +117,7 @@ data Clustering a = Clustering { parts :: Dict (Set a) ...@@ -117,6 +117,7 @@ data Clustering a = Clustering { parts :: Dict (Set a)
, index :: Dict Int , index :: Dict Int
, score :: Double , score :: Double
} }
deriving (Show)
-- TODO -- TODO
data ClusteringMode = Part | Over | Both data ClusteringMode = Part | Over | Both
...@@ -232,7 +233,8 @@ edges_confluence l fg am tm = SMatrix.toList matconf ...@@ -232,7 +233,8 @@ edges_confluence l fg am tm = SMatrix.toList matconf
matconf = SMatrix.imap (\x y v -> let am' = SMatrix.add am (SMatrix.fromList [(x,y,-v)]) matconf = SMatrix.imap (\x y v -> let am' = SMatrix.add am (SMatrix.fromList [(x,y,-v)])
v' = doProx l (sparseVectorFromList (Proxy @n) [(1,y,1)]) am' v' = doProx l (sparseVectorFromList (Proxy @n) [(1,y,1)]) am'
prox_y_x_length = _unsafeCoeff x 1 v' prox_y_x_length = SMatrix.coeff (Row x) (Col 1) v' -- FIXME
-- prox_y_x_length = _unsafeCoeff x 1 v'
prox_y_x_infini = ((VS.!) degs x - 1) / (sumdeg - 2) prox_y_x_infini = ((VS.!) degs x - 1) / (sumdeg - 2)
in (prox_y_x_length - prox_y_x_length) in (prox_y_x_length - prox_y_x_length)
...@@ -313,10 +315,10 @@ make_clust_over = undefined ...@@ -313,10 +315,10 @@ make_clust_over = undefined
--------------------------------------------------------------- ---------------------------------------------------------------
clusteringOptim :: forall n a b. KnownNat n clusteringOptim :: forall n a b. KnownNat n
=> Length => Length
-> FiniteGraph n a b
-> Similarity -> Similarity
-> FiniteGraph n a b
-> Clustering Node -> Clustering Node
clusteringOptim l fg@(FiniteGraph g) s = make_clust_part sorted_edges matq clusteringOptim l s fg@(FiniteGraph g) = make_clust_part sorted_edges matq
where where
adj = adjacent fg True adj = adjacent fg True
tra = transition adj tra = transition adj
......
...@@ -32,7 +32,7 @@ allow-newer: true ...@@ -32,7 +32,7 @@ allow-newer: true
# - wai # - wai
packages: packages:
- . - .
- '../eigen/' #- '../eigen/'
# Dependency packages to be pulled from upstream that are not in the resolver. # Dependency packages to be pulled from upstream that are not in the resolver.
# These entries can reference officially published versions as well as # These entries can reference officially published versions as well as
# forks / in-progress versions pinned to a git hash. For example: # forks / in-progress versions pinned to a git hash. For example:
...@@ -45,7 +45,7 @@ extra-deps: ...@@ -45,7 +45,7 @@ extra-deps:
- git: https://gitlab.iscpif.fr/anoe/accelerate-utility.git - git: https://gitlab.iscpif.fr/anoe/accelerate-utility.git
commit: 83ada76e78ac10d9559af8ed6bd4064ec81308e4 commit: 83ada76e78ac10d9559af8ed6bd4064ec81308e4
- accelerate-arithmetic-1.0.0.1@sha256:555639232aa5cad411e89247b27871d09352b987a754230a288c690b6de6d888,2096 - accelerate-arithmetic-1.0.0.1@sha256:555639232aa5cad411e89247b27871d09352b987a754230a288c690b6de6d888,2096
# - eigen-3.3.7.0@sha256:7c24a86426b238e02ba0ac2179cc44997518b443a13828ed7a791fe49a6dffa5,82060 - eigen-3.3.7.0@sha256:7c24a86426b238e02ba0ac2179cc44997518b443a13828ed7a791fe49a6dffa5,82060
# Override default flag values for local packages and extra-deps # Override default flag values for local packages and extra-deps
......
...@@ -28,4 +28,4 @@ main_test = do ...@@ -28,4 +28,4 @@ main_test = do
a :: KnownNat n => AdjacencyMatrix n a :: KnownNat n => AdjacencyMatrix n
a = adjacent g' False a = adjacent g' False
-} -}
print $ withG g Prelude.show -- a -- $ SMatrix.getRows a print $ withG g (Prelude.show . (clusteringOptim 3 Conf))
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