papilo/papilo-vector-bounds.patch
2024-06-19 08:58:50 -06:00

93 lines
4.7 KiB
Diff

--- papilo-2.2.1/src/papilo/core/SparseStorage.hpp.orig 2024-06-07 12:08:24.746855040 -0600
+++ papilo-2.2.1/src/papilo/core/SparseStorage.hpp 2024-06-07 12:13:44.085783196 -0600
@@ -857,15 +857,15 @@ SparseStorage<REAL>::shiftRows( const in
// space
} while( rowranges[l].start == rowranges[l - 1].end );
- REAL* valsout = &values[rowranges[l].start - lastshiftleft];
- int* colsout = &columns[rowranges[l].start - lastshiftleft];
+ REAL* valsout = &values.data()[rowranges[l].start - lastshiftleft];
+ int* colsout = &columns.data()[rowranges[l].start - lastshiftleft];
assert( rowranges[l - 1].end <=
rowranges[l].start - lastshiftleft );
while( l <= row )
{
- int shift = &values[rowranges[l].start] - valsout;
+ int shift = &values.data()[rowranges[l].start] - valsout;
#ifndef NDEBUG
Vec<REAL> tmpvals;
@@ -877,10 +877,10 @@ SparseStorage<REAL>::shiftRows( const in
#endif
if( rowranges[l].start != rowranges[l].end )
{
- valsout = std::move( &values[rowranges[l].start],
- &values[rowranges[l].end], valsout );
- colsout = std::move( &columns[rowranges[l].start],
- &columns[rowranges[l].end], colsout );
+ valsout = std::move( &values.data()[rowranges[l].start],
+ &values.data()[rowranges[l].end], valsout );
+ colsout = std::move( &columns.data()[rowranges[l].start],
+ &columns.data()[rowranges[l].end], colsout );
}
rowranges[l].start -= shift;
@@ -907,15 +907,15 @@ SparseStorage<REAL>::shiftRows( const in
// space
} while( rowranges[r].end == rowranges[r + 1].start );
- REAL* valsout = &values[rowranges[r].end + lastshiftright];
- int* colsout = &columns[rowranges[r].end + lastshiftright];
+ REAL* valsout = &values.data()[rowranges[r].end + lastshiftright];
+ int* colsout = &columns.data()[rowranges[r].end + lastshiftright];
assert( rowranges[r + 1].start >=
rowranges[r].end + lastshiftright );
while( r > row )
{
- int shift = valsout - &values[rowranges[r].end];
+ int shift = valsout - &values.data()[rowranges[r].end];
#ifndef NDEBUG
Vec<REAL> tmpvals;
@@ -928,11 +928,11 @@ SparseStorage<REAL>::shiftRows( const in
if( rowranges[r].start != rowranges[r].end )
{
valsout =
- std::move_backward( &values[rowranges[r].start],
- &values[rowranges[r].end], valsout );
+ std::move_backward( &values.data()[rowranges[r].start],
+ &values.data()[rowranges[r].end], valsout );
colsout =
- std::move_backward( &columns[rowranges[r].start],
- &columns[rowranges[r].end], colsout );
+ std::move_backward( &columns.data()[rowranges[r].start],
+ &columns.data()[rowranges[r].end], colsout );
}
rowranges[r].start += shift;
--- papilo-2.2.1/src/papilo/presolvers/ParallelColDetection.hpp.orig 2024-06-07 12:08:24.747855027 -0600
+++ papilo-2.2.1/src/papilo/presolvers/ParallelColDetection.hpp 2024-06-07 12:16:57.755305982 -0600
@@ -598,13 +598,16 @@ ParallelColDetection<REAL>::execute( con
if( flag_a_integer != flag_b_integer )
return !flag_a_integer;
+ SparseVectorView<REAL> coeffs_a = constMatrix.getColumnCoefficients( a );
+ SparseVectorView<REAL> coeffs_b = constMatrix.getColumnCoefficients( b );
+ REAL coeff_a = (coeffs_a.getLength() > 0) ? coeffs_a.getValues()[0] : (REAL)0;
+ REAL coeff_b = (coeffs_b.getLength() > 0) ? coeffs_b.getValues()[0] : (REAL)0;
return // sort by scale factor
abs( obj[a] ) < abs( obj[b] ) ||
// sort by scale factor if obj is zero
( abs( obj[a] ) == abs( obj[b] ) && obj[a] == 0 &&
determineOderingForZeroObj(
- constMatrix.getColumnCoefficients( a ).getValues()[0],
- constMatrix.getColumnCoefficients( b ).getValues()[0],
+ coeff_a, coeff_b,
colperm[a], colperm[b] ) ) ||
// sort by permutation
( abs( obj[a] ) == abs( obj[b] ) && obj[a] != 0 &&