| 1 | #ifndef SYNCLUST_NEIGHBORS_H |
| 2 | #define SYNCLUST_NEIGHBORS_H |
| 3 | |
| 4 | #include "sources/utils/boolean.h" |
| 5 | #include <cgds/List.h> |
| 6 | |
| 7 | // evaluate distance between M[i,] and M[ii,] |
| 8 | double getDistance( |
| 9 | double* M, |
| 10 | int i, |
| 11 | int ii, |
| 12 | int ncol, |
| 13 | double alpha, |
| 14 | bool simpleDists |
| 15 | ); |
| 16 | |
| 17 | // symmetrize neighborhoods lists (augmenting or reducing) |
| 18 | void symmetrizeNeighbors( |
| 19 | List** neighborhoods, |
| 20 | int nrow, |
| 21 | int gmode |
| 22 | ); |
| 23 | |
| 24 | // restrain neighborhoods: choose one per quadrant (for convex optimization) |
| 25 | void restrainToQuadrants( |
| 26 | List** neighborhoods, |
| 27 | int nrow, |
| 28 | int ncol, |
| 29 | double* M |
| 30 | ); |
| 31 | |
| 32 | // structure to store a neighbor index and the distance to this neighbor |
| 33 | typedef struct IndDist { |
| 34 | int index; |
| 35 | double distance; |
| 36 | } IndDist; |
| 37 | |
| 38 | // Function to obtain neighborhoods. |
| 39 | // NOTE: alpha = weight parameter to compute distances; -1 means "adaptive" |
| 40 | List** getNeighbors_core( |
| 41 | double* M, |
| 42 | double alpha, |
| 43 | int k, |
| 44 | int gmode, |
| 45 | bool simpleDists, |
| 46 | int nrow, |
| 47 | int ncol |
| 48 | ); |
| 49 | |
| 50 | #endif |