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 -------- >>> import numpy as np >>> np.lib.scimath._f
(x)
| 123 | |
| 124 | |
| 125 | def _fix_int_lt_zero(x): |
| 126 | """Convert `x` to double if it has real, negative components. |
| 127 | |
| 128 | Otherwise, output is just the array version of the input (via asarray). |
| 129 | |
| 130 | Parameters |
| 131 | ---------- |
| 132 | x : array_like |
| 133 | |
| 134 | Returns |
| 135 | ------- |
| 136 | array |
| 137 | |
| 138 | Examples |
| 139 | -------- |
| 140 | >>> import numpy as np |
| 141 | >>> np.lib.scimath._fix_int_lt_zero([1,2]) |
| 142 | array([1, 2]) |
| 143 | |
| 144 | >>> np.lib.scimath._fix_int_lt_zero([-1,2]) |
| 145 | array([-1., 2.]) |
| 146 | """ |
| 147 | x = asarray(x) |
| 148 | if any(isreal(x) & (x < 0)): |
| 149 | x = x * 1.0 |
| 150 | return x |
| 151 | |
| 152 | |
| 153 | def _fix_real_abs_gt_1(x): |