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

Method norm2

highs/util/HVectorBase.cpp:157–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156template <typename Real>
157Real HVectorBase<Real>::norm2() const {
158 /*
159 * Compute the squared 2-norm of the vector
160 */
161 const HighsInt workCount = count;
162 const HighsInt* workIndex = &index[0];
163 const Real* workArray = &array[0];
164
165 Real result = Real{0};
166 for (HighsInt i = 0; i < workCount; i++) {
167 Real value = workArray[workIndex[i]];
168 result += value * value;
169 }
170 return result;
171}
172
173template <typename Real>
174template <typename RealPivX, typename RealPiv>

Calls

no outgoing calls

Tested by

no test coverage detected