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

Function compare_using_data_and_stride

test/block.cpp:201–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199
200template<typename MatrixType>
201void compare_using_data_and_stride(const MatrixType& m)
202{
203 typedef typename MatrixType::Index Index;
204 Index rows = m.rows();
205 Index cols = m.cols();
206 Index size = m.size();
207 Index innerStride = m.innerStride();
208 Index outerStride = m.outerStride();
209 Index rowStride = m.rowStride();
210 Index colStride = m.colStride();
211 const typename MatrixType::Scalar* data = m.data();
212
213 for(int j=0;j<cols;++j)
214 for(int i=0;i<rows;++i)
215 VERIFY(m.coeff(i,j) == data[i*rowStride + j*colStride]);
216
217 if(!MatrixType::IsVectorAtCompileTime)
218 {
219 for(int j=0;j<cols;++j)
220 for(int i=0;i<rows;++i)
221 VERIFY(m.coeff(i,j) == data[(MatrixType::Flags&RowMajorBit)
222 ? i*outerStride + j*innerStride
223 : j*outerStride + i*innerStride]);
224 }
225
226 if(MatrixType::IsVectorAtCompileTime)
227 {
228 VERIFY(innerStride == int((&m.coeff(1))-(&m.coeff(0))));
229 for (int i=0;i<size;++i)
230 VERIFY(m.coeff(i) == data[i*innerStride]);
231 }
232}
233
234template<typename MatrixType>
235void data_and_stride(const MatrixType& m)

Callers 1

data_and_strideFunction · 0.85

Calls 9

rowsMethod · 0.45
colsMethod · 0.45
sizeMethod · 0.45
innerStrideMethod · 0.45
outerStrideMethod · 0.45
rowStrideMethod · 0.45
colStrideMethod · 0.45
dataMethod · 0.45
coeffMethod · 0.45

Tested by

no test coverage detected