Program Listing for File vector.hpp#
↰ Return to documentation for file (librapid/include/librapid/math/vector.hpp)
#ifndef LIBRAPID_MATH_VECTOR_HPP
#define LIBRAPID_MATH_VECTOR_HPP
#include "genericVector.hpp"
#include "simdVector.hpp"
namespace librapid {
namespace detail {
template<typename Scalar, int64_t Dims>
auto vectorTypeIdentifier() {
if constexpr (typetraits::TypeInfo<Scalar>::packetWidth > 1) {
return SIMDVector<Scalar, Dims> {};
} else {
return GenericVector<Scalar, Dims> {};
}
}
} // namespace detail
template<typename Scalar, int64_t Dims>
using Vec = decltype(detail::vectorTypeIdentifier<Scalar, Dims>());
using Vec2i = Vec<int32_t, 2>;
using Vec3i = Vec<int32_t, 3>;
using Vec4i = Vec<int32_t, 4>;
using Vec2f = Vec<float, 2>;
using Vec3f = Vec<float, 3>;
using Vec4f = Vec<float, 4>;
using Vec2d = Vec<double, 2>;
using Vec3d = Vec<double, 3>;
using Vec4d = Vec<double, 4>;
using Vec2 = Vec2d;
using Vec3 = Vec3d;
using Vec4 = Vec4d;
} // namespace librapid
#endif // LIBRAPID_MATH_VECTOR_HPP