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

Function call_ref

dependence/eigen-3.4.0/test/sparse_ref.cpp:62–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60EIGEN_DONT_INLINE void call_ref_5(const Ref<const SparseVector<float> >& a, const B &b) { VERIFY_IS_EQUAL(a.toDense(),b.toDense()); }
61
62void call_ref()
63{
64 SparseMatrix<float> A = MatrixXf::Random(10,10).sparseView(0.5,1);
65 SparseMatrix<float,RowMajor> B = MatrixXf::Random(10,10).sparseView(0.5,1);
66 SparseMatrix<float> C = MatrixXf::Random(10,10).sparseView(0.5,1);
67 C.reserve(VectorXi::Constant(C.outerSize(), 2));
68 const SparseMatrix<float>& Ac(A);
69 Block<SparseMatrix<float> > Ab(A,0,1, 3,3);
70 const Block<SparseMatrix<float> > Abc(A,0,1,3,3);
71 SparseVector<float> vc = VectorXf::Random(10).sparseView(0.5,1);
72 SparseVector<float,RowMajor> vr = VectorXf::Random(10).sparseView(0.5,1);
73 SparseMatrix<float> AA = A*A;
74
75
76 VERIFY_EVALUATION_COUNT( call_ref_1(A, A), 0);
77// VERIFY_EVALUATION_COUNT( call_ref_1(Ac, Ac), 0); // does not compile on purpose
78 VERIFY_EVALUATION_COUNT( call_ref_2(A, A), 0);
79 VERIFY_EVALUATION_COUNT( call_ref_3(A, A), 0);
80 VERIFY_EVALUATION_COUNT( call_ref_2(A.transpose(), A.transpose()), 1);
81 VERIFY_EVALUATION_COUNT( call_ref_3(A.transpose(), A.transpose()), 1);
82 VERIFY_EVALUATION_COUNT( call_ref_2(Ac,Ac), 0);
83 VERIFY_EVALUATION_COUNT( call_ref_3(Ac,Ac), 0);
84 VERIFY_EVALUATION_COUNT( call_ref_2(A+A,2*Ac), 1);
85 VERIFY_EVALUATION_COUNT( call_ref_3(A+A,2*Ac), 1);
86 VERIFY_EVALUATION_COUNT( call_ref_2(B, B), 1);
87 VERIFY_EVALUATION_COUNT( call_ref_3(B, B), 1);
88 VERIFY_EVALUATION_COUNT( call_ref_2(B.transpose(), B.transpose()), 0);
89 VERIFY_EVALUATION_COUNT( call_ref_3(B.transpose(), B.transpose()), 0);
90 VERIFY_EVALUATION_COUNT( call_ref_2(A*A, AA), 3);
91 VERIFY_EVALUATION_COUNT( call_ref_3(A*A, AA), 3);
92
93 VERIFY(!C.isCompressed());
94 VERIFY_EVALUATION_COUNT( call_ref_3(C, C), 1);
95
96 Ref<SparseMatrix<float> > Ar(A);
97 VERIFY_IS_APPROX(Ar+Ar, A+A);
98 VERIFY_EVALUATION_COUNT( call_ref_1(Ar, A), 0);
99 VERIFY_EVALUATION_COUNT( call_ref_2(Ar, A), 0);
100
101 Ref<SparseMatrix<float,RowMajor> > Br(B);
102 VERIFY_EVALUATION_COUNT( call_ref_1(Br.transpose(), Br.transpose()), 0);
103 VERIFY_EVALUATION_COUNT( call_ref_2(Br, Br), 1);
104 VERIFY_EVALUATION_COUNT( call_ref_2(Br.transpose(), Br.transpose()), 0);
105
106 Ref<const SparseMatrix<float> > Arc(A);
107// VERIFY_EVALUATION_COUNT( call_ref_1(Arc, Arc), 0); // does not compile on purpose
108 VERIFY_EVALUATION_COUNT( call_ref_2(Arc, Arc), 0);
109
110 VERIFY_EVALUATION_COUNT( call_ref_2(A.middleCols(1,3), A.middleCols(1,3)), 0);
111
112 VERIFY_EVALUATION_COUNT( call_ref_2(A.col(2), A.col(2)), 0);
113 VERIFY_EVALUATION_COUNT( call_ref_2(vc, vc), 0);
114 VERIFY_EVALUATION_COUNT( call_ref_2(vr.transpose(), vr.transpose()), 0);
115 VERIFY_EVALUATION_COUNT( call_ref_2(vr, vr.transpose()), 0);
116
117 VERIFY_EVALUATION_COUNT( call_ref_2(A.block(1,1,3,3), A.block(1,1,3,3)), 1); // should be 0 (allocate starts/nnz only)
118
119 VERIFY_EVALUATION_COUNT( call_ref_4(vc, vc), 0);

Callers 1

EIGEN_DECLARE_TESTFunction · 0.70

Calls 13

sparseViewMethod · 0.80
call_ref_1Function · 0.70
call_ref_2Function · 0.70
call_ref_3Function · 0.70
call_ref_4Function · 0.70
call_ref_5Function · 0.70
reserveMethod · 0.45
outerSizeMethod · 0.45
transposeMethod · 0.45
isCompressedMethod · 0.45
colMethod · 0.45
blockMethod · 0.45

Tested by

no test coverage detected