diff options
Diffstat (limited to 'match/match.c')
| -rw-r--r-- | match/match.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/match/match.c b/match/match.c index 44297d9..551e2f6 100644 --- a/match/match.c +++ b/match/match.c | |||
| @@ -43,7 +43,7 @@ static void step5 (int *ix, float *mdist, col_t *mstar, col_t *nmstar, col_t *mp | |||
| 43 | static void ixoptimal(int *ix, float *mdist, int nrows, int ncols) | 43 | static void ixoptimal(int *ix, float *mdist, int nrows, int ncols) |
| 44 | { | 44 | { |
| 45 | float *mdistTemp, *mdistEnd, *columnEnd, value, minValue; | 45 | float *mdistTemp, *mdistEnd, *columnEnd, value, minValue; |
| 46 | int nelem, dmin, row, col; | 46 | int dmin, row, col; |
| 47 | col_t ccol,crow, mstar[DIM_FINGER],mprime[DIM_FINGER],nmstar[DIM_FINGER]; | 47 | col_t ccol,crow, mstar[DIM_FINGER],mprime[DIM_FINGER],nmstar[DIM_FINGER]; |
| 48 | 48 | ||
| 49 | ccol = crow = 0; | 49 | ccol = crow = 0; |
| @@ -56,8 +56,7 @@ static void ixoptimal(int *ix, float *mdist, int nrows, int ncols) | |||
| 56 | for(row=0; row<nrows; row++) | 56 | for(row=0; row<nrows; row++) |
| 57 | ix[row] = -1; | 57 | ix[row] = -1; |
| 58 | 58 | ||
| 59 | nelem = nrows * ncols; | 59 | mdistEnd = mdist + nrows * ncols; |
| 60 | mdistEnd = mdist + nelem; | ||
| 61 | 60 | ||
| 62 | /* preliminary steps */ | 61 | /* preliminary steps */ |
| 63 | if(nrows <= ncols) { | 62 | if(nrows <= ncols) { |
| @@ -141,7 +140,7 @@ static void ixoptimal(int *ix, float *mdist, int nrows, int ncols) | |||
| 141 | static void step2a(int *ix, float *mdist, col_t *mstar, col_t *nmstar, col_t *mprime, col_t ccol, col_t crow, int nrows, int ncols, int dmin) | 140 | static void step2a(int *ix, float *mdist, col_t *mstar, col_t *nmstar, col_t *mprime, col_t ccol, col_t crow, int nrows, int ncols, int dmin) |
| 142 | { | 141 | { |
| 143 | int col, row; | 142 | int col, row; |
| 144 | 143 | ||
| 145 | /* cover every column containing a starred zero */ | 144 | /* cover every column containing a starred zero */ |
| 146 | for(col=0; col<ncols; col++) { | 145 | for(col=0; col<ncols; col++) { |
| 147 | for(row=col;row<nrows;row++) { | 146 | for(row=col;row<nrows;row++) { |
| @@ -227,11 +226,9 @@ static void step3(int *ix, float *mdist, col_t *mstar, col_t *nmstar, col_t *mpr | |||
| 227 | static void step4(int *ix, float *mdist, col_t *mstar, col_t *nmstar, col_t *mprime, col_t ccol, col_t crow, int nrows, int ncols, int dmin, int row, int col) | 226 | static void step4(int *ix, float *mdist, col_t *mstar, col_t *nmstar, col_t *mprime, col_t ccol, col_t crow, int nrows, int ncols, int dmin, int row, int col) |
| 228 | { | 227 | { |
| 229 | int n, rstar, cstar, primeRow, primeCol; | 228 | int n, rstar, cstar, primeRow, primeCol; |
| 230 | int nelem = nrows*ncols; | ||
| 231 | 229 | ||
| 232 | /* generate temporary copy of mstar */ | 230 | /* generate temporary copy of mstar */ |
| 233 | for(n=0; n<nelem; n++) | 231 | memcpy(nmstar, mstar, sizeof(mstar)); |
| 234 | nmstar[n] = mstar[n]; | ||
| 235 | 232 | ||
| 236 | /* star current zero */ | 233 | /* star current zero */ |
| 237 | SETBIT2(nmstar, row, col); | 234 | SETBIT2(nmstar, row, col); |
| @@ -265,13 +262,9 @@ static void step4(int *ix, float *mdist, col_t *mstar, col_t *nmstar, col_t *mpr | |||
| 265 | 262 | ||
| 266 | /* use temporary copy as new mstar */ | 263 | /* use temporary copy as new mstar */ |
| 267 | /* delete all primes, uncover all rows */ | 264 | /* delete all primes, uncover all rows */ |
| 268 | for(n=0; n<nelem; n++) | 265 | memset(mprime, 0, sizeof(mprime)); |
| 269 | { | 266 | memcpy(mstar, nmstar, sizeof(nmstar)); |
| 270 | mprime[n] = 0; | 267 | crow = 0; |
| 271 | mstar[n] = nmstar[n]; | ||
| 272 | } | ||
| 273 | for(n=0; n<nrows; n++) | ||
| 274 | CLEARBIT(crow, n); | ||
| 275 | 268 | ||
| 276 | /* move to step 2a */ | 269 | /* move to step 2a */ |
| 277 | step2a(ix, mdist, mstar, nmstar, mprime, ccol, crow, nrows, ncols, dmin); | 270 | step2a(ix, mdist, mstar, nmstar, mprime, ccol, crow, nrows, ncols, dmin); |
