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

Method clear

highs/util/HVectorBase.cpp:47–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46template <typename Real>
47void HVectorBase<Real>::clear() {
48 /*
49 * Clear an HVector instance
50 */
51 // Standard HVector to clear
52 HighsInt dense_clear = count < 0 || count > size * 0.3;
53 if (dense_clear) {
54 // Treat the array as full if there are no indices or too many
55 // indices
56 array.assign(size, Real{0});
57 } else {
58 // Zero according to the indices of (possible) nonzeros
59 for (HighsInt i = 0; i < count; i++) {
60 array[index[i]] = 0;
61 }
62 }
63 this->clearScalars();
64}
65
66template <typename Real>
67void HVectorBase<Real>::clearScalars() {

Callers

nothing calls this directly

Calls 1

clearScalarsMethod · 0.95

Tested by

no test coverage detected