alpaka
Abstraction Library for Parallel Kernel Acceleration
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. More...
 

Public Member Functions

constexpr ALPAKA_FN_HOST_ACC Vec ()
 
template<typename F , std::enable_if_t< std::is_invocable_v< F, std::integral_constant< std::size_t, 0 >>, int > = 0>
constexpr ALPAKA_FN_HOST_ACC 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). More...
 
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 constexpr ALPAKA_FN_HOST_ACC Vec (TArgs &&... args)
 Value constructor. This constructor is only available if the number of parameters matches the vector idx. More...
 
constexpr ALPAKA_FN_HOST_ACC auto back () -> TVal &
 
constexpr ALPAKA_FN_HOST_ACC auto back () const -> TVal const &
 
constexpr ALPAKA_FN_HOST_ACC auto begin () -> TVal *
 
constexpr ALPAKA_FN_HOST_ACC auto begin () const -> TVal const *
 
constexpr ALPAKA_FN_HOST_ACC auto end () -> TVal *
 
constexpr ALPAKA_FN_HOST_ACC auto end () const -> TVal const *
 
constexpr ALPAKA_FN_HOST_ACC auto front () -> TVal &
 
constexpr ALPAKA_FN_HOST_ACC auto front () const -> TVal const &
 

Static Public Member Functions

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

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 >
constexpr ALPAKA_FN_HOST_ACC 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 constexpr ALPAKA_FN_HOST_ACC 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 77 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>
constexpr ALPAKA_FN_HOST_ACC 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 97 of file Vec.hpp.

Member Function Documentation

◆ all()

template<typename TDim , typename TVal >
ALPAKA_NO_HOST_ACC_WARNING static constexpr ALPAKA_FN_HOST_ACC 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 116 of file Vec.hpp.

◆ back() [1/2]

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

Definition at line 168 of file Vec.hpp.

◆ back() [2/2]

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

Definition at line 173 of file Vec.hpp.

◆ begin() [1/2]

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

Definition at line 138 of file Vec.hpp.

◆ begin() [2/2]

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

Definition at line 143 of file Vec.hpp.

◆ end() [1/2]

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

Definition at line 148 of file Vec.hpp.

◆ end() [2/2]

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

Definition at line 153 of file Vec.hpp.

◆ front() [1/2]

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

Definition at line 158 of file Vec.hpp.

◆ front() [2/2]

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

Definition at line 163 of file Vec.hpp.

◆ ones()

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

One value constructor.

Definition at line 133 of file Vec.hpp.

◆ zeros()

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

Zero value constructor.

Definition at line 126 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 188 of file Vec.hpp.


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