Template Numerical Library: TNL::Algorithms::Segments Namespace Reference

Template Numerical Library version\ main:be7e16d88

Loading...
Searching...
No Matches
Classes | Enumerations | Functions
TNL::Algorithms::Segments Namespace Reference

Namespace for the segments data structures. More...

## Classes
class | BiEllpack
class | BiEllpackBase
class | BiEllpackSegmentView
class | BiEllpackView
class | ChunkedEllpack
class | ChunkedEllpackBase
class | ChunkedEllpackSegmentView
class | ChunkedEllpackSegmentView< Index, ColumnMajorOrder >
class | ChunkedEllpackSegmentView< Index, RowMajorOrder >
class | ChunkedEllpackView
class | CSR
| Data structure for CSR segments format. More...
class | CSRBase
| CSRBase serves as a base class for CSR and CSRView. More...
class | CSRView
| CSRView is provides a non-owning encapsulation of data stored in the CSR segments format. More...
struct | DefaultElementsOrganization
class | Ellpack
class | EllpackBase
class | EllpackView
struct | GrowingSegments
struct | GrowingSegmentsView
class | SegmentElement
| Simple structure representing one element of a segment. More...
class | SegmentView
| Data structure for accessing particular segment. More...
class | SegmentView< Index, ColumnMajorOrder >
| Data structure for accessing particular segment. More...
class | SegmentView< Index, RowMajorOrder >
class | SegmentViewIterator
| Iterator for iterating over elements of a segment. More...
class | SlicedEllpack
class | SlicedEllpackBase
class | SlicedEllpackView

## Enumerations
enum | ElementsOrganization : std::uint8_t { ColumnMajorOrder = 0 , RowMajorOrder }

## Functions
template<typename Device, typename Index, ElementsOrganization Organization, int WarpSize>
std::ostream & | operator<< (std::ostream &str, const BiEllpackBase< Device, Index, Organization, WarpSize > &segments)
template<typename Device, typename Index, ElementsOrganization Organization>
std::ostream & | operator<< (std::ostream &str, const ChunkedEllpackBase< Device, Index, Organization > &segments)
template<typename Device, typename Index>
std::ostream & | operator<< (std::ostream &str, const CSRBase< Device, Index > &segments)
| Insertion operator of CSR segments to output stream.
template<typename Device, typename Index, ElementsOrganization Organization, int Alignment>
std::ostream & | operator<< (std::ostream &str, const EllpackBase< Device, Index, Organization, Alignment > &ellpack)
template<typename Device, typename Index, ElementsOrganization Organization, int SliceSize>
std::ostream & | operator<< (std::ostream &str, const SlicedEllpackBase< Device, Index, Organization, SliceSize > &segments)
template<typename Segments>
std::ostream & | printSegments (std::ostream &str, const Segments &segments)
| Print segments sizes, i.e. the segments setup.
template<typename Segments, typename Fetch>
std::ostream & | printSegments (std::ostream &str, const Segments &segments, Fetch &&fetch)

## Detailed Description

Namespace for the segments data structures.

## Enumeration Type Documentation

## ◆ ElementsOrganization

enum TNL::Algorithms::Segments::ElementsOrganization : std::uint8_t

Enumerator
ColumnMajorOrder | Column-major order.
RowMajorOrder | Row-major order.

## Function Documentation

## ◆ operator<<()

template<typename Device, typename Index>

std::ostream & TNL::Algorithms::Segments::operator<< | ( | std::ostream & | str,
|  | const CSRBase< Device, Index > & | segments )

Insertion operator of CSR segments to output stream.

Template Parameters

  Device | is the device type of the source segments.
  Index | is the index type of the source segments.
  IndexAllocator | is the index allocator of the source segments.

Parameters

  str | is the output stream.
  segments | are the source segments.

Returns
  reference to the output stream.

## ◆ printSegments()

template<typename Segments>

std::ostream & TNL::Algorithms::Segments::printSegments | ( | std::ostream & | str,
|  | const Segments & | segments )

Print segments sizes, i.e. the segments setup.

Template Parameters

  Segments | is type of segments.

Parameters

  segments | is an instance of segments.
  str | is output stream.

Returns
  reference to the output stream.

Example
  #include <iostream>
  #include <TNL/Containers/Vector.h>
  #include <TNL/Algorithms/Segments/CSR.h>
  #include <TNL/Algorithms/Segments/Ellpack.h>
  #include <TNL/Algorithms/Segments/ChunkedEllpack.h>
  #include <TNL/Algorithms/Segments/BiEllpack.h>
  #include <TNL/Devices/Host.h>
  #include <TNL/Devices/Cuda.h>
  template< typename Segments >
  void
  SegmentsExample()
  {
  /***
  * Create segments with given segments sizes and print their setup.
  */
  Segments segments{ 1, 2, 3, 4, 5 };
  std::cout << "Segments sizes are: " << segments << "\n\n";
  }
  int
  main( int argc, char* argv[] )
  {
  std::cout << "Example of CSR segments on host:\n";
  SegmentsExample< TNL::Algorithms::Segments::CSR< TNL::Devices::Host, int > >();
  std::cout << "Example of Ellpack segments on host:\n";
  SegmentsExample< TNL::Algorithms::Segments::Ellpack< TNL::Devices::Host, int > >();
  std::cout << "Example of ChunkedEllpack segments on host:\n";
  SegmentsExample< TNL::Algorithms::Segments::ChunkedEllpack< TNL::Devices::Host, int > >();
  std::cout << "Example of BiEllpack segments on host:\n";
  SegmentsExample< TNL::Algorithms::Segments::BiEllpack< TNL::Devices::Host, int > >();
  #ifdef __CUDACC__
  std::cout << "Example of CSR segments on host:\n";
  SegmentsExample< TNL::Algorithms::Segments::CSR< TNL::Devices::Cuda, int > >();
  std::cout << "Example of Ellpack segments on host:\n";
  SegmentsExample< TNL::Algorithms::Segments::Ellpack< TNL::Devices::Cuda, int > >();
  std::cout << "Example of ChunkedEllpack segments on host:\n";
  SegmentsExample< TNL::Algorithms::Segments::ChunkedEllpack< TNL::Devices::Cuda, int > >();
  std::cout << "Example of BiEllpack segments on host:\n";
  SegmentsExample< TNL::Algorithms::Segments::BiEllpack< TNL::Devices::Cuda, int > >();
  #endif
  return EXIT_SUCCESS;
  }
  std::cout
  TNL::Algorithms::Segments
  Namespace for the segments data structures.
  Definition _NamespaceDoxy.h:7

Output
  Example of CSR segments on host:
  Segments sizes are: [ 1, 2, 3, 4, 5, ]
  Example of Ellpack segments on host:
  Segments sizes are: [ 5, 5, 5, 5, 5, ]
  Example of ChunkedEllpack segments on host:
  Segments sizes are: [ 17, 34, 51, 67, 87, ]
  Example of BiEllpack segments on host:
  Segments sizes are: [ 2, 4, 4, 5, 5, ]