Backwards compat helper: force w to be real if t.dtype is real and w.imag == 0
(w, t)
| 187 | |
| 188 | |
| 189 | def _to_real_if_imag_zero(w, t): |
| 190 | """Backwards compat helper: force w to be real if t.dtype is real and w.imag == 0 |
| 191 | """ |
| 192 | result_t = t.dtype.type |
| 193 | if not isComplexType(result_t) and all(w.imag == 0.0): |
| 194 | w = w.real |
| 195 | result_t = _realType(result_t) |
| 196 | else: |
| 197 | result_t = _complexType(result_t) |
| 198 | return w.astype(result_t, copy=False) |
| 199 | |
| 200 | |
| 201 | def _commonType(*arrays): |
no test coverage detected
searching dependent graphs…