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

Function CheckSparseCOOIndexValidity

cpp/src/arrow/sparse_tensor.cc:125–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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