aboutsummaryrefslogtreecommitdiff
path: root/Carpet
diff options
context:
space:
mode:
authorschnetter <>2003-08-28 19:07:00 +0000
committerschnetter <>2003-08-28 19:07:00 +0000
commit410682bb03e679e5c61a124b20fb369e5a88d471 (patch)
treec3c045704b99da334961ce64592ada90af4737c3 /Carpet
parentb259f64ffe32e43562dc36a36d4bfdf12fad8b87 (diff)
Fix bug.
Fix bug. Remove duplicate functions. darcs-hash:20030828190727-07bb3-ec3abefc3438a4822d11d3ff43587a0968e9a2a9.gz
Diffstat (limited to 'Carpet')
-rw-r--r--Carpet/CarpetLib/src/vect.hh72
1 files changed, 4 insertions, 68 deletions
diff --git a/Carpet/CarpetLib/src/vect.hh b/Carpet/CarpetLib/src/vect.hh
index f3ccf3298..22d8ef054 100644
--- a/Carpet/CarpetLib/src/vect.hh
+++ b/Carpet/CarpetLib/src/vect.hh
@@ -1,4 +1,4 @@
-// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/vect.hh,v 1.18 2003/08/15 09:32:54 schnetter Exp $
+// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/vect.hh,v 1.19 2003/08/28 21:07:27 schnetter Exp $
#ifndef VECT_HH
#define VECT_HH
@@ -465,70 +465,6 @@ public:
};
#endif
- // Higher order functions
-
- /** Return a new vector where the function func() has been applied
- to all elements. */
- template<class U>
- vect<U,D> map (U (* const func)(T x)) const {
- vect<U,D> r;
- for (int d=0; d<D; ++d) r[d] = func(elt[d]);
- return r;
- }
-
- /** Return a new vector where the function func() has been used
- element-wise to combine *this and a. */
- template<class S, class U>
- vect<U,D> zip (U (* const func)(T x, S y), const vect<S,D>& a) const {
- vect r;
- for (int d=0; d<D; ++d) r[d] = func(elt[d], a[d]);
- return r;
- }
-
- /** Return a scalar where the function func() has been used to
- reduce the vector, starting with the scalar value val. */
- template<class U>
- U fold (U (* const func)(U val, T x), U val) const {
- for (int d=0; d<D; ++d) val = func(val, elt[d]);
- return val;
- }
-
- /** Return a scalar where the function func() has been used to
- reduce the vector, starting with element 0. */
- template<class U>
- U fold1 (U (* const func)(U val, T x)) const {
- assert (D>=1);
- U val = elt[0];
- for (int d=1; d<D; ++d) val = func(val, elt[d]);
- return val;
- }
-
- /** Return a vector where the function func() has been used to scan
- the vector, starting with the scalar value val. */
- template<class U>
- vect<U,D> scan0 (U (* const func)(U val, T x), U val) const {
- vect r;
- for (int d=0; d<D; ++d) {
- r[d] = val;
- val = func(val, elt[d]);
- }
- return r;
- }
-
- /** Return a vector where the function func() has been used to scan
- the vector, starting with element 0. */
- template<class U>
- vect<U,D> scan1 (U (* const func)(U val, T x)) const {
- vect r;
- assert (D>=1);
- U val = elt[0];
- for (int d=1; d<D; ++d) {
- val = func(val, elt[d]);
- r[d] = val;
- }
- return r;
- }
-
// Input/Output
void input (istream& is);
void output (ostream& os) const;
@@ -694,11 +630,11 @@ inline U fold (U (* const func)(U val, T x), U val, const vect<T,D>& a)
/** Return a scalar where the function func() has been used to reduce
the vector a, starting with element 0. */
template<class T, class U, int D>
-inline U fold1 (U (* const func)(U val, T x))
+inline U fold1 (U (* const func)(U val, T x), const vect<T,D>& a)
{
assert (D>=1);
- U val = elt[0];
- for (int d=1; d<D; ++d) val = func(val, elt[d]);
+ U val = a[0];
+ for (int d=1; d<D; ++d) val = func(val, a[d]);
return val;
}