8000 WIP: Implement oindex by seberg · Pull Request #6075 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

WIP: Implement oindex #6075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c74243a
WIP: Implement oindex
seberg Jul 14, 2015
c5117ae
DEP: Deprecate unclear plain advanced indexing cases
seberg Nov 29, 2015
7b3fc79
FIX: Implement exact dimensions matchup requirement as in NEP
seberg Nov 29, 2015
4138d20
WIP: Try implementing __getitem__ subclass stuff
seberg Jan 3, 2016
2d6c9de
TST: Adept tests to new indexing methods
seberg Jan 3, 2016
aa07d61
Some tries, of course there are a lot of hidden errors in indexing
seberg Jan 3, 2016
f4bcb46
TST: Some more fixed tests
seberg Feb 14, 2016
72b8ee8
WIP: Try implementing new special method
seberg Sep 10, 2016
90d1dd7
WIP: Try to get stuff to work with __numpy_getitem__
seberg Sep 11, 2016
6ada047
Tiny fixups, I think I remember the main problem now, to make it quic…
seberg Mar 29, 2017
47d77ad
Tiny fixes, but overall the rebase may have been a failure :(
seberg Jun 21, 2018
8000
3385e2d
BUG: One bug and small test fixups
seberg Jun 21, 2018
528605d
ENH: Use special indexing item to drop through subclasses
seberg Jul 27, 2018
b87ade3
Some futer fixups, is ma/core really changed?
seberg Jul 28, 2018
8f4018a
Some further fixups, remaining errors seem pretty unspectacular
seberg Jul 28, 2018
3c2fbbd
Some more fixups, forbid length explicitely
seberg Jul 28, 2018
f5136f4
ENH: as per NEP, outright disallow non-tuple sequences.
seberg Jul 29, 2018
a8440d4
TST: Fix the last few failing tests
seberg Jul 29, 2018
ccdcaf3
BUG,ENH: Fix some smaller bugs, make sure no field access but mostly...
seberg Jul 29, 2018
a2eea49
BUG: Fix reported fancy_ndim
seberg Jul 29, 2018
cd0241c
BUG: Have to check 0D bool first
seberg Jul 29, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
WIP: Implement oindex
  • Loading branch information
seberg committed Jul 27, 2018
commit c74243aeb32e36931659fdd53f323cd5cf2a6fde
2 changes: 2 additions & 0 deletions numpy/core/code_generators/numpy_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
'PyHalfArrType_Type': (217,),
'NpyIter_Type': (218,),
# End 1.6 API
# Start 1.10 API
'PyArrayAttributeIndexer_Type': (301,),
}

#define NPY_NUMUSERTYPES (*(int *)PyArray_API[6])
Expand Down
11 changes: 9 additions & 2 deletions numpy/core/include/numpy/ndarraytypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1315,8 +1315,9 @@ typedef struct {
char *baseoffset;

/*
* after binding consec denotes at which axis the fancy axes
* are inserted.
* after binding consec != 0 means that a transpose is
* necessary. The exact value carries (temporarely unused) info for
* fancy indexing transpose. (Did not rename for API compat)
*/
int consec;
char *dataptr;
Expand Down Expand Up @@ -1355,9 +1356,15 @@ typedef struct {

/* Count for the external loop (which ever it is) for API iteration */
npy_intp iter_count;
/*
* Specify how to transpose for MapIterSwapAxes
*/
npy_intp set_perm[NPY_MAXDIMS];
npy_intp get_perm[NPY_MAXDIMS];

} PyArrayMapIterObject;


enum {
NPY_NEIGHBORHOOD_ITER_ZERO_PADDING,
NPY_NEIGHBORHOOD_ITER_ONE_PADDING,
Expand Down
32 changes: 32 additions & 0 deletions numpy/core/src/multiarray/getset.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "mem_overlap.h"
#include "alloc.h"

#include "mapping.h"

/******************* array attribute get and set routines ******************/

static PyObject *
Expand Down Expand Up @@ -961,6 +963,24 @@ array_transpose_get(PyArrayObject *self)
return PyArray_Transpose(self, NULL);
}

static PyObject *
array_oindex_get(PyArrayObject *self)
{
return PyArray_AttributeIndexerNew(self, OUTER_INDEXING);
}

static PyObject *
array_vindex_get(PyArrayObject *self)
{
return PyArray_AttributeIndexerNew(self, VECTOR_INDEXING);
}

static PyObject *
array_lindex_get(PyArrayObject *self)
{
return PyArray_AttributeIndexerNew(self, FANCY_INDEXING);
}

/* If this is None, no function call is made
--- default sub-class behavior
*/
Expand Down Expand Up @@ -1031,6 +1051,18 @@ NPY_NO_EXPORT PyGetSetDef array_getsetlist[] = {
(getter)array_transpose_get,
NULL,
NULL, NULL},
{"oindex",
(getter)array_oindex_get,
NULL,
NULL, NULL},
{"vindex",
(getter)array_vindex_get,
NULL,
NULL, NULL},
{"lindex",
(getter)array_lindex_get,
NULL,
NULL, NULL},
{"__array_interface__",
(getter)array_interface_get,
NULL,
Expand Down
Loading
0