| 306 | } |
| 307 | |
| 308 | Status SparseCOOTensorToNdarray(const std::shared_ptr<SparseCOOTensor>& sparse_tensor, |
| 309 | PyObject* base, PyObject** out_data, |
| 310 | PyObject** out_coords) { |
| 311 | const auto& sparse_index = arrow::internal::checked_cast<const SparseCOOIndex&>( |
| 312 | *sparse_tensor->sparse_index()); |
| 313 | |
| 314 | // Wrap tensor data |
| 315 | OwnedRef result_data; |
| 316 | RETURN_NOT_OK(SparseTensorDataToNdarray( |
| 317 | *sparse_tensor, {static_cast<npy_intp>(sparse_tensor->non_zero_length()), 1}, base, |
| 318 | result_data.ref())); |
| 319 | |
| 320 | // Wrap indices |
| 321 | PyObject* result_coords; |
| 322 | RETURN_NOT_OK(TensorToNdarray(sparse_index.indices(), base, &result_coords)); |
| 323 | |
| 324 | *out_data = result_data.detach(); |
| 325 | *out_coords = result_coords; |
| 326 | return Status::OK(); |
| 327 | } |
| 328 | |
| 329 | Status SparseCSXMatrixToNdarray(const std::shared_ptr<SparseTensor>& sparse_tensor, |
| 330 | PyObject* base, PyObject** out_data, |
nothing calls this directly
no test coverage detected