26 #ifndef CRYPTO3_ALGEBRA_TYPE_TRAITS_HPP
27 #define CRYPTO3_ALGEBRA_TYPE_TRAITS_HPP
31 #include <boost/type_traits.hpp>
32 #include <boost/tti/tti.hpp>
33 #include <boost/mpl/placeholders.hpp>
34 #include <boost/type_traits/is_same.hpp>
40 using namespace boost::mpl::placeholders;
42 BOOST_TTI_HAS_TYPE(iterator)
43 BOOST_TTI_HAS_TYPE(const_iterator)
45 BOOST_TTI_HAS_TYPE(extension_policy)
46 BOOST_TTI_HAS_TYPE(curve_type)
47 BOOST_TTI_HAS_TYPE(field_type)
48 BOOST_TTI_HAS_TYPE(value_type)
49 BOOST_TTI_HAS_TYPE(integral_type)
50 BOOST_TTI_HAS_TYPE(base_field_type)
51 BOOST_TTI_HAS_TYPE(modular_type)
52 BOOST_TTI_HAS_TYPE(scalar_field_type)
53 BOOST_TTI_HAS_TYPE(g1_type)
54 BOOST_TTI_HAS_TYPE(g2_type)
55 BOOST_TTI_HAS_TYPE(gt_type)
57 BOOST_TTI_HAS_TYPE(group_type)
59 BOOST_TTI_HAS_STATIC_MEMBER_DATA(value_bits)
60 BOOST_TTI_HAS_STATIC_MEMBER_DATA(modulus_bits)
61 BOOST_TTI_HAS_STATIC_MEMBER_DATA(base_field_modulus)
62 BOOST_TTI_HAS_STATIC_MEMBER_DATA(scalar_field_modulus)
63 BOOST_TTI_HAS_STATIC_MEMBER_DATA(arity)
64 BOOST_TTI_HAS_STATIC_MEMBER_DATA(p)
65 BOOST_TTI_HAS_STATIC_MEMBER_DATA(q)
67 BOOST_TTI_HAS_FUNCTION(to_affine)
68 BOOST_TTI_HAS_FUNCTION(to_special)
69 BOOST_TTI_HAS_FUNCTION(is_special)
71 BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION(zero)
72 BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION(one)
74 BOOST_TTI_HAS_FUNCTION(is_well_formed)
75 BOOST_TTI_HAS_FUNCTION(doubled)
79 static const bool value = has_type_base_field_type<T>::value && has_type_scalar_field_type<T>::value &&
80 has_type_g1_type<T>::value && has_type_g2_type<T>::value &&
81 has_type_gt_type<T>::value;
88 static const bool value = has_type_value_type<T>::value && has_type_field_type<T>::value &&
89 has_static_member_data_value_bits<T, const std::size_t>::value &&
90 has_type_curve_type<T>::value;
96 static const bool value =
97 has_type_value_type<T>::value && has_static_member_data_value_bits<T, const std::size_t>::value &&
98 has_type_integral_type<T>::value &&
99 has_static_member_data_modulus_bits<T, const std::size_t>::value &&
100 has_type_modular_type<T>::value && has_static_member_data_arity<T, const std::size_t>::value;
106 static const bool value = has_type_value_type<T>::value &&
107 has_static_member_data_value_bits<T, const std::size_t>::value &&
108 has_type_integral_type<T>::value &&
109 has_static_member_data_modulus_bits<T, const std::size_t>::value &&
110 has_type_modular_type<T>::value &&
111 has_type_extension_policy<T>::value;
117 static const bool value =
118 has_type_field_type<T>::value && has_type_group_type<T>::value &&
119 has_static_member_function_zero<T, T>::value && has_static_member_function_one<T, T>::value &&
120 has_function_is_zero<T, bool>::value && has_function_is_well_formed<T, bool>::value &&
121 has_function_doubled<T, T>::value;
126 template<
typename CurveParams,
typename Form,
typename Coordinates>
127 struct curve_element;
131 template<
typename CurveParams,
typename Form,
typename Coordinates>
133 static const bool value =
true;
138 template<
typename FieldParams>
141 template<
typename FieldParams>
144 template<
typename FieldParams>
147 template<
typename FieldParams>
150 template<
typename FieldParams>
151 struct element_fp6_2over3;
153 template<
typename FieldParams>
154 struct element_fp6_3over2;
156 template<
typename FieldParams>
157 struct element_fp12_2over3over2;
161 template<
typename FieldParams>
163 static const bool value =
false;
166 template<
typename FieldParams>
168 static const bool value =
true;
171 template<
typename FieldParams>
173 static const bool value =
true;
176 template<
typename FieldParams>
178 static const bool value =
true;
181 template<
typename FieldParams>
183 static const bool value =
true;
186 template<
typename FieldParams>
188 static const bool value =
true;
191 template<
typename FieldParams>
193 static const bool value =
true;
196 template<
typename FieldParams>
198 static const bool value =
true;
203 static const bool value = boost::is_same<
204 typename T::group_type::curve_type::template g1_type<typename T::coordinates, typename T::form>,
205 typename T::group_type>::value;
210 static const bool value = boost::is_same<
211 typename T::group_type::curve_type::template g2_type<typename T::coordinates, typename T::form>,
212 typename T::group_type>::value;
typename remove_complex< T >::type remove_complex_t
Definition: algebra/include/nil/crypto3/algebra/type_traits.hpp:231
constexpr bool is_complex_v
Definition: algebra/include/nil/crypto3/algebra/type_traits.hpp:220
bool is_zero(const Range &a)
Definition: basic_operations.hpp:43
blueprint_linear_combination< FieldType > element_fp
Definition: element_fp.hpp:47
Definition: algebra/include/nil/crypto3/algebra/type_traits.hpp:216
Definition: algebra/include/nil/crypto3/algebra/type_traits.hpp:87
T type
Definition: algebra/include/nil/crypto3/algebra/type_traits.hpp:91
Definition: algebra/include/nil/crypto3/algebra/type_traits.hpp:78
T type
Definition: algebra/include/nil/crypto3/algebra/type_traits.hpp:82
Definition: algebra/include/nil/crypto3/algebra/type_traits.hpp:105
T type
Definition: algebra/include/nil/crypto3/algebra/type_traits.hpp:112
Definition: algebra/include/nil/crypto3/algebra/type_traits.hpp:162
Definition: algebra/include/nil/crypto3/algebra/type_traits.hpp:95
T type
Definition: algebra/include/nil/crypto3/algebra/type_traits.hpp:101
Definition: algebra/include/nil/crypto3/algebra/type_traits.hpp:202
Definition: algebra/include/nil/crypto3/algebra/type_traits.hpp:209
Definition: algebra/include/nil/crypto3/algebra/type_traits.hpp:116
T type
Definition: algebra/include/nil/crypto3/algebra/type_traits.hpp:228
Definition: algebra/include/nil/crypto3/algebra/type_traits.hpp:223
T type
Definition: algebra/include/nil/crypto3/algebra/type_traits.hpp:224