Template Class Vector
Defined in File LinAlg.hpp
Class Documentation
-
template<class T, int N>
class Vector Vector class to represent small vectors.
- Template Parameters:
T – Vector value type.
N – Number of elements.
Public Functions
- inline constexpr __host__ __device__ void load (const T *inVector)
Load values from a C-array into this vector.
- Parameters:
inVector – [in] Input C-array vector to load values from.
- inline constexpr __host__ __device__ void store (T *outVector) const
Store values to a C-array from this vector.
- Parameters:
outVector – [out] Output C-array vector to store values to.
- inline constexpr __host__ __device__ int size () const
Get size (number of elements) of this vector.
- Returns:
Vector size.
- inline constexpr const __host__ __device__ T & operator[] (int i) const
Subscript operator for read-only access.
- Parameters:
i – [in] Position to access.
- Returns:
Value (constant reference) at given position.
- inline constexpr __host__ __device__ T & operator[] (int i)
Subscript operator for read-and-write access.
- Parameters:
i – [in] Position to access.
- Returns:
Value (reference) at given position.
- inline constexpr __host__ __device__ operator const T * () const
Pointer-access operator (constant).
- Returns:
Pointer to the first element of this vector.
- inline constexpr __host__ __device__ operator T* ()
Pointer-access operator.
- Returns:
Pointer to the first element of this vector.
- inline constexpr const __host__ __device__ T * cbegin () const
Begin (constant) pointer access.
- Returns:
Pointer to the first element of this vector.
- inline constexpr __host__ __device__ T * begin ()
Begin pointer access.
- Returns:
Pointer to the first element of this vector.
- inline constexpr const __host__ __device__ T * cend () const
End (constant) pointer access.
- Returns:
Pointer to the one-past-last element of this vector.
- inline constexpr __host__ __device__ T * end ()
End pointer access.
- Returns:
Pointer to the one-past-last element of this vector.
-
inline std::vector<T> to_vector() const
Convert a vector of this class to an stl vector.
- Returns:
STL std::vector.
- template<int R> inline constexpr __host__ __device__ Vector< T, R > subv (int beg) const
Get a sub-vector of this vector.
- Parameters:
beg – [in] Position to start getting values from this vector.
- Template Parameters:
R – Size of the sub-vector to be returned.
- Returns:
Vector of value from given index to the end.