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
19 
37  AFAPI array sparse(const dim_t nRows, const dim_t nCols,
38  const array values, const array rowIdx, const array colIdx,
39  const af::storage stype = AF_STORAGE_CSR);
40 #endif
41 
42 #if AF_API_VERSION >= 34
43 
65  AFAPI array sparse(const dim_t nRows, const dim_t nCols, const dim_t nNZ,
66  const void* const values,
67  const int * const rowIdx, const int * const colIdx,
68  const dtype type = f32, const af::storage stype = AF_STORAGE_CSR,
69  const af::source src = afHost);
70 #endif
71 
72 #if AF_API_VERSION >= 34
73 
82  AFAPI array sparse(const array dense, const af::storage stype = AF_STORAGE_CSR);
83 #endif
84 
85 #if AF_API_VERSION >= 34
86 
93  AFAPI array sparseConvertTo(const array in, const af::storage destStrorage);
94 #endif
95 
96 #if AF_API_VERSION >= 34
97 
103  AFAPI array dense(const array sparse);
104 #endif
105 
106 #if AF_API_VERSION >= 34
107 
116  AFAPI void sparseGetInfo(array &values, array &rowIdx, array &colIdx, af::storage &stype,
117  const array in);
118 #endif
119 
120 #if AF_API_VERSION >= 34
121 
127  AFAPI array sparseGetValues(const array in);
128 #endif
129 
130 #if AF_API_VERSION >= 34
131 
137  AFAPI array sparseGetRowIdx(const array in);
138 #endif
139 
140 #if AF_API_VERSION >= 34
141 
147  AFAPI array sparseGetColIdx(const array in);
148 #endif
149 
150 #if AF_API_VERSION >= 34
151 
157  AFAPI dim_t sparseGetNNZ(const array in);
158 #endif
159 
160 #if AF_API_VERSION >= 34
161 
168 #endif
169 }
170 #endif
171 
172 #ifdef __cplusplus
173 extern "C" {
174 #endif
175 
176 #if AF_API_VERSION >= 34
177 
198  af_array *out,
199  const dim_t nRows, const dim_t nCols,
200  const af_array values, const af_array rowIdx, const af_array colIdx,
201  const af_storage stype);
202 #endif
203 
204 #if AF_API_VERSION >= 34
205 
230  af_array *out,
231  const dim_t nRows, const dim_t nCols, const dim_t nNZ,
232  const void * const values,
233  const int * const rowIdx, const int * const colIdx,
234  const af_dtype type, const af_storage stype,
235  const af_source src);
236 #endif
237 
238 #if AF_API_VERSION >= 34
239 
251  af_array *out, const af_array dense,
252  const af_storage stype);
253 #endif
254 
255 #if AF_API_VERSION >= 34
256 
266  const af_storage destStorage);
267 #endif
268 
269 #if AF_API_VERSION >= 34
270 
279 #endif
280 
281 #if AF_API_VERSION >= 34
282 
293  AFAPI af_err af_sparse_get_info(af_array *values, af_array *rowIdx, af_array *colIdx, af_storage *stype,
294  const af_array in);
295 #endif
296 
297 #if AF_API_VERSION >= 34
298 
307 #endif
308 
309 #if AF_API_VERSION >= 34
310 
319 #endif
320 
321 #if AF_API_VERSION >= 34
322 
331 #endif
332 
333 #if AF_API_VERSION >= 34
334 
342  AFAPI af_err af_sparse_get_nnz(dim_t *out, const af_array in);
343 #endif
344 
345 #if AF_API_VERSION >= 34
346 
355 #endif
356 
357 #ifdef __cplusplus
358 }
359 #endif
AFAPI af_err af_sparse_get_row_idx(af_array *out, const af_array in)
AFAPI array sparseConvertTo(const array in, const af::storage destStrorage)
AFAPI af_err af_sparse_get_nnz(dim_t *out, const af_array in)
Definition: algorithm.h:14
AFAPI af::storage sparseGetStorage(const array in)
AFAPI af_err af_sparse_to_dense(af_array *out, const af_array sparse)
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...
AFAPI af_err af_sparse_convert_to(af_array *out, const af_array in, const af_storage destStorage)
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.
AFAPI array dense(const array 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_storage
Definition: defines.h:457
AFAPI af_err af_sparse_get_col_idx(af_array *out, const af_array in)
af_err
Definition: defines.h:63
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_source
Definition: defines.h:214
Storage type is CSR.
Definition: defines.h:459
AFAPI dim_t sparseGetNNZ(const array in)
long long dim_t
Definition: defines.h:50
AFAPI array sparseGetRowIdx(const array in)
#define AFAPI
Definition: defines.h:31
AFAPI af_err af_sparse_get_values(af_array *out, const af_array in)
AFAPI array sparseGetValues(const array in)
AFAPI void sparseGetInfo(array &values, array &rowIdx, array &colIdx, af::storage &stype, const array in)
static af::array array(af::dim4 idims, cl_mem buf, af::dtype type, bool retain=false)
Create an af::array object from an OpenCL cl_mem buffer.
Definition: opencl.h:327
AFAPI af_err af_sparse_get_info(af_array *values, af_array *rowIdx, af_array *colIdx, af_storage *stype, const af_array in)
AFAPI array sparseGetColIdx(const array in)
AFAPI af_err af_sparse_get_storage(af_storage *out, const af_array in)
void * af_array
Definition: defines.h:222
32-bit floating point values
Definition: defines.h:196
Host pointer.
Definition: defines.h:216
af_dtype
Definition: defines.h:195
af_dtype dtype
Definition: defines.h:468