THGreedy.c 454 Bytes
Newer Older
rusty1s's avatar
rusty1s committed
1
2
3
4
#ifndef TH_GENERIC_FILE
#define TH_GENERIC_FILE "generic/THGreedy.c"
#else

5
void THGreedy_(THLongTensor *cluster, THLongTensor *row, THLongTensor *col, THTensor *weight) {
rusty1s's avatar
rusty1s committed
6
  real *weightData = THTensor_getData(weight);
rusty1s's avatar
rusty1s committed
7
  real maxWeight = 0, tmpWeight;
8
9
10
11
12
  TH_GREEDY_CLUSTER(cluster, row, col,
    tmpWeight = weightData[idx];
    if (tmpWeight > maxWeight) {
      pairValue = colValue;
      maxWeight = tmpWeight;
rusty1s's avatar
rusty1s committed
13
14
15
16
17
    }
  )
}

#endif  // TH_GENERIC_FILE