From cc134084055cff16c0ea6e76fa87fed5a90a2002 Mon Sep 17 00:00:00 2001 From: "Yuhsiang M. Tsai" Date: Thu, 17 Sep 2020 14:11:53 +0200 Subject: [PATCH] to_complex/real and remove_complex only --- include/ginkgo/core/base/math.hpp | 47 ++++++++----------------- include/ginkgo/core/matrix/coo.hpp | 2 +- include/ginkgo/core/matrix/csr.hpp | 2 +- include/ginkgo/core/matrix/dense.hpp | 2 +- include/ginkgo/core/matrix/diagonal.hpp | 2 +- include/ginkgo/core/matrix/ell.hpp | 2 +- include/ginkgo/core/matrix/hybrid.hpp | 2 +- include/ginkgo/core/matrix/sellp.hpp | 2 +- 8 files changed, 22 insertions(+), 39 deletions(-) diff --git a/include/ginkgo/core/base/math.hpp b/include/ginkgo/core/base/math.hpp index 467d8668bd3..386f0bf737d 100644 --- a/include/ginkgo/core/base/math.hpp +++ b/include/ginkgo/core/base/math.hpp @@ -139,7 +139,7 @@ struct remove_complex_impl> { * @tparam T the type being made complex */ template -struct add_complex_impl { +struct to_complex_impl { using type = std::complex; }; @@ -149,7 +149,7 @@ struct add_complex_impl { * @tparam T the type being made complex */ template -struct add_complex_impl> { +struct to_complex_impl> { using type = std::complex; }; @@ -226,7 +226,7 @@ struct remove_complex_s< template -struct add_complex_s {}; +struct to_complex_s {}; /** * Obtains a complex counterpart of a real type, and leaves the type @@ -235,9 +235,9 @@ struct add_complex_s {}; * @tparam T complex or scalar type */ template -struct add_complex_s< +struct to_complex_s< T, xstd::void_t::value>>> { - using type = typename detail::add_complex_impl::type; + using type = typename detail::to_complex_impl::type; }; /** @@ -247,10 +247,10 @@ struct add_complex_s< * @tparam T class with template parameters */ template -struct add_complex_s< +struct to_complex_s< T, xstd::void_t::value>>> { using type = - typename detail::template_convertor::type; + typename detail::template_convertor::type; }; @@ -353,27 +353,27 @@ using remove_complex = typename remove_complex_s::type; * Add the complex of complex/scalar type or the template parameter of class * by accessing the `type` attribute of this struct. * - * @tparam T type to add complex + * @tparam T type to complex_type */ -using detail::add_complex_s; +using detail::to_complex_s; /** * Obtain the type which adds the complex of complex/scalar type or the * template parameter of class by accessing the `type` attribute of this struct. * - * @tparam T type to add complex + * @tparam T type to complex_type * - * @note add_complex can not be used in friend class declaration. + * @note to_complex can not be used in friend class declaration. * the followings are the error message from different combination. - * friend add_complex; + * friend to_complex; * error: can not recognize it is class correctly. - * friend class add_complex; + * friend class to_complex; * error: using alias template specialization - * friend class add_complex_s>::type; + * friend class to_complex_s>::type; * error: can not recognize it is class correctly. */ template -using add_complex = typename add_complex_s::type; +using to_complex = typename to_complex_s::type; /** @@ -393,23 +393,6 @@ template using to_real = remove_complex; -/** - * to_complex_s is alias of add_complex_s - * - * @tparam T type to complex - */ -template -using to_complex_s = add_complex_s; - -/** - * to_complex is alias of add_complex - * - * @tparam T type to complex - */ -template -using to_complex = add_complex; - - namespace detail { diff --git a/include/ginkgo/core/matrix/coo.hpp b/include/ginkgo/core/matrix/coo.hpp index af7b75e1233..dd048fd5825 100644 --- a/include/ginkgo/core/matrix/coo.hpp +++ b/include/ginkgo/core/matrix/coo.hpp @@ -89,7 +89,7 @@ class Coo : public EnableLinOp>, friend class Csr; friend class Dense; friend class CooBuilder; - friend class Coo, IndexType>; + friend class Coo, IndexType>; public: using EnableLinOp::convert_to; diff --git a/include/ginkgo/core/matrix/csr.hpp b/include/ginkgo/core/matrix/csr.hpp index 659a47aa05f..a30f6f856e3 100644 --- a/include/ginkgo/core/matrix/csr.hpp +++ b/include/ginkgo/core/matrix/csr.hpp @@ -142,7 +142,7 @@ class Csr : public EnableLinOp>, friend class Sellp; friend class SparsityCsr; friend class CsrBuilder; - friend class Csr, IndexType>; + friend class Csr, IndexType>; public: using value_type = ValueType; diff --git a/include/ginkgo/core/matrix/dense.hpp b/include/ginkgo/core/matrix/dense.hpp index f639f0799ed..b6ec2421455 100644 --- a/include/ginkgo/core/matrix/dense.hpp +++ b/include/ginkgo/core/matrix/dense.hpp @@ -128,7 +128,7 @@ class Dense friend class Sellp; friend class SparsityCsr; friend class SparsityCsr; - friend class Dense>; + friend class Dense>; public: using EnableLinOp::convert_to; diff --git a/include/ginkgo/core/matrix/diagonal.hpp b/include/ginkgo/core/matrix/diagonal.hpp index f34a6488d09..b268421c163 100644 --- a/include/ginkgo/core/matrix/diagonal.hpp +++ b/include/ginkgo/core/matrix/diagonal.hpp @@ -79,7 +79,7 @@ class Diagonal friend class EnableCreateMethod; friend class Csr; friend class Csr; - friend class Diagonal>; + friend class Diagonal>; public: using EnableLinOp::convert_to; diff --git a/include/ginkgo/core/matrix/ell.hpp b/include/ginkgo/core/matrix/ell.hpp index d0ee6f80906..cbcd3552700 100644 --- a/include/ginkgo/core/matrix/ell.hpp +++ b/include/ginkgo/core/matrix/ell.hpp @@ -82,7 +82,7 @@ class Ell : public EnableLinOp>, friend class EnablePolymorphicObject; friend class Dense; friend class Csr; - friend class Ell, IndexType>; + friend class Ell, IndexType>; public: using EnableLinOp::convert_to; diff --git a/include/ginkgo/core/matrix/hybrid.hpp b/include/ginkgo/core/matrix/hybrid.hpp index d53089d128a..5e782ca8aa2 100644 --- a/include/ginkgo/core/matrix/hybrid.hpp +++ b/include/ginkgo/core/matrix/hybrid.hpp @@ -83,7 +83,7 @@ class Hybrid friend class EnablePolymorphicObject; friend class Dense; friend class Csr; - friend class Hybrid, IndexType>; + friend class Hybrid, IndexType>; public: diff --git a/include/ginkgo/core/matrix/sellp.hpp b/include/ginkgo/core/matrix/sellp.hpp index 2e8fe4623b9..e28a5f3a73e 100644 --- a/include/ginkgo/core/matrix/sellp.hpp +++ b/include/ginkgo/core/matrix/sellp.hpp @@ -79,7 +79,7 @@ class Sellp : public EnableLinOp>, friend class EnablePolymorphicObject; friend class Dense; friend class Csr; - friend class Sellp, IndexType>; + friend class Sellp, IndexType>; public: using EnableLinOp::convert_to;