Commit 95b8bfbb73dc44b1e3ff2f805b6f3f20411106a3
1 parent
53b71616
Add GNdarray array division operators for Python 2 and Python 3
Showing
1 changed file
with
10 additions
and
1 deletions
pyext/GNdarray.i
| ... | ... | @@ -56,7 +56,6 @@ public: |
| 56 | 56 | GNdarray& operator+=(const GNdarray& array); |
| 57 | 57 | GNdarray& operator-=(const GNdarray& array); |
| 58 | 58 | GNdarray& operator*=(const GNdarray& array); |
| 59 | - GNdarray& operator/=(const GNdarray& array); | |
| 60 | 59 | GNdarray& operator+=(const double& value); |
| 61 | 60 | GNdarray& operator-=(const double& value); |
| 62 | 61 | GNdarray& operator*=(const double& value); |
| ... | ... | @@ -149,6 +148,16 @@ public: |
| 149 | 148 | return (*self) / a; |
| 150 | 149 | } |
| 151 | 150 | // Python 2.x operator/= |
| 151 | + GNdarray __idiv__(const GNdarray& array) { | |
| 152 | + self->operator/=(array); | |
| 153 | + return (*self); | |
| 154 | + } | |
| 155 | + // Python 3.x operator/= | |
| 156 | + GNdarray __itruediv__(const GNdarray& array) { | |
| 157 | + self->operator/=(array); | |
| 158 | + return (*self); | |
| 159 | + } | |
| 160 | + // Python 2.x operator/= | |
| 152 | 161 | GNdarray __idiv__(const double& value) { |
| 153 | 162 | self->operator/=(value); |
| 154 | 163 | return (*self); | ... | ... |