mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-13 20:26:03 +08:00
Fix warning and replace min/max macros by calls to mini/maxi
This commit is contained in:
parent
e80ed948e1
commit
2c3224924b
@ -98,9 +98,6 @@ namespace internal {
|
|||||||
/* === Definitions ========================================================== */
|
/* === Definitions ========================================================== */
|
||||||
/* ========================================================================== */
|
/* ========================================================================== */
|
||||||
|
|
||||||
#define COLAMD_MAX(a,b) (((a) > (b)) ? (a) : (b))
|
|
||||||
#define COLAMD_MIN(a,b) (((a) < (b)) ? (a) : (b))
|
|
||||||
|
|
||||||
#define ONES_COMPLEMENT(r) (-(r)-1)
|
#define ONES_COMPLEMENT(r) (-(r)-1)
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
@ -735,8 +732,8 @@ static void init_scoring
|
|||||||
|
|
||||||
/* === Extract knobs ==================================================== */
|
/* === Extract knobs ==================================================== */
|
||||||
|
|
||||||
dense_row_count = COLAMD_MAX (0, COLAMD_MIN (knobs [COLAMD_DENSE_ROW] * n_col, n_col)) ;
|
dense_row_count = numext::maxi(IndexType(0), numext::mini(IndexType(knobs [COLAMD_DENSE_ROW] * n_col), n_col)) ;
|
||||||
dense_col_count = COLAMD_MAX (0, COLAMD_MIN (knobs [COLAMD_DENSE_COL] * n_row, n_row)) ;
|
dense_col_count = numext::maxi(IndexType(0), numext::mini(IndexType(knobs [COLAMD_DENSE_COL] * n_row), n_row)) ;
|
||||||
COLAMD_DEBUG1 (("colamd: densecount: %d %d\n", dense_row_count, dense_col_count)) ;
|
COLAMD_DEBUG1 (("colamd: densecount: %d %d\n", dense_row_count, dense_col_count)) ;
|
||||||
max_deg = 0 ;
|
max_deg = 0 ;
|
||||||
n_col2 = n_col ;
|
n_col2 = n_col ;
|
||||||
@ -800,7 +797,7 @@ static void init_scoring
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* keep track of max degree of remaining rows */
|
/* keep track of max degree of remaining rows */
|
||||||
max_deg = COLAMD_MAX (max_deg, deg) ;
|
max_deg = numext::maxi(max_deg, deg) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
COLAMD_DEBUG1 (("colamd: Dense and null rows killed: %d\n", n_row - n_row2)) ;
|
COLAMD_DEBUG1 (("colamd: Dense and null rows killed: %d\n", n_row - n_row2)) ;
|
||||||
@ -838,7 +835,7 @@ static void init_scoring
|
|||||||
/* add row's external degree */
|
/* add row's external degree */
|
||||||
score += Row [row].shared1.degree - 1 ;
|
score += Row [row].shared1.degree - 1 ;
|
||||||
/* guard against integer overflow */
|
/* guard against integer overflow */
|
||||||
score = COLAMD_MIN (score, n_col) ;
|
score = numext::mini(score, n_col) ;
|
||||||
}
|
}
|
||||||
/* determine pruned column length */
|
/* determine pruned column length */
|
||||||
col_length = (IndexType) (new_cp - &A [Col [c].start]) ;
|
col_length = (IndexType) (new_cp - &A [Col [c].start]) ;
|
||||||
@ -910,7 +907,7 @@ static void init_scoring
|
|||||||
head [score] = c ;
|
head [score] = c ;
|
||||||
|
|
||||||
/* see if this score is less than current min */
|
/* see if this score is less than current min */
|
||||||
min_score = COLAMD_MIN (min_score, score) ;
|
min_score = numext::mini(min_score, score) ;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1036,7 +1033,7 @@ static IndexType find_ordering /* return the number of garbage collections */
|
|||||||
|
|
||||||
/* === Garbage_collection, if necessary ============================= */
|
/* === Garbage_collection, if necessary ============================= */
|
||||||
|
|
||||||
needed_memory = COLAMD_MIN (pivot_col_score, n_col - k) ;
|
needed_memory = numext::mini(pivot_col_score, n_col - k) ;
|
||||||
if (pfree + needed_memory >= Alen)
|
if (pfree + needed_memory >= Alen)
|
||||||
{
|
{
|
||||||
pfree = Eigen::internal::garbage_collection (n_row, n_col, Row, Col, A, &A [pfree]) ;
|
pfree = Eigen::internal::garbage_collection (n_row, n_col, Row, Col, A, &A [pfree]) ;
|
||||||
@ -1095,7 +1092,7 @@ static IndexType find_ordering /* return the number of garbage collections */
|
|||||||
|
|
||||||
/* clear tag on pivot column */
|
/* clear tag on pivot column */
|
||||||
Col [pivot_col].shared1.thickness = pivot_col_thickness ;
|
Col [pivot_col].shared1.thickness = pivot_col_thickness ;
|
||||||
max_deg = COLAMD_MAX (max_deg, pivot_row_degree) ;
|
max_deg = numext::maxi(max_deg, pivot_row_degree) ;
|
||||||
|
|
||||||
|
|
||||||
/* === Kill all rows used to construct pivot row ==================== */
|
/* === Kill all rows used to construct pivot row ==================== */
|
||||||
@ -1269,7 +1266,7 @@ static IndexType find_ordering /* return the number of garbage collections */
|
|||||||
/* add set difference */
|
/* add set difference */
|
||||||
cur_score += row_mark - tag_mark ;
|
cur_score += row_mark - tag_mark ;
|
||||||
/* integer overflow... */
|
/* integer overflow... */
|
||||||
cur_score = COLAMD_MIN (cur_score, n_col) ;
|
cur_score = numext::mini(cur_score, n_col) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* recompute the column's length */
|
/* recompute the column's length */
|
||||||
@ -1382,7 +1379,7 @@ static IndexType find_ordering /* return the number of garbage collections */
|
|||||||
cur_score -= Col [col].shared1.thickness ;
|
cur_score -= Col [col].shared1.thickness ;
|
||||||
|
|
||||||
/* make sure score is less or equal than the max score */
|
/* make sure score is less or equal than the max score */
|
||||||
cur_score = COLAMD_MIN (cur_score, max_score) ;
|
cur_score = numext::mini(cur_score, max_score) ;
|
||||||
COLAMD_ASSERT (cur_score >= 0) ;
|
COLAMD_ASSERT (cur_score >= 0) ;
|
||||||
|
|
||||||
/* store updated score */
|
/* store updated score */
|
||||||
@ -1405,7 +1402,7 @@ static IndexType find_ordering /* return the number of garbage collections */
|
|||||||
head [cur_score] = col ;
|
head [cur_score] = col ;
|
||||||
|
|
||||||
/* see if this score is less than current min */
|
/* see if this score is less than current min */
|
||||||
min_score = COLAMD_MIN (min_score, cur_score) ;
|
min_score = numext::mini(min_score, cur_score) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user