alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
alpaka::Vec< TDim, TVal > Class Template Reference

A n-dimensional vector. More...

#include <Vec.hpp>

Public Types

using Dim = TDim
 
using Val = TVal
 
using value_type = Val
 STL-like value_type.
 

Public Member Functions

ALPAKA_FN_HOST_ACC constexpr Vec ()
 
template<typename F , std::enable_if_t< std::is_invocable_v< F, std::integral_constant< std::size_t, 0 > >, int > = 0>
ALPAKA_FN_HOST_ACC constexpr Vec (F &&generator)
 Generator constructor. Initializes the vector with the values returned from generator(IC) in order, where IC::value runs from 0 to TDim - 1 (inclusive).
 
template<typename... TArgs, typename = std::enable_if_t< sizeof...(TArgs) == TDim::value && (std::is_convertible_v<std::decay_t<TArgs>, TVal> && ...)>>
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC constexpr Vec (TArgs &&... args)
 Value constructor. This constructor is only available if the number of parameters matches the vector idx.
 
ALPAKA_FN_HOST_ACC constexpr auto back () -> TVal &
 
ALPAKA_FN_HOST_ACC constexpr auto back () const -> TVal const &
 
ALPAKA_FN_HOST_ACC constexpr auto begin () -> TVal *
 
ALPAKA_FN_HOST_ACC constexpr auto begin () const -> TVal const *
 
ALPAKA_FN_HOST_ACC constexpr auto end () -> TVal *
 
ALPAKA_FN_HOST_ACC constexpr auto end () const -> TVal const *
 
ALPAKA_FN_HOST_ACC constexpr auto front () -> TVal &
 
ALPAKA_FN_HOST_ACC constexpr auto front () const -> TVal const &
 

Static Public Member Functions

ALPAKA_NO_HOST_ACC_WARNING static ALPAKA_FN_HOST_ACC constexpr auto all (TVal const &val) -> Vec< TDim, TVal >
 Single value constructor.
 
ALPAKA_NO_HOST_ACC_WARNING static ALPAKA_FN_HOST_ACC constexpr auto ones () -> Vec< TDim, TVal >
 One value constructor.
 
ALPAKA_NO_HOST_ACC_WARNING static ALPAKA_FN_HOST_ACC constexpr auto zeros () -> Vec< TDim, TVal >
 Zero value constructor.
 

Public Attributes

 int
 

Detailed Description

template<typename TDim, typename TVal>
class alpaka::Vec< TDim, TVal >

A n-dimensional vector.

Definition at line 37 of file Vec.hpp.

Member Typedef Documentation

◆ Dim

template<typename TDim , typename TVal >
using alpaka::Vec< TDim, TVal >::Dim = TDim

Definition at line 42 of file Vec.hpp.

◆ Val

template<typename TDim , typename TVal >
using alpaka::Vec< TDim, TVal >::Val = TVal

Definition at line 43 of file Vec.hpp.

◆ value_type

template<typename TDim , typename TVal >
using alpaka::Vec< TDim, TVal >::value_type = Val

STL-like value_type.

Definition at line 44 of file Vec.hpp.

Constructor & Destructor Documentation

◆ Vec() [1/3]

template<typename TDim , typename TVal >
ALPAKA_FN_HOST_ACC constexpr alpaka::Vec< TDim, TVal >::Vec ( )
inlineconstexpr

Definition at line 52 of file Vec.hpp.

◆ Vec() [2/3]

template<typename TDim , typename TVal >
template<typename... TArgs, typename = std::enable_if_t< sizeof...(TArgs) == TDim::value && (std::is_convertible_v<std::decay_t<TArgs>, TVal> && ...)>>
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC constexpr alpaka::Vec< TDim, TVal >::Vec ( TArgs &&...  args)
inlineconstexpr

Value constructor. This constructor is only available if the number of parameters matches the vector idx.

Definition at line 63 of file Vec.hpp.

◆ Vec() [3/3]

template<typename TDim , typename TVal >
template<typename F , std::enable_if_t< std::is_invocable_v< F, std::integral_constant< std::size_t, 0 > >, int > = 0>
ALPAKA_FN_HOST_ACC constexpr alpaka::Vec< TDim, TVal >::Vec ( F &&  generator)
inlineexplicitconstexpr

