Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
torch-cluster
Commits
cb1b4b1a
Commit
cb1b4b1a
authored
Mar 25, 2018
by
rusty1s
Browse files
added comments
parent
4056bf63
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
torch_cluster/src/cpu.c
torch_cluster/src/cpu.c
+10
-5
No files found.
torch_cluster/src/cpu.c
View file @
cb1b4b1a
...
@@ -8,20 +8,23 @@ void cluster_random(THLongTensor *output, THLongTensor *row, THLongTensor *col,
...
@@ -8,20 +8,23 @@ void cluster_random(THLongTensor *output, THLongTensor *row, THLongTensor *col,
int64_t
*
col_data
=
col
->
storage
->
data
+
col
->
storageOffset
;
int64_t
*
col_data
=
col
->
storage
->
data
+
col
->
storageOffset
;
int64_t
*
degree_data
=
degree
->
storage
->
data
+
degree
->
storageOffset
;
int64_t
*
degree_data
=
degree
->
storage
->
data
+
degree
->
storageOffset
;
int64_t
e
=
0
,
row_value
,
col_value
,
i
;
int64_t
e
=
0
,
row_value
,
col_value
,
i
,
value
;
while
(
e
<
THLongTensor_nElement
(
row
))
{
while
(
e
<
THLongTensor_nElement
(
row
))
{
row_value
=
row_data
[
e
];
row_value
=
row_data
[
e
];
if
(
output_data
[
row_value
]
<
0
)
{
// Node is unmatched.
if
(
output_data
[
row_value
]
<
0
)
{
// Node is unmatched.
// Find next unmatched neighbor.
// Find next unmatched neighbor.
col_value
=
-
1
;
col_value
=
-
1
;
for
(
i
=
0
;
i
<
degree_data
[
row_value
];
i
++
)
{
for
(
i
=
0
;
i
<
degree_data
[
row_value
];
i
++
)
{
col_value
=
col_data
[
e
+
i
];
value
=
col_data
[
e
+
i
];
if
(
output_data
[
col_value
]
<
0
)
break
;
// Neighbor found.
if
(
output_data
[
value
]
<
0
)
{
// Neighbor found. Save and abort.
else
col_value
=
-
1
;
col_value
=
value
;
break
;
}
}
}
// Set
output
.
// Set
cluster output for new matched nodes (one or two)
.
if
(
col_value
<
0
)
{
if
(
col_value
<
0
)
{
output_data
[
row_value
]
=
row_value
;
output_data
[
row_value
]
=
row_value
;
}
}
...
@@ -31,6 +34,8 @@ void cluster_random(THLongTensor *output, THLongTensor *row, THLongTensor *col,
...
@@ -31,6 +34,8 @@ void cluster_random(THLongTensor *output, THLongTensor *row, THLongTensor *col,
output_data
[
col_value
]
=
i
;
output_data
[
col_value
]
=
i
;
}
}
}
}
// Jump to next row.
e
+=
degree_data
[
row_value
];
e
+=
degree_data
[
row_value
];
}
}
}
}
...
...
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