|
Template Numerical Library version\ main:4e6e2c1
|
SortedSegmentsBase serves as a base class for TNL::Algorithms::Segments::SortedSegments and TNL::Algorithms::Segments::SortedSegmentsView. More...
#include <TNL/Algorithms/Segments/SortedSegmentsBase.h>
Public Types | |
| using | ConstPermutationView = typename Containers::VectorView< std::add_const_t< IndexType >, DeviceType, IndexType > |
| using | DeviceType = typename EmbeddedSegmentsView::DeviceType |
| The device where the segments are operating. | |
| using | EmbeddedSegmentsConstView = typename EmbeddedSegmentsView::ConstViewType |
| using | EmbeddedSegmentsView = EmbeddedSegmentsView_ |
| using | IndexType = typename EmbeddedSegmentsView::IndexType |
| The type used for indexing of segments elements. | |
| using | PermutationView = typename Containers::VectorView< IndexType, DeviceType, IndexType > |
| using | SegmentViewType = typename EmbeddedSegmentsView::SegmentViewType |
| Accessor type for one particular segment. | |
Public Member Functions | |
| __cuda_callable__ | SortedSegmentsBase ()=default |
| Default constructor with no parameters to create empty segments view. | |
| __cuda_callable__ | SortedSegmentsBase (const SortedSegmentsBase &)=default |
| Copy constructor. | |
| __cuda_callable__ | SortedSegmentsBase (SortedSegmentsBase &&) noexcept=default |
| Move constructor. | |
| __cuda_callable__ IndexType | getElementCount () const |
| Returns the number of elements managed by all segments. | |
| __cuda_callable__ EmbeddedSegmentsView | getEmbeddedSegmentsView () |
| __cuda_callable__ EmbeddedSegmentsConstView | getEmbeddedSegmentsView () const |
| __cuda_callable__ IndexType | getGlobalIndex (IndexType segmentIdx, IndexType localIdx) const |
| Computes the global index of an element managed by the segments. | |
| __cuda_callable__ PermutationView | getInverseSegmentsPermutationView () |
| Returns a modifiable vector view with inverse segments permutation. | |
| __cuda_callable__ ConstPermutationView | getInverseSegmentsPermutationView () const |
| Returns a constant vector view with inverse segments permutation.. | |
| __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__ PermutationView | getSegmentsPermutationView () |
| Returns a modifiable vector view with segments permutation. | |
| __cuda_callable__ ConstPermutationView | getSegmentsPermutationView () const |
| Returns a constant vector view with segments permutation.. | |
| __cuda_callable__ SegmentViewType | getSegmentView (IndexType segmentIdx) const |
| Returns a segment view (i.e., a segment accessor) for the specified segment index. | |
| __cuda_callable__ IndexType | getSigma () const |
| Gets the value of sigma. | |
| __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. | |
| SortedSegmentsBase & | operator= (const SortedSegmentsBase &)=delete |
| Copy-assignment operator. | |
| SortedSegmentsBase & | operator= (SortedSegmentsBase &&)=delete |
| Move-assignment operator. | |
| __cuda_callable__ void | setSigma (IndexType value) |
| Sets the value of sigma. | |
Static Public Member Functions | |
| static constexpr ElementsOrganization | getOrganization () |
| Returns the data layout (it is always row-major order). | |
| static std::string | getSegmentsType () |
| Returns string with the segments type. | |
| static std::string | getSerializationType () |
| Returns string with the serialization type. | |
| static constexpr bool | havePadding () |
| This function denotes if the underlying segments use the padding elements. | |
Protected Member Functions | |
| __cuda_callable__ void | bind (const EmbeddedSegmentsView &embeddedSegmentsView, const PermutationView &segmentsPermutation, const PermutationView &inverseSegmentsPermutation) |
| Re-initializes the internal attributes of the base class. | |
Protected Attributes | |
| EmbeddedSegmentsView | embeddedSegmentsView |
| PermutationView | inverseSegmentsPermutationView |
| PermutationView | segmentsPermutationView |
| Vector view with the segments permutation. | |
| IndexType | sigma = -1 |
SortedSegmentsBase serves as a base class for TNL::Algorithms::Segments::SortedSegments and TNL::Algorithms::Segments::SortedSegmentsView.
The sorted segments are inspired by SELL-C-sigma sparse matrix storage format:
Kreutzer, Moritz, et al. "A unified sparse matrix data format for efficient general sparse matrix-vector multiplication on modern processors with wide SIMD units." SIAM Journal on Scientific Computing 36.5 (2014): C401-C423.
| EmbeddedSegments | is a type of segments used to manage the data. |
|
protected |
Re-initializes the internal attributes of the base class.
Note that this function is protected to ensure that the user cannot modify the base class of segments. For the same reason, in future code development we also need to make sure that all non-const functions in the base class return by value and not by reference.
|
nodiscard |
Computes the global index of an element managed by the segments.
The global index serves as a reference to the element within its container.
| segmentIdx | The index of the segment containing the element. |
| localIdx | The local index of the element within the segment. |
|
staticnodiscard |
Returns string with the segments type.
|
nodiscard |
Returns a segment view (i.e., a segment accessor) for the specified segment index.
| segmentIdx | The index of the requested segment. |
|
staticnodiscard |
Returns string with the serialization type.