summaryrefslogtreecommitdiff
path: root/ot/lp
diff options
context:
space:
mode:
authorarolet <antoine.rolet@gmail.com>2017-07-14 15:38:20 +0900
committerarolet <antoine.rolet@gmail.com>2017-07-14 15:38:20 +0900
commit1fcb7d0ffbc5b00ed20b5ded2e7f1001dc914d6e (patch)
tree53020eca36a72c894cc63c67933023dbe2c670a3 /ot/lp
parentd59e91450272c78dd0fdd3c6bd9bf48776f10070 (diff)
Removed some references to node_id_type
node_id_type is really always int, it makes code hard to read though. In lemon they needed the typedef because they have more complicated graphs.
Diffstat (limited to 'ot/lp')
-rw-r--r--ot/lp/EMD_wrapper.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/ot/lp/EMD_wrapper.cpp b/ot/lp/EMD_wrapper.cpp
index d97ba46..d719c6e 100644
--- a/ot/lp/EMD_wrapper.cpp
+++ b/ot/lp/EMD_wrapper.cpp
@@ -25,14 +25,14 @@ void EMD_wrap(int n1, int n2, double *X, double *Y,
// Get the number of non zero coordinates for r and c
n=0;
- for (node_id_type i=0; i<n1; i++) {
+ for (int i=0; i<n1; i++) {
double val=*(X+i);
if (val>0) {
n++;
}
}
m=0;
- for (node_id_type i=0; i<n2; i++) {
+ for (int i=0; i<n2; i++) {
double val=*(Y+i);
if (val>0) {
m++;
@@ -49,10 +49,10 @@ void EMD_wrap(int n1, int n2, double *X, double *Y,
// Set supply and demand, don't account for 0 values (faster)
cur=0;
- for (node_id_type i=0; i<n1; i++) {
+ for (int i=0; i<n1; i++) {
double val=*(X+i);
if (val>0) {
- weights1[ di.nodeFromId(cur) ] = val;
+ weights1[ cur ] = val;
indI[cur++]=i;
}
}
@@ -60,10 +60,10 @@ void EMD_wrap(int n1, int n2, double *X, double *Y,
// Demand is actually negative supply...
cur=0;
- for (node_id_type i=0; i<n2; i++) {
+ for (int i=0; i<n2; i++) {
double val=*(Y+i);
if (val>0) {
- weights2[ di.nodeFromId(cur) ] = -val;
+ weights2[ cur ] = -val;
indJ[cur++]=i;
}
}
@@ -72,8 +72,8 @@ void EMD_wrap(int n1, int n2, double *X, double *Y,
net.supplyMap(&weights1[0], n, &weights2[0], m);
// Set the cost of each edge
- for (node_id_type i=0; i<n; i++) {
- for (node_id_type j=0; j<m; j++) {
+ for (int i=0; i<n; i++) {
+ for (int j=0; j<m; j++) {
double val=*(D+indI[i]*n2+indJ[j]);
net.setCost(di.arcFromId(i*m+j), val);
}