Trivial
This commit is contained in:
parent
cd8a25162e
commit
c41b6d80b6
@ -361,10 +361,10 @@ getL1Distance (const Params& v1, const Params& v2)
|
|||||||
double dist = 0.0;
|
double dist = 0.0;
|
||||||
if (globals::logDomain) {
|
if (globals::logDomain) {
|
||||||
dist = std::inner_product (v1.begin(), v1.end(), v2.begin(), 0.0,
|
dist = std::inner_product (v1.begin(), v1.end(), v2.begin(), 0.0,
|
||||||
std::plus<double>(), FuncObject::abs_diff_exp<double>());
|
std::plus<double>(), func_obj::abs_diff_exp<double>());
|
||||||
} else {
|
} else {
|
||||||
dist = std::inner_product (v1.begin(), v1.end(), v2.begin(), 0.0,
|
dist = std::inner_product (v1.begin(), v1.end(), v2.begin(), 0.0,
|
||||||
std::plus<double>(), FuncObject::abs_diff<double>());
|
std::plus<double>(), func_obj::abs_diff<double>());
|
||||||
}
|
}
|
||||||
return dist;
|
return dist;
|
||||||
}
|
}
|
||||||
@ -378,10 +378,10 @@ getMaxNorm (const Params& v1, const Params& v2)
|
|||||||
double max = 0.0;
|
double max = 0.0;
|
||||||
if (globals::logDomain) {
|
if (globals::logDomain) {
|
||||||
max = std::inner_product (v1.begin(), v1.end(), v2.begin(), 0.0,
|
max = std::inner_product (v1.begin(), v1.end(), v2.begin(), 0.0,
|
||||||
FuncObject::max<double>(), FuncObject::abs_diff_exp<double>());
|
func_obj::max<double>(), func_obj::abs_diff_exp<double>());
|
||||||
} else {
|
} else {
|
||||||
max = std::inner_product (v1.begin(), v1.end(), v2.begin(), 0.0,
|
max = std::inner_product (v1.begin(), v1.end(), v2.begin(), 0.0,
|
||||||
FuncObject::max<double>(), FuncObject::abs_diff<double>());
|
func_obj::max<double>(), func_obj::abs_diff<double>());
|
||||||
}
|
}
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
@ -295,8 +295,8 @@ void pow (Params&, double);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T> void
|
||||||
void operator+=(std::vector<T>& v, double val)
|
operator+=(std::vector<T>& v, double val)
|
||||||
{
|
{
|
||||||
std::transform (v.begin(), v.end(), v.begin(),
|
std::transform (v.begin(), v.end(), v.begin(),
|
||||||
std::bind2nd (std::plus<double>(), val));
|
std::bind2nd (std::plus<double>(), val));
|
||||||
@ -304,8 +304,8 @@ void operator+=(std::vector<T>& v, double val)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T> void
|
||||||
void operator-=(std::vector<T>& v, double val)
|
operator-=(std::vector<T>& v, double val)
|
||||||
{
|
{
|
||||||
std::transform (v.begin(), v.end(), v.begin(),
|
std::transform (v.begin(), v.end(), v.begin(),
|
||||||
std::bind2nd (std::minus<double>(), val));
|
std::bind2nd (std::minus<double>(), val));
|
||||||
@ -313,8 +313,8 @@ void operator-=(std::vector<T>& v, double val)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T> void
|
||||||
void operator*=(std::vector<T>& v, double val)
|
operator*=(std::vector<T>& v, double val)
|
||||||
{
|
{
|
||||||
std::transform (v.begin(), v.end(), v.begin(),
|
std::transform (v.begin(), v.end(), v.begin(),
|
||||||
std::bind2nd (std::multiplies<double>(), val));
|
std::bind2nd (std::multiplies<double>(), val));
|
||||||
@ -322,8 +322,8 @@ void operator*=(std::vector<T>& v, double val)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T> void
|
||||||
void operator/=(std::vector<T>& v, double val)
|
operator/=(std::vector<T>& v, double val)
|
||||||
{
|
{
|
||||||
std::transform (v.begin(), v.end(), v.begin(),
|
std::transform (v.begin(), v.end(), v.begin(),
|
||||||
std::bind2nd (std::divides<double>(), val));
|
std::bind2nd (std::divides<double>(), val));
|
||||||
@ -331,8 +331,8 @@ void operator/=(std::vector<T>& v, double val)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T> void
|
||||||
void operator+=(std::vector<T>& a, const std::vector<T>& b)
|
operator+=(std::vector<T>& a, const std::vector<T>& b)
|
||||||
{
|
{
|
||||||
assert (a.size() == b.size());
|
assert (a.size() == b.size());
|
||||||
std::transform (a.begin(), a.end(), b.begin(), a.begin(),
|
std::transform (a.begin(), a.end(), b.begin(), a.begin(),
|
||||||
@ -341,8 +341,8 @@ void operator+=(std::vector<T>& a, const std::vector<T>& b)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T> void
|
||||||
void operator-=(std::vector<T>& a, const std::vector<T>& b)
|
operator-=(std::vector<T>& a, const std::vector<T>& b)
|
||||||
{
|
{
|
||||||
assert (a.size() == b.size());
|
assert (a.size() == b.size());
|
||||||
std::transform (a.begin(), a.end(), b.begin(), a.begin(),
|
std::transform (a.begin(), a.end(), b.begin(), a.begin(),
|
||||||
@ -351,8 +351,8 @@ void operator-=(std::vector<T>& a, const std::vector<T>& b)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T> void
|
||||||
void operator*=(std::vector<T>& a, const std::vector<T>& b)
|
operator*=(std::vector<T>& a, const std::vector<T>& b)
|
||||||
{
|
{
|
||||||
assert (a.size() == b.size());
|
assert (a.size() == b.size());
|
||||||
std::transform (a.begin(), a.end(), b.begin(), a.begin(),
|
std::transform (a.begin(), a.end(), b.begin(), a.begin(),
|
||||||
@ -361,8 +361,8 @@ void operator*=(std::vector<T>& a, const std::vector<T>& b)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T> void
|
||||||
void operator/=(std::vector<T>& a, const std::vector<T>& b)
|
operator/=(std::vector<T>& a, const std::vector<T>& b)
|
||||||
{
|
{
|
||||||
assert (a.size() == b.size());
|
assert (a.size() == b.size());
|
||||||
std::transform (a.begin(), a.end(), b.begin(), a.begin(),
|
std::transform (a.begin(), a.end(), b.begin(), a.begin(),
|
||||||
@ -371,8 +371,8 @@ void operator/=(std::vector<T>& a, const std::vector<T>& b)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T> void
|
||||||
void operator^=(std::vector<T>& v, double exp)
|
operator^=(std::vector<T>& v, double exp)
|
||||||
{
|
{
|
||||||
std::transform (v.begin(), v.end(), v.begin(),
|
std::transform (v.begin(), v.end(), v.begin(),
|
||||||
std::bind2nd (std::ptr_fun<double, double, double> (std::pow), exp));
|
std::bind2nd (std::ptr_fun<double, double, double> (std::pow), exp));
|
||||||
@ -380,8 +380,8 @@ void operator^=(std::vector<T>& v, double exp)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T> void
|
||||||
void operator^=(std::vector<T>& v, int iexp)
|
operator^=(std::vector<T>& v, int iexp)
|
||||||
{
|
{
|
||||||
std::transform (v.begin(), v.end(), v.begin(),
|
std::transform (v.begin(), v.end(), v.begin(),
|
||||||
std::bind2nd (std::ptr_fun<double, int, double> (std::pow), iexp));
|
std::bind2nd (std::ptr_fun<double, int, double> (std::pow), iexp));
|
||||||
@ -389,8 +389,8 @@ void operator^=(std::vector<T>& v, int iexp)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T> std::ostream&
|
||||||
std::ostream& operator<< (std::ostream& os, const std::vector<T>& v)
|
operator<< (std::ostream& os, const std::vector<T>& v)
|
||||||
{
|
{
|
||||||
os << "[" ;
|
os << "[" ;
|
||||||
os << util::elementsToString (v, ", ");
|
os << util::elementsToString (v, ", ");
|
||||||
@ -399,7 +399,7 @@ std::ostream& operator<< (std::ostream& os, const std::vector<T>& v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace FuncObject {
|
namespace func_obj {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct max : public std::binary_function<T, T, T>
|
struct max : public std::binary_function<T, T, T>
|
||||||
@ -432,7 +432,7 @@ struct abs_diff_exp : public std::binary_function<T, T, T>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace FuncObject
|
} // namespace func_obj
|
||||||
|
|
||||||
} // namespace horus
|
} // namespace horus
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user