Convert `x` to double if it has real, negative components. Otherwise, output is just the array version of the input (via asarray). Parameters ---------- x : array_like Returns ------- array Examples -------- >>> np.lib.scimath._fix_int_lt_zero([1,2]) a
(x)
| 138 | |
| 139 | |
| 140 | def _fix_int_lt_zero(x): |
| 141 | """Convert `x` to double if it has real, negative components. |
| 142 | |
| 143 | Otherwise, output is just the array version of the input (via asarray). |
| 144 | |
| 145 | Parameters |
| 146 | ---------- |
| 147 | x : array_like |
| 148 | |
| 149 | Returns |
| 150 | ------- |
| 151 | array |
| 152 | |
| 153 | Examples |
| 154 | -------- |
| 155 | >>> np.lib.scimath._fix_int_lt_zero([1,2]) |
| 156 | array([1, 2]) |
| 157 | |
| 158 | >>> np.lib.scimath._fix_int_lt_zero([-1,2]) |
| 159 | array([-1., 2.]) |
| 160 | """ |
| 161 | x = asarray(x) |
| 162 | if any(isreal(x) & (x < 0)): |
| 163 | x = x * 1.0 |
| 164 | return x |
| 165 | |
| 166 | |
| 167 | def _fix_real_abs_gt_1(x): |