File view_matrix_csr_binary.hpp

Typedefs

typedef BinaryCsrViewAllocator<BinaryCsrView> AllocatedBinaryCsrView

Allocates the memory, a BinaryCsrView provides access to

class BinaryCsrView : public BinarySparseMatrix
#include <view_matrix_csr_binary.hpp>

A two-dimensional view that provides row-wise access to binary values stored in a matrix in the compressed sparse row (CSR) format.

Public Types

typedef const Vector<const uint32> const_row

Provides read-only access to an individual row in the view.

typedef Vector<uint32> row

Provides access to an individual row in the view and allows to modify it.

Public Functions

inline BinaryCsrView(uint32 *indices, uint32 *indptr, uint32 numRows, uint32 numCols)
Parameters:
  • indices – A pointer to an array of type uint32, shape (numNonZeroValues), that stores the column indices, the values in the matrix correspond to

  • indptr – A pointer to an array of type uint32, shape (numRows + 1), that stores the indices of the first element in indices that corresponds to a certain row. The index at the last position must be equal to numNonZeroValues

  • numRows – The number of rows in the view

  • numCols – The number of columns in the view

inline BinaryCsrView(const BinaryCsrView &other)
Parameters:

other – A const reference to an object of type BinaryCsrView that should be copied

inline BinaryCsrView(BinaryCsrView &&other)
Parameters:

other – A reference to an object of type BinaryCsrView that should be moved

inline virtual ~BinaryCsrView() override
inline const_row operator[](uint32 row) const

Creates and returns a view that provides read-only access to a specific row in the view.

Parameters:

row – The index of the row

Returns:

An object of type const_row that has been created

inline row operator[](uint32 row)

Creates and returns a view that provides access to a specific row in the view and allows to modify it.

Parameters:

row – The index of the row

Returns:

An object of type row that has been created

inline BinarySparseMatrix::index_const_iterator indices_cbegin(uint32 row) const

Returns an index_const_iterator to the beginning of the indices in a specific row of the matrix.

Parameters:

row – The index of the row

Returns:

An index_const_iterator to the beginning of the indices

inline BinarySparseMatrix::index_const_iterator indices_cend(uint32 row) const

Returns an index_const_iterator to the end of the indices in a specific row of the matrix.

Parameters:

row – The index of the row

Returns:

An index_const_iterator to the end of the indices

inline BinarySparseMatrix::index_iterator indices_begin(uint32 row)

Returns an index_iterator to the beginning of the indices in a specific row of the matrix.

Parameters:

row – The index of the row

Returns:

An index_iterator to the beginning of the indices

inline BinarySparseMatrix::index_iterator indices_end(uint32 row)

Returns an index_iterator to the end of the indices in a specific row of the matrix.

Parameters:

row – The index of the row

Returns:

An index_iterator to the end of the indices

inline uint32 getNumNonZeroElements() const

Returns the number of non-zero elements in the view.

Returns:

The number of non-zero elements

template<typename Matrix>
class BinaryCsrViewAllocator : public Matrix
#include <view_matrix_csr_binary.hpp>

Allocates the memory for a two-dimensional view that provides row-wise access to binary values stored in a matrix in the compressed sparse row (CSR) format.

Template Parameters:

Matrix – The type of the view

Subclassed by BinarySparsePredictionView

Public Functions

inline BinaryCsrViewAllocator(uint32 numNonZeroElements, uint32 numRows, uint32 numCols)
Parameters:
  • numNonZeroElements – The number of non-zero values in the view

  • numRows – The number of rows in the view

  • numCols – The number of columns in the view

inline BinaryCsrViewAllocator(const BinaryCsrViewAllocator<Matrix> &other)
Parameters:

other – A reference to an object of type BinaryCsrViewAllocator that should be copied

inline BinaryCsrViewAllocator(BinaryCsrViewAllocator<Matrix> &&other)
Parameters:

other – A reference to an object of type BinaryCsrViewAllocator that should be moved

inline virtual ~BinaryCsrViewAllocator() override