| 80 | |
| 81 | template <typename Real> |
| 82 | void HVectorBase<Real>::tight() { |
| 83 | /* |
| 84 | * Zero values in Vector.array that do not exceed kHighsTiny in |
| 85 | * magnitude, maintaining index if it is well defined |
| 86 | */ |
| 87 | HighsInt totalCount = 0; |
| 88 | using std::abs; |
| 89 | if (count < 0) { |
| 90 | for (auto& val : array) |
| 91 | if (abs(val) < kHighsTiny) val = 0; |
| 92 | } else { |
| 93 | for (HighsInt i = 0; i < count; i++) { |
| 94 | const HighsInt my_index = index[i]; |
| 95 | const Real& value = array[my_index]; |
| 96 | if (abs(value) >= kHighsTiny) { |
| 97 | index[totalCount++] = my_index; |
| 98 | } else { |
| 99 | array[my_index] = Real{0}; |
| 100 | } |
| 101 | } |
| 102 | count = totalCount; |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | template <typename Real> |
| 107 | void HVectorBase<Real>::pack() { |
no outgoing calls
no test coverage detected