A high-performance general-purpose compute library

- Main Page
- Tutorials
- Release Notes
- Examples

sparse.h
Go to the documentation of this file.
1/*******************************************************
2 * Copyright (c) 2014, ArrayFire
3 * All rights reserved.
4 *
5 * This file is distributed under 3-clause BSD license.
6 * The complete license agreement can be obtained at:
7 * http://arrayfire.com/licenses/BSD-3-Clause
8 ********************************************************/
9
10#pragma once
11#include <af/defines.h>
12
13#ifdef __cplusplus
14 namespace af
15{
16 class array;
17
18#if AF_API_VERSION >= 34
39 AFAPI array sparse(const dim_t nRows, const dim_t nCols,
40 const array values, const array rowIdx, const array colIdx,
41 const af::storage stype = AF_STORAGE_CSR);
42#endif
43
44#if AF_API_VERSION >= 34
69 AFAPI array sparse(const dim_t nRows, const dim_t nCols, const dim_t nNZ,
70 const void* const values,
71 const int * const rowIdx, const int * const colIdx,
72 const dtype type = f32, const af::storage stype = AF_STORAGE_CSR,
73 const af::source src = afHost);
74#endif
75
76#if AF_API_VERSION >= 34
88 AFAPI array sparse(const array dense, const af::storage stype = AF_STORAGE_CSR);
89#endif
90
91#if AF_API_VERSION >= 34
99 AFAPI array sparseConvertTo(const array in, const af::storage destStrorage);
100#endif
101
102#if AF_API_VERSION >= 34
111 AFAPI array dense(const array sparse);
112#endif
113
114#if AF_API_VERSION >= 34
124 AFAPI void sparseGetInfo(array &values, array &rowIdx, array &colIdx, af::storage &stype,
125 const array in);
126#endif
127
128#if AF_API_VERSION >= 34
135 AFAPI array sparseGetValues(const array in);
136#endif
137
138#if AF_API_VERSION >= 34
145 AFAPI array sparseGetRowIdx(const array in);
146#endif
147
148#if AF_API_VERSION >= 34
155 AFAPI array sparseGetColIdx(const array in);
156#endif
157
158#if AF_API_VERSION >= 34
165 AFAPI dim_t sparseGetNNZ(const array in);
166#endif
167
168#if AF_API_VERSION >= 34
175 AFAPI af::storage sparseGetStorage(const array in);
176#endif
177}
178#endif
179
180#ifdef __cplusplus
181 extern "C" {
182#endif
183
184#if AF_API_VERSION >= 34
205 AFAPI af_err af_create_sparse_array(
206 af_array *out,
207 const dim_t nRows, const dim_t nCols,
208 const af_array values, const af_array rowIdx, const af_array colIdx,
209 const af_storage stype);
210#endif
211
212#if AF_API_VERSION >= 34
237 AFAPI af_err af_create_sparse_array_from_ptr(
238 af_array *out,
239 const dim_t nRows, const dim_t nCols, const dim_t nNZ,
240 const void * const values,
241 const int * const rowIdx, const int * const colIdx,
242 const af_dtype type, const af_storage stype,
243 const af_source src);
244#endif
245
246#if AF_API_VERSION >= 34
258 AFAPI af_err af_create_sparse_array_from_dense(
259 af_array *out, const af_array dense,
260 const af_storage stype);
261#endif
262
263#if AF_API_VERSION >= 34
273 AFAPI af_err af_sparse_convert_to(af_array *out, const af_array in,
274 const af_storage destStorage);
275#endif
276
277#if AF_API_VERSION >= 34
286 AFAPI af_err af_sparse_to_dense(af_array *out, const af_array sparse);
287#endif
288
289#if AF_API_VERSION >= 34
301 AFAPI af_err af_sparse_get_info(af_array *values, af_array *rowIdx, af_array *colIdx, af_storage *stype,
302 const af_array in);
303#endif
304
305#if AF_API_VERSION >= 34
314 AFAPI af_err af_sparse_get_values(af_array *out, const af_array in);
315#endif
316
317#if AF_API_VERSION >= 34
326 AFAPI af_err af_sparse_get_row_idx(af_array *out, const af_array in);
327#endif
328
329#if AF_API_VERSION >= 34
338 AFAPI af_err af_sparse_get_col_idx(af_array *out, const af_array in);
339#endif
340
341#if AF_API_VERSION >= 34
350 AFAPI af_err af_sparse_get_nnz(dim_t *out, const af_array in);
351#endif
352
353#if AF_API_VERSION >= 34
362 AFAPI af_err af_sparse_get_storage(af_storage *out, const af_array in);
363#endif
364
365#ifdef __cplusplus
366}
367#endif
af::array
A multi dimensional data container.
Definition array.h:37
defines.h
af_dtype
af_dtype
Definition defines.h:210
f32
@ f32
32-bit floating point values
Definition defines.h:211
af_storage
af_storage
Definition defines.h:490
AF_STORAGE_CSR
@ AF_STORAGE_CSR
Storage type is CSR.
Definition defines.h:492
dim_t
long long dim_t
Definition defines.h:56
af_err
af_err
Definition defines.h:71
af_array
void * af_array
Definition defines.h:240
AFAPI
#define AFAPI
Definition defines.h:38
af_source
af_source
Definition defines.h:232
afHost
@ afHost
Host pointer.
Definition defines.h:234
af::sparseGetColIdx
AFAPI array sparseGetColIdx(const array in)
af_sparse_get_col_idx
AFAPI af_err af_sparse_get_col_idx(af_array *out, const af_array in)
af_sparse_convert_to
AFAPI af_err af_sparse_convert_to(af_array *out, const af_array in, const af_storage destStorage)
af::sparseConvertTo
AFAPI array sparseConvertTo(const array in, const af::storage destStrorage)
af_create_sparse_array
AFAPI af_err af_create_sparse_array(af_array *out, const dim_t nRows, const dim_t nCols, const af_array values, const af_array rowIdx, const af_array colIdx, const af_storage stype)
This function converts af::array of values, row indices and column indices into a sparse array.
af_create_sparse_array_from_dense
AFAPI af_err af_create_sparse_array_from_dense(af_array *out, const af_array dense, const af_storage stype)
This function converts a dense af_array into a sparse array.
af_create_sparse_array_from_ptr
AFAPI af_err af_create_sparse_array_from_ptr(af_array *out, const dim_t nRows, const dim_t nCols, const dim_t nNZ, const void *const values, const int *const rowIdx, const int *const colIdx, const af_dtype type, const af_storage stype, const af_source src)
This function converts host or device arrays of values, row indices and column indices into a sparse ...
af::sparse
AFAPI array sparse(const dim_t nRows, const dim_t nCols, const array values, const array rowIdx, const array colIdx, const af::storage stype=AF_STORAGE_CSR)
This function converts af::array of values, row indices and column indices into a sparse array.
af::dense
AFAPI array dense(const array sparse)
af_sparse_to_dense
AFAPI af_err af_sparse_to_dense(af_array *out, const af_array sparse)
af::sparseGetInfo
AFAPI void sparseGetInfo(array &values, array &rowIdx, array &colIdx, af::storage &stype, const array in)
af_sparse_get_info
AFAPI af_err af_sparse_get_info(af_array *values, af_array *rowIdx, af_array *colIdx, af_storage *stype, const af_array in)
af_sparse_get_nnz
AFAPI af_err af_sparse_get_nnz(dim_t *out, const af_array in)
af::sparseGetNNZ
AFAPI dim_t sparseGetNNZ(const array in)
af_sparse_get_row_idx
AFAPI af_err af_sparse_get_row_idx(af_array *out, const af_array in)
af::sparseGetRowIdx
AFAPI array sparseGetRowIdx(const array in)
af_sparse_get_storage
AFAPI af_err af_sparse_get_storage(af_storage *out, const af_array in)
af::sparseGetStorage
AFAPI af::storage sparseGetStorage(const array in)
af::sparseGetValues
AFAPI array sparseGetValues(const array in)
af_sparse_get_values
AFAPI af_err af_sparse_get_values(af_array *out, const af_array in)
af
Definition algorithm.h:15