+ /**
+ * Raises the given number @p x to the power @p p for a vectorized data
+ * field. The result is returned as vectorized array in the form
+ * <tt>{pow(x[0],p[0]), pow(x[1],p[1]), ...,
+ * pow(x[size()-1],p[size()-1])}</tt>.
+ *
+ * @relatesalso VectorizedArray
+ */
+ template <typename Number, std::size_t width>
+ inline ::dealii::VectorizedArray<Number, width>
+ pow(const ::dealii::VectorizedArray<Number, width> &x,
+ const ::dealii::VectorizedArray<Number, width> &p)
+ {
+ Number values[::dealii::VectorizedArray<Number, width>::size()];
+ for (unsigned int i = 0; i < dealii::VectorizedArray<Number, width>::size();
+ ++i)
+ values[i] = std::pow(x[i], p[i]);
+ ::dealii::VectorizedArray<Number, width> out;
+ out.load(&values[0]);
+ return out;
+ }
+
+
+
/**
* Compute the absolute value (modulus) of a vectorized data field. The
* result is returned as vectorized array in the form <tt>{abs(x[0]),
}
+template <typename VectorizedArrayType>
+void
+do_test(const VectorizedArrayType array, const VectorizedArrayType number)
+{
+ deallog << " test " << VectorizedArrayType::size() << " array elements"
+ << std::endl;
+
+ auto exponentiated_array = std::pow(array, number);
+
+ for (unsigned int i = 0; i < VectorizedArrayType::size(); i++)
+ deallog << exponentiated_array[i] << " ";
+ deallog << std::endl;
+}
+
+
int
main()
{
#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 512
do_test(VectorizedArray<double, 8>(2.0), 3.0);
do_test(VectorizedArray<float, 16>(2.0), 3.0);
+
+ do_test(VectorizedArray<double, 8>(2.0), VectorizedArray<double, 8>(3.0));
+ do_test(VectorizedArray<float, 16>(2.0), VectorizedArray<float, 16>(3.0));
#endif
#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 256
do_test(VectorizedArray<double, 4>(2.0), 3.0);
do_test(VectorizedArray<float, 8>(2.0), 3.0);
+
+ do_test(VectorizedArray<double, 4>(2.0), VectorizedArray<double, 4>(3.0));
+ do_test(VectorizedArray<float, 8>(2.0), VectorizedArray<float, 8>(3.0));
#endif
#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS >= 128
do_test(VectorizedArray<double, 2>(2.0), 3.0);
do_test(VectorizedArray<float, 4>(2.0), 3.0);
+
+ do_test(VectorizedArray<double, 2>(2.0), VectorizedArray<double, 2>(3.0));
+ do_test(VectorizedArray<float, 4>(2.0), VectorizedArray<float, 4>(3.0));
#endif
do_test(VectorizedArray<double, 1>(2.0), 3.0);
do_test(VectorizedArray<float, 1>(2.0), 3.0);
+
+ do_test(VectorizedArray<double, 1>(2.0), VectorizedArray<double, 1>(3.0));
+ do_test(VectorizedArray<float, 1>(2.0), VectorizedArray<float, 1>(3.0));
}
DEAL::8.00000
DEAL:: test 1 array elements
DEAL::8.00000
+DEAL:: test 1 array elements
+DEAL::8.00000
+DEAL:: test 1 array elements
+DEAL::8.00000
DEAL::8.00000 8.00000 8.00000 8.00000
DEAL:: test 8 array elements
DEAL::8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000
+DEAL:: test 4 array elements
+DEAL::8.00000 8.00000 8.00000 8.00000
+DEAL:: test 8 array elements
+DEAL::8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000
+DEAL:: test 2 array elements
+DEAL::8.00000 8.00000
+DEAL:: test 4 array elements
+DEAL::8.00000 8.00000 8.00000 8.00000
DEAL:: test 2 array elements
DEAL::8.00000 8.00000
DEAL:: test 4 array elements
DEAL::8.00000
DEAL:: test 1 array elements
DEAL::8.00000
+DEAL:: test 1 array elements
+DEAL::8.00000
+DEAL:: test 1 array elements
+DEAL::8.00000
+DEAL:: test 8 array elements
+DEAL::8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000
+DEAL:: test 16 array elements
+DEAL::8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000
DEAL:: test 8 array elements
DEAL::8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000
DEAL:: test 16 array elements
DEAL::8.00000 8.00000 8.00000 8.00000
DEAL:: test 8 array elements
DEAL::8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000
+DEAL:: test 4 array elements
+DEAL::8.00000 8.00000 8.00000 8.00000
+DEAL:: test 8 array elements
+DEAL::8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000 8.00000
DEAL:: test 2 array elements
DEAL::8.00000 8.00000
DEAL:: test 4 array elements
DEAL::8.00000 8.00000 8.00000 8.00000
+DEAL:: test 2 array elements
+DEAL::8.00000 8.00000
+DEAL:: test 4 array elements
+DEAL::8.00000 8.00000 8.00000 8.00000
+DEAL:: test 1 array elements
+DEAL::8.00000
+DEAL:: test 1 array elements
+DEAL::8.00000
DEAL:: test 1 array elements
DEAL::8.00000
DEAL:: test 1 array elements
DEAL::8.00000 8.00000
DEAL:: test 4 array elements
DEAL::8.00000 8.00000 8.00000 8.00000
+DEAL:: test 2 array elements
+DEAL::8.00000 8.00000
+DEAL:: test 4 array elements
+DEAL::8.00000 8.00000 8.00000 8.00000
+DEAL:: test 1 array elements
+DEAL::8.00000
+DEAL:: test 1 array elements
+DEAL::8.00000
DEAL:: test 1 array elements
DEAL::8.00000
DEAL:: test 1 array elements