27 #ifndef MLN_ALGEBRA_H_VEC_HH
28 # define MLN_ALGEBRA_H_VEC_HH
34 # include <mln/algebra/vec.hh>
35 # include <mln/literal/one.hh>
43 template <
unsigned d,
typename C>
class h_vec;
52 template <
template <
class>
class Name,
53 unsigned d,
typename C >
54 struct set_precise_unary_< Name, algebra::h_vec<d, C> >
56 typedef mln_trait_unary(Name, C) V;
57 typedef algebra::h_vec<d, V>
ret;
62 template < template <class, class> class Name,
63 unsigned d, typename C,
65 struct set_precise_binary_< Name,
66 algebra::h_vec<d, C>, algebra::h_vec<d, Q> >
68 typedef mln_trait_binary(Name, C, Q) V;
69 typedef algebra::h_vec<d, V> ret;
72 template < template <class, class> class Name,
73 unsigned d, typename C,
75 struct set_precise_binary_< Name,
76 algebra::h_vec<d, C>, mln::
value::scalar_<S> >
78 typedef mln_trait_binary(Name, C, S) V;
79 typedef algebra::h_vec<d, V> ret;
93 template <
unsigned d,
typename C>
113 # ifndef MLN_INCLUDE_ONLY
115 template <
unsigned d,
typename C>
126 template <
unsigned d,
typename C>
128 h_vec<d,C>::h_vec(
const vec<d+1, C>& other)
133 template <
unsigned d,
typename C>
143 template <
unsigned d,
typename C>
147 const C w = this->data_[d];
148 mln_assertion(w != 0);
151 for (
unsigned i = 0; i < d; ++i)
152 tmp[i] = static_cast<C>(this->data_[i] / w);
158 template <
unsigned n,
typename T>
164 for (
unsigned i = 0; i < n; ++i)
165 tmp[i] = this->data_[i];
170 # endif // ! MLN_INCLUDE_ONLY
177 #endif // ! MLN_ALGEBRA_H_VEC_HH