[arrayfire] 01/248: Additional operator* overloads for cfloat, cdouble

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Nov 17 15:53:47 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch dfsg-clean
in repository arrayfire.

commit 88680b58e3ec92a69e54c85f03cf24b90ea60b6f
Author: pradeep <pradeep at arrayfire.com>
Date:   Tue Jun 30 17:05:04 2015 -0400

    Additional operator* overloads for cfloat, cdouble
---
 include/af/complex.h    |  2 ++
 src/api/cpp/complex.cpp | 16 +++++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/include/af/complex.h b/include/af/complex.h
index 066958b..461ec19 100644
--- a/include/af/complex.h
+++ b/include/af/complex.h
@@ -60,6 +60,8 @@ AFAPI af::cdouble operator-(const af::cdouble &lhs, const af::cdouble &rhs);
 
 AFAPI cfloat operator*(const cfloat &lhs, const cfloat &rhs);
 AFAPI cdouble operator*(const cdouble &lhs, const cdouble &rhs);
+AFAPI cfloat operator*(const cfloat &lhs, const float &rhs);
+AFAPI cdouble operator*(const cdouble &lhs, const double &rhs);
 
 AFAPI cfloat operator/(const cfloat &lhs, const cfloat &rhs);
 AFAPI af::cfloat operator/(const af::cfloat &lhs, const float &rhs);
diff --git a/src/api/cpp/complex.cpp b/src/api/cpp/complex.cpp
index ddfd038..d51003d 100644
--- a/src/api/cpp/complex.cpp
+++ b/src/api/cpp/complex.cpp
@@ -46,7 +46,7 @@ cdouble operator-(const cdouble &lhs, const cdouble &rhs)
     return out;
 }
 
-    using std::complex;
+using std::complex;
 cfloat operator*(const cfloat &lhs, const cfloat &rhs)
 {
     complex<float> clhs(lhs.real, lhs.imag);
@@ -63,6 +63,20 @@ cdouble operator*(const cdouble &lhs, const cdouble &rhs)
     return cdouble(out.real(), out.imag());
 }
 
+cfloat operator*(const cfloat &lhs, const float &rhs)
+{
+    complex<float> clhs(lhs.real, lhs.imag);
+    complex<float> out = clhs * rhs;
+    return cfloat(out.real(), out.imag());
+}
+
+cdouble operator*(const cdouble &lhs, const double &rhs)
+{
+    complex<double> clhs(lhs.real, lhs.imag);
+    complex<double> out = clhs * rhs;
+    return cdouble(out.real(), out.imag());
+}
+
 cfloat operator/(const cfloat &lhs, const cfloat &rhs)
 {
     complex<float> clhs(lhs.real, lhs.imag);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list