Boost logo

Ublas :

Subject: [ublas] enable complex @ int
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2009-09-18 07:27:18


I use this patch to traits.hpp:

***************
*** 40,45 ****
--- 41,81 ----
  
  namespace boost { namespace numeric { namespace ublas {
  
+ typedef std::complex<double> complex_t;
+
+ inline complex_t operator+ (int in1, complex_t in2) {
+ return double(in1) + in2;
+ }
+
+ inline complex_t operator+ (complex_t in1, int in2) {
+ return in1 + double(in2);
+ }
+
+ inline complex_t operator- (int in1, complex_t in2) {
+ return double(in1) - in2;
+ }
+
+ inline complex_t operator- (complex_t in1, int in2) {
+ return in1 - double(in2);
+ }
+
+ inline complex_t operator* (int in1, complex_t in2) {
+ return double(in1) * in2;
+ }
+
+ inline complex_t operator* (complex_t in1, int in2) {
+ return in1 * double(in2);
+ }
+
+ inline complex_t operator/ (int in1, complex_t in2) {
+ return double(in1) / in2;
+ }
+
+ inline complex_t operator/ (complex_t in1, int in2) {
+ return in1 / double(in2);
+ }
+
+