|
|
using | ConstViewType = CSRView< Device, std::add_const_t< Index > > |
| | Type of constant segments view.
|
|
using | IndexAllocatorType = IndexAllocator |
|
using | OffsetsContainer = Containers::Vector< Index, Device, typename Base::IndexType, IndexAllocator > |
| | Type of container storing offsets of particular segments.
|
| template<typename Device_ = Device, typename Index_ = Index, typename IndexAllocator_ = typename Allocators::Default< Device_ >::template Allocator< Index_ >> |
| using | Self = CSR< Device_, Index_, IndexAllocator_ > |
| | Templated type for creating CSR segments with different template parameters.
|
| template<typename Device_, typename Index_> |
| using | ViewTemplate = CSRView< Device_, Index_ > |
| | Templated view type.
|
|
using | ViewType = CSRView< Device, Index > |
| | Type of segments view.
|
|
using | ConstOffsetsView = typename OffsetsView::ConstViewType |
| | The type for representing the constant vector view with segment offsets used in the CSR format.
|
|
using | DeviceType = Device |
| | The device where the segments are operating.
|
|
using | IndexType = std::remove_const_t< Index > |
| | The type used for indexing of segments elements.
|
|
using | OffsetsView = Containers::VectorView< Index, DeviceType, IndexType > |
| | The type for representing the vector view with segment offsets used in the CSR format.
|
|
using | SegmentViewType = SegmentView< IndexType, RowMajorOrder > |
| | Accessor type for one particular segment.
|
|
|
| CSR () |
| | Constructor with no parameters to create empty segments.
|
|
| CSR (const CSR &segments) |
| | Copy constructor (makes deep copy).
|
| template<typename SizesContainer, std::enable_if_t< IsArrayType< SizesContainer >::value, bool > = true> |
| | CSR (const SizesContainer &segmentsSizes) |
| | Constructor that initializes segments based on their sizes.
|
| template<typename ListIndex> |
| | CSR (const std::initializer_list< ListIndex > &segmentsSizes) |
| | Constructor that initializes segments using an initializer list.
|
|
| CSR (CSR &&) noexcept=default |
| | Move constructor.
|
|
ConstViewType | getConstView () const |
| | Returns a constant view for this instance of segments which can by used for example in lambda functions running in GPU kernels.
|
|
ViewType | getView () |
| | Returns a view for this instance of segments which can by used for example in lambda functions running in GPU kernels.
|
| void | load (File &file) |
| | Method for loading the segments from a file in a binary form.
|
|
CSR & | operator= (const CSR &segments) |
| | Copy-assignment operator (makes a deep copy).
|
| template<typename Device_, typename Index_, typename IndexAllocator_> |
| CSR & | operator= (const CSR< Device_, Index_, IndexAllocator_ > &segments) |
| | Assignment operator for segments with different template parameters.
|
|
CSR & | operator= (CSR &&) noexcept(false) |
| | Move-assignment operator.
|
|
void | reset () |
| | Reset the segments to empty states (it means that there is no segment in the segments).
|
| void | save (File &file) const |
| | Method for saving the segments to a file in a binary form.
|
| template<typename SizesContainer> |
| void | setSegmentsSizes (const SizesContainer &segmentsSizes) |
| | Set sizes of particular segments.
|
|
__cuda_callable__ | CSRBase ()=default |
| | Default constructor with no parameters to create empty segments view.
|
|
__cuda_callable__ | CSRBase (const CSRBase &)=default |
| | Copy constructor.
|
|
__cuda_callable__ | CSRBase (const OffsetsView &offsets) |
| | Binds a new CSR view to an offsets vector.
|
|
__cuda_callable__ | CSRBase (CSRBase &&) noexcept=default |
| | Move constructor.
|
|
__cuda_callable__ | CSRBase (OffsetsView &&offsets) |
| | Binds a new CSR view to an offsets vector.
|
| template<typename Function> |
| void | forAllElements (Function function) const |
| | Call TNL::Algorithms::Segments::CSR::forElements for all elements of the segments.
|
|
template<typename Condition, typename Function> |
| void | forAllElementsIf (Condition condition, Function function) const |
| template<typename Function> |
| void | forAllSegments (Function &&function) const |
| | Call TNL::Algorithms::Segments::CSR::forSegments for all segments.
|
|
template<typename Array, typename Function> |
| void | forElements (const Array &segmentIndexes, Function function) const |
|
template<typename Array, typename Function> |
| void | forElements (const Array &segmentIndexes, Index begin, Index end, Function function) const |
| template<typename Function> |
| void | forElements (IndexType begin, IndexType end, Function function) const |
| | Iterate over all elements of given segments in parallel and call given lambda function.
|
|
template<typename Condition, typename Function> |
| void | forElementsIf (IndexType begin, IndexType end, Condition condition, Function function) const |
| template<typename Function> |
| void | forSegments (IndexType begin, IndexType end, Function &&function) const |
| | Iterate over all segments in parallel and call given lambda function.
|
|
__cuda_callable__ IndexType | getElementCount () const |
| | Returns the number of elements managed by all segments.
|
| __cuda_callable__ IndexType | getGlobalIndex (Index segmentIdx, Index localIdx) const |
| | Computes the global index of an element managed by the segments.
|
|
__cuda_callable__ OffsetsView | getOffsets () |
| | Returns a modifiable vector view with segment offsets used in the CSR format.
|
|
__cuda_callable__ ConstOffsetsView | getOffsets () const |
| | Returns a constant vector view with segment offsets used in the CSR format.
|
|
__cuda_callable__ IndexType | getSegmentCount () const |
| | Returns the number of segments.
|
|
__cuda_callable__ IndexType | getSegmentsCount () const |
| | Returns the number of segments. Deprecated, use getSegmentCount().
|
|
__cuda_callable__ IndexType | getSegmentSize (IndexType segmentIdx) const |
| | Returns the size of a particular segment denoted by segmentIdx.
|
| __cuda_callable__ SegmentViewType | getSegmentView (IndexType segmentIdx) const |
| | Returns a segment view (i.e., a segment accessor) for the specified segment index.
|
|
__cuda_callable__ IndexType | getSize () const |
| | Returns the number of elements managed by all segments.
|
|
__cuda_callable__ IndexType | getStorageSize () const |
| | Returns number of elements that needs to be allocated by a container connected to this segments.
|
|
CSRBase & | operator= (const CSRBase &)=delete |
| | Copy-assignment operator.
|
|
CSRBase & | operator= (CSRBase &&)=delete |
| | Move-assignment operator.
|
| template<typename Function> |
| void | sequentialForAllSegments (Function &&function) const |
| | Call TNL::Algorithms::Segments::CSR::sequentialForSegments for all segments.
|
| template<typename Function> |
| void | sequentialForSegments (IndexType begin, IndexType end, Function &&function) const |
| | Call TNL::Algorithms::Segments::CSR::forSegments sequentially for particular segments.
|
template<typename Device, typename Index, typename IndexAllocator = typename Allocators::Default< Device >::template Allocator< Index >>
class TNL::Algorithms::Segments::CSR< Device, Index, IndexAllocator >
Data structure for CSR segments.
CSR segments are inspired by the Compressed Sparse Row (CSR) format, which is widely used for storing sparse matrices. It is the most popular format due to its versatility, making it the preferred choice for segment representation.
See TNL::Algorithms::Segments for more details about segments.
- Template Parameters
-
| Device | The type of device on which the segments will operate. |
| Index | The type used for indexing elements managed by the segments. |
| IndexAllocator | The allocator used for managing index containers. |