11 #ifndef CUBBYFLOW_CUDA_STD_ARRAY_IMPL_HPP 12 #define CUBBYFLOW_CUDA_STD_ARRAY_IMPL_HPP 14 #ifdef CUBBYFLOW_USE_CUDA 18 template <
typename T,
size_t N>
19 CUDAStdArray<T, N>::CUDAStdArray()
24 template <
typename T,
size_t N>
25 template <
typename... Args>
26 CUDAStdArray<T, N>::CUDAStdArray(ConstReference first, Args... rest)
29 sizeof...(Args) == N - 1,
30 "Number of arguments should be equal to the size of the vector.");
31 SetAt(0, first, rest...);
34 template <
typename T,
size_t N>
35 CUDAStdArray<T, N>::CUDAStdArray(
const std::array<T, N>& other)
37 for (
size_t i = 0; i < N; ++i)
39 m_elements[i] = other[i];
43 template <
typename T,
size_t N>
44 CUDAStdArray<T, N>::CUDAStdArray(
const Vector<T, N>& other)
46 for (
size_t i = 0; i < N; ++i)
48 m_elements[i] = other[i];
52 template <
typename T,
size_t N>
53 CUDAStdArray<T, N>::CUDAStdArray(
const CUDAStdArray& other)
55 for (
size_t i = 0; i < N; ++i)
57 m_elements[i] = other[i];
61 template <
typename T,
size_t N>
62 CUDAStdArray<T, N>::CUDAStdArray(CUDAStdArray&& other) noexcept
64 for (
size_t i = 0; i < N; ++i)
66 m_elements[i] = std::move(other[i]);
70 template <
typename T,
size_t N>
71 CUDAStdArray<T, N>& CUDAStdArray<T, N>::operator=(
const CUDAStdArray& other)
73 for (
size_t i = 0; i < N; ++i)
75 m_elements[i] = other[i];
81 template <
typename T,
size_t N>
82 CUDAStdArray<T, N>& CUDAStdArray<T, N>::operator=(CUDAStdArray&& other) noexcept
84 for (
size_t i = 0; i < N; ++i)
86 m_elements[i] = std::move(other[i]);
92 template <
typename T,
size_t N>
95 for (
size_t i = 0; i < N; ++i)
101 template <
typename T,
size_t N>
102 CUBBYFLOW_CUDA_HOST Vector<T, N> CUDAStdArray<T, N>::ToVector()
const 106 for (
size_t i = 0; i < N; ++i)
108 vec[i] = m_elements[i];
114 template <
typename T,
size_t N>
115 typename CUDAStdArray<T, N>::Reference CUDAStdArray<T, N>::operator[](
size_t i)
117 return m_elements[i];
120 template <
typename T,
size_t N>
121 typename CUDAStdArray<T, N>::ConstReference CUDAStdArray<T, N>::operator[](
124 return m_elements[i];
127 template <
typename T,
size_t N>
130 for (
size_t i = 0; i < N; ++i)
132 if (m_elements[i] != other.m_elements[i])
141 template <
typename T,
size_t N>
144 return !(*
this == other);
147 template <
typename T,
size_t N>
148 template <
typename... Args>
149 void CUDAStdArray<T, N>::SetAt(
size_t i, ConstReference first, Args... rest)
151 m_elements[i] = first;
152 SetAt(i + 1, rest...);
155 template <
typename T,
size_t N>
156 template <
typename... Args>
157 void CUDAStdArray<T, N>::SetAt(
size_t i, ConstReference first)
159 m_elements[i] = first;
constexpr std::enable_if_t< IsMatrixSizeStatic< Rows, Cols >), bool > operator==(const MatrixExpression< T, Rows, Cols, M1 > &a, const MatrixExpression< T, Rows, Cols, M2 > &b)
Definition: Matrix-Impl.hpp:1408
Definition: pybind11Utils.hpp:20
void Fill(ArrayView< T, N > a, const Vector< size_t, N > &begin, const Vector< size_t, N > &end, const T &val)
Definition: ArrayUtils-Impl.hpp:19
bool operator!=(const MatrixExpression< T, R1, C1, M1 > &a, const MatrixExpression< T, R2, C2, M2 > &b)
Definition: Matrix-Impl.hpp:1443