-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented ListArray and ListOffsetArray's __getitem__. (#11)
* Start by refreshing RawArray class. * Reinstate the RawArray tests. * RawArray now has the infrastructure for getitem. * Maybe I shouldn't be working on RawArray; I don't see how this will fit into ListOffsetArray. * Work on ListArray instead. * Cleaned up setid. * Ready to work on ListArray. * More cleaning up; working on making getitem universal. * Cleaned up a lot of duplication in pyawkward.cpp. * Rename Content::get (and others) to ::getitem_at and ::slice to ::getitem_range. * Start on ListArray tests. * Tested ListArray::getitem_at and ListArray::getitem_range. * Ready to work on ListArray::getitem_next. * Implemented basic (not entirely correct) ListArray::getitem for SliceArray. * more correct * Very nearly have recursive ListArray::getitem((array, array)). * it works * Split ListArray::getitem(array) into advanced and non-advanced cases. * [skip ci] calling NumpyArray::getitem_next from getitem_next isn't looking promising * It looks like NumpyArray::getitem_next(3 args) can be a simple call to NumpyArray::getitem_next(6 args) * ListArray::getitem_next slice and array tests work; need to clean up. * Cleaned up. * Solved ListArray::getitem_next(SliceAt). * Cleaned up ListArray::getitem_next(SliceAt). * ListArray::getitem_next(SliceEllipsis), but SliceNewAxis will have to wait for RegularArray. * ListOffsetArray can do everything ListArray can do. * Started converting cases that create ListArrays into creating ListOffsetArrays. * Continuing to convert cases that create ListArrays into creating ListOffsetArrays. * ListArray and ListOffsetArray now share an entry getitem_next. * Fix problems in compilation. * Fix more problems in compilation. * If *not* py27. * Implemented a new setid for ListOffsetArray. * Finished up PR #11. * Fix warnings on Windows and MacOS.
- Loading branch information
Showing
33 changed files
with
2,872 additions
and
1,236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.1.3 | ||
0.1.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# BSD 3-Clause License; see https://github.com/jpivarski/awkward-1.0/blob/master/LICENSE | ||
|
||
import awkward1.layout | ||
|
||
anycontent = ( | ||
awkward1.layout.NumpyArray, | ||
awkward1.layout.ListArray32, | ||
awkward1.layout.ListArray64, | ||
awkward1.layout.ListOffsetArray32, | ||
awkward1.layout.ListOffsetArray64, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// BSD 3-Clause License; see https://github.com/jpivarski/awkward-1.0/blob/master/LICENSE | ||
|
||
#ifndef AWKWARD_LISTARRAY_H_ | ||
#define AWKWARD_LISTARRAY_H_ | ||
|
||
#include <memory> | ||
|
||
#include "awkward/cpu-kernels/util.h" | ||
#include "awkward/Index.h" | ||
#include "awkward/Identity.h" | ||
#include "awkward/Content.h" | ||
|
||
namespace awkward { | ||
template <typename T> | ||
class ListArrayOf: public Content { | ||
public: | ||
ListArrayOf<T>(const std::shared_ptr<Identity> id, const IndexOf<T> starts, const IndexOf<T> stops, const std::shared_ptr<Content> content) | ||
: id_(id) | ||
, starts_(starts) | ||
, stops_(stops) | ||
, content_(content) { } | ||
|
||
const IndexOf<T> starts() const { return starts_; } | ||
const IndexOf<T> stops() const { return stops_; } | ||
const std::shared_ptr<Content> content() const { return content_.get()->shallow_copy(); } | ||
|
||
virtual const std::shared_ptr<Identity> id() const { return id_; } | ||
virtual void setid(); | ||
virtual void setid(const std::shared_ptr<Identity> id); | ||
virtual const std::string tostring_part(const std::string indent, const std::string pre, const std::string post) const; | ||
virtual int64_t length() const; | ||
virtual const std::shared_ptr<Content> shallow_copy() const; | ||
virtual const std::shared_ptr<Content> getitem_at(int64_t at) const; | ||
virtual const std::shared_ptr<Content> getitem_range(int64_t start, int64_t stop) const; | ||
virtual const std::shared_ptr<Content> getitem_next(const std::shared_ptr<SliceItem> head, const Slice& tail, const Index64& advanced) const; | ||
virtual const std::shared_ptr<Content> carry(const Index64& carry) const; | ||
virtual const std::pair<int64_t, int64_t> minmax_depth() const; | ||
|
||
private: | ||
std::shared_ptr<Identity> id_; | ||
const IndexOf<T> starts_; | ||
const IndexOf<T> stops_; | ||
const std::shared_ptr<Content> content_; | ||
}; | ||
|
||
typedef ListArrayOf<int32_t> ListArray32; | ||
typedef ListArrayOf<int64_t> ListArray64; | ||
} | ||
|
||
#endif // AWKWARD_LISTARRAY_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.