// L============================================================================= // L This software is distributed under the MIT license. // L Copyright 2021 Péter Kardos // L============================================================================= #pragma once #include "Definitions.hpp" #include #include #include #include #include #include namespace mathter::traits { // Vector properties template class VectorTraitsHelper {}; template class VectorTraitsHelper> { public: using Type = T_; static constexpr int Dim = Dim_; static constexpr bool Packed = Packed_; }; template class VectorTraitsHelper> { public: using Type = T_; static constexpr int Dim = Dim_; static constexpr bool Packed = Packed_; }; template class VectorTraits : public VectorTraitsHelper::type> {}; // Matrix properties template class MatrixTraitsHelper {}; template class MatrixTraitsHelper> { public: using Type = T_; static constexpr int Rows = Rows_; static constexpr int Columns = Columns_; static constexpr eMatrixOrder Order = Order_; static constexpr eMatrixLayout Layout = Layout_; static constexpr bool Packed = Packed_; }; template class MatrixTraits : public MatrixTraitsHelper::type> {}; template class OppositeOrder { public: static constexpr eMatrixOrder value = (Order == eMatrixOrder::FOLLOW_VECTOR ? eMatrixOrder::PRECEDE_VECTOR : eMatrixOrder::FOLLOW_VECTOR); }; template class OppositeLayout { public: static constexpr eMatrixLayout value = (Layout == eMatrixLayout::ROW_MAJOR ? eMatrixLayout::COLUMN_MAJOR : eMatrixLayout::ROW_MAJOR); }; // Common utility template using MatMulElemT = decltype(T() * U() + T() * U()); // Template metaprogramming utilities template