Skip to content

Commit 4a4abed

Browse files
committed
Update overflow check
1 parent 21c5301 commit 4a4abed

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

highs/ipm/hipo/factorhighs/Analyse.cpp

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,25 +1165,19 @@ void Analyse::computeBlockStart() {
11651165
}
11661166

11671167
Int Analyse::checkOverflow() const {
1168-
// Dense matrices frontal and clique must be addressable by 32-bit integers in
1169-
// order to use 32-bit BLAS.
1170-
1171-
// This check is probably excessive, but I keep it for now.
1172-
// What we really need is that the local numbering used by the BLAS calls does
1173-
// not overflow 32-bit integers. This should be equivalent to:
1174-
// largest_front * block_size < int32_limit
1168+
// In order to use 32-bit BLAS, any data accessed by BLAS must be addressable
1169+
// using 32-bit integer offset. If BLAS is given a pointer double* A, the
1170+
// distance between the first and last entry of A used by BLAS needs to be
1171+
// smaller than int32_limit. Since the matrices are stored in blocked data
1172+
// structures, and BLAS only uses contiguous data from a given block of
1173+
// columns, we need to impose that:
1174+
// front_size * min(block_size, sn_size) <= int32_limit
11751175

11761176
for (Int sn = 0; sn < sn_count_; ++sn) {
1177-
const Int64 clique_size = clique_block_start_[sn].back();
1178-
if (clique_size > int32_limit) return 1;
1179-
11801177
const Int sn_size = sn_start_[sn + 1] - sn_start_[sn];
1181-
const Int n_blocks = (sn_size - 1) / nb_ + 1;
1182-
const Int ldf = ptr_sn_[sn + 1] - ptr_sn_[sn];
1183-
std::vector<Int64> diag_start(n_blocks);
1184-
const Int64 frontal_size =
1185-
getDiagStart(ldf, sn_size, nb_, n_blocks, diag_start);
1186-
if (frontal_size > int32_limit) return 1;
1178+
const Int front_size = ptr_sn_[sn + 1] - ptr_sn_[sn];
1179+
1180+
if ((Int64)front_size * std::min(sn_size, nb_) > int32_limit) return 1;
11871181
}
11881182

11891183
return 0;

0 commit comments

Comments
 (0)