Function arrayfire::sparse [] [src]

pub fn sparse(
    rows: u64,
    cols: u64,
    values: &Array,
    row_indices: &Array,
    col_indices: &Array,
    format: SparseFormat
) -> Array

Create sprase matrix from arrays

This function converts Array of values into sparse array of format sparse format using arrays row_indices and col_indices.

Parameters

  • rows is the number of rows in the dense matrix
  • cols is the number of columns in the dense matrix
  • values is the \ref af::array containing the non-zero elements `of the matrix
  • row_indices is the row indices for the sparse array
  • col_indices is the column indices for the sparse array
  • format is the storage format of the sparse array

Return Values

Array with data in given sparse format

Note

This function only uses references of the input arrays to create the sparse data structure and does not perform deep copies.