Generate Sparse Matrices

Requires ArrayFire Pro. More...

Construct CSR-format sparse matrix from pointers

Parameters
[in]row_idxRow indices in CSR format
[in]col_idxColumn indices in CSR format
[in]valuesArray containing nonzero values
[in]nrowsNumber of rows in the matrix
[in]ncolsNumber of columns in the Matrix
[in]nonzeroNumber of non zero elements
[in]srcSpecify if pointers are from Host (default) or device
[in]ngforThe gfor tile size (default 0)
Returns
sparse nrows-by-ncols array in af_csr format
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)
 
AFAPI array sparse (const int *row_idx, const int *col_idx, const double *values, int nrows, int ncols, int nonzero, af_source_t src=afHost, unsigned ngfor=0)
 
AFAPI array sparse (const int *row_idx, const int *col_idx, const cfloat *values, int nrows, int ncols, int nonzero, af_source_t src=afHost, unsigned ngfor=0)
 
AFAPI array sparse (const int *row_idx, const int *col_idx, const cdouble *values, int nrows, int ncols, int nonzero, af_source_t src=afHost, unsigned ngfor=0)
 

Construct sparse matrix from Dense

Parameters
[in]denseMatrix stored as dense
Returns
out A sparse matrix stored in CSR format
AFAPI array sparse (array dense)
 

Construct sparse matrix from arrays

Parameters
[in]row_idxrow indices
[in]col_idxcolumn indices
[in]valuesnonzero values
[in]nrowsNumber of rows (default -1 uses max(row_idx) for COO, row_idx.elements()-1 for CSR)
[in]ncolsNumber of columns (default -1 uses max(J))
[in]formatsparse format (default: af_coo)
Returns
sparse nrows-by-ncols array
AFAPI array sparse (array &row_idx, array &col_idx, array &values, int nrows=-1, int ncols=-1, af_sparse_t format=af_coo)
 

Detailed Description

Requires ArrayFire Pro.

Function Documentation

AFAPI array af::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 
)
AFAPI array af::sparse ( const int *  row_idx,
const int *  col_idx,
const double *  values,
int  nrows,
int  ncols,
int  nonzero,
af_source_t  src = afHost,
unsigned  ngfor = 0 
)
AFAPI array af::sparse ( const int *  row_idx,
const int *  col_idx,
const cfloat values,
int  nrows,
int  ncols,
int  nonzero,
af_source_t  src = afHost,
unsigned  ngfor = 0 
)
AFAPI array af::sparse ( const int *  row_idx,
const int *  col_idx,
const cdouble values,
int  nrows,
int  ncols,
int  nonzero,
af_source_t  src = afHost,
unsigned  ngfor = 0 
)
AFAPI array af::sparse ( array  dense)
AFAPI array af::sparse ( array &  row_idx,
array &  col_idx,
array &  values,
int  nrows = -1,
int  ncols = -1,
af_sparse_t  format = af_coo 
)