26 #ifndef MLN_FUN_V2V_LINEAR_HH
27 # define MLN_FUN_V2V_LINEAR_HH
33 # include <mln/core/concept/function.hh>
34 # include <mln/convert/to.hh>
54 template <
typename V,
typename T = V,
typename R = T>
69 template <
typename V,
typename T = V,
typename R = T>
84 # ifndef MLN_INCLUDE_ONLY
89 template <
typename V,
typename T,
typename R>
97 template <
typename V,
typename T,
typename R>
102 return mln::convert::to<R>(a *
static_cast<T>(v) + b);
105 template <
typename V,
typename T,
typename R>
106 template <
typename U>
111 return this->operator()(static_cast<V>(u));
117 template <
typename V,
typename T,
typename R>
125 template <
typename V,
typename T,
typename R>
130 T res = a *
static_cast<T>(v) + b;
131 if (res > mln_max(R))
133 else if (res < mln_min(R))
135 return mln::convert::to<R>(res);
138 template <
typename V,
typename T,
typename R>
139 template <
typename U>
144 mlc_converts_to(U, V)::check();
145 return this->operator()(static_cast<V>(u));
149 # endif // ! MLN_INCLUDE_ONLY
158 #endif // ! MLN_FUN_V2V_LINEAR_HH