Do more. Code less. Free software for GPU computing.
<scroll to top>

Generate Sparse Matrices

Sparse Matrices

Requires ArrayFire Pro. More...

Construct sparse matrix from pointers

Parameters:
[in]rowsNumber of rows in the matrix
[in]colsNumber of columns in the Matrix
[in]nnzNumber of non zero elements
[in]valuesArray containing nonzero values
[in]rowptrRow indices in CSR format
[in]colindColumn indices in CSR format
[in]srcSpecify if pointers are from Host (default) or device
[in]ngforThe gfor tile size (default 0)
Returns:
out A sparse array of size(m, n). out.dims(2) returns nnz;

array sparse (int rows, int cols, int nnz, const float *values, const int *rowptr, const int *colind, af_source_t src=afHostPointer, unsigned ngfor=0)
array sparse (int rows, int cols, int nnz, const double *values, const int *rowptr, const int *colind, af_source_t src=afHostPointer, unsigned ngfor=0)
array sparse (int rows, int cols, int nnz, const cuComplex *values, const int *rowptr, const int *colind, af_source_t src=afHostPointer, unsigned ngfor=0)
array sparse (int rows, int cols, int nnz, const cuDComplex *values, const int *rowptr, const int *colind, af_source_t src=afHostPointer, unsigned ngfor=0)

Construct sparse matrix from Dense

Parameters:
[in]denseMatrix stored as dense
Returns:
out A sparse matrix stored in CSR format

array sparse (array dense)

Construct sparse matrix from arrays

Parameters:
[in]IArray containing row indices
[in]JArray containing column indices
[in]valArray containing non zero values
[in]rowsNumber of rows (default -1. Uses max(I) for COO, I.elements() - 1 for CSR)
[in]colsNumber of columns (default -1. Uses max(J))
[in]formatThe format of I, J, val (default: COO)

array sparse (array &I, array &J, array &val, int rows=-1, int cols=-1, af_sparse_t format=AF_SP_COO)

Detailed Description

Requires ArrayFire Pro.


Function Documentation

array af::sparse ( int  rows,
int  cols,
int  nnz,
const float *  values,
const int *  rowptr,
const int *  colind,
af_source_t  src = afHostPointer,
unsigned  ngfor = 0 
)
array af::sparse ( int  rows,
int  cols,
int  nnz,
const double *  values,
const int *  rowptr,
const int *  colind,
af_source_t  src = afHostPointer,
unsigned  ngfor = 0 
)
array af::sparse ( int  rows,
int  cols,
int  nnz,
const cuComplex *  values,
const int *  rowptr,
const int *  colind,
af_source_t  src = afHostPointer,
unsigned  ngfor = 0 
)
array af::sparse ( int  rows,
int  cols,
int  nnz,
const cuDComplex values,
const int *  rowptr,
const int *  colind,
af_source_t  src = afHostPointer,
unsigned  ngfor = 0 
)
array af::sparse ( array  dense)
array af::sparse ( array &  I,
array &  J,
array &  val,
int  rows = -1,
int  cols = -1,
af_sparse_t  format = AF_SP_COO 
)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines