sparse.h (2014-04-30 15:38:09 -0400, (build fd32605))
Go to the documentation of this file.
1 #pragma once
2 #include <af/array.h>
3 #include <af/exception.h>
4 
5 namespace af {
6 
8  typedef enum {
12  } af_sparse_t;
13 
15 #define SPARSE(ty) \
16  AFAPI array sparse(const int *row_idx, \
17  const int *col_idx, \
18  const ty *values, \
19  int nrows, int ncols, int nonzero, \
20  af_source_t src=afHost, \
21  unsigned ngfor=0);
22 
39  SPARSE(float);
40  SPARSE(double);
41  SPARSE(cfloat);
42  SPARSE(cdouble);
44 #undef SPARSE
45 
52  AFAPI array sparse(array dense);
54 
67  AFAPI array sparse(array& row_idx, array& col_idx, array& values, int nrows = -1,
68  int ncols = -1, af_sparse_t format = af_coo);
72 
80  AFAPI array dense(array sparse);
82 
90  AFAPI afError where(array& I, array& J, array& Val, array sp, af_sparse_t format = af_coo);
93 
94  AFAPI array getrow(int nrows, int* rows_idx, array sp);
95  AFAPI array getcol(int ncols, int* cols_idx, array sp);
96 };
array where(const array &input)
Indices where nonzero (zero-based indexing).
afError
Definition: defines.h:10
cuDoubleComplex cdouble
Definition: defines.h:109
CSR format.
Definition: sparse.h:9
af_sparse_t
Specify which sparse storage type.
Definition: sparse.h:8
#define SPARSE(ty)
Definition: sparse.h:15
#define AFAPI
Definition: defines.h:45
AFAPI array getrow(int nrows, int *rows_idx, array sp)
AFAPI array sparse(const int *row_idx, const int *col_idx, const float *values, int nrows, int ncols, int nonzero, af_source_t src=afHost, unsigned ngfor=0)
cuFloatComplex cfloat
Definition: defines.h:108
COO format.
Definition: sparse.h:11
AFAPI array getcol(int ncols, int *cols_idx, array sp)
CSC format.
Definition: sparse.h:10
AFAPI array dense(array sparse)