From 35722fa0222a7f99a8179d75244177a9801ea36b Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Mon, 30 Mar 2015 14:55:54 -0700 Subject: Made the index type a template parameter of the tensor class instead of encoding it in the options. --- unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h | 71 ++++++++++------------- 1 file changed, 30 insertions(+), 41 deletions(-) (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h b/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h index 0745b1742..ba09298c3 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h @@ -43,24 +43,13 @@ class compute_tensor_flags enum { ret = packet_access_bit | aligned_bit}; }; -template -struct compute_index_type { - typedef DenseIndex type; -}; - -template<> -struct compute_index_type { - typedef int type; -}; - - -template -struct traits > +template +struct traits > { typedef Scalar_ Scalar; typedef Dense StorageKind; - typedef typename compute_index_type(Options_&Index32Bit)>::type Index; + typedef IndexType_ Index; static const int NumDimensions = NumIndices_; static const int Layout = Options_ & RowMajor ? RowMajor : ColMajor; enum { @@ -70,12 +59,12 @@ struct traits > }; -template -struct traits > +template +struct traits > { typedef Scalar_ Scalar; typedef Dense StorageKind; - typedef typename compute_index_type(Options_&Index32Bit)>::type Index; + typedef IndexType_ Index; static const int NumDimensions = array_size::value; static const int Layout = Options_ & RowMajor ? RowMajor : ColMajor; enum { @@ -118,28 +107,28 @@ struct traits > }; -template -struct eval, Eigen::Dense> +template +struct eval, Eigen::Dense> { - typedef const Tensor<_Scalar, NumIndices_, Options>& type; + typedef const Tensor<_Scalar, NumIndices_, Options, IndexType_>& type; }; -template -struct eval, Eigen::Dense> +template +struct eval, Eigen::Dense> { - typedef const Tensor<_Scalar, NumIndices_, Options>& type; + typedef const Tensor<_Scalar, NumIndices_, Options, IndexType_>& type; }; -template -struct eval, Eigen::Dense> +template +struct eval, Eigen::Dense> { - typedef const TensorFixedSize& type; + typedef const TensorFixedSize& type; }; -template -struct eval, Eigen::Dense> +template +struct eval, Eigen::Dense> { - typedef const TensorFixedSize& type; + typedef const TensorFixedSize& type; }; template @@ -167,28 +156,28 @@ struct eval, Eigen::Dense> }; -template -struct nested > +template +struct nested > { - typedef const Tensor& type; + typedef const Tensor& type; }; -template -struct nested > +template +struct nested > { - typedef const Tensor& type; + typedef const Tensor& type; }; -template -struct nested > +template +struct nested > { - typedef const TensorFixedSize& type; + typedef const TensorFixedSize& type; }; -template -struct nested > +template +struct nested > { - typedef const TensorFixedSize& type; + typedef const TensorFixedSize& type; }; -- cgit v1.2.3