@@ -96,11 +96,11 @@ batch<T, A> acosh(batch<T, A> const& x) {
9696 * @ingroup batch_complex
9797 *
9898 * Computes the argument of the batch \c z.
99- * @param z batch of complex values.
99+ * @param z batch of complex or real values.
100100 * @return the argument of \c z.
101101 */
102102template <class T , class A >
103- batch<T, A> arg (batch<std:: complex <T> , A> const & z) {
103+ real_batch_type_t < batch<T, A>> arg (batch<T , A> const & z) {
104104 return kernel::arg<A>(z, A{});
105105}
106106
@@ -358,7 +358,7 @@ batch<T, A> clip(batch<T, A> const& x, batch<T, A> const& lo, batch<T, A> const&
358358 * @return the argument of \c z.
359359 */
360360template <class A , class T >
361- batch<std:: complex <T> , A> conj (batch<std:: complex <T> , A> const & z) {
361+ complex_batch_type_t < batch<T , A>> conj (batch<T , A> const & z) {
362362 return kernel::conj (z, A{});
363363}
364364
@@ -758,6 +758,17 @@ batch<T, A> hypot(batch<T, A> const& x, batch<T, A> const& y) {
758758 return kernel::hypot<A>(x, y, A{});
759759}
760760
761+ /* *
762+ * @ingroup batch_complex
763+ *
764+ * Computes the imaginary part of the batch \c z.
765+ * @param z batch of complex or real values.
766+ * @return the argument of \c z.
767+ */
768+ template <class T , class A >
769+ real_batch_type_t <batch<T, A>> imag (batch<T, A> const & x) {
770+ return kernel::imag<A>(x, A{});
771+ }
761772
762773/* *
763774 * @ingroup batch_constant
@@ -1115,11 +1126,11 @@ batch<T, A> nextafter(batch<T, A> const& x, batch<T, A> const& y) {
11151126 * @ingroup batch_complex
11161127 *
11171128 * Computes the norm of the batch \c x.
1118- * @param x batch of complex values.
1129+ * @param x batch of complex or real values.
11191130 * @return the norm of \c x.
11201131 */
11211132template <class A , class T >
1122- batch<T, A> norm (batch<std:: complex <T> , A> const & x) {
1133+ real_batch_type_t < batch<T, A>> norm (batch<T , A> const & x) {
11231134 return kernel::norm (x, A{});
11241135}
11251136
@@ -1167,14 +1178,26 @@ batch<T, A> pow(batch<T, A> const& x, ITy y) {
11671178 * @ingroup batch_complex
11681179 *
11691180 * Computes the projection of the batch \c x.
1170- * @param x batch of complex values.
1181+ * @param x batch of complex or real values.
11711182 * @return the projection of \c x.
11721183 */
11731184template <class A , class T >
1174- batch<std:: complex <T> , A> proj (batch<std:: complex <T> , A> const & x) {
1185+ complex_batch_type_t < batch<T , A>> proj (batch<T , A> const & x) {
11751186 return kernel::proj (x, A{});
11761187}
11771188
1189+ /* *
1190+ * @ingroup batch_complex
1191+ *
1192+ * Computes the real part of the batch \c z.
1193+ * @param z batch of complex or real values.
1194+ * @return the argument of \c z.
1195+ */
1196+ template <class T , class A >
1197+ real_batch_type_t <batch<T, A>> real (batch<T, A> const & x) {
1198+ return kernel::real<A>(x, A{});
1199+ }
1200+
11781201/* *
11791202 * @ingroup batch_math
11801203 *
0 commit comments