29 #ifndef _VECTORTOOLS_H_
30 #define _VECTORTOOLS_H_ 1
36 namespace VectorTools{
39 bool Equal(
const std::vector<T>& vec1,
const std::vector<T>& vec2 )
41 size_t s1 = vec1.size();
42 if( s1 != vec2.size())
45 return( std::equal(vec1.begin(), vec1.end(), vec2.begin() ) );
61 T
InnerProduct(
const std::vector<T>& vec1,
const std::vector<T>& vec2 )
63 size_t s1 = vec1.size();
64 if( s1 != vec2.size())
65 throw E(
"VectorTools::InnerProduct - vec sizes not equal");
67 typename std::vector< T >::const_iterator it1, it2;
71 while(it1 != vec1.end() )
73 inprod += (*it1) * (*it2) ;
88 throw E(
"IndexTools::VectorProduct - vector product of vec of size 0 is undefined!");
90 T product = *(vec.begin());
91 typename std::vector< T >::const_iterator it;
93 while(it != vec.end() )
95 product = product * (*it);
101 template <
typename T>
105 for (
Index i = 0 ; i < vec.size() ; i++)
106 norm = max (fabs (vec [i]), norm) ;