summaryrefslogtreecommitdiff
path: root/ot/lp/EMD_wrapper.cpp
diff options
context:
space:
mode:
authorarolet <antoine.rolet@gmail.com>2017-07-14 15:19:55 +0900
committerarolet <antoine.rolet@gmail.com>2017-07-14 15:19:55 +0900
commit0faef7fde7e64705b4f0ed6618a0cfd25319bdc7 (patch)
treecc2b3b8ccf833b3e907b0c97c8caefbe231415d6 /ot/lp/EMD_wrapper.cpp
parentcd9909cff342bb46c4233a0ead348dabebe9efdf (diff)
Removed unused variable max
Probably a legacy normalization variable
Diffstat (limited to 'ot/lp/EMD_wrapper.cpp')
-rw-r--r--ot/lp/EMD_wrapper.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/ot/lp/EMD_wrapper.cpp b/ot/lp/EMD_wrapper.cpp
index 2d448a0..d97ba46 100644
--- a/ot/lp/EMD_wrapper.cpp
+++ b/ot/lp/EMD_wrapper.cpp
@@ -15,10 +15,10 @@
#include "EMD.h"
-void EMD_wrap(int n1,int n2, double *X, double *Y,double *D, double *G, double *cost, int max_iter) {
+void EMD_wrap(int n1, int n2, double *X, double *Y,
+ double *D, double *G, double *cost, int max_iter) {
// beware M and C anre strored in row major C style!!!
int n, m, i,cur;
- double max;
typedef FullBipartiteDigraph Digraph;
DIGRAPH_TYPEDEFS(FullBipartiteDigraph);
@@ -39,7 +39,6 @@ void EMD_wrap(int n1,int n2, double *X, double *Y,double *D, double *G, double *
}
}
-
// Define the graph
std::vector<int> indI(n), indJ(m);
@@ -49,28 +48,23 @@ void EMD_wrap(int n1,int n2, double *X, double *Y,double *D, double *G, double *
// Set supply and demand, don't account for 0 values (faster)
- max=0;
cur=0;
for (node_id_type i=0; i<n1; i++) {
double val=*(X+i);
if (val>0) {
weights1[ di.nodeFromId(cur) ] = val;
- max+=val;
indI[cur++]=i;
}
}
// Demand is actually negative supply...
- max=0;
cur=0;
for (node_id_type i=0; i<n2; i++) {
double val=*(Y+i);
if (val>0) {
weights2[ di.nodeFromId(cur) ] = -val;
indJ[cur++]=i;
-
- max-=val;
}
}
@@ -78,14 +72,10 @@ void EMD_wrap(int n1,int n2, double *X, double *Y,double *D, double *G, double *
net.supplyMap(&weights1[0], n, &weights2[0], m);
// Set the cost of each edge
- max=0;
for (node_id_type i=0; i<n; i++) {
for (node_id_type j=0; j<m; j++) {
double val=*(D+indI[i]*n2+indJ[j]);
net.setCost(di.arcFromId(i*m+j), val);
- if (val>max) {
- max=val;
- }
}
}