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

Function CheckSparseCOOIndexValidity

cpp/src/arrow/sparse_tensor.cc:126–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124namespace {
125
126inline Status CheckSparseCOOIndexValidity(const std::shared_ptr<DataType>& type,
127 const std::vector<int64_t>& shape,
128 const std::vector<int64_t>& strides) {
129 if (!is_integer(type->id())) {
130 return Status::TypeError("Type of SparseCOOIndex indices must be integer");
131 }
132 if (shape.size() != 2) {
133 return Status::Invalid("SparseCOOIndex indices must be a matrix");
134 }
135
136 RETURN_NOT_OK(internal::CheckSparseIndexMaximumValue(type, shape));
137
138 if (!internal::IsTensorStridesContiguous(type, shape, strides)) {
139 return Status::Invalid("SparseCOOIndex indices must be contiguous");
140 }
141 return Status::OK();
142}
143
144void GetCOOIndexTensorRow(const std::shared_ptr<Tensor>& coords, const int64_t row,
145 std::vector<int64_t>* out_index) {

Callers 2

MakeMethod · 0.85
SparseCOOIndexMethod · 0.85

Calls 8

is_integerFunction · 0.70
TypeErrorFunction · 0.70
InvalidFunction · 0.70
OKFunction · 0.70
idMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected