Skip to content

Commit dedae85

Browse files
committed
Sparse API: getArrays() -> getInfo()
1 parent bb1b73e commit dedae85

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

include/af/sparse.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ namespace af
2929

3030
AFAPI array sparseConvertStorage(const array in, const af::storage stype);
3131

32-
AFAPI void sparseGetArrays(array &values, array &rowIdx, array &colIdx, const array in);
32+
AFAPI void sparseGetInfo(array &values, array &rowIdx, array &colIdx, af::storage &stype,
33+
const array in);
3334

3435
AFAPI array sparseGetValues(const array in);
3536

@@ -68,7 +69,8 @@ extern "C" {
6869
AFAPI af_err af_sparse_convert_storage(af_array *out, const af_array in,
6970
const af_storage destStorage);
7071

71-
AFAPI af_err af_sparse_get_arrays(af_array *values, af_array *rowIdx, af_array *colIdx, const af_array in);
72+
AFAPI af_err af_sparse_get_info(af_array *values, af_array *rowIdx, af_array *colIdx, af_storage *stype,
73+
const af_array in);
7274

7375
AFAPI af_err af_sparse_get_values(af_array *out, const af_array in);
7476

src/api/c/sparse.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,13 +337,14 @@ af_array getSparseValues(const af_array in)
337337
return getHandle(getSparseArray<T>(in).getValues());
338338
}
339339

340-
af_err af_sparse_get_arrays(af_array *values, af_array *rows, af_array *cols,
341-
const af_array in)
340+
af_err af_sparse_get_info(af_array *values, af_array *rows, af_array *cols, af_storage *stype,
341+
const af_array in)
342342
{
343343
try {
344344
if(values != NULL) AF_CHECK(af_sparse_get_values(values, in));
345-
if(rows != NULL) AF_CHECK(af_sparse_get_row_idx(rows , in));
346-
if(cols != NULL) AF_CHECK(af_sparse_get_col_idx(cols , in));
345+
if(rows != NULL) AF_CHECK(af_sparse_get_row_idx(rows , in));
346+
if(cols != NULL) AF_CHECK(af_sparse_get_col_idx(cols , in));
347+
if(stype != NULL) AF_CHECK(af_sparse_get_storage(stype, in));
347348
}
348349
CATCHALL;
349350

src/api/cpp/sparse.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,16 @@ namespace af
5050
return array(out);
5151
}
5252

53-
void sparseGetArrays(array &values, array &rowIdx, array &colIdx,
54-
const array in)
53+
void sparseGetInfo(array &values, array &rowIdx, array &colIdx, storage &stype,
54+
const array in)
5555
{
5656
af_array values_ = 0, rowIdx_ = 0, colIdx_ = 0;
57-
AF_THROW(af_sparse_get_arrays(&values_, &rowIdx_, &colIdx_, in.get()));
57+
af_storage stype_ = AF_STORAGE_DENSE;
58+
AF_THROW(af_sparse_get_info(&values_, &rowIdx_, &colIdx_, &stype_, in.get()));
5859
values = array(values_);
5960
rowIdx = array(rowIdx_);
6061
colIdx = array(colIdx_);
62+
stype = stype_;
6163
return;
6264
}
6365

src/api/unified/sparse.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ af_err af_sparse_convert_storage(af_array *out, const af_array in,
4646
return CALL(out, in, destStorage);
4747
}
4848

49-
af_err af_sparse_get_arrays(af_array *values, af_array *rowIdx, af_array *colIdx, const af_array in)
49+
af_err af_sparse_get_info(af_array *values, af_array *rowIdx, af_array *colIdx, af_storage *stype,
50+
const af_array in)
5051
{
5152
CHECK_ARRAYS(in);
52-
return CALL(values, rowIdx, colIdx, in);
53+
return CALL(values, rowIdx, colIdx, stype, in);
5354
}
5455

5556
af_err af_sparse_get_values(af_array *out, const af_array in)

0 commit comments

Comments
 (0)