MCPcopy Create free account
hub / github.com/Derious/cuMPC / compare_using_data_and_stride

Function compare_using_data_and_stride

dependence/eigen-3.4.0/test/block.cpp:244–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242
243template<typename MatrixType>
244void compare_using_data_and_stride(const MatrixType& m)
245{
246 Index rows = m.rows();
247 Index cols = m.cols();
248 Index size = m.size();
249 Index innerStride = m.innerStride();
250 Index outerStride = m.outerStride();
251 Index rowStride = m.rowStride();
252 Index colStride = m.colStride();
253 const typename MatrixType::Scalar* data = m.data();
254
255 for(int j=0;j<cols;++j)
256 for(int i=0;i<rows;++i)
257 VERIFY(m.coeff(i,j) == data[i*rowStride + j*colStride]);
258
259 if(!MatrixType::IsVectorAtCompileTime)
260 {
261 for(int j=0;j<cols;++j)
262 for(int i=0;i<rows;++i)
263 VERIFY(m.coeff(i,j) == data[(MatrixType::Flags&RowMajorBit)
264 ? i*outerStride + j*innerStride
265 : j*outerStride + i*innerStride]);
266 }
267
268 if(MatrixType::IsVectorAtCompileTime)
269 {
270 VERIFY(innerStride == int((&m.coeff(1))-(&m.coeff(0))));
271 for (int i=0;i<size;++i)
272 VERIFY(m.coeff(i) == data[i*innerStride]);
273 }
274}
275
276template<typename MatrixType>
277void 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