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

Function test_random_setter

unsupported/test/sparse_extra.cpp:18–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16
17template<typename SetterType,typename DenseType, typename Scalar, int Options>
18bool test_random_setter(SparseMatrix<Scalar,Options>& sm, const DenseType& ref, const std::vector<Vector2i>& nonzeroCoords)
19{
20 {
21 sm.setZero();
22 SetterType w(sm);
23 std::vector<Vector2i> remaining = nonzeroCoords;
24 while(!remaining.empty())
25 {
26 int i = internal::random<int>(0,static_cast<int>(remaining.size())-1);
27 w(remaining[i].x(),remaining[i].y()) = ref.coeff(remaining[i].x(),remaining[i].y());
28 remaining[i] = remaining.back();
29 remaining.pop_back();
30 }
31 }
32 return sm.isApprox(ref);
33}
34
35template<typename SetterType,typename DenseType, typename T>
36bool test_random_setter(DynamicSparseMatrix<T>& sm, const DenseType& ref, const std::vector<Vector2i>& nonzeroCoords)

Callers

nothing calls this directly

Calls 9

emptyMethod · 0.80
pop_backMethod · 0.80
setZeroMethod · 0.45
sizeMethod · 0.45
xMethod · 0.45
yMethod · 0.45
coeffMethod · 0.45
isApproxMethod · 0.45
coeffRefMethod · 0.45

Tested by

no test coverage detected