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 
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
45 
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
77 
88  AFAPI array sparse(const array dense, const af::storage stype = AF_STORAGE_CSR);
89 #endif
90 
91 #if AF_API_VERSION >= 34
92 
99  AFAPI array sparseConvertTo(const array in, const af::storage destStrorage);
100 #endif
101 
102 #if AF_API_VERSION >= 34
103 
111  AFAPI array dense(const array sparse);
112 #endif
113 
114 #if AF_API_VERSION >= 34
115 
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
129 
135  AFAPI array sparseGetValues(const array in);
136 #endif
137 
138 #if AF_API_VERSION >= 34
139 
145  AFAPI array sparseGetRowIdx(const array in);
146 #endif
147 
148 #if AF_API_VERSION >= 34
149 
155  AFAPI array sparseGetColIdx(const array in);
156 #endif
157 
158 #if AF_API_VERSION >= 34
159 
165  AFAPI dim_t sparseGetNNZ(const array in);
166 #endif
167 
168 #if AF_API_VERSION >= 34
169 
176 #endif
177 }
178 #endif
179 
180 #ifdef __cplusplus
181 extern "C" {
182 #endif
183 
184 #if AF_API_VERSION >= 34
185 
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
213 
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
247 
259  af_array *out, const af_array dense,
260  const af_storage stype);
261 #endif
262 
263 #if AF_API_VERSION >= 34
264 
274  const af_storage destStorage);
275 #endif
276 
277 #if AF_API_VERSION >= 34
278 
287 #endif
288 
289 #if AF_API_VERSION >= 34
290 
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
306 
315 #endif
316 
317 #if AF_API_VERSION >= 34
318 
327 #endif
328 
329 #if AF_API_VERSION >= 34
330 
339 #endif
340 
341 #if AF_API_VERSION >= 34
342 
350  AFAPI af_err af_sparse_get_nnz(dim_t *out, const af_array in);
351 #endif
352 
353 #if AF_API_VERSION >= 34
354 
363 #endif
364 
365 #ifdef __cplusplus
366 }
367 #endif
af::sparseGetColIdx
AFAPI array sparseGetColIdx(const array in)
af_source
af_source
Definition: defines.h:232
af_sparse_get_col_idx
AFAPI af_err af_sparse_get_col_idx(af_array *out, const af_array in)
dim_t
long long dim_t
Definition: defines.h:56
af_sparse_convert_to
AFAPI af_err af_sparse_convert_to(af_array *out, const af_array in, const af_storage destStorage)
af::dtype
af_dtype dtype
Definition: defines.h:549
AFAPI
#define AFAPI
Definition: defines.h:38
afHost
@ afHost
Host pointer.
Definition: defines.h:234
af
Definition: algorithm.h:14
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::sparse
AFAPI array sparse(const array dense, const af::storage stype=AF_STORAGE_CSR)
This function converts a dense af::array 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_array
void * af_array
Definition: defines.h:240
af::sparseConvertTo
AFAPI array sparseConvertTo(const array in, const af::storage destStrorage)
af_dtype
af_dtype
Definition: defines.h:210
af_sparse_get_values
AFAPI af_err af_sparse_get_values(af_array *out, const af_array in)
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.
afcl::array
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
af::sparseGetStorage
AFAPI af::storage sparseGetStorage(const array in)
af::sparseGetValues
AFAPI array sparseGetValues(const array in)
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_get_storage
AFAPI af_err af_sparse_get_storage(af_storage *out, const af_array in)
AF_STORAGE_CSR
@ AF_STORAGE_CSR
Storage type is CSR.
Definition: defines.h:491
af::sparseGetRowIdx
AFAPI array sparseGetRowIdx(const array in)
af::sparseGetInfo
AFAPI void sparseGetInfo(array &values, array &rowIdx, array &colIdx, af::storage &stype, const array in)
af::dense
AFAPI array dense(const array sparse)
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::sparseGetNNZ
AFAPI dim_t sparseGetNNZ(const array in)
af_sparse_to_dense
AFAPI af_err af_sparse_to_dense(af_array *out, const af_array sparse)
af_sparse_get_row_idx
AFAPI af_err af_sparse_get_row_idx(af_array *out, const af_array in)
af_storage
af_storage
Definition: defines.h:489
af_err
af_err
Definition: defines.h:71
defines.h
f32
@ f32
32-bit floating point values
Definition: defines.h:211
af_sparse_get_nnz
AFAPI af_err af_sparse_get_nnz(dim_t *out, const af_array in)