MCPcopy Create free account
hub / github.com/PX4/eigen / atInRange

Method atInRange

Eigen/src/SparseCore/CompressedStorage.h:159–169  ·  view source on GitHub ↗

Like at(), but the search is performed in the range [start,end) */

Source from the content-addressed store, hash-verified

157
158 /** Like at(), but the search is performed in the range [start,end) */
159 inline Scalar atInRange(Index start, Index end, Index key, const Scalar &defaultValue = Scalar(0)) const
160 {
161 if (start>=end)
162 return defaultValue;
163 else if (end>start && key==m_indices[end-1])
164 return m_values[end-1];
165 // ^^ optimization: let's first check if it is the last coefficient
166 // (very common in high level algorithms)
167 const Index id = searchLowerIndex(start,end-1,key);
168 return ((id<end) && (m_indices[id]==key)) ? m_values[id] : defaultValue;
169 }
170
171 /** \returns a reference to the value at index \a key
172 * If the value does not exist, then the value \a defaultValue is inserted

Callers 1

coeffMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected