Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

[WIP] more JaggedArray.__getitem__ cases in awk-cpp #156

Merged
merged 27 commits into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
147dfd6
added todo list
EscottC Jun 27, 2019
9c23a3c
slices
EscottC Jun 29, 2019
8ad1daf
numpy array slicing, check validity, from offsets, from counts
EscottC Jul 1, 2019
e6c92c5
fromparents, fromuniques, fromjagged, copy, deepcopy
EscottC Jul 2, 2019
8cf2114
small fixes
EscottC Jul 2, 2019
459ccdc
tolist()
EscottC Jul 2, 2019
8e89a4e
fromiter()
EscottC Jul 2, 2019
0290783
in progress (this will fail)
EscottC Jul 3, 2019
c66d7e5
fixed slices
EscottC Jul 3, 2019
a8f97d3
parents2startsstops to fully C++ side
EscottC Jul 3, 2019
57a9473
intarray_getitem and boolarray_getitem
EscottC Jul 3, 2019
011cceb
offsets2parents to CPU_methods.h
EscottC Jul 10, 2019
df150df
this is really bad and I'm going to revert this commit
EscottC Jul 11, 2019
9a18c44
Revert "this is really bad and I'm going to revert this commit"
EscottC Jul 11, 2019
7c2e8d4
Revert "offsets2parents to CPU_methods.h"
EscottC Jul 11, 2019
03643b8
offsets2parents, counts2offsets, makeIntNative => CPU
EscottC Jul 12, 2019
a1224de
hopefully fixing temp address error
EscottC Jul 12, 2019
2ef71a7
startsstops2parents_CPU and getMax_CPU
EscottC Jul 12, 2019
aaccfee
fixing travis errors attempt #1
EscottC Jul 12, 2019
5c66059
fixing travis errors attempt #2
EscottC Jul 12, 2019
76e4a71
Revert "fixing travis errors attempt #2"
EscottC Jul 12, 2019
f4d991d
memory issues in cpu_pybind11.h
EscottC Jul 16, 2019
f9bd610
Revert "memory issues in cpu_pybind11.h"
EscottC Jul 16, 2019
a35cf39
I think I found the problem, finally
EscottC Jul 17, 2019
d911070
a more efficient fix
EscottC Jul 17, 2019
ffea732
Revert "a more efficient fix"
EscottC Jul 17, 2019
85f1535
Merge branch 'master' into awk-cpp-jagged
EscottC Jul 17, 2019
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
12 changes: 7 additions & 5 deletions awkward-cpp/awkward/cpp/array/any.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ namespace py = pybind11;

class AnyOutput {
public:
virtual AnyOutput* getitem(ssize_t) = 0;
virtual py::object unwrap() = 0;
virtual std::string str() = 0;
virtual AnyOutput* getitem(ssize_t) = 0;
virtual py::object unwrap() = 0;
virtual std::string str() = 0;
virtual py::object tolist() = 0;
};

class AnyArray : public AnyOutput {
public:
virtual ssize_t len() = 0;
virtual AnyArray* getitem(ssize_t, ssize_t) = 0;
virtual ssize_t len() = 0;
virtual AnyArray* getitem(ssize_t a, ssize_t b, ssize_t c = 1) = 0;
virtual AnyArray* deepcopy() = 0;
};

class AwkwardArray : public AnyArray {
Expand Down
29 changes: 20 additions & 9 deletions awkward-cpp/awkward/cpp/array/array_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,28 @@

PYBIND11_MODULE(array_impl, m) {
py::class_<JaggedArray>(m, "JaggedArray")
.def(py::init<py::array, py::array, py::object>())
.def_property("starts", &JaggedArray::get_starts, &JaggedArray::set_starts)
.def_property("stops", &JaggedArray::get_stops, &JaggedArray::set_stops)
.def(py::init<py::object, py::object, py::object>())
.def_property("starts", &JaggedArray::get_starts, &JaggedArray::python_set_starts)
.def_property("stops", &JaggedArray::get_stops, &JaggedArray::python_set_stops)
.def_property("content", &JaggedArray::python_get_content, &JaggedArray::python_set_content)
.def_static("offsets2parents", &JaggedArray::offsets2parents)
.def_static("counts2offsets", &JaggedArray::counts2offsets)
.def_static("startsstops2parents", &JaggedArray::startsstops2parents)
.def_static("parents2startsstops", &JaggedArray::parents2startsstops)
.def_static("uniques2offsetsparents", &JaggedArray::uniques2offsetsparents)
.def_static("offsets2parents", &JaggedArray::python_offsets2parents)
.def_static("counts2offsets", &JaggedArray::python_counts2offsets)
.def_static("startsstops2parents", &JaggedArray::python_startsstops2parents)
.def_static("parents2startsstops", &JaggedArray::python_parents2startsstops,
py::arg("parents"), py::arg("length") = -1)
.def_static("uniques2offsetsparents", &JaggedArray::python_uniques2offsetsparents)
.def_static("fromiter", &JaggedArray::fromiter)
.def_static("fromoffsets", &JaggedArray::python_fromoffsets)
.def_static("fromcounts", &JaggedArray::python_fromcounts)
.def_static("fromparents", &JaggedArray::python_fromparents)
.def_static("fromuniques", &JaggedArray::python_fromuniques)
.def_static("fromjagged", &JaggedArray::fromjagged)
.def("copy", &JaggedArray::copy)
.def("deepcopy", &JaggedArray::deepcopy)
.def("tolist", &JaggedArray::tolist)
.def("__getitem__", (py::object (JaggedArray::*)(ssize_t)) &JaggedArray::python_getitem)
.def("__getitem__", (py::object (JaggedArray::*)(ssize_t, ssize_t)) &JaggedArray::python_getitem)
.def("__getitem__", (py::object (JaggedArray::*)(py::slice)) &JaggedArray::python_getitem)
.def("__getitem__", (py::object (JaggedArray::*)(py::array)) &JaggedArray::python_getitem)
.def("__str__", &JaggedArray::str)
.def("__len__", &JaggedArray::len)
.def("__iter__", &JaggedArray::iter)
Expand Down
Loading