22 #ifndef VectorHelper_h
23 #define VectorHelper_h
49 static T
sum(
const std::vector<T> &v) {
51 for (
typename std::vector<T>::const_iterator i = v.begin(); i != v.end(); i++) {
64 set(v, (T) 1.0 * msum / (T) v.size());
70 static void div(std::vector<T> &v, T by) {
71 for (
typename std::vector<T>::iterator i = v.begin(); i != v.end(); i++) {
77 typename std::vector<T>::iterator i = v.begin();
78 while (i != v.end()) {
79 for (
typename std::vector<T>::iterator j = i + 1; j != v.end();) {
91 static void set(std::vector<T> &v, T to) {
92 for (
typename std::vector<T>::iterator i = v.begin(); i != v.end(); i++) {
99 for (
typename std::vector<T>::const_iterator j = v.begin() + 1; j != v.end(); j++) {
109 for (
typename std::vector<T>::const_iterator j = v.begin() + 1; j != v.end(); j++) {
118 for (
typename std::vector<T>::iterator j = v.begin(); j != v.end();) {
128 for (
typename std::vector<T>::iterator j = v.begin(); j != v.end();) {
137 static void add2All(std::vector<T> &v, T what) {
138 for (
typename std::vector<T>::iterator j = v.begin(); j != v.end(); j++) {
144 static bool subSetExists(
const std::vector<T> &v1,
const std::vector<T> &v2) {
145 for (
typename std::vector<T>::const_iterator i = v1.begin(); i != v1.end(); i++) {
147 if (find(v2.begin(), v2.end(), val1) != v2.end()) {
159 std::ostream& operator<<(std::ostream& os, const std::vector<T> &v) {
160 for (
typename std::vector<T>::const_iterator i = v.begin(); i != v.end(); i++) {
161 if (i != v.begin()) {