Row iterator of on column for CSC matrix
| 452 | |
| 453 | // Row iterator of on column for CSC matrix |
| 454 | class CSC_RowIterator { |
| 455 | public: |
| 456 | CSC_RowIterator(const void* col_ptr, int col_ptr_type, const int32_t* indices, |
| 457 | const void* data, int data_type, int64_t ncol_ptr, int64_t nelem, int col_idx); |
| 458 | ~CSC_RowIterator() {} |
| 459 | // return value at idx, only can access by ascent order |
| 460 | double Get(int idx); |
| 461 | // return next non-zero pair, if index < 0, means no more data |
| 462 | std::pair<int, double> NextNonZero(); |
| 463 | |
| 464 | private: |
| 465 | int nonzero_idx_ = 0; |
| 466 | int cur_idx_ = -1; |
| 467 | double cur_val_ = 0.0f; |
| 468 | bool is_end_ = false; |
| 469 | std::function<std::pair<int, double>(int idx)> iter_fun_; |
| 470 | }; |
| 471 | |
| 472 | // start of c_api functions |
| 473 |
nothing calls this directly
no outgoing calls
no test coverage detected