Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / external / coinmp / bind2nd.patch.1
blob5b3222eea9a0bdcb7918f5aa2b2b3c516aa54617
1 --- a/Osi/src/OsiCommonTest/OsiSolverInterfaceTest.cpp
2 +++ b/Osi/src/OsiCommonTest/OsiSolverInterfaceTest.cpp
3 @@ -1313,8 +1313,8 @@
4    int rows_to_delete_arr[] = { 0 } ;
5    si->deleteRows(1,rows_to_delete_arr) ;
6  
7 -  std::transform(objective,objective+4,objective,
8 -                std::bind2nd(std::plus<double>(),0.15)) ;
9 +  for (int i = 0; i != 4; ++i)
10 +    objective[i] += 0.15;
11    si->setObjective(objective) ;
12    si->resolve() ;
13    OSIUNITTEST_ASSERT_ERROR(si->isProvenOptimal(),          return false, *si, "test16SebastianNowozin second resolve");
15 The below is an excerpt from
16 <https://github.com/coin-or/CoinUtils/commit/4f0dab267fc3976d0542f56e2939f900857147a6> "make c++17
17 compatible":
19 diff --git a/CoinUtils/src/CoinPackedMatrix.cpp b/CoinUtils/src/CoinPackedMatrix.cpp
20 index c7631289..0b103159 100644
21 --- a/CoinUtils/src/CoinPackedMatrix.cpp
22 +++ b/CoinUtils/src/CoinPackedMatrix.cpp
23 @@ -1490,11 +1490,11 @@ CoinPackedMatrix::minorAppendSameOrdered(const CoinPackedMatrix& matrix)
25     // now insert the entries of matrix
26     for (i = majorDim_ - 1; i >= 0; --i) {
27 -      const int l = matrix.length_[i];
28 -      std::transform(matrix.index_ + matrix.start_[i],
29 -               matrix.index_ + (matrix.start_[i] + l),
30 -               index_ + (start_[i] + length_[i]),
31 -               std::bind2nd(std::plus<int>(), minorDim_));
32 +      int l = matrix.length_[i];
33 +      CoinBigIndex put = start_[i]+length_[i];
34 +      const CoinBigIndex get = matrix.start_[i];
35 +      for (int j=0;j<l;j++)
36 +       index_[put+j]=matrix.index_[get+j]+minorDim_;
37        CoinMemcpyN(matrix.element_ + matrix.start_[i], l,
38                        element_ + (start_[i] + length_[i]));
39        length_[i] += l;
40 diff --git a/CoinUtils/src/CoinPackedVector.cpp b/CoinUtils/src/CoinPackedVector.cpp
41 index 7d90b3de..158a8373 100644
42 --- a/CoinUtils/src/CoinPackedVector.cpp
43 +++ b/CoinUtils/src/CoinPackedVector.cpp
44 @@ -284,8 +284,8 @@ CoinPackedVector::truncate( int n )
45  void
46  CoinPackedVector::operator+=(double value) 
47  {
48 -   std::transform(elements_, elements_ + nElements_, elements_,
49 -                 std::bind2nd(std::plus<double>(), value) );
50 +  for (int i=0 ; i < nElements_; i++)
51 +    elements_[i] += value;
52  }
54  //-----------------------------------------------------------------------------
55 @@ -293,8 +293,8 @@ CoinPackedVector::operator+=(double value)
56  void
57  CoinPackedVector::operator-=(double value) 
58  {
59 -   std::transform(elements_, elements_ + nElements_, elements_,
60 -                 std::bind2nd(std::minus<double>(), value) );
61 +  for (int i=0 ; i < nElements_; i++)
62 +    elements_[i] -= value;
63  }
65  //-----------------------------------------------------------------------------
66 @@ -302,8 +302,8 @@ CoinPackedVector::operator-=(double value)
67  void
68  CoinPackedVector::operator*=(double value) 
69  {
70 -   std::transform(elements_, elements_ + nElements_, elements_,
71 -                 std::bind2nd(std::multiplies<double>(), value) );
72 +  for (int i=0 ; i < nElements_; i++)
73 +    elements_[i] *= value;
74  }
76  //-----------------------------------------------------------------------------
77 @@ -311,8 +311,8 @@ CoinPackedVector::operator*=(double value)
78  void
79  CoinPackedVector::operator/=(double value) 
80  {
81 -   std::transform(elements_, elements_ + nElements_, elements_,
82 -                 std::bind2nd(std::divides<double>(), value) );
83 +  for (int i=0 ; i < nElements_; i++)
84 +    elements_[i] /= value;
85  }
87  //#############################################################################