Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
145
Issues
145
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
30757cfc
Unverified
Commit
30757cfc
authored
May 30, 2018
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add map2mat
parent
8d237e3c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
Pipeline.hs
src/Gargantext/Pipeline.hs
+0
-4
Index.hs
src/Gargantext/Viz/Graph/Index.hs
+8
-2
No files found.
src/Gargantext/Pipeline.hs
View file @
30757cfc
...
@@ -47,7 +47,3 @@ pipeline pth = do
...
@@ -47,7 +47,3 @@ pipeline pth = do
pure
$
map'
int2double
myCooc
pure
$
map'
int2double
myCooc
-- Matrix -> Graph
-- Matrix -> Graph
src/Gargantext/Viz/Graph/Index.hs
View file @
30757cfc
...
@@ -31,7 +31,7 @@ import qualified Data.Array.Accelerate.Interpreter as A
...
@@ -31,7 +31,7 @@ import qualified Data.Array.Accelerate.Interpreter as A
import
Data.Array.Accelerate
(
Matrix
,
Elt
,
Shape
,
(
:.
)(
..
),
Z
(
..
))
import
Data.Array.Accelerate
(
Matrix
,
Elt
,
Shape
,
(
:.
)(
..
),
Z
(
..
))
import
qualified
Data.Vector.Unboxed
as
DVU
import
qualified
Data.Vector.Unboxed
as
DVU
import
Data.
List
(
concat
)
import
Data.
Maybe
(
fromMaybe
)
import
Data.Set
(
Set
)
import
Data.Set
(
Set
)
import
qualified
Data.Set
as
S
import
qualified
Data.Set
as
S
...
@@ -75,7 +75,13 @@ cooc2mat ti m = A.fromFunction shape (\(Z :. x :. y) -> lookup' x y)
...
@@ -75,7 +75,13 @@ cooc2mat ti m = A.fromFunction shape (\(Z :. x :. y) -> lookup' x y)
where
where
shape
=
(
A
.
Z
A
.:.
n
A
.:.
n
)
shape
=
(
A
.
Z
A
.:.
n
A
.:.
n
)
n
=
M
.
size
ti
n
=
M
.
size
ti
lookup'
x
y
=
maybe
0
identity
(
M
.
lookup
(
x
,
y
)
(
toIndex
ti
m
))
idx
=
toIndex
ti
m
-- it is important to make sure that toIndex is ran only once.
lookup'
x
y
=
fromMaybe
0
$
M
.
lookup
(
x
,
y
)
idx
map2mat
::
Elt
a
=>
a
->
Int
->
Map
(
Index
,
Index
)
a
->
Matrix
a
map2mat
def
n
m
=
A
.
fromFunction
shape
(
\
(
Z
:.
x
:.
y
)
->
fromMaybe
def
$
M
.
lookup
(
x
,
y
)
m
)
where
shape
=
(
Z
:.
n
:.
n
)
-- TODO rename mat2map
-- TODO rename mat2map
mat2cooc
::
(
Elt
a
,
Shape
(
Z
:.
Index
))
=>
mat2cooc
::
(
Elt
a
,
Shape
(
Z
:.
Index
))
=>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment