| 354 | namespace { |
| 355 | |
| 356 | inline Status CheckSparseCSFIndexValidity(const std::shared_ptr<DataType>& indptr_type, |
| 357 | const std::shared_ptr<DataType>& indices_type, |
| 358 | const int64_t num_indptrs, |
| 359 | const int64_t num_indices, |
| 360 | const int64_t axis_order_size) { |
| 361 | if (!is_integer(indptr_type->id())) { |
| 362 | return Status::TypeError("Type of SparseCSFIndex indptr must be integer"); |
| 363 | } |
| 364 | if (!is_integer(indices_type->id())) { |
| 365 | return Status::TypeError("Type of SparseCSFIndex indices must be integer"); |
| 366 | } |
| 367 | if (num_indptrs + 1 != num_indices) { |
| 368 | return Status::Invalid( |
| 369 | "Length of indices must be equal to length of indptrs + 1 for SparseCSFIndex."); |
| 370 | } |
| 371 | if (axis_order_size != num_indices) { |
| 372 | return Status::Invalid( |
| 373 | "Length of indices must be equal to number of dimensions for SparseCSFIndex."); |
| 374 | } |
| 375 | return Status::OK(); |
| 376 | } |
| 377 | |
| 378 | } // namespace |
| 379 |
no test coverage detected