MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / IdentityCCheck

Function IdentityCCheck

test/constant.cpp:132–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130
131template<typename T>
132void IdentityCCheck() {
133 SUPPORTED_TYPE_CHECK(T);
134
135 static const int num = 1000;
136 dtype dty = (dtype)dtype_traits<T>::af_type;
137 af_array out;
138 dim_t dim[] = {(dim_t)num, (dim_t)num};
139 ASSERT_SUCCESS(af_identity(&out, 2, dim, dty));
140
141 vector<T> h_in(num * num);
142 af_get_data_ptr(&h_in.front(), out);
143
144 for (int i = 0; i < num; i++) {
145 for (int j = 0; j < num; j++) {
146 if (j == i)
147 ASSERT_EQ(h_in[i * num + j], T(1));
148 else
149 ASSERT_EQ(h_in[i * num + j], T(0));
150 }
151 }
152 ASSERT_SUCCESS(af_release_array(out));
153}
154
155template<typename T>
156void IdentityCPPError() {

Callers

nothing calls this directly

Calls 3

af_identityFunction · 0.50
af_get_data_ptrFunction · 0.50
af_release_arrayFunction · 0.50

Tested by

no test coverage detected