Algorith sandbox
euclid.h
Go to the documentation of this file.
1 
9 #pragma once
10 #include <boost/numeric/ublas/vector.hpp>
11 #include <boost/numeric/ublas/vector_expression.hpp>
12 
13 namespace algo { namespace math {
22  template <typename E>
23  double calculateSumOfSquares(const
24  boost::numeric::ublas::vector_expression<E>& x)
25  {
26  double sum = 0.0;
27  for (std::size_t i = 0; i < x().size(); ++i) {
28  sum += (x()(i) * x()(i));
29  }
30  return sum;
31  }
40  double calculateDistanceNormL2(
41  const boost::numeric::ublas::vector<double>& x1,
42  const boost::numeric::ublas::vector<double>& x2);
51  double calculateNormL2(
52  const boost::numeric::ublas::vector<double>& x);
53 } } // namespace algo { namespace math {
54 
Definition: ublas_matrix_expression_concept.hpp:5