Template Class CSCArray

Class Documentation

template<typename T>
class CSCArray

Public Functions

CSCArray()

Construct a new empty Sparse Col Array object.

CSCArray(CArray<T> array, CArray<size_t> row_index, CArray<size_t> start_index, size_t dim1, size_t dim2)

Construct a new Sparse Col Array object.

Parameters
  • array – 1d array of data values in order as read top to bottom, left to right

  • row_index – 1d array that marks what row each element is in

  • start_index – 1d array that marks where the first element of each column starts

  • dim1 – number of rows the matrix should have

  • dim2 – number of columns the matrix should have

T &operator()(size_t i, size_t j) const

Access A(i,j). Returns a dummy address with value 0 if A(i,j) is not allocated.

Parameters
  • i – : row

  • j – : column

Returns

T& : address of array_ that corresponds to A(i,j)

CSCArray &operator=(const CSCArray &temp)

Overloaded copy operator.

Parameters

temp – : Array to copy

Returns

CSCArray&

T *pointer() const
size_t stride(size_t i) const

Same functionality as nnz(i) included for compatibility with the rest of matar.

Parameters

i – : row

Returns

size_t

T &value(size_t i, size_t j) const

Same functionality as operator() included for compatibility with the rest of matar.

Parameters
  • i – row

  • j – column

Returns

T&

size_t *get_starts() const

Get the start_index array.

Returns

size_t* : returns start_index_

size_t dim1() const

Get number of rows.

Returns

size_t number of rows

size_t dim2() const

Get number of columns.

Returns

size_t number of columns

T *begin(size_t i)

iterator notation for iterating through the non zeros values of row i.

Parameters

i – : row

Returns

T*

T *end(size_t i)

iterator notation for iterating through the non zeros values of row i.

Parameters

i – : row

Returns

T*

size_t begin_index(size_t i)
size_t end_index(size_t i)
size_t nnz(size_t i)

Get the number of non zero elements in row i.

Parameters

i – : row to get

Returns

size_t : size of row

size_t nnz()

Get number of non zero elements total in array.

Returns

size_t

T &get_val_flat(size_t k)
size_t get_row_flat(size_t k)
int flat_index(size_t i, size_t j)
int toCSR(CArray<T> &data, CArray<size_t> &row_ptrs, CArray<size_t> &col_ptrs)
void to_dense(FArray<T> &A)
~CSCArray()