Commit c2ee4999 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Added constructors with segments sizes to segments and added insertion...

Added constructors with segments sizes to segments and added insertion operators of segments to out streams.
parent fddebacf
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -44,7 +44,12 @@ class BiEllpack

      BiEllpack() = default;

      BiEllpack(const Containers::Vector<IndexType, DeviceType, IndexType> &sizes);
      template< typename SizesContainer >
      BiEllpack( const SizesContainer& sizes );

      template< typename ListIndex >
      BiEllpack( const std::initializer_list< ListIndex >& segmentsSizes );


      BiEllpack(const BiEllpack &segments);

@@ -180,6 +185,14 @@ class BiEllpack
      friend class BiEllpack;
};

template <typename Device,
          typename Index,
          typename IndexAllocator,
          ElementsOrganization Organization,
          int WarpSize >
std::ostream& operator<<( std::ostream& str, const BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >& segments ) { return printSegments( str, segments ); }


      } // namespace Segments
   }    // namespace Algorithms
} // namespace TNL
+15 −2
Original line number Diff line number Diff line
@@ -26,10 +26,23 @@ template< typename Device,
          typename IndexAllocator,
          ElementsOrganization Organization,
          int WarpSize >
   template< typename SizesContainer >
BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
BiEllpack( const Containers::Vector< IndexType, DeviceType, IndexType >& sizes )
BiEllpack( const SizesContainer& segmentsSizes )
{
   this->setSegmentsSizes( sizes );
   this->setSegmentsSizes( segmentsSizes );
}

template< typename Device,
          typename Index,
          typename IndexAllocator,
          ElementsOrganization Organization,
          int WarpSize >
   template< typename ListIndex >
BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >::
BiEllpack( const std::initializer_list< ListIndex >& segmentsSizes )
{
   this->setSegmentsSizes( Containers::Vector< IndexType, DeviceType, IndexType >( segmentsSizes ) );
}

template< typename Device,
+8 −0
Original line number Diff line number Diff line
@@ -210,6 +210,14 @@ class BiEllpackView
      friend struct details::BiEllpackreduceSegmentsDispatcher;
#endif
};

template <typename Device,
          typename Index,
          ElementsOrganization Organization,
          int WarpSize >
std::ostream& operator<<( std::ostream& str, const BiEllpackView< Device, Index, Organization, WarpSize >& segments ) { return printSegments( str, segments ); }


      } // namespace Segments
   }  // namespace Algorithms
} // namespace TNL
+20 −2
Original line number Diff line number Diff line
@@ -21,6 +21,14 @@ namespace TNL {
   namespace Algorithms {
      namespace Segments {

/**
 * \brief Segments data structure based on CSR format.
 *
 * \tparam Device 
 * \tparam Index 
 * \tparam CSRScalarKernel< Index, Device > 
 * \tparam Allocator< Index > 
 */
template< typename Device,
          typename Index,
          typename Kernel = CSRScalarKernel< Index, Device >,
@@ -46,7 +54,11 @@ class CSR

      CSR();

      CSR( const SegmentsSizes& sizes );
      template< typename SizesContainer >
      CSR( const SizesContainer& sizes );

      template< typename ListIndex >
      CSR( const std::initializer_list< ListIndex >& segmentsSizes );

      CSR( const CSR& segments );

@@ -59,7 +71,7 @@ class CSR
      /**
       * \brief Set sizes of particular segments.
       */
      template< typename SizesHolder = OffsetsHolder >
      template< typename SizesHolder >
      void setSegmentsSizes( const SizesHolder& sizes );

      void reset();
@@ -145,6 +157,12 @@ class CSR
      KernelType kernel;
};

template< typename Device,
          typename Index,
          typename Kernel,
          typename IndexAllocator >
std::ostream& operator<<( std::ostream& str, const CSR< Device, Index, Kernel, IndexAllocator >& segments ) { return printSegments( segments, str ); }

template< typename Device,
          typename Index,
          typename IndexAllocator = typename Allocators::Default< Device >::template Allocator< Index > >
+13 −1
Original line number Diff line number Diff line
@@ -33,12 +33,24 @@ template< typename Device,
          typename Index,
          typename Kernel,
          typename IndexAllocator >
   template< typename SizesContainer >
CSR< Device, Index, Kernel, IndexAllocator >::
CSR( const SegmentsSizes& segmentsSizes )
CSR( const SizesContainer& segmentsSizes )
{
   this->setSegmentsSizes( segmentsSizes );
}

template< typename Device,
          typename Index,
          typename Kernel,
          typename IndexAllocator >
   template< typename ListIndex >
CSR< Device, Index, Kernel, IndexAllocator >::
CSR( const std::initializer_list< ListIndex >& segmentsSizes )
{
   this->setSegmentsSizes( Containers::Vector< IndexType, DeviceType, IndexType >( segmentsSizes ) );
}

template< typename Device,
          typename Index,
          typename Kernel,
Loading