8000 Merge pull request #5616 from juliantaylor/backport-1.9.2 · numpy/numpy@1f68813 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1f68813

Browse files
committed
Merge pull request #5616 from juliantaylor/backport-1.9.2
more backports for 1.9.2
2 parents d685309 + 7cfdd98 commit 1f68813

File tree

5 files changed

+44
-17
lines changed

5 files changed

+44
-17
lines changed

doc/release/1.9.2-notes.rst

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@ This is a bugfix only release in the 1.9.x series.
66
Issues fixed
77
============
88

9-
* `#5316 <https://github.com/scipy/scipy/issues/5316>`__: fix too large dtype alignment of strings and complex types
10-
* `#5424 <https://github.com/scipy/scipy/issues/5424>`__: fix ma.median when used on ndarrays
11-
* `#5481 <https://github.com/scipy/scipy/issues/5481>`__: Fix astype for structured array fields of different byte order
12-
* `#5155 <https://github.com/scipy/scipy/issues/5155>`__: Fix loadtxt with comments=None and a string None data
13-
* `#4476 <https://github.com/scipy/scipy/issues/4476>`__: Masked array view fails if structured dtype has datetime component
14-
* `#5388 <https://github.com/scipy/scipy/issues/5388>`__: Make RandomState.set_state and RandomState.get_state threadsafe
15-
* `#5390 <https://github.com/scipy/scipy/issues/5390>`__: make seed, randint and shuffle threadsafe
16-
* `#5374 <https://github.com/scipy/scipy/issues/5374>`__: Fixed incorrect assert_array_almost_equal_nulp documentation
17-
* `#5393 <https://github.com/scipy/scipy/issues/5393>`__: Add support for ATLAS > 3.9.33.
18-
* `#5313 <https://github.com/scipy/scipy/issues/5313>`__: PyArray_AsCArray caused segfault for 3d arrays
19-
* `#5492 <https://github.com/scipy/scipy/issues/5492>`__: handle out of memory in rfftf
20-
* `#4181 <https://github.com/scipy/scipy/issues/4181>`__: fix a few bugs in the random.pareto docstring
21-
* `#5359 <https://github.com/scipy/scipy/issues/5359>`__: minor changes to linspace docstring
22-
* `#4723 <https://github.com/scipy/scipy/issues/4723>`__: fix a compile issues on AIX
9+
* `#5316 <https://github.com/numpy/numpy/issues/5316>`__: fix too large dtype alignment of strings and complex types
10+
* `#5424 <https://github.com/numpy/numpy/issues/5424>`__: fix ma.median when used on ndarrays
11+
* `#5481 <https://github.com/numpy/numpy/issues/5481>`__: Fix astype for structured array fields of different byte order
12+
* `#5354 <https://github.com/numpy/numpy/issues/5354>`__: fix segfault when clipping complex arrays
13+
* `#5524 <https://github.com/numpy/numpy/issues/5524>`__: allow np.argpartition on non ndarrays
14+
* `#5612 <https://github.com/numpy/numpy/issues/5612>`__: Fixes ndarray.fill to accept full range of uint64
15+
* `#5155 <https://github.com/numpy/numpy/issues/5155>`__: Fix loadtxt with comments=None and a string None data
16+
* `#4476 <https://github.com/numpy/numpy/issues/4476>`__: Masked array view fails if structured dtype has datetime component
17+
* `#5388 <https://github.com/numpy/numpy/issues/5388>`__: Make RandomState.set_state and RandomState.get_state threadsafe
18+
* `#5390 <https://github.com/numpy/numpy/issues/5390>`__: make seed, randint and shuffle threadsafe
19+
* `#5374 <https://github.com/numpy/numpy/issues/5374>`__: Fixed incorrect assert_array_almost_equal_nulp documentation
20+
* `#5393 <https://github.com/numpy/numpy/issues/5393>`__: Add support for ATLAS > 3.9.33.
21+
* `#5313 <https://github.com/numpy/numpy/issues/5313>`__: PyArray_AsCArray caused segfault for 3d arrays
22+
* `#5492 <https://github.com/numpy/numpy/issues/5492>`__: handle out of memory in rfftf
23+
* `#4181 <https://github.com/numpy/numpy/issues/4181>`__: fix a few bugs in the random.pareto docstring
24+
* `#5359 <https://github.com/numpy/numpy/issues/5359>`__: minor changes to linspace docstring
25+
* `#4723 <https://github.com/numpy/numpy/issues/4723>`__: fix a compile issues on AIX

numpy/core/fromnumeric.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,8 +679,16 @@ def argpartition(a, kth, axis=-1, kind='introselect', order=None):
679679
>>> x[np.argpartition(x, (1, 3))]
680680
array([1, 2, 3, 4])
681681
682+
>>> x = [3, 4, 2, 1]
683+
>>> np.array(x)[np.argpartition(x, 3)]
684+
array([2, 1, 3, 4])
685+
682686
"""
683-
return a.argpartition(kth, axis, kind=kind, order=order)
687+
try:
688+
argpartition = a.argpartition
689+
except AttributeError:
690+
return _wrapit(a, 'argpartition',kth, axis, kind, order)
691+
return argpartition(kth, axis, kind=kind, order=order)
684692

685693

686694
def sort(a, axis=-1, kind='quicksort', order=None):

numpy/core/src/multiarray/arraytypes.c.src

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3467,8 +3467,6 @@ static void
34673467
npy_intp i;
34683468
@type@ max_val, min_val;
34693469

3470-
min_val = *min;
3471-
max_val = *max;
34723470
if (max != NULL) {
34733471
max_val = *max;
34743472
}

numpy/core/tests/test_multiarray.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,6 +1710,12 @@ def test_partition_fuzz(self):
17101710
assert_array_equal(np.partition(d, kth)[kth], tgt,
17111711
err_msg="data: %r\n kth: %r" % (d, kth))
17121712

1713+
def test_argpartition_gh5524(self):
1714+
# A test for functionality of argpartition on lists.
1715+
d = [6,7,3,2,9,0]
1716+
p = np.argpartition(d,1)
1717+
self.assert_partitioned(np.array(d)[p],[1])
1718+
17131719
def test_flatten(self):
17141720
x0 = np.array([[1, 2, 3], [4, 5, 6]], np.int32)
17151721
x1 = np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]], np.int32)

numpy/core/tests/test_numeric.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,18 @@ def test_simple_complex(self):
11761176
act = self.clip(a, m, M)
11771177
assert_array_s 67E6 trict_equal(ac, act)
11781178

1179+
def test_clip_complex(self):
1180+
# Address Issue gh-5354 for clipping complex arrays
1181+
# Test native complex input without explicit min/max
1182+
# ie, either min=None or max=None
1183+
a = np.ones(10, dtype=np.complex)
1184+
m = a.min()
1185+
M = a.max()
1186+
am = self.fastclip(a, m, None)
1187+
aM = self.fastclip(a, None, M)
1188+
assert_array_strict_equal(am, a)
1189+
assert_array_strict_equal(aM, a)
1190+
11791191
def test_clip_non_contig(self):
11801192
#Test clip for non contiguous native input and native scalar min/max.
11811193
a = self._generate_data(self.nr * 2, self.nc * 3)

0 commit comments

Comments
 (0)
0