aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/vect.hh
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@aei.mpg.de>2004-12-25 18:31:00 +0000
committerErik Schnetter <schnetter@aei.mpg.de>2004-12-25 18:31:00 +0000
commitec6bbca59cf00c90ed86fa4f9a279bad8ca76066 (patch)
tree21162f7820ddeade3d38cb46ebb89c6364ca6d31 /Carpet/CarpetLib/src/vect.hh
parent2cbafb5c128033ed2c9ab919ecfaa07fb6c0b403 (diff)
CarpetLib: Add ipow function to vect class
darcs-hash:20041225183147-891bb-84276981b1deab37af4c3b541f993e62d63200e6.gz
Diffstat (limited to 'Carpet/CarpetLib/src/vect.hh')
-rw-r--r--Carpet/CarpetLib/src/vect.hh8
1 files changed, 8 insertions, 0 deletions
diff --git a/Carpet/CarpetLib/src/vect.hh b/Carpet/CarpetLib/src/vect.hh
index 45599057b..d6e84ec46 100644
--- a/Carpet/CarpetLib/src/vect.hh
+++ b/Carpet/CarpetLib/src/vect.hh
@@ -564,6 +564,14 @@ inline vect<T,D> pow (const vect<T,D>& a, const vect<U,D>& b) {
return r;
}
+/** Return the element-wise integer power of two vectors. */
+template<class T,int D>
+inline vect<T,D> ipow (const vect<T,D>& a, const vect<int,D>& b) {
+ vect<T,D> r;
+ for (int d=0; d<D; ++d) r[d]=ipow(a[d],b[d]);
+ return r;
+}
+
// Reduction operators