deploy/DeepStream/src/Lapjv.cpp
/** Augment for a dense cost matrix.
 */
Augment for a dense cost matrix.
Augment for a dense cost matrix .
int_t _ca_dense(
        const uint_t n, cost_t *cost[],
        const uint_t n_free_rows,
        int_t *free_rows, int_t *x, int_t *y, cost_t *v) {
    int_t *pred;
    NEW(pred, int_t, n);
    for (int_t *pfree_i = free_rows; pfree_i < free_rows + n_free_rows; pfree_i++) {
        int_t  i = -1, j;
        uint_t k = 0;
        PRINTF("looking at free_i=%d\n", *pfree_i);
        j = find_path_dense(n, cost, *pfree_i, y, v, pred);
        ASSERT(j >= 0);
        ASSERT(j < n);
        while (i != *pfree_i) {
            PRINTF("augment %d\n", j);
            PRINT_INDEX_ARRAY(pred, n);
            i = pred[j];
            PRINTF("y[%d]=%d -> %d\n", j, y[j], i);
            y[j] = i;
            PRINT_INDEX_ARRAY(x, n);
            SWAP_INDICES(j, x[i]);
            k++;
            if (k >= n) {
                ASSERT(FALSE);
            }
        }
    }
    FREE(pred);
    return 0;
}
int_t _ca_dense ( const uint_t n , cost_t * cost [ ] , const uint_t n_free_rows , int_t * free_rows , int_t * x , int_t * y , cost_t * v ) { int_t * pred ; NEW ( pred , int_t , n ) ; for ( int_t * pfree_i = free_rows ; pfree_i < free_rows + n_free_rows ; pfree_i ++ ) { int_t i = -1 , j ; uint_t k = 0 ; PRINTF ( " \n " , * pfree_i ) ; j = find_path_dense ( n , cost , * pfree_i , y , v , pred ) ; ASSERT ( j >= 0 ) ; ASSERT ( j < n ) ; while ( i != * pfree_i ) { PRINTF ( " \n " , j ) ; PRINT_INDEX_ARRAY ( pred , n ) ; i = pred [ j ] ; PRINTF ( " \n " , j , y [ j ] , i ) ; y [ j ] = i ; PRINT_INDEX_ARRAY ( x , n ) ; SWAP_INDICES ( j , x [ i ] ) ; k ++ ; if ( k >= n ) { ASSERT ( FALSE ) ; } } } FREE ( pred ) ; return 0 ; }
Augment for a dense cost matrix.
Augment for a dense cost matrix .