Generator constructor. Initializes the vector with the values returned from generator(IC) in order, where IC::value runs from 0 to TDim - 1 (inclusive).

Definition at line 71 of file Vec.hpp.

Member Function Documentation

◆ all()

template<typename TDim , typename TVal >
ALPAKA_NO_HOST_ACC_WARNING static ALPAKA_FN_HOST_ACC constexpr auto alpaka::Vec< TDim, TVal >::all ( TVal const &  val) -> Vec<TDim, TVal>
inlinestaticconstexpr

Single value constructor.

Creates a vector with all values set to val.

Parameters
valThe initial value.

Definition at line 89 of file Vec.hpp.

◆ back() [1/2]

template<typename TDim , typename TVal >
ALPAKA_FN_HOST_ACC constexpr auto alpaka::Vec< TDim, TVal >::back ( ) -> TVal&
inlineconstexpr

Definition at line 141 of file Vec.hpp.

◆ back() [2/2]

template<typename TDim , typename TVal >
ALPAKA_FN_HOST_ACC constexpr auto alpaka::Vec< TDim, TVal >::back ( ) const -> TVal const&
inlineconstexpr

Definition at line 146 of file Vec.hpp.

◆ begin() [1/2]

template<typename TDim , typename TVal >
ALPAKA_FN_HOST_ACC constexpr auto alpaka::Vec< TDim, TVal >::begin ( ) -> TVal*
inlineconstexpr

Definition at line 111 of file Vec.hpp.

◆ begin() [2/2]

template<typename TDim , typename TVal >
ALPAKA_FN_HOST_ACC constexpr auto alpaka::Vec< TDim, TVal >::begin ( ) const -> TVal const*
inlineconstexpr

Definition at line 116 of file Vec.hpp.

◆ end() [1/2]

template<typename TDim , typename TVal >
ALPAKA_FN_HOST_ACC constexpr auto alpaka::Vec< TDim, TVal >::end ( ) -> TVal*
inlineconstexpr

Definition at line 121 of file Vec.hpp.

◆ end() [2/2]

template<typename TDim , typename TVal >
ALPAKA_FN_HOST_ACC constexpr auto alpaka::Vec< TDim, TVal >::end ( ) const -> TVal const*
inlineconstexpr

Definition at line 126 of file Vec.hpp.

◆ front() [1/2]

template<typename TDim , typename TVal >
ALPAKA_FN_HOST_ACC constexpr auto alpaka::Vec< TDim, TVal >::front ( ) -> TVal&
inlineconstexpr

Definition at line 131 of file Vec.hpp.

◆ front() [2/2]

template<typename TDim , typename TVal >
ALPAKA_FN_HOST_ACC constexpr auto alpaka::Vec< TDim, TVal >::front ( ) const -> TVal const&
inlineconstexpr

Definition at line 136 of file Vec.hpp.

◆ ones()

template<typename TDim , typename TVal >
ALPAKA_NO_HOST_ACC_WARNING static ALPAKA_FN_HOST_ACC constexpr auto alpaka::Vec< TDim, TVal >::ones ( ) -> Vec<TDim, TVal>
inlinestaticconstexpr

One value constructor.

Definition at line 106 of file Vec.hpp.

◆ zeros()

template<typename TDim , typename TVal >
ALPAKA_NO_HOST_ACC_WARNING static ALPAKA_FN_HOST_ACC constexpr auto alpaka::Vec< TDim, TVal >::zeros ( ) -> Vec<TDim, TVal>
inlinestaticconstexpr

Zero value constructor.

Definition at line 99 of file Vec.hpp.

Member Data Documentation

◆ int

template<typename TDim , typename TVal >
alpaka::Vec< TDim, TVal >::int
Initial value:
= 0>
ALPAKA_FN_HOST_ACC constexpr decltype(auto) x()
{
return m_data[Dim::value - 1];
}
template<typename TDefer = Dim
TDim Dim
Definition Vec.hpp:42
#define ALPAKA_FN_HOST_ACC
Definition Common.hpp:39

Definition at line 161 of file Vec.hpp.


The documentation for this class was generated from the following file: