MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / saxpy

Method saxpy

highs/util/HVectorBase.cpp:175–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173template <typename Real>
174template <typename RealPivX, typename RealPiv>
175void HVectorBase<Real>::saxpy(const RealPivX pivotX,
176 const HVectorBase<RealPiv>* pivot) {
177 /*
178 * Add a multiple pivotX of *pivot into this vector, maintaining
179 * indices of nonzeros but not tracking cancellation.
180 * The real types may all be different but must mix in operations and be
181 * convertible to this HVector's real type.
182 */
183 HighsInt workCount = count;
184 HighsInt* workIndex = &index[0];
185 Real* workArray = &array[0];
186
187 const HighsInt pivotCount = pivot->count;
188 const HighsInt* pivotIndex = &pivot->index[0];
189 const RealPiv* pivotArray = &pivot->array[0];
190
191 using std::abs;
192 for (HighsInt k = 0; k < pivotCount; k++) {
193 const HighsInt iRow = pivotIndex[k];
194 const Real x0 = workArray[iRow];
195 const Real x1 = Real(x0 + pivotX * pivotArray[iRow]);
196 if (x0 == Real{0}) workIndex[workCount++] = iRow;
197 workArray[iRow] = (abs(x1) < kHighsTiny) ? kHighsZero : x1;
198 }
199 count = workCount;
200}
201
202template <typename Real>
203bool HVectorBase<Real>::isEqual(const HVectorBase<Real>& v0) {

Callers 6

minorUpdateRowsMethod · 0.80
majorUpdateFtranFinalMethod · 0.80
updateMethod · 0.80
quass.cppFile · 0.80
solveMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected