MCPcopy Create free account
hub / github.com/apache/arrow / SetUp

Method SetUp

cpp/src/arrow/sparse_tensor_test.cc:234–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232 using c_value_type = typename ValueType::c_type;
233
234 void SetUp() {
235 shape_ = {2, 3, 4};
236 dim_names_ = {"foo", "bar", "baz"};
237
238 // Dense representation:
239 // [
240 // [
241 // 1 0 2 0
242 // 0 3 0 4
243 // 5 0 6 0
244 // ],
245 // [
246 // 0 11 0 12
247 // 13 0 14 0
248 // 0 15 0 16
249 // ]
250 // ]
251 dense_values_ = {1, 0, 2, 0, 0, 3, 0, 4, 5, 0, 6, 0,
252 0, 11, 0, 12, 13, 0, 14, 0, 0, 15, 0, 16};
253 auto dense_data = Buffer::Wrap(dense_values_);
254 NumericTensor<ValueType> dense_tensor(dense_data, shape_, {}, dim_names_);
255 ASSERT_OK_AND_ASSIGN(sparse_tensor_from_dense_,
256 SparseCOOTensor::Make(
257 dense_tensor, TypeTraits<IndexValueType>::type_singleton()));
258 }
259
260 protected:
261 using TestSparseTensorBase<ValueType>::shape_;

Callers

nothing calls this directly

Calls 4

WrapFunction · 0.85
ASSERT_OK_AND_ASSIGNFunction · 0.70
MakeFunction · 0.70
type_singletonFunction · 0.70

Tested by

no test coverage detected