diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 5e6a04b470..4c38fceca2 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -206,7 +206,7 @@ jobs: - name: Test run: >- - python -m pytest -vv -rs tests --cov=awkward._v2 --cov-report=term + python -m pytest -vv -rs tests --cov=awkward --cov-report=term --cov-report=xml - name: Codecov diff --git a/.gitignore b/.gitignore index de14e53354..5a44b6d68a 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ docs/demos/test-program.cpp include/awkward/kernels.h src/awkward/_kernel_signatures.py src/awkward/_kernel_signatures_cuda.py -src/awkward/_v2/_connect/cuda/_kernel_signatures.py +src/awkward/_connect/cuda/_kernel_signatures.py # Kernel tests tests-cpu-kernels diff --git a/.gitmodules b/.gitmodules index 48f43d6943..27b03d4421 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,3 @@ [submodule "rapidjson"] path = rapidjson url = https://github.com/Tencent/rapidjson.git -[submodule "dlpack"] - path = dlpack - url = https://github.com/dmlc/dlpack.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 5fc3e2c5ea..f20ce4fb6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,11 +42,11 @@ target_compile_definitions(awkward-parent INTERFACE VERSION_INFO="${VERSION_INFO target_include_directories(awkward-parent INTERFACE include) target_compile_features(awkward-parent INTERFACE cxx_std_11) -# C++ dependencies (header-only): RapidJSON and dlpack -target_include_directories(awkward-parent INTERFACE rapidjson/include dlpack/include) +# C++ dependencies (header-only): RapidJSON +target_include_directories(awkward-parent INTERFACE rapidjson/include) # C++ dependencies (header-only): GrowableBuffer -target_include_directories(awkward-parent INTERFACE src/awkward/_v2/cpp-headers/) +target_include_directories(awkward-parent INTERFACE src/awkward/cpp-headers/) # First tier: cpu-kernels (object files, static library, and dynamic library). add_library(awkward-cpu-kernels-objects OBJECT ${CPU_KERNEL_SOURCES}) diff --git a/MANIFEST.in b/MANIFEST.in index d63bd556bb..3875d5daf7 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,7 +3,7 @@ include dev/generate-kernel-signatures.py include kernel-specification.yml recursive-include include *.h recursive-include src *.cpp *.py *.cu -recursive-include src/awkward/_v2/cpp-headers *.h +recursive-include src/awkward/cpp-headers *.h recursive-include tests *.cpp *.py samples/* recursive-include tests-cpu-kernels *.py recursive-include tests-cuda-kernels *.py diff --git a/dev/flake8_awkward.py b/dev/flake8_awkward.py index 1c5893e5fc..b359aa83fb 100644 --- a/dev/flake8_awkward.py +++ b/dev/flake8_awkward.py @@ -11,7 +11,7 @@ class Flake8ASTErrorInfo(NamedTuple): class Visitor(ast.NodeVisitor): - msg = "AK101 exception must be wrapped in ak._v2._util.*error" + msg = "AK101 exception must be wrapped in ak._util.*error" def __init__(self): self.errors: list[Flake8ASTErrorInfo] = [] diff --git a/dev/generate-kernel-signatures.py b/dev/generate-kernel-signatures.py index 02a4ee3cf1..8156f448f6 100644 --- a/dev/generate-kernel-signatures.py +++ b/dev/generate-kernel-signatures.py @@ -312,7 +312,6 @@ def kernel_signatures_cuda_py(specification): os.path.dirname(CURRENT_DIR), "src", "awkward", - "_v2", "_connect", "cuda", "_kernel_signatures.py", @@ -347,8 +346,8 @@ def kernel_signatures_cuda_py(specification): float64, ) -from awkward._v2._connect.cuda import fetch_specialization -from awkward._v2._connect.cuda import import_cupy +from awkward._connect.cuda import fetch_specialization +from awkward._connect.cuda import import_cupy cupy = import_cupy("Awkward Arrays with CUDA") """ @@ -365,7 +364,6 @@ def by_signature(cuda_kernel_templates): os.path.dirname(CURRENT_DIR), "src", "awkward", - "_v2", "_connect", "cuda", "cuda_kernels", @@ -391,7 +389,6 @@ def by_signature(cuda_kernel_templates): os.path.dirname(CURRENT_DIR), "src", "awkward", - "_v2", "_connect", "cuda", "cuda_kernels", diff --git a/dev/generate-tests.py b/dev/generate-tests.py index e9eb3dd883..4049a0205c 100644 --- a/dev/generate-tests.py +++ b/dev/generate-tests.py @@ -297,7 +297,6 @@ def getcudakernelslist(): os.path.dirname(CURRENT_DIR), "src", "awkward", - "_v2", "_connect", "cuda", "cuda_kernels", @@ -675,7 +674,7 @@ def gencudakerneltests(specdict): ) f.write( - "import cupy\nimport pytest\n\nimport awkward as ak\nimport awkward._v2._connect.cuda as ak_cu\n\ncupy_nplike = ak.nplike.Cupy.instance()\n\n" + "import cupy\nimport pytest\n\nimport awkward as ak\nimport awkward._connect.cuda as ak_cu\n\ncupy_nplike = ak.nplike.Cupy.instance()\n\n" ) num = 1 if spec.tests == []: diff --git a/dlpack b/dlpack deleted file mode 160000 index e1e11e0d55..0000000000 --- a/dlpack +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e1e11e0d555c08bec08a6c7773aa777dfcaae9da diff --git a/docs-doxygen/Doxyfile b/docs-doxygen/Doxyfile index ac9fe03ea0..05884f438e 100644 --- a/docs-doxygen/Doxyfile +++ b/docs-doxygen/Doxyfile @@ -831,7 +831,7 @@ WARN_LOGFILE = INPUT = include \ docs-doxygen/index.md \ - src/awkward/_v2/cpp-headers/ + src/awkward/cpp-headers/ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/docs-doxygen/index.md b/docs-doxygen/index.md index 02a3cad57b..9576568ca0 100644 --- a/docs-doxygen/index.md +++ b/docs-doxygen/index.md @@ -97,7 +97,7 @@ This is the type of a [ak::Content](classawkward_1_1Content.html) array expresse ### ArrayBuilder structure -The [ak.ArrayBuilder](../_auto/ak.ArrayBuilder.html) is an append-only array for generating data backed by [ak.layout.ArrayBuilder](../_auto/ak.layout.ArrayBuilder.html) (layout-level ArrayBuilder) and [ak::ArrayBuilder](classawkward_1_1ArrayBuilder.html) (C++ implementation). +The [ak.ArrayBuilder](../_auto/ak.ArrayBuilder.html) is an append-only array for generating data backed by `ak._ext.ArrayBuilder` (layout-level ArrayBuilder) and [ak::ArrayBuilder](classawkward_1_1ArrayBuilder.html) (C++ implementation). [ak::ArrayBuilder](classawkward_1_1ArrayBuilder.html) is the front-end for a tree of [ak::Builder](classawkward_1_1Builder.html) instances. The structure of this tree indicates the current state of knowledge about the type of the data it's being filled with, and this tree can grow from any node. Types always grow in the direction of more generality, so the tree only gets bigger. diff --git a/docs-sphinx/ak.behavior.rst b/docs-sphinx/ak.behavior.rst index 5f6f206447..a5b5229776 100644 --- a/docs-sphinx/ak.behavior.rst +++ b/docs-sphinx/ak.behavior.rst @@ -123,8 +123,8 @@ and it may be accessed as the ``"__record__"`` property, through the {'__record__': 'point'} We have to dig into the layout's content because the ``"__record__"`` parameter -is set on the :doc:`ak.layout.RecordArray`, which is buried inside of a -:doc:`ak.layout.ListOffsetArray`. +is set on the :class:`ak.contents.RecordArray`, which is buried inside of a +:class:`ak.contents.ListOffsetArray`. Alternatively, we can navigate to a single :doc:`_auto/ak.Record` first: diff --git a/docs-sphinx/ak.forms.BitMaskedForm.rst b/docs-sphinx/ak.forms.BitMaskedForm.rst deleted file mode 100644 index 6afb6b6a92..0000000000 --- a/docs-sphinx/ak.forms.BitMaskedForm.rst +++ /dev/null @@ -1,42 +0,0 @@ -ak.forms.BitMaskedForm ----------------------- - -The form of a :doc:`ak.layout.BitMaskedArray`, which has :doc:`ak.types.OptionType`. - -In addition to the properties and methods described in :doc:`ak.forms.Form`, -this has the following. - -ak.forms.BitMaskedForm.__init__ -=============================== - -.. py:method:: ak.forms.BitMaskedForm.__init__(mask, content, valid_when, lsb_order, has_identities=False, parameters=None) - -ak.forms.BitMaskedForm.mask -=========================== - -.. py:attribute:: ak.forms.BitMaskedForm.mask - -ak.forms.BitMaskedForm.content -============================== - -.. py:attribute:: ak.forms.BitMaskedForm.content - -ak.forms.BitMaskedForm.valid_when -================================= - -.. py:attribute:: ak.forms.BitMaskedForm.valid_when - -ak.forms.BitMaskedForm.lsb_order -================================ - -.. py:attribute:: ak.forms.BitMaskedForm.lsb_order - -ak.forms.BitMaskedForm.has_identities -===================================== - -.. py:attribute:: ak.forms.BitMaskedForm.has_identities - -ak.forms.BitMaskedForm.parameters -================================= - -.. py:attribute:: ak.forms.BitMaskedForm.parameters diff --git a/docs-sphinx/ak.forms.ByteMaskedForm.rst b/docs-sphinx/ak.forms.ByteMaskedForm.rst deleted file mode 100644 index ace53e4bee..0000000000 --- a/docs-sphinx/ak.forms.ByteMaskedForm.rst +++ /dev/null @@ -1,37 +0,0 @@ -ak.forms.ByteMaskedForm ------------------------ - -The form of a :doc:`ak.layout.ByteMaskedArray`, which has :doc:`ak.types.OptionType`. - -In addition to the properties and methods described in :doc:`ak.forms.Form`, -this has the following. - -ak.forms.ByteMaskedForm.__init__ -================================ - -.. py:method:: ak.forms.ByteMaskedForm.__init__(mask, content, valid_when, has_identities=False, parameters=None) - -ak.forms.ByteMaskedForm.mask -============================ - -.. py:attribute:: ak.forms.ByteMaskedForm.mask - -ak.forms.ByteMaskedForm.content -=============================== - -.. py:attribute:: ak.forms.ByteMaskedForm.content - -ak.forms.ByteMaskedForm.valid_when -================================== - -.. py:attribute:: ak.forms.ByteMaskedForm.valid_when - -ak.forms.ByteMaskedForm.has_identities -====================================== - -.. py:attribute:: ak.forms.ByteMaskedForm.has_identities - -ak.forms.ByteMaskedForm.parameters -================================== - -.. py:attribute:: ak.forms.ByteMaskedForm.parameters diff --git a/docs-sphinx/ak.forms.EmptyForm.rst b/docs-sphinx/ak.forms.EmptyForm.rst deleted file mode 100644 index 9faa0ef522..0000000000 --- a/docs-sphinx/ak.forms.EmptyForm.rst +++ /dev/null @@ -1,22 +0,0 @@ -ak.forms.EmptyForm ----------------------- - -The form of a :doc:`ak.layout.EmptyArray`, which has :doc:`ak.types.OptionType`. - -In addition to the properties and methods described in :doc:`ak.forms.Form`, -this has the following. - -ak.forms.EmptyForm.__init__ -=========================== - -.. py:method:: ak.forms.EmptyForm.__init__(has_identities=False, parameters=None) - -ak.forms.EmptyForm.has_identities -================================= - -.. py:attribute:: ak.forms.EmptyForm.has_identities - -ak.forms.EmptyForm.parameters -============================= - -.. py:attribute:: ak.forms.EmptyForm.parameters diff --git a/docs-sphinx/ak.forms.Form.rst b/docs-sphinx/ak.forms.Form.rst deleted file mode 100644 index db20731405..0000000000 --- a/docs-sphinx/ak.forms.Form.rst +++ /dev/null @@ -1,95 +0,0 @@ -ak.forms.Form -------------- - -Superclass of type nodes that describe a low-level data type or "form". Unlike -the high-level type (see :doc:`_auto/ak.type`), there is an exact one-to-one -relationship between each :doc:`ak.layout.Content` class (see -`ak.Array.layout <_auto/ak.Array.html#ak-array-layout>`_) and each Form. - -Forms are rendered as JSON strings, the same JSON that can be used to construct -them. - -The type subclasses are listed below. - - * :doc:`ak.forms.EmptyForm` for :doc:`ak.layout.EmptyArray` - * :doc:`ak.forms.NumpyForm` for :doc:`ak.layout.NumpyArray` - * :doc:`ak.forms.RegularForm` for :doc:`ak.layout.RegularArray` - * :doc:`ak.forms.ListForm` for :doc:`ak.layout.ListArray` - * :doc:`ak.forms.ListOffsetForm` for :doc:`ak.layout.ListOffsetArray` - * :doc:`ak.forms.RecordForm` for :doc:`ak.layout.RecordArray` - * :doc:`ak.forms.IndexedForm` for :doc:`ak.layout.IndexedArray` - * :doc:`ak.forms.IndexedOptionForm` for :doc:`ak.layout.IndexedOptionArray` - * :doc:`ak.forms.ByteMaskedForm` for :doc:`ak.layout.ByteMaskedArray` - * :doc:`ak.forms.BitMaskedForm` for :doc:`ak.layout.BitMaskedArray` - * :doc:`ak.forms.UnmaskedForm` for :doc:`ak.layout.UnmaskedArray` - * :doc:`ak.forms.UnionForm` for :doc:`ak.layout.UnionArray` - * :doc:`ak.forms.VirtualForm` for :doc:`ak.layout.VirtualArray` - -All :doc:`ak.forms.Form` instances have the following properties and methods -in common. - -ak.forms.Form.__eq__ -==================== - -.. py:method:: ak.forms.Form.__eq__(other) - -True if two forms are equal; False otherwise. - -ak.forms.Form.__ne__ -==================== - -.. py:method:: ak.forms.Form.__ne__() - -True if two forms are not equal; False otherwise. - -ak.forms.Form.__repr__ -====================== - -.. py:method:: ak.forms.Form.__repr__() - -String representation of the form, which is pretty, non-verbose #ak.forms.Form.tojson. - -ak.forms.Form.__getstate__ -========================== - -.. py:method:: ak.forms.Form.__getstate__() - -Forms can be pickled. - -ak.forms.Form.__setstate__ -========================== - -.. py:method:: ak.forms.Form.__setstate__(arg0) - -Forms can be pickled. - -ak.forms.Form.tojson -==================== - -.. py:method:: ak.forms.Form.tojson(pretty, verbose) - -Converts to a JSON string. If ``pretty`` (bool), it will be multi-line and indented; -if ``verbose``, all fields will be shown, even defaults. - -ak.forms.Form.type -================== - -.. py:method:: ak.forms.Form.type(typestrs) - -The single high-level type associated with this low-level form. Conversion in the -other direction is not unique. ``typestrs`` is a dict of ``__record__`` to type-string -names (see `Custom type names `_). - -ak.forms.Form.parameters -======================== - -.. py:attribute:: ak.forms.Form.parameters - -Returns the parameters associated with this form. - -ak.forms.Form.parameter -======================= - -.. py:method:: ak.forms.Form.parameter(key) - -Returns the parameter associated with ``key``. (Always returns, possibly None.) diff --git a/docs-sphinx/ak.forms.IndexedForm.rst b/docs-sphinx/ak.forms.IndexedForm.rst deleted file mode 100644 index 921f3a3f99..0000000000 --- a/docs-sphinx/ak.forms.IndexedForm.rst +++ /dev/null @@ -1,32 +0,0 @@ -ak.forms.IndexedForm --------------------- - -The form of a :doc:`ak.layout.IndexedArray`, which has the same type as its ``content``. - -In addition to the properties and methods described in :doc:`ak.forms.Form`, -this has the following. - -ak.forms.IndexedForm.__init__ -============================= - -.. py:method:: ak.forms.IndexedForm.__init__(index, content, has_identities=False, parameters=None) - -ak.forms.IndexedForm.index -========================== - -.. py:attribute:: ak.forms.IndexedForm.index - -ak.forms.IndexedForm.content -============================ - -.. py:attribute:: ak.forms.IndexedForm.content - -ak.forms.IndexedForm.has_identities -=================================== - -.. py:attribute:: ak.forms.IndexedForm.has_identities - -ak.forms.IndexedForm.parameters -=============================== - -.. py:attribute:: ak.forms.IndexedForm.parameters diff --git a/docs-sphinx/ak.forms.IndexedOptionForm.rst b/docs-sphinx/ak.forms.IndexedOptionForm.rst deleted file mode 100644 index 937d93d2d6..0000000000 --- a/docs-sphinx/ak.forms.IndexedOptionForm.rst +++ /dev/null @@ -1,32 +0,0 @@ -ak.forms.IndexedOptionForm --------------------------- - -The form of a :doc:`ak.layout.IndexedOptionArray`, which has :doc:`ak.types.OptionType`. - -In addition to the properties and methods described in :doc:`ak.forms.Form`, -this has the following. - -ak.forms.IndexedOptionForm.__init__ -=================================== - -.. py:method:: ak.forms.IndexedOptionForm.__init__(index, content, has_identities=False, parameters=None) - -ak.forms.IndexedOptionForm.index -================================ - -.. py:attribute:: ak.forms.IndexedOptionForm.index - -ak.forms.IndexedOptionForm.content -================================== - -.. py:attribute:: ak.forms.IndexedOptionForm.content - -ak.forms.IndexedOptionForm.has_identities -========================================= - -.. py:attribute:: ak.forms.IndexedOptionForm.has_identities - -ak.forms.IndexedOptionForm.parameters -===================================== - -.. py:attribute:: ak.forms.IndexedOptionForm.parameters diff --git a/docs-sphinx/ak.forms.ListForm.rst b/docs-sphinx/ak.forms.ListForm.rst deleted file mode 100644 index adb1fe08fb..0000000000 --- a/docs-sphinx/ak.forms.ListForm.rst +++ /dev/null @@ -1,37 +0,0 @@ -ak.forms.ListForm ------------------ - -The form of a :doc:`ak.layout.ListArray`, which has :doc:`ak.types.ListType`. - -In addition to the properties and methods described in :doc:`ak.forms.Form`, -this has the following. - -ak.forms.ListForm.__init__ -========================== - -.. py:method:: ak.forms.ListForm.__init__(starts, stops, content, has_identities=False, parameters=None) - -ak.forms.ListForm.starts -======================== - -.. py:attribute:: ak.forms.ListForm.starts - -ak.forms.ListForm.stops -======================= - -.. py:attribute:: ak.forms.ListForm.stops - -ak.forms.ListForm.content -========================= - -.. py:attribute:: ak.forms.ListForm.content - -ak.forms.ListForm.has_identities -================================ - -.. py:attribute:: ak.forms.ListForm.has_identities - -ak.forms.ListForm.parameters -============================ - -.. py:attribute:: ak.forms.ListForm.parameters diff --git a/docs-sphinx/ak.forms.ListOffsetForm.rst b/docs-sphinx/ak.forms.ListOffsetForm.rst deleted file mode 100644 index 5ff9f5918d..0000000000 --- a/docs-sphinx/ak.forms.ListOffsetForm.rst +++ /dev/null @@ -1,32 +0,0 @@ -ak.forms.ListOffsetForm ------------------------ - -The form of a :doc:`ak.layout.ListOffsetArray`, which has :doc:`ak.types.ListType`. - -In addition to the properties and methods described in :doc:`ak.forms.Form`, -this has the following. - -ak.forms.ListOffsetForm.__init__ -=================================== - -.. py:method:: ak.forms.ListOffsetForm.__init__(offsets, content, has_identities=False, parameters=None) - -ak.forms.ListOffsetForm.offsets -=============================== - -.. py:attribute:: ak.forms.ListOffsetForm.offsets - -ak.forms.ListOffsetForm.content -=============================== - -.. py:attribute:: ak.forms.ListOffsetForm.content - -ak.forms.ListOffsetForm.has_identities -====================================== - -.. py:attribute:: ak.forms.ListOffsetForm.has_identities - -ak.forms.ListOffsetForm.parameters -================================== - -.. py:attribute:: ak.forms.ListOffsetForm.parameters diff --git a/docs-sphinx/ak.forms.NumpyForm.rst b/docs-sphinx/ak.forms.NumpyForm.rst deleted file mode 100644 index b35fe1c160..0000000000 --- a/docs-sphinx/ak.forms.NumpyForm.rst +++ /dev/null @@ -1,46 +0,0 @@ -ak.forms.NumpyForm ------------------- - -The form of a :doc:`ak.layout.NumpyArray`, which has :doc:`ak.types.PrimitiveType`, possibly wrapped -in one or more layers of :doc:`ak.types.RegularType`. - -In addition to the properties and methods described in :doc:`ak.forms.Form`, -this has the following. - -ak.forms.NumpyForm.__init__ -=========================== - -.. py:method:: ak.forms.NumpyForm.__init__(inner_shape, itemsize, format, has_identities=False, parameters=None) - -The ``inner_shape`` is the ``shape[1:]`` of the corresponding :doc:`ak.layout.NumpyArray` (*default* ``[]``). - -The ``format`` is the dtype string returned by pybind11, which is platform-dependent. A platform-independent -interpretation of this is ``primitive``. When reading from JSON, either the ``primitive`` or the ``format`` -needs to be specified. - -The ``itemsize`` is redundant, but included for safety because of the platform-dependence of ``format``. - -ak.forms.NumpyForm.inner_shape -============================== - -.. py:attribute:: ak.forms.NumpyForm.inner_shape - -ak.forms.NumpyForm.itemsize -=========================== - -.. py:attribute:: ak.forms.NumpyForm.itemsize - -ak.forms.NumpyForm.format -========================= - -.. py:attribute:: ak.forms.NumpyForm.format - -ak.forms.NumpyForm.has_identities -================================= - -.. py:attribute:: ak.forms.NumpyForm.has_identities - -ak.forms.NumpyForm.parameters -============================= - -.. py:attribute:: ak.forms.NumpyForm.parameters diff --git a/docs-sphinx/ak.forms.RecordForm.rst b/docs-sphinx/ak.forms.RecordForm.rst deleted file mode 100644 index b1c13b5280..0000000000 --- a/docs-sphinx/ak.forms.RecordForm.rst +++ /dev/null @@ -1,76 +0,0 @@ -ak.forms.RecordForm -------------------- - -The form of a :doc:`ak.layout.RecordArray`, which has :doc:`ak.types.RecordType`. - -In addition to the properties and methods described in :doc:`ak.forms.Form`, -this has the following. - -ak.forms.RecordForm.__init__ -============================ - -.. py:method:: ak.forms.RecordForm.__init__(contents, has_identities=False, parameters=None) - -The ``contents`` is a list of Forms. - -ak.forms.RecordForm.contents -============================ - -.. py:attribute:: ak.forms.RecordForm.contents - -ak.forms.RecordForm.has_identities -=================================== - -.. py:attribute:: ak.forms.RecordForm.has_identities - -ak.forms.RecordForm.parameters -=============================== - -.. py:attribute:: ak.forms.RecordForm.parameters - -ak.forms.RecordForm.istuple -=========================== - -.. py:attribute:: ak.forms.RecordForm.istuple - -ak.forms.RecordForm.numfields -============================= - -.. py:attribute:: ak.forms.RecordForm.numfields - -ak.forms.RecordForm.fieldindex -============================== - -.. py:method:: ak.forms.RecordForm.fieldindex(key) - -ak.forms.RecordForm.key -======================= - -.. py:method:: ak.forms.RecordForm.key(fieldindex) - -ak.forms.RecordForm.haskey -========================== - -.. py:method:: ak.forms.RecordForm.haskey(key) - -ak.forms.RecordForm.keys -======================== - -.. py:method:: ak.forms.RecordForm.keys() - -ak.forms.RecordForm.content -=========================== - -.. py:method:: ak.forms.RecordForm.content(fieldindex) - -.. py:method:: ak.forms.RecordForm.content(key) - -ak.forms.RecordForm.items -========================= - -.. py:method:: ak.forms.RecordForm.items() - -ak.forms.RecordForm.values -========================== - -.. py:method:: ak.forms.RecordForm.values() diff --git a/docs-sphinx/ak.forms.RegularForm.rst b/docs-sphinx/ak.forms.RegularForm.rst deleted file mode 100644 index 5ef01d412d..0000000000 --- a/docs-sphinx/ak.forms.RegularForm.rst +++ /dev/null @@ -1,32 +0,0 @@ -ak.forms.RegularForm --------------------- - -The form of a :doc:`ak.layout.RegularArray`, which has :doc:`ak.types.RegularType`. - -In addition to the properties and methods described in :doc:`ak.forms.Form`, -this has the following. - -ak.forms.RegularForm.__init__ -============================= - -.. py:method:: ak.forms.RegularForm.__init__(content, size, has_identities=False, parameters=None) - -ak.forms.RegularForm.content -============================ - -.. py:attribute:: ak.forms.RegularForm.content - -ak.forms.RegularForm.size -========================= - -.. py:attribute:: ak.forms.RegularForm.size - -ak.forms.RegularForm.has_identities -=================================== - -.. py:attribute:: ak.forms.RegularForm.has_identities - -ak.forms.RegularForm.parameters -=============================== - -.. py:attribute:: ak.forms.RegularForm.parameters diff --git a/docs-sphinx/ak.forms.UnionForm.rst b/docs-sphinx/ak.forms.UnionForm.rst deleted file mode 100644 index 89cdb3786a..0000000000 --- a/docs-sphinx/ak.forms.UnionForm.rst +++ /dev/null @@ -1,44 +0,0 @@ -ak.forms.UnionForm ------------------- - -The form of a :doc:`ak.layout.UnionArray`, which has :doc:`ak.types.UnionType`. - -In addition to the properties and methods described in :doc:`ak.forms.Form`, -this has the following. - -ak.forms.UnionForm.__init__ -=========================== - -.. py:method:: ak.forms.UnionForm.__init__(tags, index, contents, has_identities=False, parameters=None) - -The ``contents`` is a list of Forms. - -ak.forms.UnionForm.tags -======================= - -.. py:attribute:: ak.forms.UnionForm.tags - -ak.forms.UnionForm.index -======================== - -.. py:attribute:: ak.forms.UnionForm.index - -ak.forms.UnionForm.contents -=========================== - -.. py:attribute:: ak.forms.UnionForm.contents - -ak.forms.UnionForm.has_identities -================================= - -.. py:attribute:: ak.forms.UnionForm.has_identities - -ak.forms.UnionForm.parameters -============================= - -.. py:attribute:: ak.forms.UnionForm.parameters - -ak.forms.UnionForm.content -=========================== - -.. py:method:: ak.forms.UnionForm.content(index) diff --git a/docs-sphinx/ak.forms.UnmaskedForm.rst b/docs-sphinx/ak.forms.UnmaskedForm.rst deleted file mode 100644 index bd2cda67b6..0000000000 --- a/docs-sphinx/ak.forms.UnmaskedForm.rst +++ /dev/null @@ -1,27 +0,0 @@ -ak.forms.UnmaskedForm ----------------------- - -The form of a :doc:`ak.layout.UnmaskedArray`, which has :doc:`ak.types.OptionType`. - -In addition to the properties and methods described in :doc:`ak.forms.Form`, -this has the following. - -ak.forms.UnmaskedForm.__init__ -============================== - -.. py:method:: ak.forms.UnmaskedForm.__init__(content, has_identities=False, parameters=None) - -ak.forms.UnmaskedForm.content -============================= - -.. py:attribute:: ak.forms.UnmaskedForm.content - -ak.forms.UnmaskedForm.has_identities -==================================== - -.. py:attribute:: ak.forms.UnmaskedForm.has_identities - -ak.forms.UnmaskedForm.parameters -================================ - -.. py:attribute:: ak.forms.UnmaskedForm.parameters diff --git a/docs-sphinx/ak.forms.VirtualForm.rst b/docs-sphinx/ak.forms.VirtualForm.rst deleted file mode 100644 index e7cd96fb0c..0000000000 --- a/docs-sphinx/ak.forms.VirtualForm.rst +++ /dev/null @@ -1,36 +0,0 @@ -ak.forms.VirtualForm --------------------- - -The form of a :doc:`ak.layout.VirtualArray`, which has the type of its ``form`` (if known). - -In addition to the properties and methods described in :doc:`ak.forms.Form`, -this has the following. - -ak.forms.VirtualForm.__init__ -============================= - -.. py:method:: ak.forms.VirtualForm.__init__(form, has_length, has_identities=False, parameters=None) - -``form`` may be None or a form for the materialized array. - -``has_length`` is boolean. - -ak.forms.VirtualForm.form -========================= - -.. py:attribute:: ak.forms.VirtualForm.form - -ak.forms.VirtualForm.has_length -=============================== - -.. py:attribute:: ak.forms.VirtualForm.has_length - -ak.forms.VirtualForm.has_identities -=================================== - -.. py:attribute:: ak.forms.VirtualForm.has_identities - -ak.forms.VirtualForm.parameters -=============================== - -.. py:attribute:: ak.forms.VirtualForm.parameters diff --git a/docs-sphinx/ak.layout.ArrayBuilder.rst b/docs-sphinx/ak.layout.ArrayBuilder.rst deleted file mode 100644 index 95c13ea026..0000000000 --- a/docs-sphinx/ak.layout.ArrayBuilder.rst +++ /dev/null @@ -1,125 +0,0 @@ -ak.layout.ArrayBuilder ----------------------- - -The low-level ArrayBuilder that builds :doc:`ak.layout.Content` arrays. This -object is wrapped by :doc:`_auto/ak.ArrayBuilder`. - -(Method names in the high-level interface have been chnaged to include -underscores after "begin" and "end," but that hasn't happened in the -low-level interface, yet or possibly at all.) - -ak.layout.ArrayBuilder.__getitem__ -================================== - -.. py:method:: ak.layout.ArrayBuilder.__getitem__(where) - -ak.layout.ArrayBuilder.__init__ -=============================== - -.. py:method:: ak.layout.ArrayBuilder.__init__(initial=1024, resize=1.5) - -ak.layout.ArrayBuilder.__iter__ -=============================== - -.. py:method:: ak.layout.ArrayBuilder.__iter__() - -ak.layout.ArrayBuilder.__len__ -============================== - -.. py:method:: ak.layout.ArrayBuilder.__len__() - -ak.layout.ArrayBuilder.__repr__ -=============================== - -.. py:method:: ak.layout.ArrayBuilder.__repr__() - -ak.layout.ArrayBuilder.beginlist -================================ - -.. py:method:: ak.layout.ArrayBuilder.beginlist() - -ak.layout.ArrayBuilder.beginrecord -================================== - -.. py:method:: ak.layout.ArrayBuilder.beginrecord(name=None) - -ak.layout.ArrayBuilder.begintuple -================================= - -.. py:method:: ak.layout.ArrayBuilder.begintuple(arg0) - -ak.layout.ArrayBuilder.boolean -============================== - -.. py:method:: ak.layout.ArrayBuilder.boolean(arg0) - -ak.layout.ArrayBuilder.bytestring -================================= - -.. py:method:: ak.layout.ArrayBuilder.bytestring(arg0) - -ak.layout.ArrayBuilder.clear -============================ - -.. py:method:: ak.layout.ArrayBuilder.clear() - -ak.layout.ArrayBuilder.endlist -============================== - -.. py:method:: ak.layout.ArrayBuilder.endlist() - -ak.layout.ArrayBuilder.endrecord -================================ - -.. py:method:: ak.layout.ArrayBuilder.endrecord() - -ak.layout.ArrayBuilder.endtuple -=============================== - -.. py:method:: ak.layout.ArrayBuilder.endtuple() - - -ak.layout.ArrayBuilder.field -============================ - -.. py:method:: ak.layout.ArrayBuilder.field(arg0) - -ak.layout.ArrayBuilder.fromiter -=============================== - -.. py:method:: ak.layout.ArrayBuilder.fromiter(arg0) - -ak.layout.ArrayBuilder.index -============================ - -.. py:method:: ak.layout.ArrayBuilder.index(arg0) - -ak.layout.ArrayBuilder.integer -============================== - -.. py:method:: ak.layout.ArrayBuilder.integer(arg0) - -ak.layout.ArrayBuilder.null -=========================== - -.. py:method:: ak.layout.ArrayBuilder.null() - -ak.layout.ArrayBuilder.real -=========================== - -.. py:method:: ak.layout.ArrayBuilder.real(arg0) - -ak.layout.ArrayBuilder.snapshot -=============================== - -.. py:method:: ak.layout.ArrayBuilder.snapshot() - -ak.layout.ArrayBuilder.string -============================= - -.. py:method:: ak.layout.ArrayBuilder.string(arg0) - -ak.layout.ArrayBuilder.type -=========================== - -.. py:method:: ak.layout.ArrayBuilder.type(arg0) diff --git a/docs-sphinx/ak.layout.ArrayCache.rst b/docs-sphinx/ak.layout.ArrayCache.rst deleted file mode 100644 index 8f14c3c7bf..0000000000 --- a/docs-sphinx/ak.layout.ArrayCache.rst +++ /dev/null @@ -1,6 +0,0 @@ -ak.layout.ArrayCache --------------------- - -Wraps a -`collections.abc.MutableMapping `__ -for use as a cache in :doc:`ak.layout.VirtualArray`. diff --git a/docs-sphinx/ak.layout.ArrayGenerator.rst b/docs-sphinx/ak.layout.ArrayGenerator.rst deleted file mode 100644 index e6ef875123..0000000000 --- a/docs-sphinx/ak.layout.ArrayGenerator.rst +++ /dev/null @@ -1,61 +0,0 @@ -ak.layout.ArrayGenerator ------------------------- - -An ArrayGenerator takes a Python callable, arguments, and optionally -an expected :doc:`ak.forms.Form` and/or ``length``. - -It can only be used in a :doc:`ak.layout.VirtualArray` to generate -arrays. - -If a :doc:`ak.forms.Form` is given, there are fewer -circumstances in which the generator would need to be executed, -but it is an error if the generated array does not match this -:doc:`ak.forms.Form`. - -If a ``length`` is given (as a non-negative -int), there are fewer circumstances in which the generator would -need to be executed, but it is an error if the generated array does -not match this ``length``. - -ak.layout.ArrayGenerator.__init__ -================================= - -.. py:method:: ak.layout.ArrayGenerator.__init__(callable, args=(), kwargs={}, form=None, length=None) - -ak.layout.ArrayGenerator.callable -================================= - -.. py:attribute:: ak.layout.ArrayGenerator.callable - -ak.layout.ArrayGenerator.args -============================= - -.. py:attribute:: ak.layout.ArrayGenerator.args - -ak.layout.ArrayGenerator.kwargs -=============================== - -.. py:attribute:: ak.layout.ArrayGenerator.kwargs - -ak.layout.ArrayGenerator.form -============================= - -.. py:attribute:: ak.layout.ArrayGenerator.form - -ak.layout.ArrayGenerator.length -=============================== - -.. py:attribute:: ak.layout.ArrayGenerator.length - -ak.layout.ArrayGenerator.__call__ -================================= - -.. py:method:: ak.layout.ArrayGenerator.__call__() - -Generates the array and checks it against the :doc:`ak.forms.Form` and -``length``, if given. - -ak.layout.ArrayGenerator.__repr__ -================================= - -.. py:method:: ak.layout.ArrayGenerator.__repr__() diff --git a/docs-sphinx/ak.layout.BitMaskedArray.rst b/docs-sphinx/ak.layout.BitMaskedArray.rst deleted file mode 100644 index 2e16584a52..0000000000 --- a/docs-sphinx/ak.layout.BitMaskedArray.rst +++ /dev/null @@ -1,220 +0,0 @@ -ak.layout.BitMaskedArray ------------------------- - -Like :doc:`ak.layout.ByteMaskedArray`, BitMaskedArray implements an -:doc:`ak.types.OptionType` with two arrays, ``mask`` and ``content``. -However, the boolean ``mask`` values are packed into a bitmap. - -BitMaskedArray has an additional parameter, ``lsb_order``; if True, -the position of each bit is in -`Least-Significant Bit order `__ -(LSB): - -.. code-block:: python - - is_valid[j] = bool(mask[j // 8] & (1 << (j % 8))) == valid_when - -If False, the position of each bit is in Most-Significant Bit order -(MSB): - -.. code-block:: python - - is_valid[j] = bool(mask[j // 8] & (128 >> (j % 8))) == valid_when - -Note that NumPy's -`unpackbits `__ -function before version 1.17 has MSB order, but now it is configurable -(``bitorder="little"`` for LSB, ``bitorder="big"`` for MSB). - -If the logical size of the array is not a multiple of 8, the ``mask`` -has to be padded. Thus, an explicit ``length`` is also part of the -class's definition. - -Below is a simplified implementation of a BitMaskedArray class in pure Python -that exhaustively checks validity in its constructor (see -:doc:`_auto/ak.is_valid`) and can generate random valid arrays. The -``random_number()`` function returns a random float and the -``random_length(minlen)`` function returns a random int that is at least -``minlen``. The ``RawArray`` class represents simple, one-dimensional data. - -.. code-block:: python - - class BitMaskedArray(Content): - def __init__(self, mask, content, valid_when, length, lsb_order): - assert isinstance(mask, np.ndarray) - assert isinstance(content, Content) - assert isinstance(valid_when, bool) - assert isinstance(length, int) and length >= 0 - assert isinstance(lsb_order, bool) - assert len(mask) <= len(content) - self.mask = mask - self.content = content - self.valid_when = valid_when - self.length = length - self.lsb_order = lsb_order - - @staticmethod - def random(minlen, choices): - mask = [] - for i in range(random_length(minlen)): - mask.append(bool(random.randint(0, 1))) - lsb_order = bool(random.randint(0, 1)) - bitmask = np.packbits(np.array(mask, dtype=np.uint8), - bitorder=("little" if lsb_order else "big")) - content = random.choice(choices).random(len(mask), choices) - return BitMaskedArray(bitmask, content, bool(random.randint(0, 1)), - len(mask), lsb_order) - - def __len__(self): - return self.length - - def __getitem__(self, where): - if isinstance(where, int): - assert 0 <= where < len(self) - if self.lsb_order: - bit = bool(self.mask[where // 8] & (1 << (where % 8))) - else: - bit = bool(self.mask[where // 8] & (128 >> (where % 8))) - if bit == self.valid_when: - return self.content[where] - else: - return None - elif isinstance(where, slice) and where.step is None: - # In general, slices must convert BitMaskedArray to ByteMaskedArray. - bytemask = np.unpackbits(self.mask, - bitorder=("little" if self.lsb_order else "big")).view(bool) - return ByteMaskedArray(bytemask[where.start:where.stop], - self.content[where.start:where.stop], - valid_when=self.valid_when) - elif isinstance(where, str): - return BitMaskedArray(self.mask, - self.content[where], - valid_when=self.valid_when, - length=self.length, - lsb_order=self.lsb_order) - else: - raise AssertionError(where) - - def __repr__(self): - return ("BitMaskedArray(" + repr(self.mask) + ", " + repr(self.content) - + ", " + repr(self.valid_when) + ", " + repr(self.length) - + ", " + repr(self.lsb_order) + ")") - - def xml(self, indent="", pre="", post=""): - out = indent + pre + "\n" - out += indent + " " + repr(self.valid_when) + "\n" - out += indent + " " + repr(self.length) + "\n" - out += indent + " " + repr(self.lsb_order) + "\n" - out += indent + " " + " ".join(str(x) for x in self.mask) + "\n" - out += self.content.xml(indent + " ", "", "\n") - out += indent + "\n" - return out - -Here is an example: - -.. code-block:: python - - BitMaskedArray(np.array([ 40, 173, 59, 104, 182, 116], dtype=np.uint8), - RawArray([5.5, 6.6, 1.5, 3.2, 9.8, 0.4, 5.7, 1.5, 0.2, 6.1, 5.4, 4.3, 5.9, - 10.1, -2.3, 5.8, 3.4, 5.6, 6.2, 8.8, 3.1, 7.0, 1.2, 7.3, 5.8, 8.3, - 9.7, 5.2, 3.4, 5.8, 1.7, 4.3, 5.8, 1.2, 1.7, 3.6, 4.4, 9.7, 5.0, - 4.3, 7.8, 6.1, 3.3, 7.9, 7.1, 6.5, -0.6, 8.2, 3.7, 4.6, 3.9, 7.5]), - False, - 46, - False) - -.. code-block:: xml - - - False - 46 - False - 40 173 59 104 182 116 - - 5.5 6.6 1.5 3.2 9.8 0.4 5.7 1.5 0.2 6.1 5.4 4.3 5.9 10.1 -2.3 5.8 3.4 5.6 6.2 - 8.8 3.1 7.0 1.2 7.3 5.8 8.3 9.7 5.2 3.4 5.8 1.7 4.3 5.8 1.2 1.7 3.6 4.4 9.7 5.0 - 4.3 7.8 6.1 3.3 7.9 7.1 6.5 -0.6 8.2 3.7 4.6 3.9 7.5 - - - -which represents the following logical data. - -.. code-block:: python - - [5.5, 6.6, None, 3.2, None, 0.4, 5.7, 1.5, None, 6.1, None, 4.3, None, None, -2.3, None, 3.4, - 5.6, None, None, None, 7.0, None, None, 5.8, None, None, 5.2, None, 5.8, 1.7, 4.3, None, - 1.2, None, None, 4.4, None, None, 4.3, 7.8, None, None, None, 7.1, None] - -This is equivalent to *all* of Apache Arrow's array types because they all -`use bitmaps `__ -to mask their data, with ``valid_when=True`` and ``lsb_order=True``. - -In addition to the properties and methods described in :doc:`ak.layout.Content`, -a BitMaskedArray has the following. - -ak.layout.BitMaskedArray.__init__ -================================= - -.. py:method:: ak.layout.BitMaskedArray.__init__(mask, content, valid_when, length, lsb_order, identities=None, parameters=None) - -ak.layout.BitMaskedArray.mask -============================= - -.. py:attribute:: ak.layout.BitMaskedArray.mask - -ak.layout.BitMaskedArray.content -================================ - -.. py:attribute:: ak.layout.BitMaskedArray.content - -ak.layout.BitMaskedArray.valid_when -=================================== - -.. py:attribute:: ak.layout.BitMaskedArray.valid_when - -ak.layout.BitMaskedArray.lsb_order -================================== - -.. py:attribute:: ak.layout.BitMaskedArray.lsb_order - -ak.layout.BitMaskedArray.project -================================ - -.. py:method:: ak.layout.BitMaskedArray.project(mask=None) - -Returns a non-:doc:`ak.types.OptionType` array containing only the valid elements. -If ``mask`` is a signed 8-bit :doc:`ak.layout.Index` in which ``0`` means valid -and ``1`` means missing, this ``mask`` is unioned with the BitMaskedArray's -mask (after converting to 8-bit and to ``valid_when=False`` to match this ``mask``). - -ak.layout.BitMaskedArray.bytemask -================================= - -.. py:method:: ak.layout.BitMaskedArray.bytemask() - -Returns an array of 8-bit values in which ``0`` means valid and ``1`` means missing. - -ak.layout.BitMaskedArray.simplify -================================= - -.. py:method:: ak.layout.BitMaskedArray.simplify() - -Combines this node with its ``content`` if the ``content`` also has -:doc:`ak.types.OptionType`; otherwise, this is a pass-through. -In all cases, the output has the same logical meaning as the input. - -This method only operates one level deep. - -ak.layout.BitMaskedArray.toByteMaskedArray -========================================== - -.. py:method:: ak.layout.BitMaskedArray.toByteMaskedArray() - -Converts to the equivalent :doc:`ak.layout.ByteMaskedArray`. - -ak.layout.BitMaskedArray.toIndexedOptionArray -============================================= - -.. py:method:: ak.layout.BitMaskedArray.toIndexedOptionArray() - -Converts to the equivalent :doc:`ak.layout.IndexedOptionArray`. diff --git a/docs-sphinx/ak.layout.ByteMaskedArray.rst b/docs-sphinx/ak.layout.ByteMaskedArray.rst deleted file mode 100644 index ddd37541dd..0000000000 --- a/docs-sphinx/ak.layout.ByteMaskedArray.rst +++ /dev/null @@ -1,155 +0,0 @@ -ak.layout.ByteMaskedArray -------------------------- - -The ByteMaskedArray implements an :doc:`ak.types.OptionType` with two aligned -arrays, a boolean ``mask`` and ``content``. At any element ``i`` where -``mask[i] == valid_when``, the value can be found at ``content[i]``. If -``mask[i] != valid_when``, the value is missing (None). - -This is equivalent to NumPy's -`masked arrays `__ -if ``valid_when=False``. - -There is no Apache Arrow equivalent because Arrow -`uses bitmaps `__ -to mask all node types. - -Below is a simplified implementation of a ByteMaskedArray class in pure Python -that exhaustively checks validity in its constructor (see -:doc:`_auto/ak.is_valid`) and can generate random valid arrays. The -``random_number()`` function returns a random float and the -``random_length(minlen)`` function returns a random int that is at least -``minlen``. The ``RawArray`` class represents simple, one-dimensional data. - -.. code-block:: python - - class ByteMaskedArray(Content): - def __init__(self, mask, content, valid_when): - assert isinstance(mask, list) - assert isinstance(content, Content) - assert isinstance(valid_when, bool) - for x in mask: - assert isinstance(x, bool) - assert len(mask) <= len(content) - self.mask = mask - self.content = content - self.valid_when = valid_when - - @staticmethod - def random(minlen, choices): - mask = [] - for i in range(random_length(minlen)): - mask.append(bool(random.randint(0, 1))) - content = random.choice(choices).random(len(mask), choices) - return ByteMaskedArray(mask, content, bool(random.randint(0, 1))) - - def __len__(self): - return len(self.mask) - - def __getitem__(self, where): - if isinstance(where, int): - assert 0 <= where < len(self) - if self.mask[where] == self.valid_when: - return self.content[where] - else: - return None - elif isinstance(where, slice) and where.step is None: - return ByteMaskedArray(self.mask[where.start:where.stop], - self.content[where.start:where.stop], - valid_when=self.valid_when) - elif isinstance(where, str): - return ByteMaskedArray(self.mask, self.content[where], valid_when=self.valid_when) - else: - raise AssertionError(where) - - def __repr__(self): - return ("ByteMaskedArray(" + repr(self.mask) + ", " + repr(self.content) - + ", " + repr(self.valid_when) + ")") - - def xml(self, indent="", pre="", post=""): - out = indent + pre + "\n" - out += indent + " " + repr(self.valid_when) + "\n" - out += indent + " " + " ".join(str(x) for x in self.mask) + "\n" - out += self.content.xml(indent + " ", "", "\n") - out += indent + "\n" - return out - -Here is an example: - -.. code-block:: python - - ByteMaskedArray([True, True, False, False, True, False, False, True, True, True, True, True], - RawArray([5.7, 4.5, 8.3, 4.1, 5.1, 4.1, 0.3, 6.4, 5.5, 9.5, 7.1, 7.7, 4.0, - 4.8, 4.4, 2.9, 1.4, 4.8, 7.3, 4.9, 6.0, 0.6, 11.2, 6.1, 4.7, 4.1, - 4.4, 5.9, 7.6, 6.3, 5.5, 11.0, 9.2, 5.3, 0.1, 1.2, 4.5, 6.4, 2.8, - 1.4, 5.8]), - False) - -.. code-block:: xml - - - False - True True False False True False False True True True True True - - 5.7 4.5 8.3 4.1 5.1 4.1 0.3 6.4 5.5 9.5 7.1 7.7 4.0 4.8 4.4 2.9 1.4 4.8 7.3 4.9 - 6.0 0.6 11.2 6.1 4.7 4.1 4.4 5.9 7.6 6.3 5.5 11.0 9.2 5.3 0.1 1.2 4.5 6.4 2.8 - 1.4 5.8 - - - -which represents the following logical data. - -.. code-block:: python - - [None, None, 8.3, 4.1, None, 4.1, 0.3, None, None, None, None, None] - -In addition to the properties and methods described in :doc:`ak.layout.Content`, -a ByteMaskedArray has the following. - -ak.layout.ByteMaskedArray.__init__ -================================== - -.. py:method:: ak.layout.ByteMaskedArray.__init__(mask, content, valid_when, identities=None, parameters=None) - -ak.layout.ByteMaskedArray.mask -============================== - -.. py:attribute:: ak.layout.ByteMaskedArray.mask - -ak.layout.ByteMaskedArray.content -================================= - -.. py:attribute:: ak.layout.ByteMaskedArray.content - -ak.layout.ByteMaskedArray.valid_when -==================================== - -.. py:attribute:: ak.layout.ByteMaskedArray.valid_when - -ak.layout.ByteMaskedArray.project -================================= - -.. py:method:: ak.layout.ByteMaskedArray.project(mask=None) - -Returns a non-:doc:`ak.types.OptionType` array containing only the valid elements. -If ``mask`` is a signed 8-bit :doc:`ak.layout.Index` in which ``0`` means valid -and ``1`` means missing, this ``mask`` is unioned with the ByteMaskedArray's -mask (after converting to ``valid_when=False`` to match this ``mask``). - -ak.layout.ByteMaskedArray.bytemask -================================== - -.. py:method:: ak.layout.ByteMaskedArray.bytemask() - -Returns an array of 8-bit values in which ``0`` means valid and ``1`` means missing. - -ak.layout.ByteMaskedArray.simplify -================================== - -.. py:method:: ak.layout.ByteMaskedArray.simplify() - -Combines this node with its ``content`` if the ``content`` also has -:doc:`ak.types.OptionType`; otherwise, this is a pass-through. -In all cases, the output has the same logical meaning as the input. - -This method only operates one level deep. diff --git a/docs-sphinx/ak.layout.Content.rst b/docs-sphinx/ak.layout.Content.rst deleted file mode 100644 index fb87d4e8e3..0000000000 --- a/docs-sphinx/ak.layout.Content.rst +++ /dev/null @@ -1,449 +0,0 @@ -ak.layout.Content ------------------ - -Superclass of array nodes that build up the structure of an -:doc:`_auto/ak.Array`; the array layout returned by the -`ak.Array.layout <_auto/ak.Array.html#ak-array-layout>`__ property. - -The array node types are listed below. - - * :doc:`ak.layout.EmptyArray`: array with zero length and - :doc:`ak.types.UnknownType`. - * :doc:`ak.layout.NumpyArray`: complete equivalent to a NumPy np.ndarray, - usually with :doc:`ak.types.PrimitiveType`. - * :doc:`ak.layout.RegularArray`: nested lists of equal length; has - :doc:`ak.types.RegularType`. - * :doc:`ak.layout.ListArray` (64-bit, 32-bit, and unsigned 32-bit - specializations): nested lists of any length (built with two indexes, - ``starts`` and ``stops``), has :doc:`ak.types.ListType`. - * :doc:`ak.layout.ListOffsetArray` (64-bit, 32-bit, and unsigned 32-bit - specializations): nested lists of any length (built with one index, - ``offsets``), has :doc:`ak.types.ListType`. - * :doc:`ak.layout.RecordArray`: array of records or tuples; has - :doc:`ak.types.RecordType`. - * :doc:`ak.layout.IndexedArray` (64-bit, 32-bit, and unsigned 32-bit - specializations): contains any array and reorders/duplicates it with an - arbitrary integer ``index``; has the same type as its content. - * :doc:`ak.layout.IndexedOptionArray` (64-bit and 32-bit specializations): - same as above but ``-1`` values in the ``index`` are interpreted as None; - has :doc:`ak.types.OptionType`. - * :doc:`ak.layout.ByteMaskedArray`: boolean bytes in a ``mask`` are - interpreted as valid contents or None; has :doc:`ak.types.OptionType`. - * :doc:`ak.layout.BitMaskedArray`: boolean bits in a ``mask`` are - interpreted as valid contents or None; has :doc:`ak.types.OptionType`. - * :doc:`ak.layout.UnmaskedArray`: formally has :doc:`ak.types.OptionType`, - but all data are valid (no ``mask``). - * :doc:`ak.layout.UnionArray` (8-bit signed ``tags`` with 64-bit, 32-bit, and - unsigned 32-bit ``index`` specializations): heterogeneous data represented - as a tagged union; has :doc:`ak.types.UnionType`. - -In Python, :doc:`ak.layout.Record` is not a subclass of -:doc:`ak.layout.Content` (though it is in C++ for technical reasons). - -All :doc:`ak.layout.Content` nodes have the following properties and methods -in common. - -ak.layout.Content.identities -============================ - -.. py:attribute:: ak.layout.Content.identities - -Returns the :doc:`ak.layout.Identities` object associated with this array node -(if any). - -ak.layout.Content.identity -========================== - -.. py:attribute:: ak.layout.Content.identity - -Returns the single element of an :doc:`ak.layout.Identities` associated with -this array node (if any). - -ak.layout.Content.nbytes -======================== - -.. py:attribute:: ak.layout.Content.nbytes - -The total number of bytes in all the :doc:`ak.layout.Index`, -:doc:`ak.layout.Identities`, and :doc:`ak.layout.NumpyArray` buffers in this -array tree. - -Note: this calculation takes overlapping buffers into account, to the -extent that overlaps are not double-counted, but overlaps are currently -assumed to be complete subsets of one another, and so it is -theoretically possible (though unlikely) that this number is an -underestimate of the true usage. - -It also does not count buffers that must be kept in memory because -of ownership, but are not directly used in the array. Nor does it count -the (small) C++ nodes or Python objects that reference the (large) -array buffers. - -ak.layout.Content.numfields -=========================== - -.. py:attribute:: ak.layout.Content.numfields - -Number of fields in the outermost records or tuples, or `-1` if the array does -not contain records or tuples. - -ak.layout.Content.parameters -============================ - -.. py:attribute:: ak.layout.Content.parameters - -Free-form parameters associated with every array node as a dict from parameter -name to its JSON-like value. Some parameters are special and are used to assign -behaviors to the data. - -Note that the dict returned by this property is a *copy* of the array node's -parameters. *Changing the dict will not change the array!* - -See :doc:`ak.behavior` and :doc:`_auto/ak.Array`. - -ak.layout.Content.purelist_depth -================================ - -.. py:attribute:: ak.layout.Content.purelist_depth - -Number of dimensions of nested lists, not counting anything deeper than the -first record or tuple layer, if any. The depth of a one-dimensional array is -`1`. - -If the array contains :doc:`ak.types.UnionType` data and its contents have -equal depths, the return value is that depth. If they do not have equal -depths, the return value is `-1`. - -ak.layout.Content.purelist_isregular -==================================== - -.. py:attribute:: ak.layout.Content.purelist_isregular - -Returns True if all dimensions down to the first record or tuple layer have -:doc:`ak.types.RegularType`; False otherwise. - -ak.layout.Content.__getitem__ -============================= - -.. py:method:: ak.layout.Content.__getitem__(where) - -See `ak.Array.__getitem__ <_auto/ak.Array.html#ak-array-getitem>`_. - -ak.layout.Content.__iter__ -========================== - -.. py:method:: ak.layout.Content.__iter__() - -See `ak.Array.__iter__ <_auto/ak.Array.html#ak-array-iter>`_. - -ak.layout.Content.__len__ -========================= - -.. py:method:: ak.layout.Content.__len__() - -See `ak.Array.__len__ <_auto/ak.Array.html#ak-array-len>`_. - -ak.layout.Content.__repr__ -========================== - -.. py:method:: ak.layout.Content.__repr__() - -A multi-line XML representation of the array structure. - -See (for contrast) `ak.Array.__repr__ <_auto/ak.Array.html#ak-array-repr>`_. - -ak.layout.Content.all -===================== - -.. py:method:: ak.layout.Content.all(axis=-1, mask=False, keepdims=False) - -Implements :doc:`_auto/ak.all`. - -ak.layout.Content.any -===================== - -.. py:method:: ak.layout.Content.any(axis=-1, mask=False, keepdims=False) - -Implements :doc:`_auto/ak.any`. - -ak.layout.Content.argmax -======================== - -.. py:method:: ak.layout.Content.argmax(axis=-1, mask=True, keepdims=False) - -Implements :doc:`_auto/ak.argmax`. - -ak.layout.Content.argmin -======================== - -.. py:method:: ak.layout.Content.argmin(axis=-1, mask=True, keepdims=False) - -Implements :doc:`_auto/ak.argmin`. - -ak.layout.Content.combinations -============================== - -.. py:method:: ak.layout.Content.combinations(n, replacement=False, keys=None, parameters=None, axis=1) - -Implements :doc:`_auto/ak.combinations`. - -ak.layout.Content.count -======================= - -.. py:method:: ak.layout.Content.count(axis=-1, mask=False, keepdims=False) - -Implements :doc:`_auto/ak.count`. - -ak.layout.Content.count_nonzero -=============================== - -.. py:method:: ak.layout.Content.count_nonzero(axis=-1, mask=False, keepdims=False) - -Implements :doc:`_auto/ak.count_nonzero`. - -ak.layout.Content.deep_copy -=========================== - -.. py:method:: ak.layout.Content.deep_copy(copyarrays=True, copyindexes=True, copyidentities=True) - -Returns a copy of the array node and its children. - - * If ``copyarrays``, then :doc:`ak.layout.NumpyArray` buffers are also - copied. - * If ``copyindexes``, then :doc:`ak.layout.Index` buffers are also copied. - * If ``copyidentities``, then :doc:`ak.layout.Identities` buffers are also - copied. - -If all three flags are False, then only (small) C++ and Pyhton objects are -copied, not (large) array buffers. - -ak.layout.Content.fieldindex -============================ - -.. py:method:: ak.layout.Content.fieldindex(key) - -Returns the ``fieldindex`` (int) associated with a ``key`` (str) of the -outermost record or tuple. If the array does not contain records or tuples, -this method raises an error. - -ak.layout.Content.fillna -======================== - -.. py:method:: ak.layout.Content.fillna(value) - -Implements :doc:`_auto/ak.fill_none`. - -ak.layout.Content.flatten -========================= - -.. py:method:: ak.layout.Content.flatten(axis=1) - -Implements :doc:`_auto/ak.flatten`. - -ak.layout.Content.getitem_nothing -================================= - -.. py:method:: ak.layout.Content.getitem_nothing() - -Returns an empty array with this array structure. Used for a corner-case of -``__getitem__``. - -ak.layout.Content.haskey -======================== - -.. py:method:: ak.layout.Content.haskey(key) - -Returns True if the outermost record or tuple has a given ``key``; False -otherwise (including the case of not containing records or tuples). - -ak.layout.Content.key -===================== - -.. py:method:: ak.layout.Content.key(fieldindex) - -Returns the ``key`` (str) associated with a ``fieldindex`` (int) of the -outermost record or tuple. If the array does not contain records or tuples, -this method raises an error. - -ak.layout.Content.keys -====================== - -.. py:method:: ak.layout.Content.keys() - -Returns the keys of the outermost record or tuple or an empty list. - -ak.layout.Content.localindex -============================ - -.. py:method:: ak.layout.Content.localindex(axis=1) - -Returns nested lists of integers (down to the chosen ``axis``) that count -from `0` to the `length - 1` of the innermost list. - -This is used internally to generate :doc:`_auto/ak.argcartesian` from -:doc:`_auto/ak.cartesian`, etc. - -ak.layout.Content.max -===================== - -.. py:method:: ak.layout.Content.max(axis=-1, mask=True, keepdims=False) - -Implements :doc:`_auto/ak.max`. - -ak.layout.Content.merge -======================= - -.. py:method:: ak.layout.Content.merge(other) - -Concatenate this array node with the ``other`` array node (``axis=0``) by -sharing buffers; i.e. without using a :doc:`ak.layout.UnionArray`. If this -is not possible, this method raises an error. - -ak.layout.Content.merge_as_union -================================ - -.. py:method:: ak.layout.Content.merge_as_union(other) - -Concatenate this array node with the ``other`` array node (``axis=0``) using -a :doc:`ak.layout.UnionArray` instead of attempting to share buffers. - -ak.layout.Content.mergeable -=========================== - -.. py:method:: ak.layout.Content.mergeable(other, mergebool=False) - -If True, this array node can be concatenated (``axis=0``) with the ``other`` -array node without resorting to a :doc:`ak.layout.UnionArray`; otherwise, -they cannot. - -If ``mergebool`` is True, consider booleans to be a numeric type that can -be merged with numeric arrays (integers and floating-point). - -ak.layout.Content.min -===================== - -.. py:method:: ak.layout.Content.min(axis=-1, mask=True, keepdims=False) - -Implements :doc:`_auto/ak.min`. - -ak.layout.Content.num -===================== - -.. py:method:: ak.layout.Content.num(axis=1) - -Implements :doc:`_auto/ak.num`. - -ak.layout.Content.offsets_and_flatten -===================================== - -.. py:method:: ak.layout.Content.offsets_and_flatten(axis=1) - -Implements :doc:`_auto/ak.flatten`, though it returns a set of ``offsets`` -along with the flattened array. - -ak.layout.Content.parameter -=========================== - -.. py:method:: ak.layout.Content.parameter(key) - -Get one parameter by its ``key`` (outermost node only). If a ``key`` is not -found, None is returned. - -ak.layout.Content.prod -====================== - -.. py:method:: ak.layout.Content.prod(axis=-1, mask=False, keepdims=False) - -Implements :doc:`_auto/ak.prod`. - -ak.layout.Content.purelist_parameter -==================================== - -.. py:method:: ak.layout.Content.purelist_parameter(key) - -Return the value of the outermost parameter matching ``key`` in a sequence -of nested lists, stopping at the first record or tuple layer. - -If a layer has :doc:`ak.types.UnionType`, the value is only returned if all -possibilities have the same value. - -ak.layout.Content.rpad -====================== - -.. py:method:: ak.layout.Content.rpad(arg0, arg1) - -Implements :doc:`_auto/ak.pad_none` with ``clip=False``. - -ak.layout.Content.rpad_and_clip -=============================== - -.. py:method:: ak.layout.Content.rpad_and_clip(arg0, arg1) - -Implements :doc:`_auto/ak.pad_none` with ``clip=True``. - -ak.layout.Content.setidentities -=============================== - -.. py:method:: ak.layout.Content.setidentities() - -.. py:method:: ak.layout.Content.setidentities(identities) - -Sets identities in-place. - -**Do not use this function:** it is deprecated and will be removed. Assign -:doc:`ak.layout.Identities` in the constructor only. - -ak.layout.Content.setparameter -============================== - -.. py:method:: ak.layout.Content.setparameter(key, value) - -Sets one parameter in-place. - -**Do not use this function:** it is deprecated and will be removed. Assign -parameters in the constructor only. - -ak.layout.Content.simplify -========================== - -.. py:method:: ak.layout.Content.simplify() - -Flattens one extraneous level of :doc:`ak.types.OptionType` or -:doc:`ak.types.UnionType`. If there is no such level, this is a pass-through. -In all cases, the output has the same logical meaning as the input. - -ak.layout.Content.sum -===================== - -.. py:method:: ak.layout.Content.sum(axis=-1, mask=False, keepdims=False) - -Implements :doc:`_auto/ak.sum`. - -ak.layout.Content.toRegularArray -================================ - -.. py:method:: ak.layout.Content.toRegularArray() - -Converts the data to a :doc:`ak.layout.RegularArray`, if possible. - -ak.layout.Content.tojson -======================== - -.. py:method:: ak.layout.Content.tojson(pretty=False, maxdecimals=None) - -Converts this array node to JSON and returns it as a string. - -See :doc:`_auto/ak.to_json`. - -.. py:method:: ak.layout.Content.tojson(destination, pretty=False, maxdecimals=None, buffersize=65536) - -Converts this array node to JSON and writes it to a file (``destination``). - -See :doc:`_auto/ak.to_json`. - -ak.layout.Content.type -====================== - -.. py:method:: ak.layout.Content.type() - -Returns the high-level :doc:`ak.types.Type` of this array node. diff --git a/docs-sphinx/ak.layout.EmptyArray.rst b/docs-sphinx/ak.layout.EmptyArray.rst deleted file mode 100644 index c375ba698a..0000000000 --- a/docs-sphinx/ak.layout.EmptyArray.rst +++ /dev/null @@ -1,84 +0,0 @@ -ak.layout.EmptyArray --------------------- - -An EmptyArray is used whenever an array's type is not known because it is empty -(such as data from :doc:`_auto/ak.ArrayBuilder` without enough sample points -to resolve the type). - -EmptyArray has no equivalent in Apache Arrow. - -Below is a simplified implementation of an EmptyArray class in pure Python -that exhaustively checks validity in its constructor (see -:doc:`_auto/ak.is_valid`) and can generate random valid arrays. The -``random_number()`` function returns a random float and the -``random_length(minlen)`` function returns a random int that is at least -``minlen``. The ``RawArray`` class represents simple, one-dimensional data. - -.. code-block:: python - - class EmptyArray(Content): - def __init__(self): - pass - - @staticmethod - def random(minlen, choices): - assert minlen == 0 - return EmptyArray() - - def __len__(self): - return 0 - - def __getitem__(self, where): - if isinstance(where, int): - assert False - elif isinstance(where, slice) and where.step is None: - return EmptyArray() - elif isinstance(where, str): - raise ValueError("field " + repr(where) + " not found") - else: - raise AssertionError(where) - - def __repr__(self): - return "EmptyArray()" - - def xml(self, indent="", pre="", post=""): - return indent + pre + "" + post - -Here is an example: - -.. code-block:: python - - EmptyArray() - -.. code-block:: xml - - - -which represents the following logical data. - -.. code-block:: python - - [] - -In addition to the properties and methods described in :doc:`ak.layout.Content`, -an EmptyArray has the following. - -ak.layout.EmptyArray.__init__ -============================= - -.. py:method:: ak.layout.EmptyArray.__init__(identities=None, parameters=None) - -ak.layout.EmptyArray.toNumpyArray -================================= - -.. py:method:: ak.layout.EmptyArray.toNumpyArray() - -Converts this EmptyArray into a :doc:`ak.layout.NumpyArray` with 64-bit -floating-point type. - -ak.layout.EmptyArray.simplify -============================= - -.. py:method:: ak.layout.EmptyArray.simplify() - -Pass-through; returns the original array. diff --git a/docs-sphinx/ak.layout.Identities.rst b/docs-sphinx/ak.layout.Identities.rst deleted file mode 100644 index df29d4e96d..0000000000 --- a/docs-sphinx/ak.layout.Identities.rst +++ /dev/null @@ -1,152 +0,0 @@ -ak.layout.Identities --------------------- - -The Identities concept is implemented in 2 specialized classes: - - * ``ak.layout.Identities64``: values are 64-bit signed integers. - * ``ak.layout.Identities32``: values are 32-bit signed integers. - -Identities are optional auxiliary arrays that can be attached to any -:doc:`ak.layout.Content` node. The Identities label every element of an -array (at every node of the tree) with the original ``__getitem__`` path -from the root of a data structure to that element, the original "identity" -of the element. As data are filtered with selections, shuffled with -sorting operations, or duplicated in combinatorial functions like -:doc:`_auto/ak.cartesian` and :doc:`_auto/ak.combinations`, the Identities -are selected, shuffled, and duplicated with them. - -The primary purpose of these Identities is to act as an index key for -SQL-like join operations. At the time of this writing, such operations -have not been written, but Identities are included in the framework as a -placeholder to ensure that this will be possible later. - -The identity of a single item is equivalent to a tuple of int and str, such -as - -.. code-block:: python - - (999, "muons", 1, "pt") - -This tuple corresponds to the original path from the root of the array structure -to that value: - -.. code-block:: python - - array[999, "muons", 1, "pt"] - -After filtering, reordering, and/or duplicating, the actual path of the -manipulated array might be very different from this, but two elements sharing -an identity means they originally came from the same value. - -In addition to the tuple, an Identities has a globally unique (per process) -reference integer, to distinguish between Identities from originally -distinct arrays. - -The integer values of each identity are collectively stored in a 2-dimensional -array. The width of that array would include ``999`` and ``1`` from the above -example and the length of that array includes all the distinct identities from -distinct objects. - -The strings of the tuple are stored in a "fieldloc," a list of int-str pairs -that specify the index positions where fields are located. Whereas a large, -2-dimensional array is needed to express all row positions, only a small, -indexed set of strings are needed to express all column positions. - -Here is an example of a properly formatted Identities object (with 64-bit -integers): - -.. code-block:: python - - >>> identities = ak.layout.Identities64(0, [(0, "muons"), (1, "pt")], - ... np.array([[0, 0], [0, 1], [0, 2], [2, 0], [2, 1]])) - >>> for i in range(5): - ... print(identities.identity_at(i)) - ... - (0, 'muons', 0, 'pt') - (0, 'muons', 1, 'pt') - (0, 'muons', 2, 'pt') - (2, 'muons', 0, 'pt') - (2, 'muons', 1, 'pt') - -(The ``"muons"`` field has index ``0`` because it comes *after* axis ``0`` -in the NumPy array, and the ``"pt"`` field has index ``1`` because it comes -*after* index ``1``. It is possible for fields in the sequence to have the -same index if there are records nested directly inside records, with no -list dimensions in between.) - -These identities would correspond with an array like - -.. code-block:: python - - [{"muons": [{"pt": ...}, {"pt": ...}, {"pt": ...}]}, - {"muons": [{"pt": ...}]}, - {"muons": [{"pt": ...}, {"pt": ...}]}] - -ak.layout.Identities.newref -=========================== - -.. py:method:: ak.layout.Identities.newref() - -Static method to create a new reference (int). This reference is globally -unique in the process, as it is implemented with an atomic integer. - -ak.layout.Identities.__init__ -============================= - -.. py:method:: ak.layout.Identities.__init__(ref, fieldloc, array) - -Creates a new Identities from a reference (int), fieldloc (list of int-str -pairs), and a 2-dimensional array (np.ndarray) of integers. - -.. py:method:: ak.layout.Identities.__init__(ref, fieldloc, width, length) - -Allocates a new Identities from a reference (int), fieldloc (list of int-str -pairs), and a width and height for the 2-dimensional array. - -The data in the newly allocated array are uninitialized, but the Identities -object is a buffer that may be cast as NumPy or the array can be accessed -from the ``array`` property to set its values. - -ak.layout.Identities.array -========================== - -.. py:attribute:: ak.layout.Identities.array - -The 2-dimensional array containing all the numeric row data. - -ak.layout.Identities.fieldloc -============================= - -.. py:attribute:: ak.layout.Identities.fieldloc - -The list of int-str pairs containing all the string field data. - -ak.layout.Identities.__getitem__ -================================ - -.. py:method:: ak.layout.Identities.__getitem__(at) - -ak.layout.Identities.__getitem__ -================================ - -.. py:method:: ak.layout.Identities.__getitem__(start, stop) - -ak.layout.Identities.__len__ -============================ - -.. py:method:: ak.layout.Identities.__len__() - -ak.layout.Identities.__repr__ -============================= - -.. py:method:: ak.layout.Identities.__repr__() - -ak.layout.Identities.identity_at -================================ - -.. py:method:: ak.layout.Identities.identity_at(at) - -ak.layout.Identities.identity_at_str -==================================== - -.. py:method:: ak.layout.Identities.identity_at_str(at) diff --git a/docs-sphinx/ak.layout.Index.rst b/docs-sphinx/ak.layout.Index.rst deleted file mode 100644 index e711cb098f..0000000000 --- a/docs-sphinx/ak.layout.Index.rst +++ /dev/null @@ -1,61 +0,0 @@ -ak.layout.Index ---------------- - -The Index concept is implemented in 5 specialized classes: - - * ``ak.layout.Index64``: values are 64-bit signed integers. - * ``ak.layout.Index32``: values are 32-bit signed integers. - * ``ak.layout.IndexU32``: values are 32-bit unsigned integers. - * ``ak.layout.Index8``: values are 8-bit signed integers. - * ``ak.layout.IndexU8``: values are 8-bit unsigned integers. - -Index supports the buffer protocol, so it can be directly cast as a NumPy array. - -An Index represents a contiguous, one-dimensional array of integers that is -fully interpreted in the C++ layer. The structure of all -:doc:`ak.layout.Content` nodes is implemented in Indexes, such as a -:doc:`ak.layout.ListArray`'s ``starts`` and ``stops``. Only data at the leaves -of a structure, such as :doc:`ak.layout.NumpyArray` content, are not implemented -in an Index. (This allows :doc:`ak.layout.NumpyArray` to handle non-contiguous, -non-integer data.) - -This distinction is made because the C++ layer needs to make stronger -assumptions about the arrays used to define structure than any content at the -leaves of the structure. - -ak.layout.Index.__init__ -======================== - -.. py:method:: ak.layout.Index.__init__(numpy_array) - -Creates an Index from a NumPy array. If the array has the wrong type for -this specialization, or if it is not C-contiguous, the array is copied. -Otherwise, it is a view (shares data). - -ak.layout.Index.__getitem__ -=========================== - -.. py:method:: ak.layout.Index.__getitem__(at) - -Extracts one element from the Index. - -ak.layout.Index.__getitem__ -=========================== - -.. py:method:: ak.layout.Index.__getitem__(start, stop) - -Slices the Index between ``start`` and ``stop``. - -ak.layout.Index.__len__ -======================= - -.. py:method:: ak.layout.Index.__len__() - -The length of the Index. - -ak.layout.Index.__repr__ -======================== - -.. py:method:: ak.layout.Index.__repr__() - -A string representation of the Index (single-line XML, trucated middle). diff --git a/docs-sphinx/ak.layout.IndexedArray.rst b/docs-sphinx/ak.layout.IndexedArray.rst deleted file mode 100644 index dba3f79052..0000000000 --- a/docs-sphinx/ak.layout.IndexedArray.rst +++ /dev/null @@ -1,155 +0,0 @@ -ak.layout.IndexedArray ----------------------- - -The IndexedArray concept is implemented in 3 specialized classes: - - * ``ak.layout.IndexArray64``: ``index`` values are 64-bit signed integers. - * ``ak.layout.IndexArray32``: ``index`` values are 32-bit signed integers. - * ``ak.layout.IndexArrayU32``: ``index`` values are 32-bit unsigned - integers. - -The IndexedArray class is a general-purpose tool for changing the order of -and/or duplicating some ``content``. Its ``index`` array is a lazily applied -`np.take `__ -(integer-array slice, also known as "advanced indexing"). - -It has many uses: - - * representing a lazily applied slice. - * simulating pointers into another collection. - * emulating the dictionary encoding of Apache Arrow and Parquet. - -IndexedArray doesn't have a direct equivalent in Apache Arrow. - -Below is a simplified implementation of a IndexedArray class in pure Python -that exhaustively checks validity in its constructor (see -:doc:`_auto/ak.is_valid`) and can generate random valid arrays. The -``random_number()`` function returns a random float and the -``random_length(minlen)`` function returns a random int that is at least -``minlen``. The ``RawArray`` class represents simple, one-dimensional data. - -.. code-block:: python - - class IndexedArray(Content): - def __init__(self, index, content): - assert isinstance(index, list) - assert isinstance(content, Content) - for x in index: - assert isinstance(x, int) - assert 0 <= x < len(content) # index[i] must not be negative - self.index = index - self.content = content - - @staticmethod - def random(minlen, choices): - if minlen == 0: - content = random.choice(choices).random(0, choices) - else: - content = random.choice(choices).random(1, choices) - if len(content) == 0: - index = [] - else: - index = [random.randint(0, len(content) - 1) - for i in range(random_length(minlen))] - return IndexedArray(index, content) - - def __len__(self): - return len(self.index) - - def __getitem__(self, where): - if isinstance(where, int): - assert 0 <= where < len(self) - return self.content[self.index[where]] - elif isinstance(where, slice) and where.step is None: - return IndexedArray(self.index[where.start:where.stop], self.content) - elif isinstance(where, str): - return IndexedArray(self.index, self.content[where]) - else: - raise AssertionError(where) - - def __repr__(self): - return "IndexedArray(" + repr(self.index) + ", " + repr(self.content) + ")" - - def xml(self, indent="", pre="", post=""): - out = indent + pre + "\n" - out += indent + " " + " ".join(str(x) for x in self.index) + "\n" - out += self.content.xml(indent + " ", "", "\n") - out += indent + "\n" - return out - -Here is an example: - -.. code-block:: python - - IndexedArray([3, 5, 1, 1, 5, 3], - RawArray([8.9, 3.2, 5.4, 9.8, 7.5, 1.9])) - -.. code-block:: xml - - - 3 5 1 1 5 3 - - 8.9 3.2 5.4 9.8 7.5 1.9 - - - -which represents the following logical data. - -.. code-block:: python - - [9.8, 1.9, 3.2, 3.2, 1.9, 9.8] - -In addition to the properties and methods described in :doc:`ak.layout.Content`, -an IndexedArray has the following. - -ak.layout.IndexedArray.__init__ -=============================== - -.. py:method:: ak.layout.IndexedArray.__init__(index, content, identities=None, parameters=None) - -ak.layout.IndexedArray.index -============================ - -.. py:attribute:: ak.layout.IndexedArray.index - -ak.layout.IndexedArray.content -============================== - -.. py:attribute:: ak.layout.IndexedArray.content - -ak.layout.IndexedArray.isoption -=============================== - -.. py:attribute:: ak.layout.IndexedArray.isoption - -Returns False because this is not an IndexedOptionArray. - -ak.layout.IndexedArray.project -============================== - -.. py:method:: ak.layout.IndexedArray.project(mask=None) - -Returns an array with the ``index`` applied to reorder/duplicate elements. - -If ``mask`` is a signed 8-bit :doc:`ak.layout.Index` in which ``0`` means valid -and ``1`` means missing, only valid elements according to this ``mask`` are -returned. - -ak.layout.IndexedArray.bytemask -=============================== - -.. py:method:: ak.layout.IndexedArray.bytemask() - -Returns an 8-bit signed :doc:`ak.layout.Index` of all zeros, because this -IndexedArray does not have :doc:`ak.types.OptionType`. - -ak.layout.IndexedArray.simplify -=============================== - -.. py:method:: ak.layout.IndexedArray.simplify() - -Combines this node with its ``content`` if the ``content`` also has -:doc:`ak.types.OptionType` or is an :doc:`ak.layout.IndexedArray`; otherwise, this is -a pass-through. In all cases, the output has the same logical meaning as the input. - -This method only operates one level deep. diff --git a/docs-sphinx/ak.layout.IndexedOptionArray.rst b/docs-sphinx/ak.layout.IndexedOptionArray.rst deleted file mode 100644 index beb15c1c79..0000000000 --- a/docs-sphinx/ak.layout.IndexedOptionArray.rst +++ /dev/null @@ -1,154 +0,0 @@ -ak.layout.IndexedOptionArray ----------------------------- - -The IndexedOptionArray concept is implemented in 2 specialized classes: - - * ``ak.layout.IndexOptionArray64``: ``index`` values 64-bit signed integers. - * ``ak.layout.IndexOptionArray32``: ``index`` values are 32-bit signed - integers. - -The IndexedOptionArray class is an :doc:`ak.layout.IndexedArray` for which -negative values in the index are interpreted as missing. It represents -:doc:`ak.types.OptionType` data like :doc:`ak.layout.ByteMaskedArray`, -:doc:`ak.layout.BitMaskedArray`, and :doc:`ak.layout.UnmaskedArray`, but -the flexibility of the arbitrary ``index`` makes it a common output of -many operations. - -IndexedOptionArray doesn't have a direct equivalent in Apache Arrow. - -Below is a simplified implementation of a IndexedOptionArray class in pure Python -that exhaustively checks validity in its constructor (see -:doc:`_auto/ak.is_valid`) and can generate random valid arrays. The -``random_number()`` function returns a random float and the -``random_length(minlen)`` function returns a random int that is at least -``minlen``. The ``RawArray`` class represents simple, one-dimensional data. - -.. code-block:: python - - class IndexedOptionArray(Content): - def __init__(self, index, content): - assert isinstance(index, list) - assert isinstance(content, Content) - for x in index: - assert isinstance(x, int) - assert x < len(content) # index[i] may be negative - self.index = index - self.content = content - - @staticmethod - def random(minlen, choices): - content = random.choice(choices).random(0, choices) - index = [] - for i in range(random_length(minlen)): - if len(content) == 0 or random.randint(0, 4) == 0: - index.append(-random_length(1)) # a random number, but not necessarily -1 - else: - index.append(random.randint(0, len(content) - 1)) - return IndexedOptionArray(index, content) - - def __len__(self): - return len(self.index) - - def __getitem__(self, where): - if isinstance(where, int): - assert 0 <= where < len(self) - if self.index[where] < 0: - return None - else: - return self.content[self.index[where]] - elif isinstance(where, slice) and where.step is None: - return IndexedOptionArray(self.index[where.start:where.stop], self.content) - elif isinstance(where, str): - return IndexedOptionArray(self.index, self.content[where]) - else: - raise AssertionError(where) - - def __repr__(self): - return "IndexedOptionArray(" + repr(self.index) + ", " + repr(self.content) + ")" - - def xml(self, indent="", pre="", post=""): - out = indent + pre + "\n" - out += indent + " " + " ".join(str(x) for x in self.index) + "\n" - out += self.content.xml(indent + " ", "", "\n") - out += indent + "\n" - return out - -Here is an example: - -.. code-block:: python - - IndexedOptionArray([-30, 19, 6, 7, -3, 21, 13, 22, 17, 9, -12, 16], - RawArray([5.2, 1.7, 6.7, -0.4, 4.0, 7.8, 3.8, 6.8, 4.2, 0.3, 4.6, 6.2, - 6.9, -0.7, 3.9, 1.6, 8.7, -0.7, 3.2, 4.3, 4.0, 5.8, 4.2, 7.0, - 5.6, 3.8])) - -.. code-block:: xml - - - -30 19 6 7 -3 21 13 22 17 9 -12 16 - - 5.2 1.7 6.7 -0.4 4.0 7.8 3.8 6.8 4.2 0.3 4.6 6.2 6.9 -0.7 3.9 1.6 8.7 -0.7 3.2 - 4.3 4.0 5.8 4.2 7.0 5.6 3.8 - - - -which represents the following logical data. - -.. code-block:: python - - [None, 4.3, 3.8, 6.8, None, 5.8, -0.7, 4.2, -0.7, 0.3, None, 8.7] - -In addition to the properties and methods described in :doc:`ak.layout.Content`, -an IndexedOptionArray has the following. - -ak.layout.IndexedOptionArray.__init__ -===================================== - -.. py:method:: ak.layout.IndexedOptionArray.__init__(index, content, identities=None, parameters=None) - -ak.layout.IndexedOptionArray.index -================================== - -.. py:attribute:: ak.layout.IndexedOptionArray.index - -ak.layout.IndexedOptionArray.content -==================================== - -.. py:attribute:: ak.layout.IndexedOptionArray.content - -ak.layout.IndexedOptionArray.isoption -===================================== - -.. py:attribute:: ak.layout.IndexedOptionArray.isoption - -Returns True because this is an IndexedOptionArray. - -ak.layout.IndexedOptionArray.project -==================================== - -.. py:method:: ak.layout.IndexedOptionArray.project(mask=None) - -Returns a non-:doc:`ak.types.OptionType` array containing only the valid elements -with the ``index`` applied to reorder/duplicate elements. - -If ``mask`` is a signed 8-bit :doc:`ak.layout.Index` in which ``0`` means valid -and ``1`` means missing, this ``mask`` is unioned with the BitMaskedArray's -mask (after converting to 8-bit and to ``valid_when=False`` to match this ``mask``). - -ak.layout.IndexedOptionArray.bytemask -===================================== - -.. py:method:: ak.layout.IndexedOptionArray.bytemask() - -Returns an array of 8-bit values in which ``0`` means valid and ``1`` means missing. - -ak.layout.IndexedOptionArray.simplify -===================================== - -.. py:method:: ak.layout.IndexedOptionArray.simplify() - -Combines this node with its ``content`` if the ``content`` also has -:doc:`ak.types.OptionType` or is an :doc:`ak.layout.IndexedArray`; otherwise, this is -a pass-through. In all cases, the output has the same logical meaning as the input. - -This method only operates one level deep. diff --git a/docs-sphinx/ak.layout.Iterator.rst b/docs-sphinx/ak.layout.Iterator.rst deleted file mode 100644 index 4c22d6d3c5..0000000000 --- a/docs-sphinx/ak.layout.Iterator.rst +++ /dev/null @@ -1,29 +0,0 @@ -ak.layout.Iterator ------------------- - -Iterates over :doc:`ak.layout.Content` arrays. - -ak.layout.Iterator.__init__ -=========================== - -.. py:method:: ak.layout.Iterator.__init__(arg0) - -ak.layout.Iterator.__iter__ -=========================== - -.. py:method:: ak.layout.Iterator.__iter__() - -ak.layout.Iterator.__next__ -=========================== - -.. py:method:: ak.layout.Iterator.__next__() - -ak.layout.Iterator.__repr__ -=========================== - -.. py:method:: ak.layout.Iterator.__repr__() - -ak.layout.Iterator.next -======================= - -.. py:method:: ak.layout.Iterator.next() diff --git a/docs-sphinx/ak.layout.ListArray.rst b/docs-sphinx/ak.layout.ListArray.rst deleted file mode 100644 index 3667cf6fa2..0000000000 --- a/docs-sphinx/ak.layout.ListArray.rst +++ /dev/null @@ -1,195 +0,0 @@ -ak.layout.ListArray -------------------- - -The ListArray concept is implemented in 3 specialized classes: - - * ``ak.layout.ListArray64``: ``starts`` and ``stops`` values are 64-bit - signed integers. - * ``ak.layout.ListArray32``: ``starts`` and ``stops`` values are 32-bit - signed integers. - * ``ak.layout.ListArrayU32``: ``starts`` and ``stops`` values are 32-bit - unsigned integers. - -The ListArray class generalizes :doc:`ak.layout.ListOffsetArray` by not -requiring its ``content`` to be in increasing order and by allowing it to -have unreachable elements between lists. Instead of a single ``offsets`` array, -ListArray has - - * ``starts``: The starting index of each list. - * ``stops``: The stopping index of each list. - -:doc:`ak.layout.ListOffsetArray` ``offsets`` may be related to ``starts`` and -``stops``: - -.. code-block:: python - - starts = offsets[:-1] - stops = offsets[1:] - -ListArrays are a common by-product of structure manipulation: as a result of -some operation, we might want to view slices or permutations of the ``content`` -without copying it to make a contiguous version of it. For that reason, -ListArrays are more useful in a data-manipulation library like Awkward Array -than in a data-representation library like Apache Arrow. - -There is not equivalent of ListArray in Apache Arrow. - -Below is a simplified implementation of a ListArray class in pure Python -that exhaustively checks validity in its constructor (see -:doc:`_auto/ak.is_valid`) and can generate random valid arrays. The -``random_number()`` function returns a random float and the -``random_length(minlen)`` function returns a random int that is at least -``minlen``. The ``RawArray`` class represents simple, one-dimensional data. - -.. code-block:: python - - class ListArray(Content): - def __init__(self, starts, stops, content): - assert isinstance(starts, list) - assert isinstance(stops, list) - assert isinstance(content, Content) - assert len(stops) >= len(starts) # usually equal - for i in range(len(starts)): - start = starts[i] - stop = stops[i] - assert isinstance(start, int) - assert isinstance(stop, int) - if start != stop: - assert start < stop # i.e. start <= stop - assert start >= 0 - assert stop <= len(content) - self.starts = starts - self.stops = stops - self.content = content - - @staticmethod - def random(minlen, choices): - content = random.choice(choices).random(0, choices) - length = random_length(minlen) - if len(content) == 0: - starts = [random.randint(0, 10) for i in range(length)] - stops = list(starts) - else: - starts = [random.randint(0, len(content) - 1) for i in range(length)] - stops = [x + min(random_length(), len(content) - x) for x in starts] - return ListArray(starts, stops, content) - - def __len__(self): - return len(self.starts) - - def __getitem__(self, where): - if isinstance(where, int): - assert 0 <= where < len(self) - return self.content[self.starts[where]:self.stops[where]] - elif isinstance(where, slice) and where.step is None: - starts = self.starts[where.start:where.stop] - stops = self.stops[where.start:where.stop] - return ListArray(starts, stops, self.content) - elif isinstance(where, str): - return ListArray(self.starts, self.stops, self.content[where]) - else: - raise AssertionError(where) - - def __repr__(self): - return ("ListArray(" + repr(self.starts) + ", " + repr(self.stops) + ", " - + repr(self.content) + ")") - - def xml(self, indent="", pre="", post=""): - out = indent + pre + "\n" - out += indent + " " + " ".join(str(x) for x in self.starts) - out += "\n" - out += indent + " " + " ".join(str(x) for x in self.stops) + "\n" - out += self.content.xml(indent + " ", "", "\n") - out += indent + "" + post - return out - -Here is an example: - -.. code-block:: python - - ListArray([5, 1, 4, 1, 1, 1, 0, 0, 4, 3, 5], - [6, 2, 5, 6, 6, 1, 6, 6, 6, 3, 6], - RawArray([13.3, 3.8, 5.9, 5.9, 9.2, 9.3])) - -.. code-block:: xml - - - 5 1 4 1 1 1 0 0 4 3 5 - 6 2 5 6 6 1 6 6 6 3 6 - - 13.3 3.8 5.9 5.9 9.2 9.3 - - - -which represents the following logical data. - -.. code-block:: python - - [[9.3], - [3.8], - [9.2], - [3.8, 5.9, 5.9, 9.2, 9.3], - [3.8, 5.9, 5.9, 9.2, 9.3], - [], - [13.3, 3.8, 5.9, 5.9, 9.2, 9.3], - [13.3, 3.8, 5.9, 5.9, 9.2, 9.3], - [9.2, 9.3], - [], - [9.3]] - -In addition to the properties and methods described in :doc:`ak.layout.Content`, -a ListArray has the following. - -ak.layout.ListArray.__init__ -============================ - -.. py:method:: ak.layout.ListArray.__init__(starts, stops, content, identities=None, parameters=None) - -ak.layout.ListArray.starts -========================== - -.. py:attribute:: ak.layout.ListArray.starts - -ak.layout.ListArray.stops -========================= - -.. py:attribute:: ak.layout.ListArray.stops - -ak.layout.ListArray.content -=========================== - -.. py:attribute:: ak.layout.ListArray.content - -ak.layout.ListArray.compact_offsets64 -===================================== - -.. py:method:: ak.layout.ListArray.compact_offsets64(start_at_zero=True) - -Returns a 64-bit :doc:`ak.layout.Index` of ``offsets`` that represent the same lengths -of this array's ``starts`` and ``stops`` (though not the physical order in memory). - -ak.layout.ListArray.broadcast_tooffsets64 -========================================= - -.. py:method:: ak.layout.ListArray.broadcast_tooffsets64(offsets) - -Reorders ``contents`` to match a given set of ``offsets`` (if possible) and -returns a :doc:`ak.layout.ListOffsetArray` with the results. This is used in -broadcasting because a set of :doc:`ak.types.ListType` and :doc:`ak.types.RegularType` -arrays have to be reordered to a common ``offsets`` before they can be directly -operated upon. - -ak.layout.ListArray.toRegularArray -================================== - -.. py:method:: ak.layout.ListArray.toRegularArray() - -Converts this :doc:`ak.types.ListType` into a :doc:`ak.types.RegularType` array -if possible. - -ak.layout.ListArray.simplify -============================ - -.. py:method:: ak.layout.ListArray.simplify() - -Pass-through; returns the original array. diff --git a/docs-sphinx/ak.layout.ListOffsetArray.rst b/docs-sphinx/ak.layout.ListOffsetArray.rst deleted file mode 100644 index 71b1e8e385..0000000000 --- a/docs-sphinx/ak.layout.ListOffsetArray.rst +++ /dev/null @@ -1,189 +0,0 @@ -ak.layout.ListOffsetArray -------------------------- - -The ListOffsetArray concept is implemented in 3 specialized classes: - - * ``ak.layout.ListOffsetArray64``: ``offsets`` values are 64-bit signed - integers. - * ``ak.layout.ListOffsetArray32``: ``offsets`` values are 32-bit signed - integers. - * ``ak.layout.ListOffsetArrayU32``: ``offsets`` values are 32-bit - unsigned integers. - -The ListOffsetArray class describes unequal-length lists (often called a -"jagged" or "ragged" array). Like :doc:`ak.layout.RegularArray`, the -underlying data for all lists are in a contiguous ``content``. It is -subdivided into lists according to an ``offsets`` array, which specifies -the starting and stopping index of each list. - -The ``offsets`` must have at least length 1 (corresponding to an empty array), -but it need not start with ``0`` or include all of the ``content``. Just as -:doc:`ak.layout.RegularArray` can have unreachable ``content`` if it is not -an integer multiple of ``size``, a ListOffsetArray can have unreachable -content before the first list and after the last list. - -ListOffsetArray corresponds to Apache Arrow `List type `__. - -Below is a simplified implementation of a ListOffsetArray class in pure Python -that exhaustively checks validity in its constructor (see -:doc:`_auto/ak.is_valid`) and can generate random valid arrays. The -``random_number()`` function returns a random float and the -``random_length(minlen)`` function returns a random int that is at least -``minlen``. The ``RawArray`` class represents simple, one-dimensional data. - -.. code-block:: python - - class ListOffsetArray(Content): - def __init__(self, offsets, content): - assert isinstance(offsets, list) - assert isinstance(content, Content) - assert len(offsets) != 0 - for i in range(len(offsets) - 1): - start = offsets[i] - stop = offsets[i + 1] - assert isinstance(start, int) - assert isinstance(stop, int) - if start != stop: - assert start < stop # i.e. start <= stop - assert start >= 0 - assert stop <= len(content) - self.offsets = offsets - self.content = content - - @staticmethod - def random(minlen, choices): - counts = [random_length() for i in range(random_length(minlen))] - offsets = [random_length()] - for x in counts: - offsets.append(offsets[-1] + x) - return ListOffsetArray(offsets, random.choice(choices).random(offsets[-1], choices)) - - def __len__(self): - return len(self.offsets) - 1 - - def __getitem__(self, where): - if isinstance(where, int): - assert 0 <= where < len(self) - return self.content[self.offsets[where]:self.offsets[where + 1]] - elif isinstance(where, slice) and where.step is None: - offsets = self.offsets[where.start : where.stop + 1] - if len(offsets) == 0: - offsets = [0] - return ListOffsetArray(offsets, self.content) - elif isinstance(where, str): - return ListOffsetArray(self.offsets, self.content[where]) - else: - raise AssertionError(where) - - def __repr__(self): - return "ListOffsetArray(" + repr(self.offsets) + ", " + repr(self.content) + ")" - - def xml(self, indent="", pre="", post=""): - out = indent + pre + "\n" - out += indent + " " + " ".join(str(x) for x in self.offsets) - out += "\n" - out += self.content.xml(indent + " ", "", "\n") - out += indent + "" + post - return out - -Here is an example: - -.. code-block:: python - - ListOffsetArray([0, 2, 4, 11, 19], - RawArray([5.9, 3.5, 2.2, 5.8, 7.4, 3.4, 2.7, 7.2, 6.6, 8.6, 8.2, 5.5, 3.8, - 3.0, 8.4, 5.1, 1.2, -0.9, 3.7, 4.2, 0.8, 9.5, 4.0, 4.2, 4.2])) - -.. code-block:: xml - - - 0 2 4 11 19 - - 5.9 3.5 2.2 5.8 7.4 3.4 2.7 7.2 6.6 8.6 8.2 5.5 3.8 3.0 8.4 5.1 1.2 -0.9 3.7 - 4.2 0.8 9.5 4.0 4.2 4.2 - - - -which represents the following logical data. - -.. code-block:: python - - [[5.9, 3.5], - [2.2, 5.8], - [7.4, 3.4, 2.7, 7.2, 6.6, 8.6, 8.2], - [5.5, 3.8, 3.0, 8.4, 5.1, 1.2, -0.9, 3.7]] - -In addition to the properties and methods described in :doc:`ak.layout.Content`, -a ListOffsetArray has the following. - -ak.layout.ListOffsetArray.__init__ -================================== - -.. py:method:: ak.layout.ListOffsetArray.__init__(offsets, content, identities=None, parameters=None) - -ak.layout.ListOffsetArray.offsets -================================= - -.. py:attribute:: ak.layout.ListOffsetArray.offsets - -ak.layout.ListOffsetArray.content -================================= - -.. py:attribute:: ak.layout.ListOffsetArray.content - -ak.layout.ListOffsetArray.starts -================================ - -.. py:attribute:: ak.layout.ListOffsetArray.starts - -Derives ``starts`` as a view of ``offsets``: - -.. code-block:: python - - starts = offsets[:-1] - -ak.layout.ListOffsetArray.stops -=============================== - -.. py:attribute:: ak.layout.ListOffsetArray.stops - -Derives ``stops`` as a view of ``offsets``: - -.. code-block:: python - - stops = offsets[1:] - -ak.layout.ListOffsetArray.compact_offsets64 -=========================================== - -.. py:method:: ak.layout.ListOffsetArray.compact_offsets64(start_at_zero=True) - -Returns a 64-bit :doc:`ak.layout.Index` of ``offsets`` that represent the same lengths -of this array's ``offsets``. If this ``offsets[0] == 0 or not start_at_zero``, the -return value is a view of this array's ``offsets``. - -ak.layout.ListOffsetArray.broadcast_tooffsets64 -=============================================== - -.. py:method:: ak.layout.ListOffsetArray.broadcast_tooffsets64(offsets) - -Shifts ``contents`` to match a given set of ``offsets`` (if possible) and -returns a :doc:`ak.layout.ListOffsetArray` with the results. This is used in -broadcasting because a set of :doc:`ak.types.ListType` and :doc:`ak.types.RegularType` -arrays have to be reordered to a common ``offsets`` before they can be directly -operated upon. - -ak.layout.ListOffsetArray.toRegularArray -======================================== - -.. py:method:: ak.layout.ListOffsetArray.toRegularArray() - -Converts this :doc:`ak.types.ListType` into a :doc:`ak.types.RegularType` array -if possible. - -ak.layout.ListOffsetArray.simplify -================================== - -.. py:method:: ak.layout.ListOffsetArray.simplify() - -Pass-through; returns the original array. diff --git a/docs-sphinx/ak.layout.NumpyArray.rst b/docs-sphinx/ak.layout.NumpyArray.rst deleted file mode 100644 index 04c75d61b5..0000000000 --- a/docs-sphinx/ak.layout.NumpyArray.rst +++ /dev/null @@ -1,255 +0,0 @@ -ak.layout.NumpyArray --------------------- - -A NumpyArray describes multidimensional data with the same set of parameters -as a NumPy ``np.ndarray``. - - * ``ptr``: The data themselves, a raw buffer. - * ``shape``: Non-negative integers, at least one. Each represents the - number of components in a dimension; a shape of length *N* represents an - *N* dimensional tensor. The number of items in the array is the product - of all values in shape (may be zero). - * ``strides``: The same number of integers as ``shape``. The strides - describes how many items in ``ptr`` to skip per element in a dimension. - (Strides can be negative or zero.) - * ``offset``: the number of items in ptr to skip before the first element - of the array. - * ``itemsize``: the number of bytes per item (i.e. 1 for characters, 4 for - int32, 8 for double types). - * ``format``: a string representing the NumPy - `dtype `__ - constructed by pybind11. Note that on Windows and 32-bit systems, - ``"q"``/``"Q"`` mean signed/unsigned 64-bit and ``"l"``/``"L"`` mean - signed/unsigned 32-bit; on all other systems, ``"l"``/``"L"`` mean - signed/unsigned 64-bit and ``"i"``/``"I"`` mean 32-bit. - -If the ``shape`` is one-dimensional, a NumpyArray corresponds to an Apache -Arrow `Primitive array `__. - -Below is a simplified implementation of a NumpyArray class in pure Python -that exhaustively checks validity in its constructor (see -:doc:`_auto/ak.is_valid`) and can generate random valid arrays. The -``random_number()`` function returns a random float and the -``random_length(minlen)`` function returns a random int that is at least -``minlen``. The ``RawArray`` class represents simple, one-dimensional data. - -For a real NumpyArray, ``strides`` and ``itemsize`` are measured in bytes; -in the simplified code below, they are measured in number of elements, as -though we were dealing with 1-byte data. - -.. code-block:: python - - class NumpyArray(Content): - def __init__(self, ptr, shape, strides, offset): - assert isinstance(ptr, list) - assert isinstance(shape, list) - assert isinstance(strides, list) - for x in ptr: - assert isinstance(x, (bool, int, float)) - assert len(shape) > 0 - assert len(strides) == len(shape) - for x in shape: - assert isinstance(x, int) - assert x >= 0 - for x in strides: - assert isinstance(x, int) - assert isinstance(offset, int) - if all(x != 0 for x in shape): - assert 0 <= offset < len(ptr) - last = offset - for sh, st in zip(shape, strides): - last += (sh - 1) * st - assert last <= len(ptr) - self.ptr = ptr - self.shape = shape - self.strides = strides - self.offset = offset - - @staticmethod - def random(minlen, choices): - shape = [random_length(minlen)] - for i in range(random_length(0, 2)): - shape.append(random_length(1, 3)) - strides = [1] - for x in shape[:0:-1]: - skip = random_length(0, 2) - strides.insert(0, x * strides[0] + skip) - offset = random_length() - ptr = [random_number() for i in range(shape[0] * strides[0] + offset)] - return NumpyArray(ptr, shape, strides, offset) - - def __len__(self): - return self.shape[0] - - def __getitem__(self, where): - if isinstance(where, int): - assert 0 <= where < len(self) - offset = self.offset + self.strides[0] * where - if len(self.shape) == 1: - return self.ptr[offset] - else: - return NumpyArray(self.ptr, self.shape[1:], self.strides[1:], offset) - elif isinstance(where, slice) and where.step is None: - offset = self.offset + self.strides[0] * where.start - shape = [where.stop - where.start] + self.shape[1:] - return NumpyArray(self.ptr, shape, self.strides, offset) - elif isinstance(where, str): - raise ValueError("field " + repr(where) + " not found") - else: - raise AssertionError(where) - - def __repr__(self): - return ("NumpyArray(" + repr(self.ptr) + ", " + repr(self.shape) + ", " + - repr(self.strides) + ", " + repr(self.offset) + ")") - - def xml(self, indent="", pre="", post=""): - out = indent + pre + "\n" - out += indent + " " + " ".join(str(x) for x in self.ptr) + "\n" - out += indent + " " + " ".join(str(x) for x in self.shape) + "\n" - out += indent + " " + " ".join(str(x) for x in self.strides) - out += "\n" - out += indent + " " + str(self.offset) + "\n" - out += indent + "" + post - return out - -Here is an example: - -.. code-block:: python - - NumpyArray([2.4, 9.6, -0.2, 7.1, 10.2, 3.3, 7.9, 4.5, 2.1, 5.4, 8.4, 2.3, 12.0, 5.6, 6.2, - 11.4, 4.4, 3.0, 4.7, 7.8, 2.4, 2.2, 0.8, 10.6, 8.2, 5.4, 6.7, 4.5, 5.1, 11.2, - 11.4, 9.2, 6.6, 2.1, -2.4, 6.8, 8.8, 8.2, 5.4, 2.9, 8.2, 7.0, 2.2, 4.8, 5.3, - 6.4, 4.1, 5.1, 8.6, 9.4, 5.1, 6.0], - [17, 2], - [2, 1], - 18) - -.. code-block:: xml - - - 2.4 9.6 -0.2 7.1 10.2 3.3 7.9 4.5 2.1 5.4 8.4 2.3 12.0 5.6 6.2 11.4 4.4 3.0 4.7 7.8 - 2.4 2.2 0.8 10.6 8.2 5.4 6.7 4.5 5.1 11.2 11.4 9.2 6.6 2.1 -2.4 6.8 8.8 8.2 5.4 2.9 - 8.2 7.0 2.2 4.8 5.3 6.4 4.1 5.1 8.6 9.4 5.1 6.0 - 17 2 - 2 1 - 18 - - -which represents the following logical data. - -.. code-block:: python - - [[4.7, 7.8], - [2.4, 2.2], - [0.8, 10.6], - [8.2, 5.4], - [6.7, 4.5], - [5.1, 11.2], - [11.4, 9.2], - [6.6, 2.1], - [-2.4, 6.8], - [8.8, 8.2], - [5.4, 2.9], - [8.2, 7.0], - [2.2, 4.8], - [5.3, 6.4], - [4.1, 5.1], - [8.6, 9.4], - [5.1, 6.0]] - -NumpyArray supports the buffer protocol, so it can be directly cast as a -NumPy array. - -In addition to the properties and methods described in :doc:`ak.layout.Content`, -a NumpyArray has the following. - -ak.layout.NumpyArray.__init__ -============================= - -.. py:method:: ak.layout.NumpyArray.__init__(array, identities=None, parameters=None) - -ak.layout.NumpyArray.shape -========================== - -.. py:attribute:: ak.layout.NumpyArray.shape - -ak.layout.NumpyArray.strides -============================ - -.. py:attribute:: ak.layout.NumpyArray.strides - -ak.layout.NumpyArray.itemsize -============================= - -.. py:attribute:: ak.layout.NumpyArray.itemsize - -ak.layout.NumpyArray.format -=========================== - -.. py:attribute:: ak.layout.NumpyArray.format - -ak.layout.NumpyArray.ndim -========================= - -.. py:attribute:: ak.layout.NumpyArray.ndim - -Returns ``len(shape)``. - -ak.layout.NumpyArray.isscalar -============================= - -.. py:attribute:: ak.layout.NumpyArray.isscalar - -Should always return False (``len(shape) == 0`` NumpyArrays in C++ are converted into -scalar numbers and booleans before they appear in Python). - -ak.layout.NumpyArray.isempty -============================ - -.. py:attribute:: ak.layout.NumpyArray.isempty - -Returns True if any ``shape`` element is ``0``; False otherwise. - -ak.layout.NumpyArray.iscontiguous -================================= - -.. py:attribute:: ak.layout.NumpyArray.iscontiguous - -Contiguous arrays have no gaps between elements and are sequenced in increasing -order in memory. This is the same as NumPy's notion of -`"C contiguous" `__. - -A NumpyArray is contiguous if the following are true of its ``shape``, ``strides``, -and ``itemsize``: - -.. code-block:: python - - x = itemsize - for i in range(len(shape) - 1, 0, -1): - if x != strides[i]: - return False - x *= shape[i] - else: - return True - -ak.layout.NumpyArray.toRegularArray -=================================== - -.. py:method:: ak.layout.NumpyArray.toRegularArray() - -Returns a contiguous version of this array with any multidimensional ``shape`` replaced by -nested :doc:`ak.layout.RegularArray` nodes. - -ak.layout.NumpyArray.contiguous -=============================== - -.. py:method:: ak.layout.NumpyArray.contiguous() - -Returns a contiguous version of this array (possibly the original array, unchanged). - -ak.layout.NumpyArray.simplify -============================= - -.. py:method:: ak.layout.NumpyArray.simplify() - -Pass-through; returns the original array. diff --git a/docs-sphinx/ak.layout.Record.rst b/docs-sphinx/ak.layout.Record.rst deleted file mode 100644 index 2f97116ac3..0000000000 --- a/docs-sphinx/ak.layout.Record.rst +++ /dev/null @@ -1,144 +0,0 @@ -ak.layout.Record ----------------- - -Represents a single value from a :doc:`ak.layout.RecordArray`. - -As this is a columnar representation, the Record contains a -:doc:`ak.layout.RecordArray`, rather than the other way around. -Its two fields are - - * ``array``: the :doc:`ak.layout.RecordArray` and - * ``at``: the index posiion where this Record is found. - -The Record shares a reference with its :doc:`ak.layout.RecordArray`; -it is not a copy (not even a shallow-copied node object). - -A :doc:`ak.layout.Record` node has the following properties and methods. -See their definitions in :doc:`ak.layout.Content` and :doc:`ak.layout.RecordArray` -as a guide. They pass through to the underlying ``array`` with adjustments -in some cases because Record is a scalar. - -ak.layout.Record.__init__ -========================= - -.. py:method:: ak.layout.Record.__init__(array, at) - -ak.layout.Record.array -====================== - -.. py:attribute:: ak.layout.Record.array - -ak.layout.Record.at -=================== - -.. py:attribute:: ak.layout.Record.at - -ak.layout.Record.__getitem__ -============================ - -.. py:method:: ak.layout.Record.__getitem__(where) - -ak.layout.Record.__repr__ -========================= - -.. py:method:: ak.layout.Record.__repr__() - -ak.layout.Record.field -====================== - -.. py:method:: ak.layout.Record.field(index) - -ak.layout.Record.field -====================== - -.. py:method:: ak.layout.Record.field(key) - -ak.layout.Record.fieldindex -=========================== - -.. py:method:: ak.layout.Record.fieldindex(key) - -ak.layout.Record.fielditems -=========================== - -.. py:method:: ak.layout.Record.fielditems() - -ak.layout.Record.fields -======================= - -.. py:method:: ak.layout.Record.fields() - -ak.layout.Record.haskey -======================= - -.. py:method:: ak.layout.Record.haskey(key) - -ak.layout.Record.keys -===================== - -.. py:method:: ak.layout.Record.keys() - -ak.layout.Record.parameter -========================== - -.. py:method:: ak.layout.Record.parameter(arg0) - -ak.layout.Record.purelist_parameter -=================================== - -.. py:method:: ak.layout.Record.purelist_parameter(arg0) - -ak.layout.Record.setparameter -============================= - -.. py:method:: ak.layout.Record.setparameter(arg0, arg1) - -ak.layout.Record.simplify -========================= - -.. py:method:: ak.layout.Record.simplify() - -ak.layout.Record.tojson -======================= - -.. py:method:: ak.layout.Record.tojson(pretty=False, maxdecimals=None) - -ak.layout.Record.tojson -======================= - -.. py:method:: ak.layout.Record.tojson(destination, pretty=False, maxdecimals=None, buffersize=65536) - -ak.layout.Record.type -===================== - -.. py:method:: ak.layout.Record.type(arg0) - -ak.layout.Record.astuple -======================== - -.. py:attribute:: ak.layout.Record.astuple - -ak.layout.Record.identities -=========================== - -.. py:attribute:: ak.layout.Record.identities - -ak.layout.Record.identity -========================= - -.. py:attribute:: ak.layout.Record.identity - -ak.layout.Record.istuple -======================== - -.. py:attribute:: ak.layout.Record.istuple - -ak.layout.Record.numfields -========================== - -.. py:attribute:: ak.layout.Record.numfields - -ak.layout.Record.parameters -=========================== - -.. py:attribute:: ak.layout.Record.parameters diff --git a/docs-sphinx/ak.layout.RecordArray.rst b/docs-sphinx/ak.layout.RecordArray.rst deleted file mode 100644 index fcd3d8a1b0..0000000000 --- a/docs-sphinx/ak.layout.RecordArray.rst +++ /dev/null @@ -1,291 +0,0 @@ -ak.layout.RecordArray ---------------------- - -The RecordArray class represents an array of tuples or records, all with the -same type. Its ``contents`` is an ordered list of arrays. - - * If a ``recordlookup`` is absent, the data are tuples, indexed only by - their order. - * If a ``recordlookup`` is present, it is an ordered list of names with - the same length as the ``contents``, associating a field name to every - content. - -The length of the RecordArray, if not given, is the length of its shortest -content; all are aligned element-by-element. If a RecordArray has zero contents, -it may still represent a non-empty array. In that case, its length is specified -by a ``length`` parameter. - -RecordArrays correspond to Apache Arrow's `struct type `__. - -Below is a simplified implementation of a RecordArray class in pure Python -that exhaustively checks validity in its constructor (see -:doc:`_auto/ak.is_valid`) and can generate random valid arrays. The -``random_number()`` function returns a random float and the -``random_length(minlen)`` function returns a random int that is at least -``minlen``. The ``RawArray`` class represents simple, one-dimensional data. - -.. code-block:: python - - class RecordArray(Content): - def __init__(self, contents, recordlookup, length): - assert isinstance(contents, list) - assert isinstance(length, int) - for x in contents: - assert isinstance(x, Content) - assert len(x) >= length - assert recordlookup is None or isinstance(recordlookup, list) - if isinstance(recordlookup, list): - assert len(recordlookup) == len(contents) - for x in recordlookup: - assert isinstance(x, str) - self.contents = contents - self.recordlookup = recordlookup - self.length = length - - @staticmethod - def random(minlen, choices): - length = random_length(minlen) - contents = [] - for i in range(random.randint(0, 2)): - contents.append(random.choice(choices).random(length, choices)) - if random.randint(0, 1) == 0: - recordlookup = None - else: - recordlookup = ["x" + str(i) for i in range(len(contents))] - return RecordArray(contents, recordlookup, length) - - def __len__(self): - return self.length - - def __getitem__(self, where): - if isinstance(where, int): - assert 0 <= where < len(self) - record = [x[where] for x in self.contents] - if self.recordlookup is None: - return tuple(record) - else: - return dict(zip(self.recordlookup, record)) - elif isinstance(where, slice) and where.step is None: - if len(self.contents) == 0: - start = min(max(where.start, 0), self.length) - stop = min(max(where.stop, 0), self.length) - if stop < start: - stop = start - return RecordArray([], self.recordlookup, stop - start) - else: - return RecordArray([x[where] for x in self.contents], self.recordlookup, - where.stop - where.start) - elif isinstance(where, str): - if self.recordlookup is None: - try: - i = int(where) - except ValueError: - pass - else: - if i < len(self.contents): - return self.contents[i][0:len(self)] - else: - try: - i = self.recordlookup.index(where) - except ValueError: - pass - else: - return self.contents[i][0:len(self)] - raise ValueError("field " + repr(where) + " not found") - else: - raise AssertionError(where) - - def __repr__(self): - return ("RecordArray([" + ", ".join(repr(x) for x in self.contents) + "], " - + repr(self.recordlookup) + ", " + repr(self.length) + ")") - - def xml(self, indent="", pre="", post=""): - out = indent + pre + "\n" - if len(self.contents) == 0: - out += indent + " " + str(self.recordlookup is None) + "\n" - out += indent + " " + str(self.length) + "\n" - if self.recordlookup is None: - for i, content in enumerate(self.contents): - out += content.xml(indent + " ", "", - "\n") - else: - for i, (key, content) in enumerate(zip(self.recordlookup, self.contents)): - out += content.xml(indent + " ", "", "\n") - out += indent + "" + post - return out - -Here is an example: - -.. code-block:: python - - RecordArray([RawArray([1.8, 6.2, 2.3, 7.2, 8.6, 6.0, 0.1, 4.6, 7.4, 3.6, 8.6, 10.7]), - RawArray([2.9, -0.9, 2.6, 0.9, -0.8, 5.3, 4.7, 1.2, 3.3, 5.5])], - ['x0', 'x1'], - 10) - -.. code-block:: xml - - - 10 - - 1.8 6.2 2.3 7.2 8.6 6.0 0.1 4.6 7.4 3.6 8.6 10.7 - - - 2.9 -0.9 2.6 0.9 -0.8 5.3 4.7 1.2 3.3 5.5 - - - -which represents the following logical data. - -.. code-block:: python - - [{'x0': 1.8, 'x1': 2.9}, - {'x0': 6.2, 'x1': -0.9}, - {'x0': 2.3, 'x1': 2.6}, - {'x0': 7.2, 'x1': 0.9}, - {'x0': 8.6, 'x1': -0.8}, - {'x0': 6.0, 'x1': 5.3}, - {'x0': 0.1, 'x1': 4.7}, - {'x0': 4.6, 'x1': 1.2}, - {'x0': 7.4, 'x1': 3.3}, - {'x0': 3.6, 'x1': 5.5}] - -Here is an example without field names. - -.. code-block:: python - - RecordArray([RawArray([1.5, 1.7, 2.6, 5.4, 5.8, 2.6, 7.0, 3.5, 7.1, 6.9, 6.3, 5.3, 2.9, 3.6, - 3.7, 3.6, 0.8, 2.1, 0.4, -0.6, 5.1, 4.2, 9.5, 1.9, 8.4, 7.4, 6.5, 9.6, - 7.7, 4.0, 5.4, 2.5, 6.7, 3.6, 7.4, 1.5, 3.6, 2.3, 3.6, 2.4, 4.7, 4.0, - 6.0, 10.2, 4.7, 0.6]), - RawArray([6.5, 8.8, 2.4, 2.2, 5.0, 4.4, 7.7, 5.1, 6.2, 3.7, 6.7, 1.2])], - None, - 12) - -.. code-block:: xml - - - 12 - - 1.5 1.7 2.6 5.4 5.8 2.6 7.0 3.5 7.1 6.9 6.3 5.3 2.9 3.6 3.7 3.6 0.8 2.1 0.4 - -0.6 5.1 4.2 9.5 1.9 8.4 7.4 6.5 9.6 7.7 4.0 5.4 2.5 6.7 3.6 7.4 1.5 3.6 2.3 - 3.6 2.4 4.7 4.0 6.0 10.2 4.7 0.6 - - - 6.5 8.8 2.4 2.2 5.0 4.4 7.7 5.1 6.2 3.7 6.7 1.2 - - - -which represents the following logical data. - -.. code-block:: python - - [(1.5, 6.5), - (1.7, 8.8), - (2.6, 2.4), - (5.4, 2.2), - (5.8, 5.0), - (2.6, 4.4), - (7.0, 7.7), - (3.5, 5.1), - (7.1, 6.2), - (6.9, 3.7), - (6.3, 6.7), - (5.3, 1.2)] - -And here is an example of records with no ``contents``, but a non-zero ``length``. - -.. code-block:: python - - RecordArray([], [], 12) - -.. code-block:: xml - - - False - 12 - - -which represents the following block of logical data. - -.. code-block:: python - - [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}] - -In addition to the properties and methods described in :doc:`ak.layout.Content`, -a RecordArray has the following. - -ak.layout.RecordArray.__init__ -============================== - -.. py:method:: ak.layout.RecordArray.__init__(contents, keys=None, length=None, identities=None, parameters=None) - -ak.layout.RecordArray.contents -============================== - -.. py:attribute:: ak.layout.RecordArray.contents - -ak.layout.RecordArray.recordlookup -================================== - -.. py:attribute:: ak.layout.RecordArray.recordlookup - -ak.layout.RecordArray.istuple -============================= - -.. py:attribute:: ak.layout.RecordArray.istuple - -Returns True if ``recordlookup`` does not exist; False if it does. - -ak.layout.RecordArray.astuple -============================= - -.. py:attribute:: ak.layout.RecordArray.astuple - -Returns a RecordArray with the ``recordlookup`` removed. - -ak.layout.RecordArray.setitem_field -=================================== - -.. py:method:: ak.layout.RecordArray.setitem_field(where, what) - -Sets a field in-place. - -**Do not use this function.** It is deprecated. Use :doc:`_auto/ak.with_field` -instead. - -ak.layout.RecordArray.field -=========================== - -.. py:method:: ak.layout.RecordArray.field(fieldindex) - -Gets a field by index number. - -ak.layout.RecordArray.field -=========================== - -.. py:method:: ak.layout.RecordArray.field(key) - -Gets a field by str name. - -ak.layout.RecordArray.fields -============================ - -.. py:method:: ak.layout.RecordArray.fields() - -Returns a list of the fields themselves; equivalent to ``contents``. - -ak.layout.RecordArray.fielditems -================================ - -.. py:method:: ak.layout.RecordArray.fielditems() - -Returns a list of key-value pairs, where the values are ``contents``. - -ak.layout.RecordArray.simplify -============================== - -.. py:method:: ak.layout.RecordArray.simplify() - -Pass-through; returns the original array. diff --git a/docs-sphinx/ak.layout.RegularArray.rst b/docs-sphinx/ak.layout.RegularArray.rst deleted file mode 100644 index 20e073cfbd..0000000000 --- a/docs-sphinx/ak.layout.RegularArray.rst +++ /dev/null @@ -1,166 +0,0 @@ -ak.layout.RegularArray ----------------------- - -The RegularArray class describes lists that all have the same length, the single -integer ``size``. Its underlying ``content`` is a flattened view of the data; -that is, each list is not stored separately in memory, but is inferred as a -subinterval of the underlying data. - -If the ``content`` length is not an integer multiple of ``size``, then the length -of the RegularArray is truncated to the largest integer multiple. - -An extra field ``zeros_length`` is ignored unless the ``size`` is zero. This sets the -length of the RegularArray in only those cases, so that it is possible for an -array to contain a non-zero number of zero-length lists with regular type. - -A multidimensional :doc:`ak.layout.NumpyArray` is equivalent to a one-dimensional -:doc:`ak.layout.NumpyArray` nested within several RegularArrays, one for each -dimension. However, RegularArrays can be used to make lists of any other type. - -RegularArray corresponds to an Apache Arrow `Tensor `__. - -Below is a simplified implementation of a RegularArray class in pure Python -that exhaustively checks validity in its constructor (see -:doc:`_auto/ak.is_valid`) and can generate random valid arrays. The -``random_number()`` function returns a random float and the -``random_length(minlen)`` function returns a random int that is at least -``minlen``. The ``RawArray`` class represents simple, one-dimensional data. - -.. code-block:: python - - class RegularArray(Content): - def __init__(self, content, size, zeros_length=0): - assert isinstance(content, Content) - assert isinstance(size, int) - assert isinstance(zeros_length, int) - assert size >= 0 - if size != 0: - length = len(content) // size # floor division - else: - assert zeros_length >= 0 - length = zeros_length - self.content = content - self.size = size - self.length = length - - @staticmethod - def random(minlen, choices): - size = random_length(0, 5) - zeros_length = random_length(0, 5) - content = random.choice(choices).random(random_length(minlen) * size, choices) - return RegularArray(content, size, zeros_length) - - def __len__(self): - return self.length - - def __getitem__(self, where): - if isinstance(where, int): - assert 0 <= where < len(self) - return self.content[(where) * self.size:(where + 1) * self.size] - elif isinstance(where, slice) and where.step is None: - start = where.start * self.size - stop = where.stop * self.size - zeros_length = where.stop - where.start - return RegularArray(self.content[start:stop], self.size, zeros_length) - elif isinstance(where, str): - return RegularArray(self.content[where], self.size, self.length) - else: - raise AssertionError(where) - - def __repr__(self): - if self.size == 0: - zeros_length = ", " + repr(self.length) - else: - zeros_length = "" - return "RegularArray(" + repr(self.content) + ", " + repr(self.size) + zeros_length + ")" - - def xml(self, indent="", pre="", post=""): - out = indent + pre + "\n" - out += self.content.xml(indent + " ", "", "\n") - out += indent + " " + str(self.size) + "\n" - if size == 0: - out += indent + " " + str(self.length) + "\n" - out += indent + "" + post - return out - -Here is an example: - -.. code-block:: python - - RegularArray(RawArray([7.4, -0.0, 6.6, 6.6, 5.2, 4.6, 9.6, 4.2, 2.3, 6.5, 4.2, 1.3, 2.2, 4.1, - 1.9, 3.9, 2.3, 2.3, 0.7, 6.9, 1.4, 9.6, 11.8, 6.8, 8.2, 10.5, 8.2, - 7.5, 6.3, 5.4, 0.5, 1.0, 5.5, 4.1, 5.9, 7.9, 6.7, 7.3, 5.6, 5.5, 2.2, - 2.2, -0.3, 3.5, 11.2, 13.4, 6.7, -1.0, 6.4, 1.3, 6.8, 5.1, 3.2, 9.5, - 2.8]), - 5) - -.. code-block:: xml - - - - 7.4 -0.0 6.6 6.6 5.2 4.6 9.6 4.2 2.3 6.5 4.2 1.3 2.2 4.1 1.9 3.9 2.3 2.3 0.7 6.9 - 1.4 9.6 11.8 6.8 8.2 10.5 8.2 7.5 6.3 5.4 0.5 1.0 5.5 4.1 5.9 7.9 6.7 7.3 5.6 - 5.5 2.2 2.2 -0.3 3.5 11.2 13.4 6.7 -1.0 6.4 1.3 6.8 5.1 3.2 9.5 2.8 - - 5 - - -which represents the following logical data. - -.. code-block:: python - - [[7.4, -0.0, 6.6, 6.6, 5.2], - [4.6, 9.6, 4.2, 2.3, 6.5], - [4.2, 1.3, 2.2, 4.1, 1.9], - [3.9, 2.3, 2.3, 0.7, 6.9], - [1.4, 9.6, 11.8, 6.8, 8.2], - [10.5, 8.2, 7.5, 6.3, 5.4], - [0.5, 1.0, 5.5, 4.1, 5.9], - [7.9, 6.7, 7.3, 5.6, 5.5], - [2.2, 2.2, -0.3, 3.5, 11.2], - [13.4, 6.7, -1.0, 6.4, 1.3], - [6.8, 5.1, 3.2, 9.5, 2.8]] - -In addition to the properties and methods described in :doc:`ak.layout.Content`, -a RegularArray has the following. - -ak.layout.RegularArray.__init__ -=============================== - -.. py:method:: ak.layout.RegularArray.__init__(content, size, identities=None, parameters=None) - -ak.layout.RegularArray.content -============================== - -.. py:attribute:: ak.layout.RegularArray.content - -ak.layout.RegularArray.size -=========================== - -.. py:attribute:: ak.layout.RegularArray.size - -ak.layout.RegularArray.compact_offsets64 -======================================== - -.. py:method:: ak.layout.RegularArray.compact_offsets64(start_at_zero=True) - -Returns a 64-bit :doc:`ak.layout.Index` of ``offsets`` by prefix summing -in steps of ``size``. - -ak.layout.RegularArray.broadcast_tooffsets64 -============================================ - -.. py:method:: ak.layout.RegularArray.broadcast_tooffsets64(offsets) - -Shifts ``contents`` to match a given set of ``offsets`` (if possible) and -returns a :doc:`ak.layout.ListOffsetArray` with the results. This is used in -broadcasting because a set of :doc:`ak.types.ListType` and :doc:`ak.types.RegularType` -arrays have to be reordered to a common ``offsets`` before they can be directly -operated upon. - -ak.layout.RegularArray.simplify -=============================== - -.. py:method:: ak.layout.RegularArray.simplify() - -Pass-through; returns the original array. diff --git a/docs-sphinx/ak.layout.SliceGenerator.rst b/docs-sphinx/ak.layout.SliceGenerator.rst deleted file mode 100644 index 83e3cd8f95..0000000000 --- a/docs-sphinx/ak.layout.SliceGenerator.rst +++ /dev/null @@ -1,54 +0,0 @@ -ak.layout.SliceGenerator ------------------------- - -An SliceGenerator takes a :doc:`ak.layout.Content` array and a -slice (any Python object that can be used in an array's -``__getitem__``), and optionally -an expected :doc:`ak.forms.Form` and/or ``length``. - -It can only be used in a :doc:`ak.layout.VirtualArray` to generate -arrays. When executed, it applies the slice to its -:doc:`ak.layout.Content`. - -If a :doc:`ak.forms.Form` is given, there are fewer -circumstances in which the generator would need to be executed, -but it is an error if the generated array does not match this -:doc:`ak.forms.Form`. - -If a ``length`` is given (as a non-negative -int), there are fewer circumstances in which the generator would -need to be executed, but it is an error if the generated array does -not match this ``length``. - -ak.layout.SliceGenerator.__init__ -================================= - -.. py:method:: ak.layout.SliceGenerator.__init__(content, slice, form=None, length=None) - -ak.layout.SliceGenerator.content -================================ - -.. py:attribute:: ak.layout.SliceGenerator.content - -ak.layout.SliceGenerator.form -============================= - -.. py:attribute:: ak.layout.SliceGenerator.form - -ak.layout.SliceGenerator.length -=============================== - -.. py:attribute:: ak.layout.SliceGenerator.length - -ak.layout.SliceGenerator.__call__ -================================= - -.. py:method:: ak.layout.SliceGenerator.__call__() - -Generates the array and checks it against the :doc:`ak.forms.Form` and -``length``, if given. - -ak.layout.SliceGenerator.__repr__ -================================= - -.. py:method:: ak.layout.SliceGenerator.__repr__() diff --git a/docs-sphinx/ak.layout.UnionArray.rst b/docs-sphinx/ak.layout.UnionArray.rst deleted file mode 100644 index 5489df0895..0000000000 --- a/docs-sphinx/ak.layout.UnionArray.rst +++ /dev/null @@ -1,239 +0,0 @@ -ak.layout.UnionArray --------------------- - -The UnionArray concept is implemented in 3 specialized classes: - - * ``ak.layout.UnionArray8_64``: ``tags`` values are 8-bit signed integers - and ``index`` values are 64-bit signed integers. - * ``ak.layout.UnionArray8_32``: ``tags`` values are 8-bit signed integers - and ``index`` values are 32-bit signed integers. - * ``ak.layout.UnionArray8_U32``: ``tags`` values are 8-bit signed integers - and ``index`` values are 32-bit unsigned integers. - -The UnionArray class represents data drawn from an ordered list of ``contents``, -which can have different types, using - - * ``tags``: array of integers indicating which content each array element - draws from. - * ``index``: array of integers indicating which element from the content - to draw from. - -UnionArrays correspond to Apache Arrow's -`dense union type `__. -Awkward Array has no direct equivalent for Apache Arrow's -`sparse union type `__, -but an appropriate index may be generated with -`sparse_index <#ak.layout.UnionArray.sparse_index>`_. - -Below is a simplified implementation of a UnionArray class in pure Python -that exhaustively checks validity in its constructor (see -:doc:`_auto/ak.is_valid`) and can generate random valid arrays. The -``random_number()`` function returns a random float and the -``random_length(minlen)`` function returns a random int that is at least -``minlen``. The ``RawArray`` class represents simple, one-dimensional data. - -.. code-block:: python - - class UnionArray(Content): - def __init__(self, tags, index, contents): - assert isinstance(tags, list) - assert isinstance(index, list) - assert isinstance(contents, list) - assert len(index) >= len(tags) # usually equal - for x in tags: - assert isinstance(x, int) - assert 0 <= x < len(contents) - for i, x in enumerate(tags): - assert isinstance(index[i], numbers.Integral) - assert 0 <= index[i] < len(contents[x]) - self.tags = tags - self.index = index - self.contents = contents - - @staticmethod - def random(minlen, choices): - contents = [] - unshuffled_tags = [] - unshuffled_index = [] - for i in range(random.randint(1, 3)): - if minlen == 0: - contents.append(random.choice(choices).random(0, choices)) - else: - contents.append(random.choice(choices).random(1, choices)) - if len(contents[-1]) != 0: - thisindex = [random.randint(0, len(contents[-1]) - 1) - for i in range(random_length(minlen))] - unshuffled_tags.extend([i] * len(thisindex)) - unshuffled_index.extend(thisindex) - permutation = list(range(len(unshuffled_tags))) - random.shuffle(permutation) - tags = [unshuffled_tags[i] for i in permutation] - index = [unshuffled_index[i] for i in permutation] - return UnionArray(tags, index, contents) - - def __len__(self): - return len(self.tags) - - def __getitem__(self, where): - if isinstance(where, int): - assert 0 <= where < len(self) - return self.contents[self.tags[where]][self.index[where]] - elif isinstance(where, slice) and where.step is None: - return UnionArray(self.tags[where], self.index[where], self.contents) - elif isinstance(where, str): - return UnionArray(self.tags, self.index, [x[where] for x in self.contents]) - else: - raise AssertionError(where) - - def __repr__(self): - return ("UnionArray(" + repr(self.tags) + ", " + repr(self.index) - + ", [" + ", ".join(repr(x) for x in self.contents) + "])") - - def xml(self, indent="", pre="", post=""): - out = indent + pre + "\n" - out += indent + " " + " ".join(str(x) for x in self.tags) + "\n" - out += indent + " " + " ".join(str(x) for x in self.index) + "\n" - for i, content in enumerate(self.contents): - out += content.xml(indent + " ", "", - "\n") - out += indent + "" + post - return out - -Here is an example: - -.. code-block:: python - - UnionArray([0, 1, 2, 0, 2, 2, 1], - [0, 16, 9, 0, 10, 0, 13], - [ListOffsetArray([10, 21, 22, 50, 54, 55, 59, 89, 92, 101, 111, 119, 120, 131, - 138, 158, 165, 171, 173], - RawArray([0.5, 4.8, 8.6, -1.3, 4.0, 2.5, 5.0, 3.3, 5.0, 1.5, 9.3, 2.5, 5.4, 2.1, - 7.1, 5.3, 10.8, -2.1, 6.4, 7.6, 5.6, 6.2, 4.9, 8.0, 6.2, 4.1, 6.6, - -1.3, 4.0, 3.8, 0.3, 5.7, 9.9, 5.6, 9.9, 9.4, 1.4, 3.9, 6.2, 6.3, 3.4, - 6.2, 10.1, 3.7, 8.3, -0.6, 2.8, 9.7, 3.3, 6.5, 6.5, 2.1, 4.9, 5.8, 1.0, - 6.8, 2.7, 3.2, 6.0, 6.4, 1.9, 8.1, 5.5, 6.3, 4.8, 5.5, 1.1, 0.1, 4.0, - 1.8, 10.0, 3.8, 3.9, 2.5, 1.8, 6.0, 5.2, 6.0, 9.6, 11.7, 6.4, 7.9, 4.3, - 5.3, 4.4, 7.0, 8.6, 6.1, 11.2, 4.7, 5.9, 9.3, 7.0, 5.1, 8.0, 6.9, 8.4, - 3.7, 5.8, 4.8, 1.6, -1.5, -0.9, 6.0, 2.8, -0.2, 8.1, 2.9, 7.6, 5.7, - 8.3, 8.1, 5.5, 7.1, 6.5, 0.8, 4.3, 1.9, 0.2, 7.7, 5.6, -0.5, 2.1, 6.1, - 7.1, 4.5, 4.5, 4.2, 9.1, 5.7, 2.2, 9.0, 2.6, 3.8, 7.2, 3.2, 5.1, 6.6, - 3.0, 6.6, 6.3, 4.8, 2.6, 3.7, 7.0, 5.2, 1.8, 4.2, 5.9, 2.2, 7.1, 6.1, - 1.8, 4.2, 3.6, 3.0, 5.7, 2.1, 7.7, 1.5, 3.8, 6.4, 5.1, 7.4, 2.8, 3.3, - 10.1, 8.0, 2.3, 4.5, 5.9, 6.0, 4.2, 2.6, 1.1, 2.5, 12.2])), - RawArray([3.8, 5.3, 2.2, 4.9, 6.9, 5.6, -0.6, 3.2, 2.5, 2.6, 3.6, 6.9, 7.7, 4.7, - 4.0, 5.1, 0.5, 4.0]), - RawArray([6.2, 7.6, 7.6, -1.2, 5.0, 6.3, 6.8, 6.0, 3.2, 5.6, 2.3, 9.4, 1.6, 5.2, - 6.1, 1.2])]) - -.. code-block:: xml - - - 0 1 2 0 2 2 1 - 0 16 9 0 10 0 13 - - 10 21 22 50 54 55 59 89 92 101 111 119 120 131 138 158 165 171 173 - - 0.5 4.8 8.6 -1.3 4.0 2.5 5.0 3.3 5.0 1.5 9.3 2.5 5.4 2.1 7.1 5.3 10.8 -2.1 - 6.4 7.6 5.6 6.2 4.9 8.0 6.2 4.1 6.6 -1.3 4.0 3.8 0.3 5.7 9.9 5.6 9.9 9.4 1.4 - 3.9 6.2 6.3 3.4 6.2 10.1 3.7 8.3 -0.6 2.8 9.7 3.3 6.5 6.5 2.1 4.9 5.8 1.0 - 6.8 2.7 3.2 6.0 6.4 1.9 8.1 5.5 6.3 4.8 5.5 1.1 0.1 4.0 1.8 10.0 3.8 3.9 2.5 - 1.8 6.0 5.2 6.0 9.6 11.7 6.4 7.9 4.3 5.3 4.4 7.0 8.6 6.1 11.2 4.7 5.9 9.3 - 7.0 5.1 8.0 6.9 8.4 3.7 5.8 4.8 1.6 -1.5 -0.9 6.0 2.8 -0.2 8.1 2.9 7.6 5.7 - 8.3 8.1 5.5 7.1 6.5 0.8 4.3 1.9 0.2 7.7 5.6 -0.5 2.1 6.1 7.1 4.5 4.5 4.2 9.1 - 5.7 2.2 9.0 2.6 3.8 7.2 3.2 5.1 6.6 3.0 6.6 6.3 4.8 2.6 3.7 7.0 5.2 1.8 4.2 - 5.9 2.2 7.1 6.1 1.8 4.2 3.6 3.0 5.7 2.1 7.7 1.5 3.8 6.4 5.1 7.4 2.8 3.3 10.1 - 8.0 2.3 4.5 5.9 6.0 4.2 2.6 1.1 2.5 12.2 - - - - 3.8 5.3 2.2 4.9 6.9 5.6 -0.6 3.2 2.5 2.6 3.6 6.9 7.7 4.7 4.0 5.1 0.5 4.0 - - - 6.2 7.6 7.6 -1.2 5.0 6.3 6.8 6.0 3.2 5.6 2.3 9.4 1.6 5.2 6.1 1.2 - - - -which represents the following logical data. - -.. code-block:: python - - [[9.3, 2.5, 5.4, 2.1, 7.1, 5.3, 10.8, -2.1, 6.4, 7.6, 5.6], - 0.5, - 5.6, - [9.3, 2.5, 5.4, 2.1, 7.1, 5.3, 10.8, -2.1, 6.4, 7.6, 5.6], - 2.3, - 6.2, - 4.7] - -In addition to the properties and methods described in :doc:`ak.layout.Content`, -a UnionArray has the following. - -ak.layout.UnionArray.__init__ -============================= - -.. py:method:: ak.layout.UnionArray.__init__(tags, index, contents, identities=None, parameters=None) - -ak.layout.UnionArray.sparse_index -================================= - -.. py:method:: ak.layout.UnionArray.sparse_index(length) - -ak.layout.UnionArray.regular_index -================================== - -.. py:method:: ak.layout.UnionArray.regular_index(tags) - -ak.layout.UnionArray.tags -========================= - -.. py:attribute:: ak.layout.UnionArray.tags - -ak.layout.UnionArray.index -========================== - -.. py:attribute:: ak.layout.UnionArray.index - -ak.layout.UnionArray.contents -============================= - -.. py:attribute:: ak.layout.UnionArray.contents - -ak.layout.UnionArray.numcontents -================================ - -.. py:attribute:: ak.layout.UnionArray.numcontents - -Returns the number of ``contents``. - -ak.layout.UnionArray.content -============================ - -.. py:method:: ak.layout.UnionArray.content(i) - -Returns one of the ``contents`` by index. - -ak.layout.UnionArray.project -============================ - -.. py:method:: ak.layout.UnionArray.project(i) - -Returns an array of only one of the possibilities, like selecting - -.. code-block:: python - - union_array[union_array.tags == i] - -Note that this is different from the ``content(i)`` method because this reindexes -to present the result in its logical order, not its physical order. - -ak.layout.UnionArray.simplify -============================= - -.. py:method:: ak.layout.UnionArray.simplify(mergebool=False) - -If any of the ``contents`` have :doc:`ak.types.UnionType` and/or any -of the ``contents`` are -`ak.layout.Content.mergeable `__, -they are combined to return the simplest possible node structure. - -This method only operates one level deep. diff --git a/docs-sphinx/ak.layout.UnmaskedArray.rst b/docs-sphinx/ak.layout.UnmaskedArray.rst deleted file mode 100644 index efe5a51e31..0000000000 --- a/docs-sphinx/ak.layout.UnmaskedArray.rst +++ /dev/null @@ -1,118 +0,0 @@ -ak.layout.UnmaskedArray ------------------------ - -UnmaskedArray implements an :doc:`ak.types.OptionType` for which the values are -never, in fact, missing. It exists to satisfy systems that formally require this -high-level type without the overhead of generating an array of all True or all -False values. - -This is like NumPy's -`masked arrays `__ -with ``mask=None``. - -It is also like Apache Arrow's -`validity bitmaps `__ -because the bitmap can be omitted when all values are valid. - -Below is a simplified implementation of an UnmaskedArray class in pure Python -that exhaustively checks validity in its constructor (see -:doc:`_auto/ak.is_valid`) and can generate random valid arrays. The -``random_number()`` function returns a random float and the -``random_length(minlen)`` function returns a random int that is at least -``minlen``. The ``RawArray`` class represents simple, one-dimensional data. - -.. code-block:: python - - class UnmaskedArray(Content): - def __init__(self, content): - assert isinstance(content, Content) - self.content = content - - @staticmethod - def random(minlen, choices): - content = random.choice(choices).random(minlen, choices) - return UnmaskedArray(content) - - def __len__(self): - return len(self.content) - - def __getitem__(self, where): - if isinstance(where, int): - return self.content[where] - else: - return UnmaskedArray(self.content[where]) - - def __repr__(self): - return "UnmaskedArray(" + repr(self.content) + ")" - - def xml(self, indent="", pre="", post=""): - out = indent + pre + "\n" - out += self.content.xml(indent + " ", "", "\n") - out += indent + "\n" - return out - -Here is an example: - -.. code-block:: python - - UnmaskedArray(RawArray([6.0, 4.6, 4.2, 2.2, 2.4, 2.0, 8.3, 5.8, 6.8, 5.3, 0.4, 7.4, 0.9, 3.4, - 7.6, 3.9, 8.9, 4.2, 4.0, 5.3, 1.9, 8.8])) - -.. code-block:: xml - - - - 6.0 4.6 4.2 2.2 2.4 2.0 8.3 5.8 6.8 5.3 0.4 7.4 0.9 3.4 7.6 3.9 8.9 4.2 4.0 5.3 - 1.9 8.8 - - - -which represents the following logical data. - -.. code-block:: python - - [6.0, 4.6, 4.2, 2.2, 2.4, 2.0, 8.3, 5.8, 6.8, 5.3, 0.4, 7.4, 0.9, 3.4, 7.6, 3.9, 8.9, 4.2, - 4.0, 5.3, 1.9, 8.8] - -In addition to the properties and methods described in :doc:`ak.layout.Content`, -a UnmaskedArray has the following. - -ak.layout.UnmaskedArray.__init__ -================================ - -.. py:method:: ak.layout.UnmaskedArray.__init__(content, identities=None, parameters=None) - -ak.layout.UnmaskedArray.content -=============================== - -.. py:attribute:: ak.layout.UnmaskedArray.content - -ak.layout.UnmaskedArray.project -=============================== - -.. py:method:: ak.layout.UnmaskedArray.project(mask=None) - -Returns a non-:doc:`ak.types.OptionType` array containing only the valid elements. -If ``mask`` is a signed 8-bit :doc:`ak.layout.Index` in which ``0`` means valid -and ``1`` means missing, this ``mask`` is used to select the data. Otherwise, ``project`` -has no effect. - -ak.layout.UnmaskedArray.bytemask -================================ - -.. py:method:: ak.layout.UnmaskedArray.bytemask() - -Returns an array of 8-bit values in which ``0`` means valid and ``1`` means missing. - -Since this array is unmasked, the output is all ``0``. - -ak.layout.UnmaskedArray.simplify -================================ - -.. py:method:: ak.layout.UnmaskedArray.simplify() - -Combines this node with its ``content`` if the ``content`` also has -:doc:`ak.types.OptionType`; otherwise, this is a pass-through. -In all cases, the output has the same logical meaning as the input. - -This method only operates one level deep. diff --git a/docs-sphinx/ak.layout.VirtualArray.rst b/docs-sphinx/ak.layout.VirtualArray.rst deleted file mode 100644 index eb98277453..0000000000 --- a/docs-sphinx/ak.layout.VirtualArray.rst +++ /dev/null @@ -1,90 +0,0 @@ -ak.layout.VirtualArray ----------------------- - -A VirtualArray is an array that may be generated later. - -It requires a :doc:`ak.layout.ArrayGenerator` or :doc:`ak.layout.SliceGenerator`, -a function with arguments that generates and checks the generated array against -an expected :doc:`ak.forms.Form`. - -It can optionally take a :doc:`ak.layout.ArrayCache`, which wraps a MutableMapping -with ``__getitem__`` and ``__setitem__`` methods to store arrays. Without this -cache, the VirtualArray would call its generator every time an array is needed. -With the cache, it first checks to see if the array is already in the cache -(though it is assumed that arrays might get evicted from this cache at any time). - -It can optionally be given a ``cache_key`` (str), which is the string it passes -to the ``__getitem__`` of its :doc:`ak.layout.ArrayCache`. This key ought to be -unique in the cache. If a ``cache_key`` is not provided, a string will be generated -that is unique in the currently running process. - -VirtualArray has no Apache Arrow equivalent. - -Below is a simplified implementation of a VirtualArray class in pure Python -that. - -.. code-block:: python - - class VirtualArray(Content): - def __init__(self, generator, cache=None, cache_key=None): - assert callable(generator) - if cache is not None: - assert isinstance(cache, collections.abc.MutableMapping) - if cache_key is not None: - assert isinstance(cache_key, str) - self.generator = generator - self.cache = cache - self.cache_key = cache_key - - @staticmethod - def random(minlen, choices): - raise NotImplementedError("FIXME!") - - def __len__(self): - raise NotImplementedError("FIXME!") - - def __getitem__(self, where): - raise NotImplementedError("FIXME!") - - def __repr__(self): - raise NotImplementedError("FIXME!") - - def xml(self, indent="", pre="", post=""): - raise NotImplementedError("FIXME!") - -In addition to the properties and methods described in :doc:`ak.layout.Content`, -a VirtualArray has the following. - -ak.layout.VirtualArray.__init__ -=============================== - -.. py:method:: ak.layout.VirtualArray.__init__(generator, cache=None, cache_key=None, identities=None, parameters=None) - -ak.layout.VirtualArray.generator -================================ - -.. py:attribute:: ak.layout.VirtualArray.generator - -ak.layout.VirtualArray.cache -============================ - -.. py:attribute:: ak.layout.VirtualArray.cache - -ak.layout.VirtualArray.cache_key -================================ - -.. py:attribute:: ak.layout.VirtualArray.cache_key - -ak.layout.VirtualArray.peek_array -================================= - -.. py:attribute:: ak.layout.VirtualArray.peek_array - -Does not materialize the array; might return None. - -ak.layout.VirtualArray.array -============================ - -.. py:attribute:: ak.layout.VirtualArray.array - -Materializes the array if necessary; never returns None. diff --git a/docs-sphinx/ak.pandas.register.rst b/docs-sphinx/ak.pandas.register.rst deleted file mode 100644 index 08f34e16eb..0000000000 --- a/docs-sphinx/ak.pandas.register.rst +++ /dev/null @@ -1,12 +0,0 @@ -ak.pandas.register ------------------- - -.. py:function:: ak.pandas.register() - -Registers :doc:`_auto/ak.Array` as a column type for `Pandas `__ -DataFrames and Series. - -Users should not need to call this function because it is invoked whenever a Pandas-specific -method on :doc:`_auto/ak.Array` is called. - -(But if Pandas doesn't recognize an :doc:`_auto/ak.Array`, try calling this function anyway!) diff --git a/docs-sphinx/ak.types.ArrayType.rst b/docs-sphinx/ak.types.ArrayType.rst deleted file mode 100644 index 7ecaff0707..0000000000 --- a/docs-sphinx/ak.types.ArrayType.rst +++ /dev/null @@ -1,45 +0,0 @@ -ak.types.ArrayType ------------------- - -Type of a high-level :doc:`_auto/ak.Array`, which includes the length of the -array. - -Consider, for instance the distinction between this :doc:`_auto/ak.Array` and -the :doc:`ak.layout.Content` in its -`ak.Array.layout <_auto/ak.Array.html#ak-array-layout>`_: - -.. code-block:: python - - >>> array = ak.Array([[1.1, 2.2, 3.3], [], [4.4, 5.5]]) - >>> ak.type(array) - 3 * var * float64 - >>> ak.type(array.layout) - var * float64 - -This distinction is between an :doc:`ak.types.ArrayType` and the -:doc:`ak.types.ListType` it contains. - -.. code-block:: python - - >>> type(ak.type(array)) - - >>> type(ak.type(array.layout)) - - -In addition to the properties and methods described in :doc:`ak.types.Type`, -an ArrayType has the following. - -ak.types.ArrayType.__init__ -=========================== - -.. py:method:: ak.types.ArrayType.__init__(type, length, parameters=None, typestr=None) - -ak.types.ArrayType.type -======================= - -.. py:attribute:: ak.types.ArrayType.type - -ak.types.ArrayType.length -========================= - -.. py:attribute:: ak.types.ArrayType.length diff --git a/docs-sphinx/ak.types.ListType.rst b/docs-sphinx/ak.types.ListType.rst deleted file mode 100644 index 16bb0b3a73..0000000000 --- a/docs-sphinx/ak.types.ListType.rst +++ /dev/null @@ -1,17 +0,0 @@ -ak.types.ListType ------------------ - -The type of a :doc:`ak.layout.ListArray` or :doc:`ak.layout.ListOffsetArray`. - -In addition to the properties and methods described in :doc:`ak.types.Type`, -a ListType has the following. - -ak.types.ListType.__init__ -========================== - -.. py:method:: ak.types.ListType.__init__(type, parameters=None, typestr=None) - -ak.types.ListType.type -====================== - -.. py:attribute:: ak.types.ListType.type diff --git a/docs-sphinx/ak.types.OptionType.rst b/docs-sphinx/ak.types.OptionType.rst deleted file mode 100644 index 97cd80eb67..0000000000 --- a/docs-sphinx/ak.types.OptionType.rst +++ /dev/null @@ -1,19 +0,0 @@ -ak.types.OptionType -------------------- - -The type of an :doc:`ak.layout.IndexedOptionArray`, -:doc:`ak.layout.ByteMaskedArray`, :doc:`ak.layout.BitMaskedArray`, or -:doc:`ak.layout.UnmaskedArray`. - -In addition to the properties and methods described in :doc:`ak.types.Type`, -an OptionType has the following. - -ak.types.OptionType.__init__ -============================ - -.. py:method:: ak.types.OptionType.__init__(type, parameters=None, typestr=None) - -ak.types.OptionType.type -======================== - -.. py:attribute:: ak.types.OptionType.type diff --git a/docs-sphinx/ak.types.PrimitiveType.rst b/docs-sphinx/ak.types.PrimitiveType.rst deleted file mode 100644 index 98a45a29d3..0000000000 --- a/docs-sphinx/ak.types.PrimitiveType.rst +++ /dev/null @@ -1,18 +0,0 @@ -ak.types.PrimitiveType ----------------------- - -The type of some :doc:`ak.layout.NumpyArray` nodes, if its ``format`` is -recognized. - -In addition to the properties and methods described in :doc:`ak.types.Type`, -a PrimitiveType has the following. - -ak.types.PrimitiveType.__init__ -=============================== - -.. py:method:: ak.types.PrimitiveType.__init__(dtype, parameters=None, typestr=None) - -ak.types.PrimitiveType.dtype -============================ - -.. py:attribute:: ak.types.PrimitiveType.dtype diff --git a/docs-sphinx/ak.types.RecordType.rst b/docs-sphinx/ak.types.RecordType.rst deleted file mode 100644 index 5188662886..0000000000 --- a/docs-sphinx/ak.types.RecordType.rst +++ /dev/null @@ -1,47 +0,0 @@ -ak.types.RecordType -------------------- - -The type of a :doc:`ak.layout.RecordArray`. - -In addition to the properties and methods described in :doc:`ak.types.Type`, -a RecordType has the following. - -ak.types.RecordType.__init__ -============================ - -.. py:method:: ak.types.RecordType.__init__(types, keys=None, parameters=None, typestr=None) - -ak.types.RecordType.types -========================= - -.. py:attribute:: ak.types.RecordType.types - -ak.types.RecordType.__getitem__ -=============================== - -.. py:method:: ak.types.RecordType.__getitem__(where) - -ak.types.RecordType.field -========================= - -.. py:method:: ak.types.RecordType.field(fieldindex) - -ak.types.RecordType.field -========================= - -.. py:method:: ak.types.RecordType.field(key) - -ak.types.RecordType.fielditems -============================== - -.. py:method:: ak.types.RecordType.fielditems() - -ak.types.RecordType.fields -========================== - -.. py:method:: ak.types.RecordType.fields() - -ak.types.RecordType.istuple -=========================== - -.. py:attribute:: ak.types.RecordType.istuple diff --git a/docs-sphinx/ak.types.RegularType.rst b/docs-sphinx/ak.types.RegularType.rst deleted file mode 100644 index a4ecefa46d..0000000000 --- a/docs-sphinx/ak.types.RegularType.rst +++ /dev/null @@ -1,22 +0,0 @@ -ak.types.RegularType --------------------- - -The type of a :doc:`ak.layout.RegularArray`. - -In addition to the properties and methods described in :doc:`ak.types.Type`, -a RegularType has the following. - -ak.types.RegularType.__init__ -============================= - -.. py:method:: ak.types.RegularType.__init__(type, size, parameters=None, typestr=None) - -ak.types.RegularType.type -========================= - -.. py:attribute:: ak.types.RegularType.type - -ak.types.RegularType.size -========================= - -.. py:attribute:: ak.types.RegularType.size diff --git a/docs-sphinx/ak.types.Type.rst b/docs-sphinx/ak.types.Type.rst deleted file mode 100644 index 7b91fe93ea..0000000000 --- a/docs-sphinx/ak.types.Type.rst +++ /dev/null @@ -1,136 +0,0 @@ -ak.types.Type -------------- - -Superclass of type nodes that describe a high-level data type (see -:doc:`_auto/ak.type` and -`ak.Array.layout <_auto/ak.Array.html#ak-array-layout>`_). - -Types are rendered as `Datashape `__ strings, -whenever possible. In some cases, they have more information than this -specification can express, so we extend the Datashape language in natural ways. - -The type subclasses are listed below. - - * :doc:`ak.types.ArrayType`: type of a high-level :doc:`_auto/ak.Array`, - which includes the length of the array (and hence is not composable with - other types). - * :doc:`ak.types.UnknownType`: a type that is not known, for example in - :doc:`ak.layout.EmptyArray`. - * :doc:`ak.types.PrimitiveType`: numbers and booleans. - * :doc:`ak.types.RegularType`: nested lists, each with the same length. - * :doc:`ak.types.ListType`: nested lists with unconstrained lengths. - * :doc:`ak.types.RecordType`: records or tuples. - * :doc:`ak.types.OptionType`: data that might be missing (None in Python). - * :doc:`ak.types.UnionType`: heterogeneous data; one of several types. - -All :doc:`ak.types.Type` instances have the following properties and methods -in common. - -ak.types.Type.__eq__ -==================== - -.. py:method:: ak.types.Type.__eq__(other) - -True if two types are equal; False otherwise. - -ak.types.Type.__ne__ -==================== - -.. py:method:: ak.types.Type.__ne__() - -True if two types are not equal; False otherwise. - -ak.types.Type.__repr__ -====================== - -.. py:method:: ak.types.Type.__repr__() - -String representation of the type, mostly following the -`Datashape `__ grammar. - -ak.types.Type.__getstate__ -========================== - -.. py:method:: ak.types.Type.__getstate__() - -Types can be pickled. - -ak.types.Type.__setstate__ -========================== - -.. py:method:: ak.types.Type.__setstate__(arg0) - -Types can be pickled. - -ak.types.Type.empty -=================== - -.. py:method:: ak.types.Type.empty() - -Creates an empty :doc:`ak.layout.Content` array with this type. - -ak.types.Type.fieldindex -======================== - -.. py:method:: ak.types.Type.fieldindex(key) - -Returns the index position of a ``key`` if the type contains -:doc:`ak.types.RecordType` and ``key`` is in the record. - -ak.types.Type.haskey -==================== - -.. py:method:: ak.types.Type.haskey(key) - -Returns True if the type contains :doc:`ak.types.RecordType` and ``key`` is -in the record; False otherwise. - -ak.types.Type.key -================= - -.. py:method:: ak.types.Type.key(fieldindex) - -Returns the ``key`` name at a given index position in the record if the -type contains :doc:`ak.types.RecordType` with more than ``fieldindex`` -fields. - -ak.types.Type.keys -================== - -.. py:method:: ak.types.Type.keys() - -Returns a list of keys in the record if the type contains -:doc:`ak.types.RecordType`. - -ak.types.Type.setparameter -========================== - -.. py:method:: ak.types.Type.setparameter(key, value) - -Sets a parameter. - -**Do not use this method!** Mutable parameters are deprecated. - -ak.types.Type.numfields -======================= - -.. py:attribute:: ak.types.Type.numfields - -Returns the number of fields in the record if this type contains a -:doc:`ak.types.RecordType`. - -ak.types.Type.parameters -======================== - -.. py:attribute:: ak.types.Type.parameters - -Returns the parameters associated with this type. - -ak.types.Type.typestr -===================== - -.. py:attribute:: ak.types.Type.typestr - -Returns the custom type string if overridden with :doc:`ak.behavior`. - -See `Custom type names `_. diff --git a/docs-sphinx/ak.types.UnionType.rst b/docs-sphinx/ak.types.UnionType.rst deleted file mode 100644 index def88884cc..0000000000 --- a/docs-sphinx/ak.types.UnionType.rst +++ /dev/null @@ -1,32 +0,0 @@ -ak.types.UnionType ------------------- - -The type of a :doc:`ak.layout.UnionArray`. - -In addition to the properties and methods described in :doc:`ak.types.Type`, -a UnionType has the following. - -ak.types.UnionType.__init__ -=========================== - -.. py:method:: ak.types.UnionType.__init__(types, parameters=None, typestr=None) - -ak.types.UnionType.types -======================== - -.. py:attribute:: ak.types.UnionType.types - -ak.types.UnionType.__getitem__ -============================== - -.. py:method:: ak.types.UnionType.__getitem__(where) - -ak.types.UnionType.type -======================= - -.. py:method:: ak.types.UnionType.type(index) - -ak.types.UnionType.numtypes -=========================== - -.. py:attribute:: ak.types.UnionType.numtypes diff --git a/docs-sphinx/ak.types.UnknownType.rst b/docs-sphinx/ak.types.UnknownType.rst deleted file mode 100644 index 3109d13b80..0000000000 --- a/docs-sphinx/ak.types.UnknownType.rst +++ /dev/null @@ -1,15 +0,0 @@ -ak.types.UnknownType --------------------- - -The type of a :doc:`ak.layout.EmptyArray`. - -Types can be unknown if created with an :doc:`_auto/ak.ArrayBuilder` and -no instances are encountered to resolve the type. - -In addition to the properties and methods described in :doc:`ak.types.Type`, -an UnknownType has the following. - -ak.types.UnknownType.__init__ -============================= - -.. py:method:: ak.types.UnknownType.__init__(parameters=None, typestr=None) diff --git a/docs-sphinx/index.rst b/docs-sphinx/index.rst index 1955008864..5f42f6fda5 100644 --- a/docs-sphinx/index.rst +++ b/docs-sphinx/index.rst @@ -107,10 +107,6 @@ Navigation **Combinatorics:** :doc:`_auto/ak.cartesian` produces tuples of *n* items from *n* arrays, usually per-sublist, and :doc:`_auto/ak.combinations` produces unique tuples of *n* items from the same array. To get integer arrays for selecting these tuples, use :doc:`_auto/ak.argcartesian` and :doc:`_auto/ak.argcombinations`. -**Partitioned arrays:** :doc:`_auto/ak.partitions` reveals how an array is internally partitioned (if at all) and :doc:`_auto/ak.partitioned`, :doc:`_auto/ak.repartition` create or change the partitioning. - -**Virtual arrays:** :doc:`_auto/ak.virtual` creates an array that will be generated on demand and :doc:`_auto/ak.with_cache` assigns a new cache to all virtual arrays in a structure. - **NumPy compatibility:** :doc:`_auto/ak.size`, :doc:`_auto/ak.atleast_1d`. **Reducers:** eliminate a dimension by replacing it with a count, sum, logical and/or, etc. over its members. These functions summarize the innermost lists with ``axis=-1`` and cross lists with other values of ``axis``. They never apply to data structures, only numbers at the innermost fields of a structure. @@ -139,8 +135,6 @@ Navigation **String behaviors:** defined in the ``ak.behaviors.string`` submodule; rarely needed for analysis (strings are a built-in behavior). -**Partition functions:** defined in the ``ak.partition`` submodule; rarely needed for analysis: use :doc:`_auto/ak.partitions`, :doc:`_auto/ak.partitioned`, :doc:`_auto/ak.repartition`. - **Numba compatibility:** :doc:`ak.numba.register` informs Numba about Awkward Array types; rarely needed because this should happen automatically. **Pandas compatibility:** :doc:`ak.to_pandas` turns an Awkward Array into a list of DataFrames or joins them with `pd.merge `__ if necessary. @@ -151,68 +145,60 @@ Navigation **Layout nodes:** the high-level :doc:`_auto/ak.Array` and :doc:`_auto/ak.Record` types hide the tree-structure that build the array, but they can be accessed with `ak.Array.layout <_auto/ak.Array.html#ak-array-layout>`_. This layout structure is the core of the library, but usually doesn't have to be accessed by data analysts. - * :doc:`ak.layout.Content`: the abstract base class. - * :doc:`ak.layout.EmptyArray`: an array of unknown type with no elements (usually produced by :doc:`_auto/ak.ArrayBuilder`, which can't determine type at a given level without samples). - * :doc:`ak.layout.NumpyArray`: any NumPy array (e.g. multidimensional shape, arbitrary dtype), though usually only one-dimensional arrays of numbers. - * :doc:`ak.layout.RegularArray`: splits its nested content into equal-length lists. - * :doc:`ak.layout.ListArray`: splits its nested content into variable-length lists with full generality (may use its content non-contiguously, overlapping, or out-of-order). - * :doc:`ak.layout.ListOffsetArray`: splits its nested content into variable-length lists, assuming contiguous, non-overlapping, in-order content. - * :doc:`ak.layout.RecordArray`: represents a logical array of records with a "struct of arrays" layout in memory. - * :doc:`ak.layout.Record`: represents a single record (not a subclass of :doc:`ak.layout.Content` in Python). - * :doc:`ak.layout.IndexedArray`: rearranges and/or duplicates its content by lazily applying an integer index. - * :doc:`ak.layout.IndexedOptionArray`: same as :doc:`ak.layout.IndexedArray` with missing values as negative indexes. - * :doc:`ak.layout.ByteMaskedArray`: represents its content with missing values with an 8-bit boolean mask. - * :doc:`ak.layout.BitMaskedArray`: represents its content with missing values with a 1-bit boolean mask. - * :doc:`ak.layout.UnmaskedArray`: specifies that its content can contain missing values in principle, but no mask is supplied because all elements are non-missing. - * :doc:`ak.layout.UnionArray`: interleaves a set of arrays as a tagged union, can represent heterogeneous data. - * :doc:`ak.layout.VirtualArray`: generates an array on demand from an :doc:`ak.layout.ArrayGenerator` or a :doc:`ak.layout.SliceGenerator` and optionally caches the generated array in an :doc:`ak.layout.ArrayCache`. - -Most layout nodes contain another content node (:doc:`ak.layout.RecordArray` and :doc:`ak.layout.UnionArray` can contain more than one), thus forming a tree. Only :doc:`ak.layout.EmptyArray` and :doc:`ak.layout.NumpyArray` cannot contain a content, and hence these are leaves of the tree. - -Note that :doc:`_auto/ak.partition.PartitionedArray` and its concrete class, :doc:`_auto/ak.partition.IrregularlyPartitionedArray`, are not :doc:`ak.layout.Content` because they cannot be nested within a tree. Partitioning is only allowed at the root of the tree. - -**Iterator for layout nodes:** :doc:`ak.layout.Iterator` (used internally). + * :class:`ak.contents.Content`: the abstract base class. + * :class:`ak.contents.EmptyArray`: an array of unknown type with no elements (usually produced by :doc:`_auto/ak.ArrayBuilder`, which can't determine type at a given level without samples). + * :class:`ak.contents.NumpyArray`: any NumPy array (e.g. multidimensional shape, arbitrary dtype), though usually only one-dimensional arrays of numbers. + * :class:`ak.contents.RegularArray`: splits its nested content into equal-length lists. + * :class:`ak.contents.ListArray`: splits its nested content into variable-length lists with full generality (may use its content non-contiguously, overlapping, or out-of-order). + * :class:`ak.contents.ListOffsetArray`: splits its nested content into variable-length lists, assuming contiguous, non-overlapping, in-order content. + * :class:`ak.contents.RecordArray`: represents a logical array of records with a "struct of arrays" layout in memory. + * :class:`ak.contents.Record`: represents a single record (not a subclass of :class:`ak.contents.Content` in Python). + * :class:`ak.contents.IndexedArray`: rearranges and/or duplicates its content by lazily applying an integer index. + * :class:`ak.contents.IndexedOptionArray`: same as :class:`ak.contents.IndexedArray` with missing values as negative indexes. + * :class:`ak.contents.ByteMaskedArray`: represents its content with missing values with an 8-bit boolean mask. + * :class:`ak.contents.BitMaskedArray`: represents its content with missing values with a 1-bit boolean mask. + * :class:`ak.contents.UnmaskedArray`: specifies that its content can contain missing values in principle, but no mask is supplied because all elements are non-missing. + * :class:`ak.contents.UnionArray`: interleaves a set of arrays as a tagged union, can represent heterogeneous data. -**Layout-level ArrayBuilder:** :doc:`ak.layout.ArrayBuilder` (used internally). +Most layout nodes contain another content node (:class:`ak.contents.RecordArray` and :class:`ak.contents.UnionArray` can contain more than one), thus forming a tree. Only :class:`ak.contents.EmptyArray` and :class:`ak.contents.NumpyArray` cannot contain a content, and hence these are leaves of the tree. -**Index for layout nodes:** integer and boolean arrays that define the shape of the data structure, such as boolean masks in :doc:`ak.layout.ByteMaskedArray`, are not :doc:`ak.layout.NumpyArray` but a more constrained type called :doc:`ak.layout.Index`. +**Index for layout nodes:** integer and boolean arrays that define the shape of the data structure, such as boolean masks in :class:`ak.contents.ByteMaskedArray`, are not :class:`ak.contents.NumpyArray` but a more constrained type called :class:`ak.index.Index`. -**Identities for layout nodes:** :doc:`ak.layout.Identities` are an optional surrogate key for certain join operations. (Not yet used.) +**Identifiers for layout nodes:** :class:`ak.identifier.Identifier` is an optional surrogate key for certain join operations. (Not yet used.) **High-level data types:** -This is the type of data in a high-level :doc:`_auto/ak.Array` or :doc:`_auto/ak.Record` as reported by :doc:`_auto/ak.type`. It represents as much information as a data analyst needs to know (e.g. the distinction between variable and fixed-length lists, but not the distinction between :doc:`ak.layout.ListArray` and :doc:`ak.layout.ListOffsetArray`). +This is the type of data in a high-level :doc:`_auto/ak.Array` or :doc:`_auto/ak.Record` as reported by :doc:`_auto/ak.type`. It represents as much information as a data analyst needs to know (e.g. the distinction between variable and fixed-length lists, but not the distinction between :class:`ak.contents.ListArray` and :class:`ak.contents.ListOffsetArray`). - * :doc:`ak.types.Type`: the abstract base class. - * :doc:`ak.types.ArrayType`: type of a non-composable, high-level :doc:`_auto/ak.Array`, which includes the length of the array. - * :doc:`ak.types.UnknownType`: a type that is not known because it is represented by an :doc:`ak.layout.EmptyArray`. - * :doc:`ak.types.PrimitiveType`: a numeric or boolean type. - * :doc:`ak.types.RegularType`: lists of a fixed length; this ``size`` is part of the type description. - * :doc:`ak.types.ListType`: lists of unspecified or variable length. - * :doc:`ak.types.RecordType`: records with named fields or tuples with a fixed number of unnamed slots. The fields/slots and their types are part of the type description. - * :doc:`ak.types.OptionType`: data that may be missing. - * :doc:`ak.types.UnionType`: heterogeneous data selected from a short list of possibilities. + * :class:`ak.types.Type`: the abstract base class. + * :class:`ak.types.ArrayType`: type of a non-composable, high-level :doc:`_auto/ak.Array`, which includes the length of the array. + * :class:`ak.types.UnknownType`: a type that is not known because it is represented by an :class:`ak.contents.EmptyArray`. + * :class:`ak.types.PrimitiveType`: a numeric or boolean type. + * :class:`ak.types.RegularType`: lists of a fixed length; this ``size`` is part of the type description. + * :class:`ak.types.ListType`: lists of unspecified or variable length. + * :class:`ak.types.RecordType`: records with named fields or tuples with a fixed number of unnamed slots. The fields/slots and their types are part of the type description. + * :class:`ak.types.OptionType`: data that may be missing. + * :class:`ak.types.UnionType`: heterogeneous data selected from a short list of possibilities. -All concrete :doc:`ak.types.Type` subclasses are composable except :doc:`ak.types.ArrayType`. +All concrete :class:`ak.types.Type` subclasses are composable except :class:`ak.types.ArrayType`. **Low-level array forms:** -This is the type of a :doc:`ak.layout.Content` array expressed with low-level granularity (e.g. including the distinction between :doc:`ak.layout.ListArray` and :doc:`ak.layout.ListOffsetArray`). There is a one-to-one relationship between :doc:`ak.layout.Content` subclasses and :doc:`ak.forms.Form` subclasses, and each :doc:`ak.forms.Form` maps to only one :doc:`ak.types.Type`. - - * :doc:`ak.forms.Form`: the abstract base class. - * :doc:`ak.forms.EmptyForm` for :doc:`ak.layout.EmptyArray`. - * :doc:`ak.forms.NumpyForm` for :doc:`ak.layout.NumpyArray`. - * :doc:`ak.forms.RegularForm` for :doc:`ak.layout.RegularArray`. - * :doc:`ak.forms.ListForm` for :doc:`ak.layout.ListArray`. - * :doc:`ak.forms.ListOffsetForm` for :doc:`ak.layout.ListOffsetArray`. - * :doc:`ak.forms.RecordForm` for :doc:`ak.layout.RecordArray`. - * :doc:`ak.forms.IndexedForm` for :doc:`ak.layout.IndexedArray`. - * :doc:`ak.forms.IndexedOptionForm` for :doc:`ak.layout.IndexedOptionArray`. - * :doc:`ak.forms.ByteMaskedForm` for :doc:`ak.layout.ByteMaskedArray`. - * :doc:`ak.forms.BitMaskedForm` for :doc:`ak.layout.BitMaskedArray`. - * :doc:`ak.forms.UnmaskedForm` for :doc:`ak.layout.UnmaskedArray`. - * :doc:`ak.forms.UnionForm` for :doc:`ak.layout.UnionArray`. - * :doc:`ak.forms.VirtualForm` for :doc:`ak.layout.VirtualArray`. +This is the type of a :class:`ak.contents.Content` array expressed with low-level granularity (e.g. including the distinction between :class:`ak.contents.ListArray` and :class:`ak.contents.ListOffsetArray`). There is a one-to-one relationship between :class:`ak.contents.Content` subclasses and :class:`ak.forms.Form` subclasses, and each :class:`ak.forms.Form` maps to only one :class:`ak.types.Type`. + + * :class:`ak.forms.Form`: the abstract base class. + * :class:`ak.forms.EmptyForm` for :class:`ak.contents.EmptyArray`. + * :class:`ak.forms.NumpyForm` for :class:`ak.contents.NumpyArray`. + * :class:`ak.forms.RegularForm` for :class:`ak.contents.RegularArray`. + * :class:`ak.forms.ListForm` for :class:`ak.contents.ListArray`. + * :class:`ak.forms.ListOffsetForm` for :class:`ak.contents.ListOffsetArray`. + * :class:`ak.forms.RecordForm` for :class:`ak.contents.RecordArray`. + * :class:`ak.forms.IndexedForm` for :class:`ak.contents.IndexedArray`. + * :class:`ak.forms.IndexedOptionForm` for :class:`ak.contents.IndexedOptionArray`. + * :class:`ak.forms.ByteMaskedForm` for :class:`ak.contents.ByteMaskedArray`. + * :class:`ak.forms.BitMaskedForm` for :class:`ak.contents.BitMaskedArray`. + * :class:`ak.forms.UnmaskedForm` for :class:`ak.contents.UnmaskedArray`. + * :class:`ak.forms.UnionForm` for :class:`ak.contents.UnionArray`. Internal implementation """"""""""""""""""""""" diff --git a/docs-sphinx/prepare_docstrings.py b/docs-sphinx/prepare_docstrings.py index b6cc8555c5..a9b7bd3ff8 100644 --- a/docs-sphinx/prepare_docstrings.py +++ b/docs-sphinx/prepare_docstrings.py @@ -22,7 +22,7 @@ .strip() ) -toctree = ["_auto/changelog.rst"] +toctree = ["_auto/changelog.rst", "ak.behavior.rst"] def tostr(node): if isinstance(node, ast.NameConstant): @@ -253,10 +253,6 @@ def dofunction(link, linelink, shortname, name, astfcn): key=lambda x: x.replace("/__init__.py", "!") .replace("/highlevel", "#") .replace("/operations", "$") - - .replace("/describe.py", "#") - .replace("/convert.py", "$") - .replace("/structure.py", "%") .replace("/reducers.py", "&") .replace("/categorical.py", "'") @@ -269,71 +265,22 @@ def dofunction(link, linelink, shortname, name, astfcn): shortname = (modulename.replace("awkward.", "ak.") .replace(".highlevel", "") - .replace(".operations.convert", "") - .replace(".operations.describe", "") - .replace(".operations.structure", "") - .replace(".operations.reducers", "") .replace(".behaviors.mixins", "") .replace(".behaviors.categorical", "") .replace(".behaviors.string", "")) + shortname = re.sub(r"\.operations\.ak_\w+", "", shortname) + shortname = re.sub(r"\.(contents|types|forms)\.\w+", r".\1", shortname) - if modulename == "awkward.operations.describe": - toctree.append("ak.behavior.rst") - elif not done_extra and modulename.startswith("awkward._"): + if not done_extra and modulename.startswith("awkward._"): done_extra = True toctree.extend(["ak.numba.register.rst", "ak.numexpr.evaluate.rst", "ak.numexpr.re_evaluate.rst", "ak.autograd.elementwise_grad.rst", - "ak.layout.Content.rst", - "ak.layout.EmptyArray.rst", - "ak.layout.NumpyArray.rst", - "ak.layout.RegularArray.rst", - "ak.layout.ListArray.rst", - "ak.layout.ListOffsetArray.rst", - "ak.layout.RecordArray.rst", - "ak.layout.Record.rst", - "ak.layout.IndexedArray.rst", - "ak.layout.IndexedOptionArray.rst", - "ak.layout.ByteMaskedArray.rst", - "ak.layout.BitMaskedArray.rst", - "ak.layout.UnmaskedArray.rst", - "ak.layout.UnionArray.rst", - "ak.layout.VirtualArray.rst", - "ak.layout.ArrayGenerator.rst", - "ak.layout.SliceGenerator.rst", - "ak.layout.ArrayCache.rst", - "ak.layout.Iterator.rst", - "ak.layout.ArrayBuilder.rst", - "ak.layout.Index.rst", - "ak.layout.Identities.rst", - "ak.types.Type.rst", - "ak.types.ArrayType.rst", - "ak.types.UnknownType.rst", - "ak.types.PrimitiveType.rst", - "ak.types.RegularType.rst", - "ak.types.ListType.rst", - "ak.types.RecordType.rst", - "ak.types.OptionType.rst", - "ak.types.UnionType.rst", - "ak.forms.Form.rst", - "ak.forms.EmptyForm.rst", - "ak.forms.NumpyForm.rst", - "ak.forms.RegularForm.rst", - "ak.forms.ListForm.rst", - "ak.forms.ListOffsetForm.rst", - "ak.forms.RecordForm.rst", - "ak.forms.IndexedForm.rst", - "ak.forms.IndexedOptionForm.rst", - "ak.forms.ByteMaskedForm.rst", - "ak.forms.BitMaskedForm.rst", - "ak.forms.UnmaskedForm.rst", - "ak.forms.UnionForm.rst", - "ak.forms.VirtualForm.rst", "awkwardforth.rst", ]) - if modulename.startswith("awkward._") or modulename == "awkward.nplike": + if modulename.startswith("awkward._") or modulename == "awkward.nplike" or modulename == "awkward.types._awkward_datashape_parser": continue # don't show awkward._*, including _v2 link = ("`{0} - -#include "awkward/common.h" -#include "awkward/Identities.h" -#include "awkward/Slice.h" -#include "awkward/Index.h" - -namespace awkward { - class Content; - using ContentPtr = std::shared_ptr; - using ContentPtrVec = std::vector>; - class Form; - using FormPtr = std::shared_ptr
; - using FormKey = std::shared_ptr; - class ArrayCache; - using ArrayCachePtr = std::shared_ptr; - class Type; - using TypePtr = std::shared_ptr; - class Reducer; - class ToJson; - class ToJsonPrettyString; - class ToJsonString; - class ToJsonPrettyFile; - class ToJsonFile; - - /// @class Form - /// - /// @brief Abstract superclass of all array node forms, which expresses the - /// nesting structure without any large {@link IndexOf Index} or data - /// buffers. - /// - /// Forms may be thought of as low-level types, whereas Type is a high-level - /// type. There is a one-to-many relationship from Type to Form. - class LIBAWKWARD_EXPORT_SYMBOL Form { - public: - static FormPtr - fromnumpy(char kind, - int64_t itemsize, - const std::vector& inner_shape); - static FormPtr - fromjson(const std::string& data); - - /// @brief Called by subclass constructors; assigns #has_identities, - /// #parameters, and #form_key upon construction. - Form(bool has_identities, - const util::Parameters& parameters, - const FormKey& form_key); - - /// @brief Empty destructor; required for some C++ reason. - virtual ~Form() { } - - /// @brief High-level Type describing this Form. - /// - /// @param typestrs A mapping from `"__record__"` parameters to string - /// representations of those types, to override the derived strings. - virtual const TypePtr - type(const util::TypeStrs& typestrs) const = 0; - - /// @brief Internal function to produce a JSON representation one node at - /// a time. - virtual void - tojson_part(ToJson& builder, bool verbose) const = 0; - - /// @brief Copies this node without copying any nodes hierarchically - /// nested within it. - virtual const FormPtr - shallow_copy() const = 0; - - /// @brief Copies this node, adding or replacing a form_key. - virtual const FormPtr - with_form_key(const FormKey& form_key) const = 0; - - /// @brief Returns `true` if this Form is equal to the other Form; `false` - /// otherwise. - /// - /// @param check_identities If `true`, Forms are not equal unless they both - /// #has_identities. - /// @param check_parameters If `true`, Forms are not equal unless they have - /// the same #parameters. - /// @param check_form_key If `true`, Forms are not equal unless they have - /// the same #form_key. - /// @param compatibility_check If `true`, this is part of a compatibility - /// check between an expected Form (`this`) and a generated array's Form - /// (`other`). When the expected Form is a VirtualForm, it's allowed to be - /// less specific than the `other` VirtualForm. - virtual bool - equal(const FormPtr& other, - bool check_identities, - bool check_parameters, - bool check_form_key, - bool compatibility_check) const = 0; - - /// @brief Returns `true` if this Form has the same #form_key as the other. - bool - form_key_equals(const FormKey& other_form_key) const; - - /// @brief The parameter associated with `key` at the first level - /// that has a non-null value, descending only as deep as the first - /// RecordForm. - virtual const std::string - purelist_parameter(const std::string& key) const = 0; - - /// @brief Returns `true` if the parameter associated with `key` exists - /// and is equal to `value`; `false` otherwise. - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - /// - /// Equality is checked at the level of JSON DOMs. The `value` does not - /// need to be exactly the same string; it needs to have equivalent JSON - /// value. - bool - parameter_equals(const std::string& key, const std::string& value) const; - - /// @brief Returns `true` if all nested lists down to the first RecordForm - /// are RegularForm nodes; `false` otherwise. - virtual bool - purelist_isregular() const = 0; - - /// @brief The list-depth of this array, not counting any contained - /// within a RecordForm. - /// - /// If this array contains a UnionForm with different depths, the return - /// value is `-1`. - virtual int64_t - purelist_depth() const = 0; - - /// @brief Returns `true` if this dimension has option-type; `false` - /// otherwise. - virtual bool - dimension_optiontype() const = 0; - - /// @brief An optional string associated with this Form, usually specifying - /// where an array may be fetched. - const FormKey - form_key() const; - - /// @brief Returns (a) the minimum list-depth and (b) the maximum - /// list-depth of the array, which can differ if this array "branches" - /// (differs when followed through different fields of a RecordForm or - /// UnionForm). - virtual const std::pair - minmax_depth() const = 0; - - /// @brief Returns (a) whether the list-depth of this array "branches," - /// or differs when followed through different fields of a RecordForm or - /// UnionForm and (b) the minimum list-depth. - /// - /// If the array does not contain any records or heterogeneous data, the - /// `first` element is always `true` and the `second` is simply the depth. - virtual const std::pair - branch_depth() const = 0; - - /// @brief The number of fields in the first nested tuple or - /// records or `-1` if this array does not contain a RecordForm. - virtual int64_t - numfields() const = 0; - - /// @brief The position of a tuple or record key name if this array - /// contains a RecordForm. - virtual int64_t - fieldindex(const std::string& key) const = 0; - - /// @brief The record name associated with a given field index or - /// the tuple index as a string (e.g. `"0"`, `"1"`, `"2"`) if a tuple. - /// - /// Raises an error if the array does not contain a RecordForm. - virtual const std::string - key(int64_t fieldindex) const = 0; - - /// @brief Returns `true` if the array contains a RecordForm with the - /// specified `key`; `false` otherwise. - virtual bool - haskey(const std::string& key) const = 0; - - /// @brief A list of RecordArray keys or an empty list if this - /// array does not contain a RecordArray. - virtual const std::vector - keys() const = 0; - - /// @brief Returns `true` if the outermost RecordArray is a tuple - virtual bool - istuple() const = 0; - - /// @brief Returns a string representation of this Form (#tojson with - /// `pretty = true` and `verbose = false`). - virtual const std::string - tostring() const; - - /// @brief Returns a JSON representation of this array. - /// - /// @param pretty If `true`, add spacing to make the JSON human-readable. - /// If `false`, return a compact representation. - virtual const std::string - tojson(bool pretty, bool verbose) const; - - /// @brief Returns `true` if the corresponding array has associated - /// {@link IdentitiesOf Identities}. - bool - has_identities() const; - - /// @brief String-to-JSON map that augments the meaning of this - /// Form. - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - const util::Parameters - parameters() const; - - /// @brief Get one parameter from this Form. - /// - /// If the `key` does not exist, this function returns `"null"`. - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - const std::string - parameter(const std::string& key) const; - - /// @brief Internal function for adding identities in #tojson. - /// - /// Must be called between `builder.beginrecord()` and `builder.endrecord()`. - void - identities_tojson(ToJson& builder, bool verbose) const; - - /// @brief Internal function for adding parameters in #tojson. - /// - /// Must be called between `builder.beginrecord()` and `builder.endrecord()`. - void - parameters_tojson(ToJson& builder, bool verbose) const; - - /// @brief Internal function for adding form_key in #tojson. - /// - /// Must be called between `builder.beginrecord()` and `builder.endrecord()`. - void - form_key_tojson(ToJson& builder, bool verbose) const; - - /// @brief Returns the Form that would result from a range-slice. - /// - /// Matches the operation of Content#getitem_range. - virtual const FormPtr - getitem_range() const; - - /// @brief Returns the Form that would result from a field-slice. - /// - /// Matches the operation of Content#getitem_field. - virtual const FormPtr - getitem_field(const std::string& key) const = 0; - - /// @brief Returns the Form that would result from a fields-slice. - /// - /// Matches the operation of Content#getitem_fields. - virtual const FormPtr - getitem_fields(const std::vector& keys) const = 0; - - protected: - /// @brief See #has_identities - bool has_identities_; - /// @brief See #parameters - util::Parameters parameters_; - /// @brief See #form_key - FormKey form_key_; - }; - - /// @class Content - /// - /// @brief Abstract superclass of all array node types (flat hierarchy). - /// Any Content can be nested within any other Content. - class LIBAWKWARD_EXPORT_SYMBOL Content { - public: - /// @brief Called by all subclass constructors; assigns #identities and - /// #parameters upon construction. - Content(const IdentitiesPtr& identities, - const util::Parameters& parameters); - - /// @brief Empty destructor; required for some C++ reason. - virtual ~Content() { } - - /// @brief Returns `true` if the data represented by this node is scalar, - /// not a true array. - /// - /// Scalars are not valid inputs to many operations, but they are - /// instances of Content so that they can be outputs of some operations. - /// - /// Formally, scalars and arrays should probably be distinct C++ types - /// to eliminate this ambiguity, but that would introduce excessive - /// type-testing and casting in all the algorithms that chain operations - /// (output of one is input to another). It is more convenient to test - /// for scalars at runtime with this method. - /// - /// The only scalars are: - /// - /// - NumpyArray with `shape.empty()` (zero-dimensional array), which - /// represents scalar numbers and booleans. (Immediately converted - /// to a number object in Python.) - /// - None, which represents missing values. (Immediately converted - /// to `None` in Python.) - /// - Record, which represents one item from a RecordArray. - virtual bool - isscalar() const; - - /// @brief User-friendly name of this class, including integer-type - /// specialization. - virtual const std::string - classname() const = 0; - - /// @brief Optional Identities for each element of the array - /// (may be `nullptr`). - virtual const IdentitiesPtr - identities() const; - - /// @brief Assign a surrogate index of Identities to this array (in-place). - /// - /// This also assigns and possibly replaces Identities in nested arrays. - /// - /// @note This mutability is temporary: - /// [scikit-hep/awkward-1.0#116](https://github.com/scikit-hep/awkward-1.0/issues/176) - /// Eventually, this interface will be deprecated and all Content - /// instances will be immutable. - virtual void - setidentities() = 0; - - /// @brief Assign a specified set of Identities to this array (in-place). - /// - /// This also assigns and possibly replaces Identities in nested arrays. - /// - /// @note This mutability is temporary: - /// [scikit-hep/awkward-1.0#116](https://github.com/scikit-hep/awkward-1.0/issues/176) - /// Eventually, this interface will be deprecated and all Content - /// instances will be immutable. - virtual void - setidentities(const IdentitiesPtr& identities) = 0; - - /// @brief High-level Type describing this array. - /// - /// @param typestrs A mapping from `"__record__"` parameters to string - /// representations of those types, to override the derived strings. - virtual const TypePtr - type(const util::TypeStrs& typestrs) const = 0; - - /// @brief Low-level Form describing all the features of this array - /// except the actual data buffers ({@link IndexOf Index}, - /// {@link IdentitiesOf Identities}, - /// {@link NumpyArray#ptr NumpyArray::ptr}, and - /// {@link RawArrayOf#ptr RawArray::ptr}). - /// - /// @param materialize If true, materialize any - /// {@link VirtualArray VirtualArrays} encountered along the way. - virtual const FormPtr - form(bool materialize) const = 0; - - /// @brief Returns the kernel library enum for all nested `ptr_lib` - /// within the array's tree structure. If different libraries are - /// associated with nodes of the same tree, this returns `kernel::lib::size` - /// to indicate that it is "mixed". - virtual kernel::lib - kernels() const = 0; - - /// @brief Accumulates all the unique #ArrayCache objects from nested - /// #VirtualArray nodes. (Uniqueness is determined by pointer value.) - virtual void - caches(std::vector& out) const = 0; - - /// @brief Internal function to build an output string for #tostring. - /// - /// @param indent Indentation depth as a string of spaces. - /// @param pre Prefix string, usually an opening XML tag. - /// @param post Postfix string, usually a closing XML tag and carriage - /// return. - virtual const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const = 0; - - /// @brief Internal function to produce a JSON representation one node at - /// a time. - virtual void - tojson_part(ToJson& builder, bool include_beginendlist) const = 0; - - /// @brief Internal function used to calculate #nbytes. - /// - /// @param largest The largest range of bytes used in each - /// reference-counted pointer (`size_t`). - /// - /// @note This method of accounting for overlapping buffers is - /// insufficient: two nodes could use parts of the same buffer in which - /// one doesn't completely overlap the other. It's not likely, but - /// currently the calculation of #nbytes is an underestimate. - virtual void - nbytes_part(std::map& largest) const = 0; - - /// @brief The number of elements in the array. - virtual int64_t - length() const = 0; - - /// @brief Copies this node without copying any nodes hierarchically - /// nested within it or any array/index/identity buffers. - /// - /// See also #deep_copy. - virtual const ContentPtr - shallow_copy() const = 0; - - /// @brief Copies this node and all nodes hierarchically - /// nested within it, optionally copying the associated arrays, indexes, - /// and identities, too. - /// - /// See also #shallow_copy. - /// - /// @param copyarrays If `true`, copy the associated array buffers (in - /// NumpyArray and {@link RawArrayOf RawArray}), not just the lightweight - /// objects that point to them. - /// @param copyindexes If `true`, copy the {@link IndexOf Index} objects - /// and their buffers as well. - /// @param copyidentities If `true`, copy the - /// {@link IdentitiesOf Identities} objects and their buffers as well. - virtual const ContentPtr - deep_copy(bool copyarrays, - bool copyindexes, - bool copyidentities) const = 0; - - /// @brief Performs up-front validity checks on an array so that they don't - /// have to be checked in #getitem_at_nowrap for each item. - virtual void - check_for_iteration() const = 0; - - /// @brief Internal function to get an empty slice (with the correct - /// type). - virtual const ContentPtr - getitem_nothing() const = 0; - - /// @brief Returns the element at a given position in the array, handling - /// negative indexing and bounds-checking like Python. - /// - /// The first item in the array is at `0`, the second at `1`, the last at - /// `-1`, the penultimate at `-2`, etc. - virtual const ContentPtr - getitem_at(int64_t at) const = 0; - - /// @brief Returns the element at a given position in the array, without - /// handling negative indexing or bounds-checking. - /// - /// If the array has Identities, the identity bounds are checked. - virtual const ContentPtr - getitem_at_nowrap(int64_t at) const = 0; - - /// @brief Subinterval of this array, handling negative indexing - /// and bounds-checking like Python. - /// - /// The first item in the array is at `0`, the second at `1`, the last at - /// `-1`, the penultimate at `-2`, etc. - /// - /// Ranges beyond the array are not an error; they are trimmed to - /// `start = 0` on the left and `stop = length() - 1` on the right. - /// - /// This operation only affects the node metadata; its calculation time - /// does not scale with the size of the array. - virtual const ContentPtr - getitem_range(int64_t start, int64_t stop) const = 0; - - /// @brief Subinterval of this array, without handling negative - /// indexing or bounds-checking. - /// - /// If the array has Identities, the identity bounds are checked. - /// - /// This operation only affects the node metadata; its calculation time - /// does not scale with the size of the array. - virtual const ContentPtr - getitem_range_nowrap(int64_t start, int64_t stop) const = 0; - - /// @brief This array with the first nested RecordArray replaced by - /// the field at `key`. - virtual const ContentPtr - getitem_field(const std::string& key) const = 0; - - virtual const ContentPtr - getitem_field(const std::string& key, - const Slice& only_fields) const = 0; - - /// @brief This array with the first nested RecordArray replaced by - /// a RecordArray of a given subset of `keys`. - virtual const ContentPtr - getitem_fields(const std::vector& keys) const = 0; - - virtual const ContentPtr - getitem_fields(const std::vector& keys, - const Slice& only_fields) const = 0; - - /// @brief Entry point for general slicing: Slice represents a tuple of - /// SliceItem nodes applying to each level of nested lists. - virtual const ContentPtr - getitem(const Slice& where) const; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis (including advanced indexing). - /// - /// @param head First element of the Slice tuple. - /// @param tail The rest of the elements of the Slice tuple. - /// @param advanced If empty, no array slices (integer or boolean) have - /// been encountered yet; otherwise, positions in any subsequent array - /// slices to select. - /// - /// In the [NumPy documentation](https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#integer-array-indexing), - /// advanced indexes are described as iterating "as one," which requires - /// an {@link IndexOf Index} to be propagated when implemented recursively. - virtual const ContentPtr - getitem_next(const SliceItemPtr& head, - const Slice& tail, - const Index64& advanced) const; - - /// @brief Internal function that propagates a jagged array (array with - /// irregular-length dimensions) slice through one axis. - /// - /// @param slicestarts Effective `starts` (similar to - /// {@link ListArrayOf ListArray}'s `starts`) of the jagged slice. - /// @param slicestops Effective `stops` of the jagged slice. - /// @param slicecontent Nested `content` within the jagged slice. - /// @param tail Subsequent SliceItem elements beyond the jagged array - /// hierarchy. - virtual const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceItemPtr& slicecontent, - const Slice& tail) const; - - /// @brief Returns an array of the same type with elements filtered, - /// rearranged, and possibly duplicated by the `carry` array of integers. - /// - /// The output has the same length as the `carry` index, not the `array` - /// that is being manipulated. For each item `i` in `carry`, the output - /// is `array[index[i]]`. - /// - /// This operation is called - /// [take](https://docs.scipy.org/doc/numpy/reference/generated/numpy.take.html) - /// in NumPy and Arrow, although this #carry is a low-level function that - /// does not handle negative indexes and is not exposed to the Python - /// layer. It is used by many operations to pass - /// filters/rearrangements/duplications from one typed array node to - /// another without knowing the latter's type. - /// - /// Taking #getitem_at_nowrap as a function from integers to the array's - /// item type, `A: [0, len(a)) → T`, and the `carry` array's - /// {@link IndexOf#getitem_at_nowrap Index64::getitem_at_nowrap} as a - /// function `C: [0, len(c)) → [0, len(a))`, this method represents - /// function composition, `A ∘ C: [0, len(c)) → T`. - /// - /// @note If the `carry` array has duplicate elements, the array is only - /// duplicated one level deep. For instance, on a - /// {@link ListArrayOf ListArray}, only the `starts` and `stops` get - /// duplicated, not the `content` (and similarly for all other node types). - virtual const ContentPtr - carry(const Index64& carry, bool allow_lazy) const = 0; - - /// @brief The parameter associated with `key` at the first level - /// that has a non-null value, descending only as deep as the first - /// RecordArray. - virtual const std::string - purelist_parameter(const std::string& key) const; - - /// @brief Returns `true` if all nested lists down to the first RecordArray - /// are RegularArray nodes; `false` otherwise. - bool - purelist_isregular() const; - - /// @brief Returns `true` if this dimension has option-type; `false` - /// otherwise. - virtual bool - dimension_optiontype() const; - - /// @brief The list-depth of this array, not counting any contained - /// within a RecordArray. - /// - /// The `purelist_depth` of a Record is `0`, and a RecordArray is `1` - /// (regardless of what its fields contain). - /// - /// If this array contains a {@link UnionArrayOf UnionArray} with - /// different depths, the return value is `-1`. - virtual int64_t - purelist_depth() const = 0; - - /// @brief Returns (a) the minimum list-depth and (b) the maximum - /// list-depth of the array, which can differ if this array "branches" - /// (differs when followed through different fields of a RecordArray or - /// {@link UnionArrayOf UnionArray}). - virtual const std::pair - minmax_depth() const = 0; - - /// @brief Returns (a) whether the list-depth of this array "branches," - /// or differs when followed through different fields of a RecordArray or - /// {@link UnionArrayOf UnionArray} and (b) the minimum list-depth. - /// - /// If the array does not contain any records or heterogeneous data, the - /// `first` element is always `true` and the `second` is simply the depth. - virtual const std::pair - branch_depth() const = 0; - - /// @brief The number of fields in the first nested tuple or - /// records or `-1` if this array does not contain a RecordArray. - virtual int64_t - numfields() const = 0; - - /// @brief The position of a tuple or record key name if this array - /// contains a RecordArray. - virtual int64_t - fieldindex(const std::string& key) const = 0; - - /// @brief The record name associated with a given field index or - /// the tuple index as a string (e.g. `"0"`, `"1"`, `"2"`) if a tuple. - /// - /// Raises an error if the array does not contain a RecordArray. - virtual const std::string - key(int64_t fieldindex) const = 0; - - /// @brief Returns `true` if the array contains a RecordArray with the - /// specified `key`; `false` otherwise. - virtual bool - haskey(const std::string& key) const = 0; - - /// @brief A list of RecordArray keys or an empty list if this - /// array does not contain a RecordArray. - virtual const std::vector - keys() const = 0; - - /// @brief Returns `true` if the outermost RecordArray is a tuple - virtual bool - istuple() const = 0; - - /// @brief Returns an error message if this array is invalid; otherwise, - /// returns an empty string. - virtual const std::string - validityerror(const std::string& path) const = 0; - - /// @brief Returns an equivalent array simplified at one level only using - /// {@link IndexedArrayOf#simplify_optiontype simplify_optiontype} - /// if an option-type array and - /// {@link UnionArrayOf#simplify_uniontype simplify_uniontype} - /// if a union-type array. - /// - /// For all other types of arrays, this operation is a pass-through. - virtual const ContentPtr - shallow_simplify() const = 0; - - /// @brief The length of this array (as a NumpyArray scalar) if `axis = 0` - /// or the lengths of subarrays (as an array or nested array) if - /// `axis != 0`. - /// - /// @param axis The axis whose length or lengths to quantify. - /// Negative `axis` counts backward from the deepest levels (`-1` is - /// the last valid `axis`). - /// @param depth The current depth while stepping into the array: this - /// value is set to `0` on the array node where the user starts the - /// process and is increased at each level of list-depth (instead of - /// decreasing the user-specified `axis`). - virtual const ContentPtr - num(int64_t axis, int64_t depth) const = 0; - - /// @brief Returns (a) an offsets {@link IndexOf Index} and (b) a flattened - /// version of the array at some `axis` depth. - /// - /// If `axis > 1` (or its negative equivalent), the offsets is empty. - /// - /// @param axis The axis to eliminate by flattening. `axis = 0` is - /// invalid. - /// Negative `axis` counts backward from the deepest levels (`-1` is - /// the last valid `axis`). - /// @param depth The current depth while stepping into the array: this - /// value is set to `0` on the array node where the user starts the - /// process and is increased at each level of list-depth (instead of - /// decreasing the user-specified `axis`). - virtual const std::pair - offsets_and_flattened(int64_t axis, int64_t depth) const = 0; - - /// @brief Returns `true` if this array can be merged with the `other`; - /// `false` otherwise. - /// - /// The #merge method will complete without errors if this function - /// returns `true`. - /// - /// @param other The other array to merge with. - /// @param mergebool If `true`, consider boolean types to be equivalent - /// to integers. - virtual bool - mergeable(const ContentPtr& other, bool mergebool) const = 0; - - /// @brief Returns `true` if this array has all the same buffers and - /// parameters as `other`; `false` otherwise. - /// - /// @param other The array to compare this with. - virtual bool - referentially_equal(const ContentPtr& other) const = 0; - - /// @brief Partitions `this` array plus a list of `others` into a `head` - /// sequence and a `tail` sequence: - /// - /// `[this] + others == head + tail` - /// - /// The order is preserved and no arrays are lost. The `others` must - /// have at least one array, and `this` will be added to `head`, - /// though `tail` might be empty. - /// - /// (If `tail` is empty, `head` must contain at least two arrays!) - /// - /// The position of the split between `head` and `tail` is such that the - /// first array in `tail` must be merged with #reverse_merge (usually - /// because it is an option-type or union-type array, though this - /// rule depends on whether `this` is option-type, union-type, or neither). - /// - /// The purpose of this function is to prepare a `head` of arrays that - /// can all be merged "normally," followed by a `tail` whose first array - /// must be "reverse merged" and subsequent arrays recurse. - /// - /// This is the first step in #merge. - virtual const std::pair - merging_strategy(const ContentPtrVec& others) const; - - /// @brief Merges a single `other` with this array in reverse order: - /// `other` first, this last. - /// - /// Only arrays that need to be reversible have this function: - /// option-type and union-type arrays. Others raise a runtime error. - virtual const ContentPtr - reverse_merge(const ContentPtr& other) const; - - /// @brief An array with this and the `other` concatenated (this - /// first, `other` last). - const ContentPtr - merge(const ContentPtr& other) const; - - /// @brief Returns an array with this and the `others` concatenated - /// (in order, this first, `others` last). - virtual const ContentPtr - mergemany(const ContentPtrVec& others) const = 0; - - /// @brief Converts this array into a SliceItem that can be used in - /// getitem. - virtual const SliceItemPtr - asslice() const = 0; - - /// @brief Returns this array with `None` values replaced by a given - /// `value`. - /// - /// @param value An array of exactly one element, which need not have - /// the same type as the missing values it's replacing. - virtual const ContentPtr - fillna(const ContentPtr& value) const = 0; - - /// @brief If `axis = 0`, returns a view of this array padded on the - /// right with `None` values to have a minimum length; otherwise, returns - /// an array with nested lists all padded to the minimum length. - /// - /// @param target The intended length. The output may be longer than this - /// target length, but not shorter (using {@link ListArrayOf ListArray}). - /// @param axis The axis at which to apply padding. - /// Negative `axis` counts backward from the deepest levels (`-1` is - /// the last valid `axis`). - /// @param depth The current depth while stepping into the array: this - /// value is set to `0` on the array node where the user starts the - /// process and is increased at each level of list-depth (instead of - /// decreasing the user-specified `axis`). - virtual const ContentPtr - rpad(int64_t target, int64_t axis, int64_t depth) const = 0; - - /// @brief If `axis = 0`, returns a view of this array padded on the right - //// with `None` values to have exactly the specified length; otherwise, - /// returns an array with nested lists all padded to the specified length. - /// - /// @param target The intended length; the output has exactly this target - /// length (using RegularArray). - /// @param axis The axis at which to apply padding. - /// Negative `axis` counts backward from the deepest levels (`-1` is - /// the last valid `axis`). - /// @param depth The current depth while stepping into the array: this - /// value is set to `0` on the array node where the user starts the - /// process and is increased at each level of list-depth (instead of - /// decreasing the user-specified `axis`). - virtual const ContentPtr - rpad_and_clip(int64_t target, int64_t axis, int64_t depth) const = 0; - - /// @brief This array with one axis removed by applying a Reducer - /// (e.g. "sum", "max", "any", "all). - /// - /// The user's entry point for this operation is #reduce. - /// - /// @param reducer The choice of Reducer algorithm. - /// @param negaxis The negative axis: `-axis`. That is, `negaxis = 1` - /// means the deepest axis level. - /// @param starts Staring positions of each group to combine as an - /// {@link IndexOf Index}. These are downward pointers from an outer - /// structure into this structure with the same meaning as in - /// {@link ListArrayOf ListArray}. Only used by a reducer that - /// {@link Reducer#returns_positions returns_positions} (currently - /// only argmin and argmax). - /// @param shifts Per-element adjustments for any reducer that - /// {@link Reducer#returns_positions returns_positions}. Allows - /// for variable-length lists with axis != -1 and for missing values - /// (None) in argmin and argmax. - /// @param parents Groups to combine as an {@link IndexOf Index} of - /// upward pointers from this structure to the outer structure to reduce. - /// @param outlength The length of the reduced array, after the operation - /// completes. - /// @param mask If `true`, the Reducer's identity values will be covered - /// by `None` using a ByteMaskedArray. This is desirable for ReducerMin, - /// ReducerMax, ReducerArgmin, and ReducerArgmax to indicate that empty - /// lists have no minimum or maximum. - /// @param keepdims If `true`, the reduced values will be wrapped by a - /// singleton RegularArray to maintain the same number of dimensions in - /// the output. - virtual const ContentPtr - reduce_next(const Reducer& reducer, - int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool mask, - bool keepdims) const = 0; - - /// @brief This array sorted - /// - /// The user's entry point for this operation is #sort. - /// - /// @param negaxis The negative axis: `-axis`. That is, `negaxis = 1` - /// means the deepest axis level. - /// @param starts Staring positions of each group to combine as an - /// {@link IndexOf Index}. These are downward pointers from an outer - /// structure into this structure with the same meaning as in - /// {@link ListArrayOf ListArray}. - /// @param parents Groups to combine as an {@link IndexOf Index} of - /// upward pointers from this structure to the outer structure to sort. - /// @param outlength The length of the array, after the operation - /// completes. - /// @param ascending If `true`, the values will be sorted in an ascending - /// order. - /// @param stable If `true`, the values will be sorted by a - /// stable sort algorithm to maintain the relative order of records with - /// equal keys (i.e. values). - virtual const ContentPtr - sort_next(int64_t negaxis, - const Index64& starts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const = 0; - - /// @brief This array sorted indices - /// - /// The user's entry point for this operation is #argsort. - /// - /// @param negaxis The negative axis: `-axis`. That is, `negaxis = 1` - /// means the deepest axis level. - /// @param starts Staring positions of each group to combine as an - /// {@link IndexOf Index}. These are downward pointers from an outer - /// structure into this structure with the same meaning as in - /// {@link ListArrayOf ListArray}. - /// @param shifts Per-element adjustments that allows - /// for variable-length lists with axis != -1 and for missing values - /// (None). - /// @param parents Groups to combine as an {@link IndexOf Index} of - /// upward pointers from this structure to the outer structure to sort. - /// @param outlength The length of the array, after the operation - /// completes. - /// @param ascending If `true`, the values will be sorted in an ascending - /// order. - /// @param stable If `true`, the values will be sorted by a - /// stable sort algorithm to maintain the relative order of records with - /// equal keys (i.e. values). - virtual const ContentPtr - argsort_next(int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const = 0; - - /// @brief A (possibly nested) array of integers indicating the - /// positions of elements within each nested list. - /// - /// @param axis The nesting depth at which this operation is applied. - /// If `axis = 0`, the output is simply an array of integers from `0` - /// to `length()`. If `axis = 1`, the output has one level of nesting - /// containing integers from `0` to the length of the nested list. - /// Higher values of `axis` leave outer layers of the structure untouched. - /// Negative `axis` counts backward from the deepest levels (`-1` is - /// the last valid `axis`). - /// @param depth The current depth while stepping into the array: this - /// value is set to `0` on the array node where the user starts the - /// process and is increased at each level of list-depth (instead of - /// decreasing the user-specified `axis`). - virtual const ContentPtr - localindex(int64_t axis, int64_t depth) const = 0; - - /// @brief Tuples or records of all `n`-tuple combinations of - /// list items at some `axis` depth. - /// - /// For example, the `n = 2` combinations at `axis = 0` of - /// - /// @code{.py} - /// [a, b, c, d, e] - /// @endcode - /// - /// would be - /// - /// @code{.py} - /// [[(a, b), (a, c), (a, d), (a, e)], - /// [(b, c), (b, d), (b, e)], - /// [(c, d), (c, e)], - /// [(d, e)]] - /// @endcode - /// - /// and the `n = 3` combinations at `axis = 1` of - /// - /// @code{.py} - /// [[a, b, c, d], [], [e, f], [g, h, i]] - /// @endcode - /// - /// would be - /// - /// @code{.py} - /// [[[(a, b, c), (a, b, d), (a, c, d)], [(b, c, d)]], - /// [], - /// [], - /// [[(g, h, i)]]] - /// @endcode - /// - /// @param n The number of items in each tuple/record. - /// @param replacement If `true`, the tuples/records are allowed to include - /// the same item more than once, such as `(a, a, a)` and `(a, a, b)`. - /// In the above examples, `replacement = false`. (If the output of this - /// function is thought of as the "upper triangle" elements of the - /// Cartesian product of the input with itself `n` times, the `replacement` - /// parameter determines whether elements on the diagonal are allowed.) - /// @param recordlookup If `nullptr`, the output consists of tuples, a - /// RecordArray indexed by `"0"`, `"1"`, `"2"`, etc. If `recordlookup` - /// is a `std::vector`, the output consists of records, - /// a RecordArray indexed by names (strings). The length of `recordlookup` - /// must be equal to `n`. - /// @param parameters Parameters assigned to the new RecordArray. This - /// can be used to set `"__record_" = "\"record_name\\""` to give the - /// records a custom behavior in Python. - /// @param axis The nesting depth at which this operation is applied. - /// At `axis = 0`, combinations are formed from elements of the whole - /// array (see example above); at `axis = 1`, combinations are formed - /// independently for each element. At a deeper `axis`, outer levels are - /// left untouched. - /// Negative `axis` counts backward from the deepest levels (`-1` is - /// the last valid `axis`). - /// @param depth The current depth while stepping into the array: this - /// value is set to `0` on the array node where the user starts the - /// process and is increased at each level of list-depth (instead of - /// decreasing the user-specified `axis`). - /// - /// Note that `axis = 0` is qualitatively different from any other `axis` - /// because a dataset is typically much larger than any one of its - /// elements. As such, `axis = 0` is lazily generated with an - /// {@link IndexedArrayOf IndexedArray}, while any other `axis` is - /// eagerly generated by duplicating elements (with #carry). - virtual const ContentPtr - combinations(int64_t n, - bool replacement, - const util::RecordLookupPtr& recordlookup, - const util::Parameters& parameters, - int64_t axis, - int64_t depth) const = 0; - - /// @brief Returns a string representation of this array (multi-line XML). - /// - /// Although this XML string has detail about every node in the tree, - /// it does not show all elements in the array buffers and therefore - /// does not scale with the size of the dataset (i.e. it is safe to - /// print to the screen). - /// - /// Thus, it's also not a storage format: see #tojson. - const std::string - tostring() const; - - /// @brief Returns a JSON representation of this array. - /// - /// @param pretty If `true`, add spacing to make the JSON human-readable. - /// If `false`, return a compact representation. - /// @param maxdecimals Maximum number of decimals for floating-point - /// numbers or `-1` for no limit. - /// @param nan_string user-defined string for a not-a-number (NaN) value - /// representation in JSON format - /// @param infinity_string user-defined string for a positive infinity - /// representation in JSON format - /// @param minus_infinity_string user-defined string for a negative - /// infinity representation in JSON format - /// - /// Although the JSON output contains all of the data from the array - /// (and therefore might not be safe to print to the screen), it - /// does not preserve the type information of an array. In particular, - /// the distinction between ListType and RegularType is lost. - const std::string - tojson(bool pretty, int64_t maxdecimals, - const char* nan_string = nullptr, - const char* infinity_string = nullptr, - const char* minus_infinity_string = nullptr, - const char* complex_real_string = nullptr, - const char* complex_imag_string = nullptr) const; - - /// @brief Writes a JSON representation of this array to a `destination` - /// file. - /// - /// @param destination The file to write into. - /// @param pretty If `true`, add spacing to make the JSON human-readable. - /// If `false`, return a compact representation. - /// @param maxdecimals Maximum number of decimals for floating-point - /// numbers or `-1` for no limit. - /// @param buffersize Size of a temporary buffer in bytes. - /// @param nan_string user-defined string for a not-a-number (NaN) value - /// representation in JSON format - /// @param infinity_string user-defined string for a positive infinity - /// representation in JSON format - /// @param minus_infinity_string user-defined string for a negative - /// infinity representation in JSON format - /// - /// Although the JSON output contains all of the data from the array - /// (and therefore might not be safe to print to the screen), it - /// does not preserve the type information of an array. In particular, - /// the distinction between ListType and RegularType is lost. - void - tojson(FILE* destination, - bool pretty, - int64_t maxdecimals, - int64_t buffersize, - const char* nan_string = nullptr, - const char* infinity_string = nullptr, - const char* minus_infinity_string = nullptr, - const char* complex_real_string = nullptr, - const char* complex_imag_string = nullptr) const; - - /// @brief The number of bytes contained in all array buffers, - /// {@link IndexOf Index} buffers, and Identities buffers, not including - /// the lightweight node objects themselves. - int64_t - nbytes() const; - - /// @brief This array with one axis removed by applying a Reducer - /// (e.g. "sum", "max", "any", "all). - /// - /// This operation is implemented on each node through #reduce_next. - /// - /// @param reducer The choice of Reducer algorithm. - /// @param axis The axis to remove by reduction. - /// Negative `axis` counts backward from the deepest levels (`-1` is - /// the last valid `axis`). - /// @param mask If `true`, the Reducer's identity values will be covered - /// by `None` using a ByteMaskedArray. This is desirable for ReducerMin, - /// ReducerMax, ReducerArgmin, and ReducerArgmax to indicate that empty - /// lists have no minimum or maximum. - /// @param keepdims If `true`, the reduced values will be wrapped by a - /// singleton RegularArray to maintain the same number of dimensions in - /// the output. - const ContentPtr - reduce(const Reducer& reducer, - int64_t axis, - bool mask, - bool keepdims) const; - - /// @brief This array with one axis sorted by applying a sorting algorithm - /// - /// This operation is implemented on each node through #sort_next. - /// - /// @param axis The axis to sort. - /// Negative `axis` counts backward from the deepest levels (`-1` is - /// the last valid `axis`). - /// @param ascending If `true`, the values will be sorted in an ascending - /// order. - /// @param stable If `true`, the values will be sorted by a - /// stable sort algorithm to maintain the relative order of records with - /// equal keys (i.e. values). - const ContentPtr - sort(int64_t axis, bool ascending, bool stable) const; - - /// @brief This array indices with one axis sorted by applying - /// a sorting algorithm - /// - /// This operation is implemented on each node through #argsort_next. - /// - /// @param axis The axis to sort. - /// Negative `axis` counts backward from the deepest levels (`-1` is - /// the last valid `axis`). - /// @param ascending If `true`, the values will be sorted in an ascending - /// order. - /// @param stable If `true`, the values will be sorted by a - /// stable sort algorithm to maintain the relative order of records with - /// equal keys (i.e. values). - const ContentPtr - argsort(int64_t axis, bool ascending, bool stable) const; - - /// @brief String-to-JSON map that augments the meaning of this - /// array. - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - const util::Parameters - parameters() const; - - /// @brief Assign all the parameters for this array node (in-place). - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - /// - /// @note This mutability is temporary: - /// [scikit-hep/awkward-1.0#117](https://github.com/scikit-hep/awkward-1.0/issues/177) - /// Eventually, this interface will be deprecated and all Content - /// instances will be immutable. - void - setparameters(const util::Parameters& parameters); - - /// @brief Get one parameter from this array node. - /// - /// If the `key` does not exist, this function returns `"null"`. - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - const std::string - parameter(const std::string& key) const; - - /// @brief Assign one parameter for this array node (in-place). - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - /// - /// @note This mutability is temporary: - /// [scikit-hep/awkward-1.0#117](https://github.com/scikit-hep/awkward-1.0/issues/177) - /// Eventually, this interface will be deprecated and all Content - /// instances will be immutable. - void - setparameter(const std::string& key, const std::string& value); - - /// @brief Returns `true` if the parameter associated with `key` exists - /// and is equal to `value`; `false` otherwise. - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - /// - /// Equality is checked at the level of JSON DOMs. The `value` does not - /// need to be exactly the same string; it needs to have equivalent JSON - /// value. - bool - parameter_equals(const std::string& key, const std::string& value) const; - - /// @brief Returns `true` if all parameters of this array node are equal - /// to the `other` parameters. - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - /// - /// Equality is checked at the level of JSON DOMs. The `value` does not - /// need to be exactly the same string; it needs to have equivalent JSON - /// value. - /// - /// If `check_all`, every parameter is checked; otherwise, only - /// `"__array__"` and `"__record__"` are checked. - bool - parameters_equal(const util::Parameters& other, bool check_all) const; - - /// @brief Returns `true` if the parameter associated with `key` is a - /// string; `false` otherwise. - bool - parameter_isstring(const std::string& key) const; - - /// @brief Returns `true` if the parameter associated with `key` is a - /// string that matches `[A-Za-z_][A-Za-z_0-9]*`; `false` otherwise. - bool - parameter_isname(const std::string& key) const; - - /// @brief Returns the parameter associated with `key` as a string if - /// #parameter_isstring; raises an error otherwise. - const std::string - parameter_asstring(const std::string& key) const; - - /// @brief Concatenates this array with `other` by creating a - /// {@link UnionArrayOf UnionArray} instead of actually merging the data. - /// This does not call - /// {@link UnionArrayOf#simplify_uniontype UnionArray::simplify_uniontype}. - const ContentPtr - merge_as_union(const ContentPtr& other) const; - - /// @brief Internal function to handle the `axis = 0` case of #rpad - /// and #rpad_and_clip. - /// - /// The `axis = 0` case does not depend on array node type, so it is - /// defined universally in the Content class. - /// - /// @param target The intended length. The output may be longer than this - /// target length, but not shorter (using {@link ListArrayOf ListArray}). - /// @param clip If `true`, do #rpad_and_clip; if `false`, do #rpad. - const ContentPtr - rpad_axis0(int64_t target, bool clip) const; - - /// @brief Internal function to handle the `axis = 0` case of #localindex. - /// - /// The `axis = 0` case does not depend on array node type, so it is - /// defined universally in the Content class. - const ContentPtr - localindex_axis0() const; - - /// @brief Internal function to handle the `axis = 0` case of - /// #combinations. - /// - /// The `axis = 0` case does not depend on array node type, so it is - /// defined universally in the Content class. - /// - /// @param n The number of items in each tuple/record. - /// @param replacement If `true`, the tuples/records are allowed to include - /// the same item more than once, such as `(a, a, a)` and `(a, a, b)`. - /// In the above examples, `replacement = false`. (If the output of this - /// function is thought of as the "upper triangle" elements of the - /// Cartesian product of the input with itself `n` times, the `replacement` - /// parameter determines whether elements on the diagonal are allowed.) - /// @param recordlookup If `nullptr`, the output consists of tuples, a - /// RecordArray indexed by `"0"`, `"1"`, `"2"`, etc. If `recordlookup` - /// is a `std::vector`, the output consists of records, - /// a RecordArray indexed by names (strings). The length of `recordlookup` - /// must be equal to `n`. - /// @param parameters Parameters assigned to the new RecordArray. This - /// can be used to set `"__record_" = "\"record_name\\""` to give the - /// records a custom behavior in Python. - const ContentPtr - combinations_axis0(int64_t n, - bool replacement, - const util::RecordLookupPtr& recordlookup, - const util::Parameters& parameters) const; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis (including advanced indexing). - /// - /// See generic #getitem_next for details. - virtual const ContentPtr - getitem_next(const SliceAt& at, - const Slice& tail, - const Index64& advanced) const = 0; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis (including advanced indexing). - /// - /// See generic #getitem_next for details. - virtual const ContentPtr - getitem_next(const SliceRange& range, - const Slice& tail, - const Index64& advanced) const = 0; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis (including advanced indexing). - /// - /// See generic #getitem_next for details. - virtual const ContentPtr - getitem_next(const SliceEllipsis& ellipsis, - const Slice& tail, - const Index64& advanced) const; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis (including advanced indexing). - /// - /// See generic #getitem_next for details. - virtual const ContentPtr - getitem_next(const SliceNewAxis& newaxis, - const Slice& tail, - const Index64& advanced) const; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis (including advanced indexing). - /// - /// See generic #getitem_next for details. - virtual const ContentPtr - getitem_next(const SliceArray64& array, - const Slice& tail, - const Index64& advanced) const = 0; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis (including advanced indexing). - /// - /// See generic #getitem_next for details. - virtual const ContentPtr - getitem_next(const SliceField& field, - const Slice& tail, - const Index64& advanced) const; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis (including advanced indexing). - /// - /// See generic #getitem_next for details. - virtual const ContentPtr - getitem_next(const SliceFields& fields, - const Slice& tail, - const Index64& advanced) const; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis (including advanced indexing). - /// - /// See generic #getitem_next for details. - virtual const ContentPtr - getitem_next(const SliceMissing64& missing, - const Slice& tail, - const Index64& advanced) const; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis (including advanced indexing). - /// - /// See generic #getitem_next for details. - virtual const ContentPtr - getitem_next(const SliceJagged64& jagged, - const Slice& tail, - const Index64& advanced) const = 0; - - /// @brief Internal function that propagates a jagged array (array with - /// irregular-length dimensions) slice through one axis. - /// - /// See generic #getitem_next_jagged for details. - virtual const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceArray64& slicecontent, - const Slice& tail) const = 0; - - /// @brief Internal function that propagates a jagged array (array with - /// irregular-length dimensions) slice through one axis. - /// - /// See generic #getitem_next_jagged for details. - virtual const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceMissing64& slicecontent, - const Slice& tail) const = 0; - - /// @brief Internal function that propagates a jagged array (array with - /// irregular-length dimensions) slice through one axis. - /// - /// See generic #getitem_next_jagged for details. - virtual const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceJagged64& slicecontent, - const Slice& tail) const = 0; - - /// @brief Internal function defining the negative axis handling for many - /// operations. - /// - /// Returns a non-negative equivalent `axis` if unambiguous and passes - /// the negative `axis` through if ambiguous. A negative `axis` can be - /// ambiguous if the list-depth "branches" in a RecordArray or a - /// {@link UnionArrayOf UnionArray} with different `contents` having - /// different depths. As an operation descends through the nodes of - /// an array, it repeatedly calls `axis_wrap_if_negative` until an - /// unambiguous non-negative `axis` can be identified. - /// - /// This allows a RecordArray or {@link UnionArrayOf UnionArray} with - /// different depths to accept `axis = -1` as the last axis, regardless - /// of how deep that is in different record fields or union possibilities. - const int64_t - axis_wrap_if_negative(int64_t axis) const; - - /// @brief Recursively copies components of the array from main memory to a - /// GPU (if `ptr_lib == kernel::lib::cuda`) or to main memory (if - /// `ptr_lib == kernel::lib::cpu`) if those components are not already there. - virtual const ContentPtr - copy_to(kernel::lib ptr_lib) const = 0; - - /// @brief Change the leaf types to 'totype'. - virtual const ContentPtr - numbers_to_type(const std::string& name) const = 0; - - /// @brief Returns 'true' if all components of the array are unique - virtual bool - is_unique() const = 0; - - /// @brief Returns sorted unique values. - /// - virtual const ContentPtr - unique() const = 0; - - /// @brief Returns 'true' if subranges are equal - virtual bool - is_subrange_equal(const Index64& start, const Index64& stop) const = 0; - - protected: - /// @brief Internal function to determine if a particular set of parameters - /// are allowed on a particular node (centralized by parameter, not by class). - const std::string - validityerror_parameters(const std::string& path) const; - - /// @brief Internal function to wrap putative #getitem output with enough - /// RegularArray nodes to satisfy a given `shape`. - /// - /// The `shape` is intended to match a - /// {@link SliceArrayOf#shape SliceArray::shape}. - const ContentPtr - getitem_next_array_wrap(const ContentPtr& outcontent, - const std::vector& shape) const; - - /// @brief Internal function to convert #parameters into a string fragment - /// for #tostring. - /// - /// @param indent Indentation depth as a string of spaces. - /// @param pre Prefix string, usually an opening XML tag. - /// @param post Postfix string, usually a closing XML tag and carriage - /// return. - const std::string - parameters_tostring(const std::string& indent, - const std::string& pre, - const std::string& post) const; - - /// @brief Internal function to support most of the logic in #kernels. - kernel::lib - kernels_compare(kernel::lib from_index, const ContentPtr& content) const; - - protected: - /// @brief See #identities. - IdentitiesPtr identities_; - /// @brief See #parameters. - util::Parameters parameters_; - }; -} - -#endif // AWKWARD_CONTENT_H_ diff --git a/include/awkward/Identities.h b/include/awkward/Identities.h deleted file mode 100644 index 35706f683d..0000000000 --- a/include/awkward/Identities.h +++ /dev/null @@ -1,422 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_IDENTITIES_H_ -#define AWKWARD_IDENTITIES_H_ - -#include -#include -#include -#include - -#include "awkward/common.h" -#include "awkward/Index.h" - -namespace awkward { - class Identities; - using IdentitiesPtr = std::shared_ptr; - - /// @class Identities - /// - /// @brief A contiguous, two-dimensional array of integers and a list - /// of strings used to represent a path from the root of an array structure - /// to each item in an array. - /// - /// A single value's identity is equivalent to a tuple of integers and - /// strings: - /// - /// @code{.py} - /// (999, "muons", 1, "pt") - /// @endcode - /// - /// which corresponds to the "getitem" path from the root of the array - /// to that value: - /// - /// @code{.py} - /// array[999, "muons", 1, "pt"] - /// @endcode - /// - /// The #fieldloc is a set of integer-string pairs, such as - /// - /// @code{.py} - /// [(1, "muons"), (3, "pt")] - /// @endcode - /// - /// in the above example. The identities array is two-dimensional so that - /// a single value can be an array, such as - /// - /// @code{.py} - /// [999, 1] - /// @endcode - /// - /// in the above example. - /// - /// The Identities superclass abstracts over templated specializations: - /// - /// - {@link IdentitiesOf Identities32}, which is `IdentitiesOf` - /// - {@link IdentitiesOf Identities64}, which is `IdentitiesOf` - class LIBAWKWARD_EXPORT_SYMBOL Identities { - public: - /// @brief Identities reference type (64-bit integer). - using Ref = int64_t; - - /// @brief Identities field location type (integer-string pairs). - using FieldLoc = std::vector>; - - /// @brief Returns a new Identities reference that is globally unique - /// in the current process. - /// - /// This is thread-safe: the global counter is an atomic integer. - static Ref - newref(); - - /// @brief A constant, empty Identities pointer (`nullptr`). - static IdentitiesPtr - none(); - - /// @brief Called by all subclass constructors; assigns #ref, - /// #fieldloc, #offset, #width, and #length upon construction. - /// - /// @param ref A globally unique reference to this set of identities. - /// @param fieldloc A list of integer-string pairs indicating the positions - /// of all tuple/record field indicators within the identity tuple. - /// @param offset Location of item zero in the buffer, relative to - /// `ptr`, measured in the number of elements. We keep this information in - /// two parameters (`ptr` and `offset`) rather than moving `ptr` so that - /// `ptr` can be reference counted among all arrays that use the same - /// buffer. - /// @param width The number of integers in each identity tuple. - /// @param length The number of identities in the array. - Identities(const Ref ref, - const FieldLoc& fieldloc, - int64_t offset, - int64_t width, - int64_t length); - - /// @brief Virtual destructor acts as a first non-inline virtual function - /// that determines a specific translation unit in which vtable shall be - /// emitted. - virtual ~Identities(); - - /// @brief A globally unique reference to this set of identities. - const Ref - ref() const; - - /// @brief A list of integer-string pairs indicating the positions - /// of all tuple/record field indicators within the identity tuple. - const FieldLoc - fieldloc() const; - - /// @brief Location of item zero in the buffer, relative to - /// `ptr`, measured in the number of elements. We keep this information in - /// two parameters (`ptr` and `offset`) rather than moving `ptr` so that - /// `ptr` can be reference counted among all arrays that use the same - /// buffer. - const int64_t - offset() const; - - /// @brief The number of integers in each identity tuple. - const int64_t - width() const; - - /// @brief The number of identities in the array. - const int64_t - length() const; - - /// @brief The Kernel Library that ptr uses. - virtual kernel::lib - ptr_lib() const = 0; - - /// @brief User-friendly name of this class: `"Identities32"` or - /// `"Identities64"`. - virtual const std::string - classname() const = 0; - - /// @brief Return a string representing an identity tuple at `where`. - virtual const std::string - identity_at(int64_t where) const = 0; - - /// @brief Converts this Identities to an {@link Identities Identities64}. - virtual const IdentitiesPtr - to64() const = 0; - - /// @brief Internal function to build an output string for #tostring. - /// - /// @param indent Indentation depth as a string of spaces. - /// @param pre Prefix string, usually an opening XML tag. - /// @param post Postfix string, usually a closing XML tag and carriage - /// return. - virtual const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const = 0; - - /// @brief Subinterval of this array, without handling negative - /// indexing or bounds-checking. - /// - /// This operation only affects the node metadata; its calculation time - /// does not scale with the size of the array. - virtual const IdentitiesPtr - getitem_range_nowrap(int64_t start, int64_t stop) const = 0; - - /// @brief Internal function used to calculate Content#nbytes. - /// - /// @param largest The largest range of bytes used in each - /// reference-counted pointer (`size_t`). - /// - /// @note This method of accounting for overlapping buffers is - /// insufficient: two nodes could use parts of the same buffer in which - /// one doesn't completely overlap the other. It's not likely, but - /// currently the calculation of Content#nbytes is an underestimate. - virtual void - nbytes_part(std::map& largest) const = 0; - - /// @brief Copies this Identities node without copying its buffer. - /// - /// See also #deep_copy. - virtual const IdentitiesPtr - shallow_copy() const = 0; - - /// @brief Copies this Identities node and all the data in its buffer. - /// - /// See also #shallow_copy. - virtual const IdentitiesPtr - deep_copy() const = 0; - - /// @brief Returns an Identities array with elements filtered, - /// rearranged, and possibly duplicated by the `carry` array of integers. - /// - /// The output has the same length as the `carry` index, not the `array` - /// that is being manipulated. For each item `i` in `carry`, the output - /// is `array[index[i]]`. - /// - /// This operation is called - /// [take](https://docs.scipy.org/doc/numpy/reference/generated/numpy.take.html) - /// in NumPy and Arrow, although this carry is a low-level function that - /// does not handle negative indexes and is not exposed to the Python - /// layer. It is used by many operations to pass - /// filters/rearrangements/duplications from one typed array node to - /// another without knowing the latter's type. - /// - /// Taking {@link IdentitiesOf#getitem_at_nowrap getitem_at_nowrap} as a - /// function from integers to the array's item type, `A: [0, len(a)) → T`, - /// and the `carry` array's - /// {@link IndexOf#getitem_at_nowrap Index64::getitem_at_nowrap} as a - /// function `C: [0, len(c)) → [0, len(a))`, this method represents - /// function composition, `A ∘ C: [0, len(c)) → T`. - virtual const IdentitiesPtr - getitem_carry_64(const Index64& carry) const = 0; - - /// @brief Returns this Identities node with a different #fieldloc. - virtual const IdentitiesPtr - withfieldloc(const FieldLoc& fieldloc) const = 0; - - /// @brief Returns the integer value of the two-dimensional array at - /// `row` and `col`. - virtual int64_t - value(int64_t row, int64_t col) const = 0; - - /// @brief Moves the identity ptr buffer of the array between devices - /// - /// Returns a std::shared_ptr which is, by default, allocated - /// on the first device(device [0]) - /// - /// @note This function has not been implemented to handle Multi-GPU setups - virtual const IdentitiesPtr - copy_to(kernel::lib ptr_lib) const = 0; - - /// @brief Returns a string representation of this array (multi-line XML). - const std::string - tostring() const; - - /// @brief Returns `true` if this Identities has all the same buffers and - /// parameters as `other`; `false` otherwise. - /// - /// @param other The Identities to compare this with. - virtual bool - referentially_equal(const IdentitiesPtr& other) const = 0; - - protected: - /// @brief See #ref. - const Ref ref_; - /// @brief See #fieldloc. - const FieldLoc fieldloc_; - /// @brief See #offset. - int64_t offset_; - /// @brief See #width. - int64_t width_; - /// @brief See #length. - int64_t length_; - }; - - /// @class IdentitiesOf - /// - /// @brief A contiguous, two-dimensional array of integers and a list - /// of strings used to represent a path from the root of an array structure - /// to each item in an array. - /// - /// A single value's identity is equivalent to a tuple of integers and - /// strings: - /// - /// @code{.py} - /// (999, "muons", 1, "pt") - /// @endcode - /// - /// which corresponds to the "getitem" path from the root of the array - /// to that value: - /// - /// @code{.py} - /// array[999, "muons", 1, "pt"] - /// @endcode - /// - /// The #fieldloc is a set of integer-string pairs, such as - /// - /// @code{.py} - /// [(1, "muons"), (3, "pt")] - /// @endcode - /// - /// in the above example. The identities array is two-dimensional so that - /// a single value can be an array, such as - /// - /// @code{.py} - /// [999, 1] - /// @endcode - /// - /// in the above example. - /// - /// The Identities superclass abstracts over templated specializations: - /// - /// - {@link IdentitiesOf Identities32}, which is `IdentitiesOf` - /// - {@link IdentitiesOf Identities64}, which is `IdentitiesOf` - template - class -#ifdef AWKWARD_IDENTITIES_NO_EXTERN_TEMPLATE - LIBAWKWARD_EXPORT_SYMBOL -#endif - IdentitiesOf: public Identities { - public: - /// @brief Creates an IdentitiesOf from a full set of parameters. - /// - /// @param ref A globally unique reference to this set of identities. - /// @param fieldloc A list of integer-string pairs indicating the positions - /// of all tuple/record field indicators within the identity tuple. - /// @param offset Location of item zero in the buffer, relative to - /// `ptr`, measured in the number of elements. We keep this information in - /// two parameters (`ptr` and `offset`) rather than moving `ptr` so that - /// `ptr` can be reference counted among all arrays that use the same - /// buffer. - /// @param width The number of integers in each identity tuple. - /// @param length The number of identities in the array. - /// @param ptr Reference-counted pointer to the array buffer. - /// @param Choose the Kernel Library for this array, default:= cpu_kernels. - IdentitiesOf(const Ref ref, - const FieldLoc& fieldloc, - int64_t offset, - int64_t width, - int64_t length, - const std::shared_ptr ptr, - kernel::lib ptr_lib = kernel::lib::cpu); - - /// @brief Allocates a new array buffer with a given #ref, #fieldloc, - /// #length and #width. - IdentitiesOf(const Ref ref, - const FieldLoc& fieldloc, - int64_t width, - int64_t length, - kernel::lib ptr_lib = kernel::lib::cpu); - - /// @brief Reference-counted pointer to the array buffer. - const std::shared_ptr - ptr() const; - - kernel::lib - ptr_lib() const override; - - /// @brief Raw pointer to the beginning of data (i.e. offset accounted for). - T* - data() const; - - const std::string - classname() const override; - - const std::string - identity_at(int64_t at) const override; - - const IdentitiesPtr - to64() const override; - - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - const IdentitiesPtr - getitem_range_nowrap(int64_t start, int64_t stop) const override; - - void - nbytes_part(std::map& largest) const override; - - const IdentitiesPtr - shallow_copy() const override; - - const IdentitiesPtr - deep_copy() const override; - - const IdentitiesPtr - getitem_carry_64(const Index64& carry) const override; - - const IdentitiesPtr - withfieldloc(const FieldLoc& fieldloc) const override; - - int64_t - value(int64_t row, int64_t col) const override; - - const IdentitiesPtr - copy_to(kernel::lib ptr_lib) const override; - - /// @brief Returns the element at a given position in the array, handling - /// negative indexing and bounds-checking like Python. - /// - /// The first item in the array is at `0`, the second at `1`, the last at - /// `-1`, the penultimate at `-2`, etc. - const std::vector - getitem_at(int64_t at) const; - - /// @brief Returns the element at a given position in the array, without - /// handling negative indexing or bounds-checking. - const std::vector - getitem_at_nowrap(int64_t at) const; - - /// @brief Subinterval of this array, handling negative indexing - /// and bounds-checking like Python. - /// - /// The first item in the array is at `0`, the second at `1`, the last at - /// `-1`, the penultimate at `-2`, etc. - /// - /// Ranges beyond the array are not an error; they are trimmed to - /// `start = 0` on the left and `stop = length() - 1` on the right. - /// - /// This operation only affects the node metadata; its calculation time - /// does not scale with the size of the array. - const IdentitiesPtr - getitem_range(int64_t start, int64_t stop) const; - - bool - referentially_equal(const IdentitiesPtr& other) const override; - - private: - /// @brief See #ptr. - const std::shared_ptr ptr_; - /// @brief See #ptr_lib. - const kernel::lib ptr_lib_; - }; - -#ifndef AWKWARD_IDENTITIES_NO_EXTERN_TEMPLATE - extern template class IdentitiesOf; - extern template class IdentitiesOf; -#endif - - using Identities32 = IdentitiesOf; - using Identities64 = IdentitiesOf; -} - -#endif // AWKWARD_IDENTITIES_H_ diff --git a/include/awkward/Index.h b/include/awkward/Index.h deleted file mode 100644 index babf9e8198..0000000000 --- a/include/awkward/Index.h +++ /dev/null @@ -1,262 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_INDEX_H_ -#define AWKWARD_INDEX_H_ - -#include -#include -#include - -#include "awkward/common.h" -#include "awkward/util.h" -#include "awkward/kernel-dispatch.h" - -namespace awkward { - template - class IndexOf; - - /// @class Index - /// - /// @brief A contiguous, one-dimensional array of integers used to - /// represent data structures, rather than numerical data in the arrays - /// themselves. - /// - /// The Index superclass abstracts over templated specializations: - /// - /// - {@link IndexOf Index8}, which is `IndexOf` - /// - {@link IndexOf IndexU8}, which is `IndexOf` - /// - {@link IndexOf Index32}, which is `IndexOf` - /// - {@link IndexOf IndexU32}, which is `IndexOf` - /// - {@link IndexOf Index64}, which is `IndexOf` - class LIBAWKWARD_EXPORT_SYMBOL Index { - public: - /// @brief Integer type of an Index, used by ListForm, IndexedForm, etc. - enum class Form {i8, u8, i32, u32, i64, kNumIndexForm}; - - /// @brief Converts a string into a Form enumeration. - static Form - str2form(const std::string& str); - - /// @brief Converts a Form enumeration into a string. - static const std::string - form2str(Form form); - - /// @brief Virtual destructor acts as a first non-inline virtual function - /// that determines a specific translation unit in which vtable shall be - /// emitted. - virtual ~Index(); - - /// @brief Copies this Index node without copying its buffer. - /// - /// See also #deep_copy. - virtual const std::shared_ptr - shallow_copy() const = 0; - - /// @brief Converts this Index to an {@link IndexOf Index64}. - virtual IndexOf - to64() const = 0; - - /// @brief Returns true if this index is contiguous false otherwise. - virtual bool - iscontiguous() const = 0; - }; - - /// @class IndexOf - /// - /// @brief A contiguous, one-dimensional array of integers used to - /// represent data structures, rather than numerical data in the arrays - /// themselves. - /// - /// The Index superclass abstracts over templated specializations: - /// - /// - {@link IndexOf Index8}, which is `IndexOf` - /// - {@link IndexOf IndexU8}, which is `IndexOf` - /// - {@link IndexOf Index32}, which is `IndexOf` - /// - {@link IndexOf IndexU32}, which is `IndexOf` - /// - {@link IndexOf Index64}, which is `IndexOf` - template - class -#ifdef AWKWARD_INDEX_NO_EXTERN_TEMPLATE - LIBAWKWARD_EXPORT_SYMBOL -#endif - IndexOf: public Index { - public: - /// @brief Creates an IndexOf from a full set of parameters. - /// - /// @param ptr Reference-counted pointer to the integer array buffer. - /// @param offset Location of item zero in the buffer, relative to - /// `ptr`, measured in the number of elements. We keep this information in - /// two parameters (`ptr` and `offset`) rather than moving `ptr` so that - /// `ptr` can be reference counted among all arrays that use the same - /// buffer. - /// @param length Number of elements in the array. - /// @param Choose the Kernel Library for this array, default:= kernel::lib::cpu - IndexOf(const std::shared_ptr& ptr, - int64_t offset, - int64_t length, - kernel::lib ptr_lib); - - /// @brief Allocates a new integer array buffer with a given #length. - IndexOf(int64_t length, kernel::lib ptr_lib = kernel::lib::cpu); - - /// @brief Create a zero-length index representing an empty 'advanced' index. - static IndexOf - empty_advanced(); - - /// @brief Returns true if this is an empty 'advanced' index. - bool - is_empty_advanced() const; - - /// @brief Reference-counted pointer to the integer array buffer. - const std::shared_ptr - ptr() const; - - /// @brief The Kernel Library that ptr uses. - kernel::lib - ptr_lib() const; - - /// @brief Raw pointer to the beginning of data (i.e. offset accounted for). - T* - data() const; - - /// @brief Location of item zero in the buffer, relative to - /// #ptr, measured in the number of elements. - /// - /// We keep this information in two parameters - /// (#ptr and #offset) rather than moving #ptr so that #ptr can be - /// reference counted among all arrays that use the same buffer. - int64_t - offset() const; - - /// @brief Number of elements in the array. - int64_t - length() const; - - /// @brief User-friendly name of this class: `"Index8"`, `"IndexU8"`, - /// `"Index32"`, `"IndexU32"`, or `"Index64"`. - const std::string - classname() const; - - /// @brief Returns a string representation of this array (single-line XML). - const std::string - tostring() const; - - /// @brief Internal function to build an output string for #tostring. - /// - /// @param indent Indentation depth as a string of spaces. - /// @param pre Prefix string, usually an opening XML tag. - /// @param post Postfix string, usually a closing XML tag and carriage - /// return. - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const; - - /// @brief Returns the enum describing this Index's integer specialization. - Form - form() const; - - /// @brief Returns the element at a given position in the array, handling - /// negative indexing and bounds-checking like Python. - /// - /// The first item in the array is at `0`, the second at `1`, the last at - /// `-1`, the penultimate at `-2`, etc. - T - getitem_at(int64_t at) const; - - /// @brief Returns the element at a given position in the array, without - /// handling negative indexing or bounds-checking. - T - getitem_at_nowrap(int64_t at) const; - - /// @brief Assigns an integer value (type `T`) in-place. - /// - /// This modifies the array itself. - void - setitem_at_nowrap(int64_t at, T value) const; - - /// @brief Subinterval of this array, handling negative indexing - /// and bounds-checking like Python. - /// - /// The first item in the array is at `0`, the second at `1`, the last at - /// `-1`, the penultimate at `-2`, etc. - /// - /// Ranges beyond the array are not an error; they are trimmed to - /// `start = 0` on the left and `stop = length() - 1` on the right. - /// - /// This operation only affects the node metadata; its calculation time - /// does not scale with the size of the array. - IndexOf - getitem_range(int64_t start, int64_t stop) const; - - /// @brief Subinterval of this array, without handling negative - /// indexing or bounds-checking. - /// - /// If the array has Identities, the identity bounds are checked. - /// - /// This operation only affects the node metadata; its calculation time - /// does not scale with the size of the array. - IndexOf - getitem_range_nowrap(int64_t start, int64_t stop) const; - - /// @brief Internal function used to calculate Content#nbytes. - /// - /// @param largest The largest range of bytes used in each - /// reference-counted pointer (`size_t`). - /// - /// @note This method of accounting for overlapping buffers is - /// insufficient: two nodes could use parts of the same buffer in which - /// one doesn't completely overlap the other. It's not likely, but - /// currently the calculation of Content#nbytes is an underestimate. - void - nbytes_part(std::map& largest) const; - - const std::shared_ptr - shallow_copy() const override; - - IndexOf - to64() const override; - - bool - iscontiguous() const override; - - /// @brief Copies this Index node and all the data in its buffer. - /// - /// See also #shallow_copy. - const IndexOf - deep_copy() const; - - const IndexOf - copy_to(kernel::lib ptr_lib) const; - - bool - referentially_equal(const IndexOf& other) const; - - private: - /// @brief See #ptr. - const std::shared_ptr ptr_; - /// @brief See #ptr_lib - const kernel::lib ptr_lib_; - /// @brief See #offset. - const int64_t offset_; - /// @brief See #length. - const int64_t length_; - bool is_empty_advanced_; - }; - -#ifndef AWKWARD_INDEX_NO_EXTERN_TEMPLATE - extern template class IndexOf; - extern template class IndexOf; - extern template class IndexOf; - extern template class IndexOf; - extern template class IndexOf; -#endif - - using Index8 = IndexOf; - using IndexU8 = IndexOf; - using Index32 = IndexOf; - using IndexU32 = IndexOf; - using Index64 = IndexOf; -} - -#endif // AWKWARD_INDEX_H_ diff --git a/include/awkward/Iterator.h b/include/awkward/Iterator.h deleted file mode 100644 index 858d6fe1b1..0000000000 --- a/include/awkward/Iterator.h +++ /dev/null @@ -1,68 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_ITERATOR_H_ -#define AWKWARD_ITERATOR_H_ - -#include "awkward/common.h" - -namespace awkward { - class Content; - using ContentPtr = std::shared_ptr; - - /// @class Iterator - /// - /// @brief Represents the current state of iteration over a Content array. - /// - /// An Iterator is characterized by its #content (an input parameter) and - /// where it is #at (in-place mutable integer). - /// - /// It can only be modified by calling #next. - class LIBAWKWARD_EXPORT_SYMBOL Iterator { - public: - /// @brief Creates an Iterator from a full set of parameters. - /// - /// @param content The array to iterate over. - Iterator(const ContentPtr& content); - - /// @brief The array to iterate over. - const ContentPtr - content() const; - - /// @brief The current position of the Iterator. - const int64_t - at() const; - - /// @brief If `true`, the Iterator has reached the end of the array and - /// calling #next again would raise an error. If `false`, the Iterator - /// can still be moved forward. - const bool - isdone() const; - - /// @brief Return the current item and then move the pointer to the next. - const ContentPtr - next(); - - /// @brief Internal function to build an output string for #tostring. - /// - /// @param indent Indentation depth as a string of spaces. - /// @param pre Prefix string, usually an opening XML tag. - /// @param post Postfix string, usually a closing XML tag and carriage - /// return. - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const; - - /// @brief Returns a string representation of this array (single-line XML). - const std::string - tostring() const; - - private: - /// @brief See #content. - const ContentPtr content_; - /// @brief See #at. - int64_t at_; - }; -} - -#endif // AWKWARD_ITERATOR_H_ diff --git a/include/awkward/Reducer.h b/include/awkward/Reducer.h deleted file mode 100644 index 17819c3200..0000000000 --- a/include/awkward/Reducer.h +++ /dev/null @@ -1,1295 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_REDUCER_H_ -#define AWKWARD_REDUCER_H_ - -#include -#include - -#include "awkward/common.h" -#include "awkward/Index.h" - -namespace awkward { - /// @class Reducer - /// - /// @brief Abstract class for all reducer algorithms. - /// - /// Reducers have no parameters or state. They are classes for convenience, - /// to separate {@link Content#reduce_next Content::reduce_next}, determining - /// which values to combine, from the choice of reducer algorithm. - class LIBAWKWARD_EXPORT_SYMBOL Reducer { - public: - /// @brief Name of the reducer algorithm. - virtual const std::string - name() const = 0; - - /// @brief Data type to prefer, as a NumPy dtype, if the array has - /// UnknownType. - virtual util::dtype - preferred_dtype() const = 0; - - /// @brief Return type for a `given_dtype` as a NumPy dtype. - virtual util::dtype - return_dtype(util::dtype given_dtype) const; - - /// @brief True if this reducer returns index positions; false otherwise. - virtual bool - returns_positions() const; - - /// @brief Apply the reducer algorithm to an array of boolean values. - /// - /// @param data The array to reduce. - /// @param parents An integer array indicating which group each element - /// belongs to. - /// @param outlength The length of the output array (equal to the number - /// of groups). - virtual const std::shared_ptr - apply_bool(const bool* data, - const Index64& parents, - int64_t outlength) const = 0; - - /// @brief Apply the reducer algorithm to an array of signed 8-bit - /// integer values. - /// - /// @param data The array to reduce. - /// @param parents An integer array indicating which group each element - /// belongs to. - /// @param outlength The length of the output array (equal to the number - /// of groups). - virtual const std::shared_ptr - apply_int8(const int8_t* data, - const Index64& parents, - int64_t outlength) const = 0; - - /// @brief Apply the reducer algorithm to an array of unsigned 8-bit - /// integer values. - /// - /// @param data The array to reduce. - /// @param parents An integer array indicating which group each element - /// belongs to. - /// @param outlength The length of the output array (equal to the number - /// of groups). - virtual const std::shared_ptr - apply_uint8(const uint8_t* data, - const Index64& parents, - int64_t outlength) const = 0; - - /// @brief Apply the reducer algorithm to an array of signed 16-bit - /// integer values. - /// - /// @param data The array to reduce. - /// @param parents An integer array indicating which group each element - /// belongs to. - /// @param outlength The length of the output array (equal to the number - /// of groups). - virtual const std::shared_ptr - apply_int16(const int16_t* data, - const Index64& parents, - int64_t outlength) const = 0; - - /// @brief Apply the reducer algorithm to an array of unsigned 16-bit - /// integer values. - /// - /// @param data The array to reduce. - /// @param parents An integer array indicating which group each element - /// belongs to. - /// @param outlength The length of the output array (equal to the number - /// of groups). - virtual const std::shared_ptr - apply_uint16(const uint16_t* data, - const Index64& parents, - int64_t outlength) const = 0; - - /// @brief Apply the reducer algorithm to an array of signed 32-bit - /// integer values. - /// - /// @param data The array to reduce. - /// @param parents An integer array indicating which group each element - /// belongs to. - /// @param outlength The length of the output array (equal to the number - /// of groups). - virtual const std::shared_ptr - apply_int32(const int32_t* data, - const Index64& parents, - int64_t outlength) const = 0; - - /// @brief Apply the reducer algorithm to an array of unsigned 32-bit - /// integer values. - /// - /// @param data The array to reduce. - /// @param parents An integer array indicating which group each element - /// belongs to. - /// @param outlength The length of the output array (equal to the number - /// of groups). - virtual const std::shared_ptr - apply_uint32(const uint32_t* data, - const Index64& parents, - int64_t outlength) const = 0; - - /// @brief Apply the reducer algorithm to an array of signed 64-bit - /// integer values. - /// - /// @param data The array to reduce. - /// @param parents An integer array indicating which group each element - /// belongs to. - /// @param outlength The length of the output array (equal to the number - /// of groups). - virtual const std::shared_ptr - apply_int64(const int64_t* data, - const Index64& parents, - int64_t outlength) const = 0; - - /// @brief Apply the reducer algorithm to an array of unsigned 64-bit - /// integer values. - /// - /// @param data The array to reduce. - /// @param parents An integer array indicating which group each element - /// belongs to. - /// @param outlength The length of the output array (equal to the number - /// of groups). - virtual const std::shared_ptr - apply_uint64(const uint64_t* data, - const Index64& parents, - int64_t outlength) const = 0; - - /// @brief Apply the reducer algorithm to an array of 32-bit - /// floating-point values. - /// - /// @param data The array to reduce. - /// @param parents An integer array indicating which group each element - /// belongs to. - /// @param outlength The length of the output array (equal to the number - /// of groups). - virtual const std::shared_ptr - apply_float32(const float* data, - const Index64& parents, - int64_t outlength) const = 0; - - /// @brief Apply the reducer algorithm to an array of 64-bit - /// floating-point values. - /// - /// @param data The array to reduce. - /// @param parents An integer array indicating which group each element - /// belongs to. - /// @param outlength The length of the output array (equal to the number - /// of groups). - virtual const std::shared_ptr - apply_float64(const double* data, - const Index64& parents, - int64_t outlength) const = 0; - - /// @brief Apply the reducer algorithm to an array of complex 32-bit - /// floating-point values. - /// - /// @param data The array to reduce. - /// @param parents An integer array indicating which group each element - /// belongs to. - /// @param outlength The length of the output array (equal to the number - /// of groups). - virtual const std::shared_ptr - apply_complex64(const std::complex* data, - const Index64& parents, - int64_t outlength) const = 0; - - /// @brief Apply the reducer algorithm to an array of complex 64-bit - /// floating-point values. - /// - /// @param data The array to reduce. - /// @param parents An integer array indicating which group each element - /// belongs to. - /// @param outlength The length of the output array (equal to the number - /// of groups). - virtual const std::shared_ptr - apply_complex128(const std::complex* data, - const Index64& parents, - int64_t outlength) const = 0; - - /// @brief Apply the reducer algorithm to an array of datetime - /// values. - /// - /// @param data The array to reduce. - /// @param parents An integer array indicating which group each element - /// belongs to. - /// @param outlength The length of the output array (equal to the number - /// of groups). - virtual const std::shared_ptr - apply_datetime(const int64_t* data, - const Index64& parents, - int64_t outlength) const = 0; - - /// @brief Apply the reducer algorithm to an array of timedelta - /// values. - /// - /// @param data The array to reduce. - /// @param parents An integer array indicating which group each element - /// belongs to. - /// @param outlength The length of the output array (equal to the number - /// of groups). - virtual const std::shared_ptr - apply_timedelta(const int64_t* data, - const Index64& parents, - int64_t outlength) const = 0; - - }; - - /// @class ReducerCount - /// - /// @brief Reducer algorithm that simply counts items. The identity is `0`. - /// - /// Reducers have no parameters or state. They are classes for convenience, - /// to separate {@link Content#reduce_next Content::reduce_next}, determining - /// which values to combine, from the choice of reducer algorithm. - class LIBAWKWARD_EXPORT_SYMBOL ReducerCount: public Reducer { - public: - /// @brief Name of the reducer algorithm: `"count"`. - const std::string - name() const override; - - /// @copydoc Reducer::preferred_dtype() - /// - /// The preferred type for ReducerCount is `double`. - util::dtype - preferred_dtype() const override; - - /// @copydoc Reducer::return_dtype() - /// - /// The return type for ReducerCount is `int64`. - util::dtype - return_dtype(util::dtype given_dtype) const override; - - const std::shared_ptr - apply_bool(const bool* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int8(const int8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint8(const uint8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int16(const int16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint16(const uint16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int32(const int32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint32(const uint32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int64(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint64(const uint64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float32(const float* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float64(const double* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex64(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex128(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_datetime(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_timedelta(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - }; - - /// @class ReducerCountNonzero - /// - /// @brief Reducer algorithm that counts non-zero items. The identity is `0`. - /// - /// Reducers have no parameters or state. They are classes for convenience, - /// to separate {@link Content#reduce_next Content::reduce_next}, determining - /// which values to combine, from the choice of reducer algorithm. - class LIBAWKWARD_EXPORT_SYMBOL ReducerCountNonzero: public Reducer { - public: - /// @brief Name of the reducer algorithm: `"count_nonzero"`. - const std::string - name() const override; - - /// @copydoc Reducer::preferred_nptype() - /// - /// The preferred type for ReducerCountNonzero is `double`. - util::dtype - preferred_dtype() const override; - - /// @copydoc Reducer::return_dtype() - /// - /// The return type for ReducerCountNonzero is `int64`. - util::dtype - return_dtype(util::dtype given_dtype) const override; - - const std::shared_ptr - apply_bool(const bool* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int8(const int8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint8(const uint8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int16(const int16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint16(const uint16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int32(const int32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint32(const uint32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int64(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint64(const uint64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float32(const float* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float64(const double* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex64(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex128(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_datetime(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_timedelta(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - }; - - /// @class ReducerSum - /// - /// @brief Reducer algorithm that adds up items. The identity is `0`. - /// - /// Reducers have no parameters or state. They are classes for convenience, - /// to separate {@link Content#reduce_next Content::reduce_next}, determining - /// which values to combine, from the choice of reducer algorithm. - class LIBAWKWARD_EXPORT_SYMBOL ReducerSum: public Reducer { - public: - /// @brief Name of the reducer algorithm: `"sum"`. - const std::string - name() const override; - - /// @copydoc Reducer::preferred_dtype() - /// - /// The preferred type for ReducerSum is `double`. - util::dtype - preferred_dtype() const override; - - /// @copydoc Reducer::return_dtype() - /// - /// The return type for ReducerSum promotes integers and booleans to - /// 64-bit but leaves floating-point number types as they are. - util::dtype - return_dtype(util::dtype given_dtype) const override; - - const std::shared_ptr - apply_bool(const bool* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int8(const int8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint8(const uint8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int16(const int16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint16(const uint16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int32(const int32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint32(const uint32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int64(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint64(const uint64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float32(const float* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float64(const double* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex64(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex128(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_datetime(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_timedelta(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - }; - - /// @class ReducerProd - /// - /// @brief Reducer algorithm that multiplies items. The identity is `1`. - /// - /// Reducers have no parameters or state. They are classes for convenience, - /// to separate {@link Content#reduce_next Content::reduce_next}, determining - /// which values to combine, from the choice of reducer algorithm. - class LIBAWKWARD_EXPORT_SYMBOL ReducerProd: public Reducer { - public: - /// @brief Name of the reducer algorithm: `"prod"`. - const std::string - name() const override; - - /// @copydoc Reducer::preferred_dtype() - /// - /// The preferred type for ReducerProd is `int64`. - util::dtype - preferred_dtype() const override; - - /// @copydoc Reducer::return_dtype() - /// - /// The return type for ReducerProd promotes integers and booleans to - /// 64-bit but leaves floating-point number types as they are. - util::dtype - return_dtype(util::dtype given_dtype) const override; - - const std::shared_ptr - apply_bool(const bool* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int8(const int8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint8(const uint8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int16(const int16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint16(const uint16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int32(const int32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint32(const uint32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int64(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint64(const uint64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float32(const float* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float64(const double* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex64(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex128(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_datetime(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_timedelta(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - }; - - /// @class ReducerAny - /// - /// @brief Reducer algorithm that returns `true` if any values are `true`, - /// `false` otherwise. The identity is `false`. - /// - /// Reducers have no parameters or state. They are classes for convenience, - /// to separate {@link Content#reduce_next Content::reduce_next}, determining - /// which values to combine, from the choice of reducer algorithm. - class LIBAWKWARD_EXPORT_SYMBOL ReducerAny: public Reducer { - public: - /// @brief Name of the reducer algorithm: `"any"`. - const std::string - name() const override; - - /// @copydoc Reducer::preferred_dtype() - /// - /// The preferred type for ReducerAny is `boolean`. - util::dtype - preferred_dtype() const override; - - /// @copydoc Reducer::return_dtype() - /// - /// The return type for ReducerAny is `boolean`. - util::dtype - return_dtype(util::dtype given_dtype) const override; - - const std::shared_ptr - apply_bool(const bool* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int8(const int8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint8(const uint8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int16(const int16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint16(const uint16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int32(const int32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint32(const uint32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int64(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint64(const uint64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float32(const float* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float64(const double* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex64(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex128(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_datetime(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_timedelta(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - }; - - /// @class ReducerAll - /// - /// @brief Reducer algorithm that returns `true` if all values are `true`, - /// `false` otherwise. The identity is `true`. - /// - /// Reducers have no parameters or state. They are classes for convenience, - /// to separate {@link Content#reduce_next Content::reduce_next}, determining - /// which values to combine, from the choice of reducer algorithm. - class LIBAWKWARD_EXPORT_SYMBOL ReducerAll: public Reducer { - public: - /// @brief Name of the reducer algorithm: `"all"`. - const std::string - name() const override; - - /// @copydoc Reducer::preferred_dtype() - /// - /// The preferred type for ReducerAll is `boolean`. - util::dtype - preferred_dtype() const override; - - /// @copydoc Reducer::return_dtype() - /// - /// The return type for ReducerAll is `boolean`. - util::dtype - return_dtype(util::dtype given_dtype) const override; - - const std::shared_ptr - apply_bool(const bool* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int8(const int8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint8(const uint8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int16(const int16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint16(const uint16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int32(const int32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint32(const uint32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int64(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint64(const uint64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float32(const float* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float64(const double* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex64(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex128(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_datetime(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_timedelta(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - }; - - /// @class ReducerMin - /// - /// @brief Reducer algorithm that returns the minimum value. The identity - /// is infinity or the largest possible value. - /// - /// Reducers have no parameters or state. They are classes for convenience, - /// to separate {@link Content#reduce_next Content::reduce_next}, determining - /// which values to combine, from the choice of reducer algorithm. - /// - /// ReducerMin and ReducerMax are exceptions to the no-state rule: they are - /// parameterized by `initial`, used as an initial value in the minimization - /// or maximization. - /// - /// For the complex numbers array it - /// returns the minimum absolute value (also known as norm, modulus, - /// or magnitude) of a complex number. - class LIBAWKWARD_EXPORT_SYMBOL ReducerMin: public Reducer { - public: - ReducerMin(double initial_f64, uint64_t initial_u64, int64_t initial_i64); - ReducerMin(); - - /// @brief Name of the reducer algorithm: `"min"`. - const std::string - name() const override; - - /// @copydoc Reducer::preferred_dtype() - /// - /// The preferred type for ReducerMin is `double`. - util::dtype - preferred_dtype() const override; - - const std::shared_ptr - apply_bool(const bool* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int8(const int8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint8(const uint8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int16(const int16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint16(const uint16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int32(const int32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint32(const uint32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int64(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint64(const uint64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float32(const float* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float64(const double* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex64(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex128(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_datetime(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_timedelta(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - private: - double initial_f64_; - uint64_t initial_u64_; - int64_t initial_i64_; - bool has_initial_; - }; - - /// @class ReducerMax - /// - /// @brief Reducer algorithm that returns the maximum value. The identity - /// is minus infinity or the smallest possible value. - /// - /// Reducers have no parameters or state. They are classes for convenience, - /// to separate {@link Content#reduce_next Content::reduce_next}, determining - /// which values to combine, from the choice of reducer algorithm. - /// - /// ReducerMin and ReducerMax are exceptions to the no-state rule: they are - /// parameterized by `initial`, used as an initial value in the minimization - /// or maximization. - /// - /// For the complex numbers array it - /// returns the minimum absolute value (also known as norm, modulus, - /// or magnitude) of a complex number. - class LIBAWKWARD_EXPORT_SYMBOL ReducerMax: public Reducer { - public: - ReducerMax(double initial_f64_, uint64_t initial_u64_, int64_t initial_i64_); - ReducerMax(); - - /// @brief Name of the reducer algorithm: `"max"`. - const std::string - name() const override; - - /// @copydoc Reducer::preferred_dtype() - /// - /// The preferred type for ReducerMax is `double`. - util::dtype - preferred_dtype() const override; - - const std::shared_ptr - apply_bool(const bool* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int8(const int8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint8(const uint8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int16(const int16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint16(const uint16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int32(const int32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint32(const uint32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int64(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint64(const uint64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float32(const float* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float64(const double* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex64(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex128(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_datetime(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_timedelta(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - private: - double initial_f64_; - uint64_t initial_u64_; - int64_t initial_i64_; - bool has_initial_; - }; - - /// @class ReducerArgmin - /// - /// @brief Reducer algorithm that returns the position of the minimum value. - /// The identity is meaningless and should be covered using `mask = true`. - /// - /// Reducers have no parameters or state. They are classes for convenience, - /// to separate {@link Content#reduce_next Content::reduce_next}, determining - /// which values to combine, from the choice of reducer algorithm. - /// - /// For the complex numbers array it - /// returns the position of the minimum absolute value (also known as norm, - /// modulus, or magnitude) of a complex number. - class LIBAWKWARD_EXPORT_SYMBOL ReducerArgmin: public Reducer { - public: - /// @brief Name of the reducer algorithm: `"argmin"`. - const std::string - name() const override; - - /// @copydoc Reducer::preferred_dtype() - /// - /// The preferred type for ReducerArgmin is `int64`. - util::dtype - preferred_dtype() const override; - - /// @copydoc Reducer::return_dtype() - /// - /// The return type for ReducerArgmin is `int64`. - util::dtype - return_dtype(util::dtype given_dtype) const override; - - /// @copydoc Reducer::returns_positions() - /// - /// This is always true. - virtual bool - returns_positions() const override; - - const std::shared_ptr - apply_bool(const bool* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int8(const int8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint8(const uint8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int16(const int16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint16(const uint16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int32(const int32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint32(const uint32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int64(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint64(const uint64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float32(const float* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float64(const double* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex64(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex128(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_datetime(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_timedelta(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - }; - - /// @class ReducerArgmax - /// - /// @brief Reducer algorithm that returns the position of the maximum value. - /// The identity is meaningless and should be covered using `mask = true`. - /// - /// Reducers have no parameters or state. They are classes for convenience, - /// to separate {@link Content#reduce_next Content::reduce_next}, determining - /// which values to combine, from the choice of reducer algorithm. - /// - /// For the complex numbers array it - /// returns the position of the maximum absolute value (also known as norm, - /// modulus, or magnitude) of a complex number. - class LIBAWKWARD_EXPORT_SYMBOL ReducerArgmax: public Reducer { - public: - /// @brief Name of the reducer algorithm: `"argmax"`. - const std::string - name() const override; - - /// @copydoc Reducer::preferred_dtype() - /// - /// The preferred type for ReducerArgmax is `int64`. - util::dtype - preferred_dtype() const override; - - /// @copydoc Reducer::return_dtype() - /// - /// The return type for ReducerArgmax is `int64`. - util::dtype - return_dtype(util::dtype given_dtype) const override; - - /// @copydoc Reducer::returns_positions() - /// - /// This is always true. - virtual bool - returns_positions() const override; - - const std::shared_ptr - apply_bool(const bool* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int8(const int8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint8(const uint8_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int16(const int16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint16(const uint16_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int32(const int32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint32(const uint32_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_int64(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_uint64(const uint64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float32(const float* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_float64(const double* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex64(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_complex128(const std::complex* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_datetime(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - - const std::shared_ptr - apply_timedelta(const int64_t* data, - const Index64& parents, - int64_t outlength) const override; - }; - -} - -#endif // AWKWARD_REDUCER_H_ diff --git a/include/awkward/Slice.h b/include/awkward/Slice.h deleted file mode 100644 index bd36428343..0000000000 --- a/include/awkward/Slice.h +++ /dev/null @@ -1,721 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_SLICE_H_ -#define AWKWARD_SLICE_H_ - -#include -#include -#include - -#include "awkward/common.h" -#include "awkward/Index.h" - -namespace awkward { - class SliceItem; - using SliceItemPtr = std::shared_ptr; - - /// @class SliceItem - /// - /// @brief Abstract class for slice items, which are elements of a tuple - /// passed to an array's `__getitem__` in Python. - class LIBAWKWARD_EXPORT_SYMBOL SliceItem { - public: - /// @brief Virtual destructor acts as a first non-inline virtual function - /// that determines a specific translation unit in which vtable shall be - /// emitted. - virtual ~SliceItem(); - - /// @brief Copies this node without copying any associated arrays. - virtual const SliceItemPtr - shallow_copy() const = 0; - - /// @brief Returns a string representation of this slice item (single-line - /// custom format). - virtual const std::string - tostring() const = 0; - - /// @brief Returns `true` if this slice would preserve an array's slice - /// and therefore should pass on - /// {@link Content#parameters Content::parameters}. - /// - /// @param advanced The index that is passed through - /// {@link Content#getitem_next Content::getitem_next}. - virtual bool - preserves_type(const Index64& advanced) const = 0; - - /// @brief Returns `true` if this slice item has all the same buffers and - /// parameters as `other`; `false` otherwise. - /// - /// @param other The slice item to compare this with. - virtual bool - referentially_equal(const SliceItemPtr& other) const = 0; - }; - - /// @class SliceAt - /// - /// @brief Represents an integer in a tuple of slices passed to - /// `__getitem__` in Python. - class LIBAWKWARD_EXPORT_SYMBOL SliceAt: public SliceItem { - public: - /// @brief Creates a SliceAt from a full set of parameters. - /// - /// @param at The integer that this slice item represents. - SliceAt(int64_t at); - - /// @brief The integer that this slice item represents. - int64_t - at() const; - - const SliceItemPtr - shallow_copy() const override; - - const std::string - tostring() const override; - - /// @copydoc SliceItem::preserves_type() - /// - /// Always `false` for SliceAt. - bool - preserves_type(const Index64& advanced) const override; - - virtual bool - referentially_equal(const SliceItemPtr& other) const override; - - private: - /// @brief See #at. - const int64_t at_; - }; - - /// @class SliceRange - /// - /// @brief Represents a Python `slice` object (usual syntax: - /// `array[start:stop:step]`). - class LIBAWKWARD_EXPORT_SYMBOL SliceRange: public SliceItem { - public: - /// @brief Creates a SliceRange from a full set of parameters. - /// - /// @param start The inclusive starting position. - /// @param stop The exclusive stopping position. - /// @param step The step size, which may be negative but must not be zero. - /// - /// Any #start, #stop, or #step may be - /// {@link Slice#none Slice::none}. Appropriate values are - /// derived from an array's {@link Content#length length} the same way - /// they are in Python. - SliceRange(int64_t start, int64_t stop, int64_t step); - - /// @brief The inclusive starting position. - /// - /// This value may be {@link Slice#none Slice::none}; if so, - /// the value used would be derived from an array's - /// {@link Content#length length} the same way they are in Python. - int64_t - start() const; - - /// @brief The exclusive stopping position. - /// - /// This value may be {@link Slice#none Slice::none}; if so, - /// the value used would be derived from an array's - /// {@link Content#length length} the same way they are in Python. - int64_t - stop() const; - - /// @brief The step size, which may be negative but must not be zero. - /// - /// This value may be {@link Slice#none Slice::none}; if so, - /// the value used would be derived from an array's - /// {@link Content#length length} the same way they are in Python. - int64_t - step() const; - - /// @brief Returns `true` if #start is not - /// {@link Slice#none Slice::none}; `false` otherwise. - bool - hasstart() const; - - /// @brief Returns `true` if #stop is not - /// {@link Slice#none Slice::none}; `false` otherwise. - bool - hasstop() const; - - const SliceItemPtr - shallow_copy() const override; - - const std::string - tostring() const override; - - /// @copydoc SliceItem::preserves_type() - /// - /// Always `true` for SliceRange. - bool - preserves_type(const Index64& advanced) const override; - - virtual bool - referentially_equal(const SliceItemPtr& other) const override; - - private: - /// @brief See #start. - const int64_t start_; - /// @brief See #stop. - const int64_t stop_; - /// @brief See #step. - const int64_t step_; - }; - - /// @class SliceEllipsis - /// - /// @brief Represents a Python `Ellipsis` object (usual syntax: - /// `array[...]`). - class LIBAWKWARD_EXPORT_SYMBOL SliceEllipsis: public SliceItem { - public: - /// @brief Creates a SliceEllipsis. - SliceEllipsis(); - - const SliceItemPtr - shallow_copy() const override; - - const std::string - tostring() const override; - - /// @copydoc SliceItem::preserves_type() - /// - /// Always `true` for SliceEllipsis. - bool - preserves_type(const Index64& advanced) const override; - - virtual bool - referentially_equal(const SliceItemPtr& other) const override; - }; - - /// @class SliceNewAxis - /// - /// @brief Represents NumPy's - /// [newaxis](https://docs.scipy.org/doc/numpy/reference/constants.html#numpy.newaxis) - /// marker (a.k.a. `None`), which prompts `__getitem__` to insert a - /// length-1 regular dimension (RegularArray) at some point in the slice - /// tuple. - class LIBAWKWARD_EXPORT_SYMBOL SliceNewAxis: public SliceItem { - public: - /// @brief Creates a SliceNewAxis. - SliceNewAxis(); - - const SliceItemPtr - shallow_copy() const override; - - const std::string - tostring() const override; - - /// @copydoc SliceItem::preserves_type() - /// - /// Always `false` for SliceNewAxis. - bool - preserves_type(const Index64& advanced) const override; - - virtual bool - referentially_equal(const SliceItemPtr& other) const override; - }; - - /// @class SliceArrayOf - /// - /// @brief Represents an array of integers in a slice (possibly converted - /// from an array of booleans). - /// - /// Currently, the only type specialization is `T = int64_t`. - template - class -#ifdef AWKWARD_SLICE_NO_EXTERN_TEMPLATE - LIBAWKWARD_EXPORT_SYMBOL -#endif - SliceArrayOf: public SliceItem { - public: - /// @brief Creates a SliceArrayOf from a full set of parameters. - /// - /// @param index A flattened version of the array used for slicing. - /// If the original array was multidimensional, the shape/strides are - /// stored separately. - /// @param shape Number of elements in each dimension, like NumPy's - /// array shape. - /// Note that unlike {@link NumpyArray#shape NumpyArray::shape}, the - /// integer type is `int64_t`, rather than `ssize_t`, and it must be - /// at least one-dimensional. - /// @param strides Length of each dimension in number of items. The length - /// of strides must match the length of `shape`. - /// Note that unlike {@link NumpyArray#shape NumpyArray::strides}, the - /// integer type is `int64_t`, rather than `ssize_t`, and it quantifies - /// the number of items, not the number of bytes. - /// @param frombool If `true`, this integer array of positions was - /// derived from a boolean array mask (via `numpy.nonzero` or - /// equivalent); `false` otherwise. - SliceArrayOf(const IndexOf& index, - const std::vector& shape, - const std::vector& strides, bool frombool); - - /// @brief A flattened version of the array used for slicing. - /// - /// If the original array was multidimensional, the shape/strides are - /// stored separately. - const IndexOf - index() const; - - /// @brief Number of elements in each dimension, like NumPy's - /// array shape. - /// - /// Note that unlike {@link NumpyArray#shape NumpyArray::shape}, the - /// integer type is `int64_t`, rather than `ssize_t`, and it must be - /// at least one-dimensional. - const std::vector - shape() const; - - /// @brief Length of each dimension in number of items. The length - /// of strides must match the length of `shape`. - /// - /// Note that unlike {@link NumpyArray#shape NumpyArray::strides}, the - /// integer type is `int64_t`, rather than `ssize_t`, and it quantifies - /// the number of items, not the number of bytes. - const std::vector - strides() const; - - /// @brief If `true`, this integer array of positions was - /// derived from a boolean array mask (from NumPy's - /// [nonzero](https://docs.scipy.org/doc/numpy/reference/generated/numpy.nonzero.html) - /// or equivalent); `false` otherwise. - bool - frombool() const; - - /// @brief The length of the logical array: `shape[0]`. - /// - /// If the array is one-dimensional, this is equal to `array.length()`. - const int64_t - length() const; - - /// @brief The number of dimensions: `shape.size()`. - int64_t - ndim() const; - - const SliceItemPtr - shallow_copy() const override; - - const std::string - tostring() const override; - - const std::string - tostring_part() const; - - /// @copydoc SliceItem::preserves_type() - /// - /// This is `true` for SliceArrayOf if `advanced.length() == 0`, `false` - /// otherwise. - bool - preserves_type(const Index64& advanced) const override; - - virtual bool - referentially_equal(const SliceItemPtr& other) const override; - - /// @brief Returns a one-dimensional contiguous version of the array, - /// like NumPy's [ravel](https://docs.scipy.org/doc/numpy/reference/generated/numpy.ravel.html). - const IndexOf - ravel() const; - - private: - /// @brief See #index. - const IndexOf index_; - /// @brief See #shape. - const std::vector shape_; - /// @brief See #strides. - const std::vector strides_; - /// @brief See #frombool. - bool frombool_; - }; - -#ifndef AWKWARD_SLICE_NO_EXTERN_TEMPLATE - extern template class SliceArrayOf; -#endif - - using SliceArray64 = SliceArrayOf; - - /// @class SliceField - /// - /// @brief Represents a single string in a slice tuple, indicating that a - /// RecordArray should be replaced by one of its fields. - class LIBAWKWARD_EXPORT_SYMBOL SliceField: public SliceItem { - public: - /// @brief Creates a SliceField from a full set of parameters. - /// - /// @param key The name of the field to select. - /// This may be an element of a - /// {@link RecordArray#recordlookup RecordArray::recordlookup} or a - /// {@link RecordArray#fieldindex RecordArray::fieldindex} integer - /// as a string. - SliceField(const std::string& key); - - /// @brief The name of the field to select. - /// - /// This may be an element of a - /// {@link RecordArray#recordlookup RecordArray::recordlookup} or a - /// {@link RecordArray#fieldindex RecordArray::fieldindex} integer - /// as a string. - const std::string - key() const; - - const SliceItemPtr - shallow_copy() const override; - - const std::string - tostring() const override; - - /// @copydoc SliceItem::preserves_type() - /// - /// Always `false` for SliceField. - bool - preserves_type(const Index64& advanced) const override; - - virtual bool - referentially_equal(const SliceItemPtr& other) const override; - - private: - /// @brief See #key. - const std::string key_; - }; - - /// @class SliceField - /// - /// @brief Represents a list of strings in a slice tuple, indicating that a - /// RecordArray should be replaced by a subset of its fields. - class LIBAWKWARD_EXPORT_SYMBOL SliceFields: public SliceItem { - public: - /// @brief Creates a SliceFields from a full set of parameters. - /// - /// @param keys The names of the fields to select. - /// This may be elements of a - /// {@link RecordArray#recordlookup RecordArray::recordlookup} or - /// {@link RecordArray#fieldindex RecordArray::fieldindex} integers - /// as strings. - SliceFields(const std::vector& keys); - - /// @brief The names of the fields to select. - /// - /// This may be elements of a - /// {@link RecordArray#recordlookup RecordArray::recordlookup} or - /// {@link RecordArray#fieldindex RecordArray::fieldindex} integers - /// as strings. - const std::vector - keys() const; - - const SliceItemPtr - shallow_copy() const override; - - const std::string - tostring() const override; - - /// @copydoc SliceItem::preserves_type() - /// - /// Always `false` for SliceFields. - bool - preserves_type(const Index64& advanced) const override; - - virtual bool - referentially_equal(const SliceItemPtr& other) const override; - - private: - /// @brief See #keys. - const std::vector keys_; - }; - - /// @class SliceMissingOf - /// - /// @brief Represents a SliceArrayOf, SliceMissingOf, or SliceJaggedOf - /// with missing values: `None` (no equivalent in NumPy). - /// - /// Currently, the only type specialization is `T = int64_t`. - template - class -#ifdef AWKWARD_SLICE_NO_EXTERN_TEMPLATE - LIBAWKWARD_EXPORT_SYMBOL -#endif - SliceMissingOf: public SliceItem { - public: - /// @brief Creates a SliceMissingOf with a full set of parameters. - /// - /// @param index Positions in the #content or negative values representing - /// `None` in the same sense as {@link IndexedArrayOf IndexedOptionArray}. - /// @param originalmask The array of booleans from which the #index was - /// derived. - /// @param content The non-`None` values of the array, much like an - /// IndexedOptionArray's {@link IndexedArrayOf#content content}. - SliceMissingOf(const IndexOf& index, - const Index8& originalmask, - const SliceItemPtr& content); - - /// @brief Positions in the #content or negative values representing - /// `None` in the same sense as {@link IndexedArrayOf IndexedOptionArray}. - const IndexOf - index() const; - - /// @brief The array of booleans from which the #index was - /// derived. - const Index8 - originalmask() const; - - /// @brief The non-`None` values of the array, much like an - /// IndexedOptionArray's {@link IndexedArrayOf#content content}. - const SliceItemPtr - content() const; - - /// @brief The length of the array: `len(index)`. - int64_t - length() const; - - const SliceItemPtr - shallow_copy() const override; - - const std::string - tostring() const override; - - const std::string - tostring_part() const; - - /// @copydoc SliceItem::preserves_type() - /// - /// Always `true` for SliceMissingOf. - /// - /// @note This might not be the right choice; it should be revisited. - bool - preserves_type(const Index64& advanced) const override; - - virtual bool - referentially_equal(const SliceItemPtr& other) const override; - - private: - /// @brief See #index. - const IndexOf index_; - /// @brief See #originalmask. - const Index8 originalmask_; - /// @brief See #content. - const SliceItemPtr content_; - }; - -#ifndef AWKWARD_SLICE_NO_EXTERN_TEMPLATE - extern template class SliceMissingOf; -#endif - - using SliceMissing64 = SliceMissingOf; - - /// @class SliceJaggedOf - /// - /// @brief Represents an array of nested lists, where the #content - /// may be SliceArrayOf, SliceMissingOf, or SliceJaggedOf - /// (no equivalent in NumPy). - /// - /// Currently, the only type specialization is `T = int64_t`. - template - class -#ifdef AWKWARD_SLICE_NO_EXTERN_TEMPLATE - LIBAWKWARD_EXPORT_SYMBOL -#endif - SliceJaggedOf: public SliceItem { - public: - /// @brief Creates a SliceJaggedOf with a full set of parameters. - /// - /// @param offsets Positions where one nested list stops and the next - /// starts in the #content in the same sense as - /// {@link ListOffsetArrayOf ListOffsetArray}. - /// The `offsets` must be monotonically increasing and its length is one - /// greater than the length of the array it represents. As such, it must - /// always have at least one element. - /// @param content The contiguous content of the nested lists, like - /// ListOffsetArray's {@link ListOffsetArrayOf#content content}. - SliceJaggedOf(const IndexOf& offsets, const SliceItemPtr& content); - - /// @brief Positions where one nested list stops and the next - /// starts in the #content in the same sense as - /// {@link ListOffsetArrayOf ListOffsetArray}. - /// - /// The `offsets` must be monotonically increasing and its length is one - /// greater than the length of the array it represents. As such, it must - /// always have at least one element. - const IndexOf - offsets() const; - - /// @brief The contiguous content of the nested lists, like - /// ListOffsetArray's {@link ListOffsetArrayOf#content content}. - const SliceItemPtr - content() const; - - /// @brief The length of the array: `len(offsets) - 1`. - int64_t - length() const; - - const SliceItemPtr - shallow_copy() const override; - - const std::string - tostring() const override; - - const std::string - tostring_part() const; - - /// @copydoc SliceItem::preserves_type() - /// - /// Always `true` for SliceJaggedOf. - /// - /// @note This might not be the right choice; it should be revisited. - bool - preserves_type(const Index64& advanced) const override; - - virtual bool - referentially_equal(const SliceItemPtr& other) const override; - - private: - /// @brief See #offsets. - const IndexOf offsets_; - /// @brief See #content. - const SliceItemPtr content_; - }; - -#ifndef AWKWARD_SLICE_NO_EXTERN_TEMPLATE - extern template class SliceJaggedOf; -#endif - - using SliceJagged64 = SliceJaggedOf; - - /// @class Slice - /// - /// @brief A sequence of SliceItem objects representing a tuple passed - /// to Python's `__getitem__`. - class LIBAWKWARD_EXPORT_SYMBOL Slice { - public: - /// @brief Represents a missing {@link SliceRange#start start}, - /// {@link SliceRange#stop stop}, or {@link SliceRange#step step} - /// in a SliceRange. - static int64_t none(); - - /// @brief Creates a Slice with a full set of parameters. - /// - /// @param items The SliceItem objects in this Slice. - /// @param sealed If `true`, the Slice is immutable and #append will fail. - /// Otherwise, the #items may be appended to. - Slice(const std::vector& items, bool sealed); - - /// @brief Creates an "unsealed" Slice, to which we can still add - /// SliceItem objects (with #append). - /// @param items The SliceItem objects in this Slice. - Slice(const std::vector& items); - - /// @brief Creates an empty Slice. - Slice(); - - /// @brief The SliceItem objects in this Slice. - const std::vector - items() const; - - /// @brief If `true`, the Slice is immutable and #append will fail. - /// Otherwise, the #items may be appended to. - bool - sealed() const; - - /// @brief The number of SliceItem objects in #items. - int64_t - length() const; - - /// @brief The number of SliceAt, SliceRange, and SliceArrayOf objects - /// in the #items. - int64_t - dimlength() const; - - /// @brief Returns a pointer to the first SliceItem. - const SliceItemPtr - head() const; - - /// @brief Returns a Slice representing all but the first SliceItem. - const Slice - tail() const; - - /// @brief Returns a Slice containing only SliceField and SliceFields. - const Slice - only_fields() const; - - /// @brief Returns a Slice without any SliceField or SliceFields. - const Slice - not_fields() const; - - /// @brief Returns a string representation of this slice item (single-line - /// custom format). - const std::string - tostring() const; - - /// @brief Returns a new Slice with `item` prepended. - const Slice - prepended(const SliceItemPtr& item) const; - - /// @brief Inserts a SliceItem in-place at the end of the #items. - void - append(const SliceItemPtr& item); - - /// @brief Inserts a SliceAt in-place at the end of the #items. - void - append(const SliceAt& item); - - /// @brief Inserts a SliceRange in-place at the end of the #items. - void - append(const SliceRange& item); - - /// @brief Inserts a SliceEllipsis in-place at the end of the #items. - void - append(const SliceEllipsis& item); - - /// @brief Inserts a SliceNewAxis in-place at the end of the #items. - void - append(const SliceNewAxis& item); - - /// @brief Inserts a {@link SliceArrayOf SliceArray64} in-place at the end - /// of the #items. - void - append(const SliceArray64& item); - - /// @brief Inserts a SliceField in-place at the end of the #items. - void - append(const SliceField& item); - - /// @brief Inserts a SliceFields in-place at the end of the #items. - void - append(const SliceFields& item); - - /// @brief Inserts a {@link SliceMissingOf SliceMissing64} in-place at the - /// end of the #items. - void - append(const SliceMissing64& item); - - /// @brief Inserts a {@link SliceJaggedOf SliceJagged64} in-place at the - /// end of the #items. - void - append(const SliceJagged64& item); - - /// @brief Seal this Slice so that it is no longer open to #append. - void - become_sealed(); - - /// @brief Returns `true` if the Slice contains SliceArrayOf; `false` - /// otherwise. - /// - /// This function can only be called when the Slice is sealed (see - /// #Slice and #become_sealed). - bool - isadvanced() const; - - /// @brief Returns `true` if this slice has all the same buffers and - /// parameters as `other`; `false` otherwise. - /// - /// @param other The slice to compare this with. - bool - referentially_equal(const Slice& other) const; - - private: - /// @brief See #items. - std::vector items_; - /// @brief See #sealed. - bool sealed_; - }; - -} - -#endif // AWKWARD_SLICE_H_ diff --git a/include/awkward/array/BitMaskedArray.h b/include/awkward/array/BitMaskedArray.h deleted file mode 100644 index d5dcbcf4ce..0000000000 --- a/include/awkward/array/BitMaskedArray.h +++ /dev/null @@ -1,493 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_BITMASKEDARRAY_H_ -#define AWKWARD_BITMASKEDARRAY_H_ - -#include -#include -#include - -#include "awkward/common.h" -#include "awkward/Slice.h" -#include "awkward/Index.h" -#include "awkward/Content.h" - -namespace awkward { - template - class IndexedArrayOf; - - class ByteMaskedArray; - - /// @class BitMaskedForm - /// - /// @brief Form describing BitMaskedArray. - class LIBAWKWARD_EXPORT_SYMBOL BitMaskedForm: public Form { - public: - /// @brief Creates a BitMaskedForm. See BitMaskedArray for documentation. - BitMaskedForm(bool has_identities, - const util::Parameters& parameters, - const FormKey& form_key, - Index::Form mask, - const FormPtr& content, - bool valid_when, - bool lsb_order); - - Index::Form - mask() const; - - const FormPtr - content() const; - - bool - valid_when() const; - - bool - lsb_order() const; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - void - tojson_part(ToJson& builder, bool verbose) const override; - - const FormPtr - shallow_copy() const override; - - const FormPtr - with_form_key(const FormKey& form_key) const override; - - const std::string - purelist_parameter(const std::string& key) const override; - - bool - purelist_isregular() const override; - - int64_t - purelist_depth() const override; - - bool - dimension_optiontype() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - bool - equal(const FormPtr& other, - bool check_identities, - bool check_parameters, - bool check_form_key, - bool compatibility_check) const override; - - virtual const FormPtr - getitem_range() const override; - - const FormPtr - getitem_field(const std::string& key) const override; - - const FormPtr - getitem_fields(const std::vector& keys) const override; - - const FormPtr - simplify_optiontype() const; - - private: - Index::Form mask_; - const FormPtr content_; - bool valid_when_; - bool lsb_order_; - }; - - /// @class BitMaskedArray - /// - /// @brief Represents potentially missing data by overlaying a bit #mask - /// over its #content. - /// - /// See #BitMaskedArray for the meaning of each parameter. - class LIBAWKWARD_EXPORT_SYMBOL BitMaskedArray: public Content { - public: - /// @brief Creates an BitMaskedArray from a full set of parameters. - /// - /// @param identities Optional Identities for each element of the array - /// (may be `nullptr`). - /// @param parameters String-to-JSON map that augments the meaning of this - /// array. - /// @param mask Mask in which each bit represents a missing value (`None`) - /// or a valid value (from #content). - /// The interpretation depends on #valid_when; only bits that are - /// equal to #valid_when are not `None`. (Any non-zero value of #valid_when - /// is equivalent to a `1` bit.) - /// @param content Data to be masked; `mask[i]` corresponds to `content[i]` - /// for all `i`. - /// @param valid_when Interpretation of the boolean bytes in #mask as - /// `None` or valid values from #content. Only boolean bytes that are - /// equal to valid_when are not `None`. - /// @param length Length of the array, since it cannot be determined from - /// the #mask without an 8-fold ambiguity. - /// @param lsb_order If `true`, the bits in each byte of the #mask are - /// taken to be in - /// [Least Significant Bit (LSB)](https://en.wikipedia.org/wiki/Bit_numbering#LSB_0_bit_numbering) - /// order; if `false`, they are taken to be in - /// [Most Significant Bit (MSB)](https://en.wikipedia.org/wiki/Bit_numbering#MSB_0_bit_numbering) - /// order. - /// - /// Any non-zero value of a boolean byte and #valid_when are equivalent. - BitMaskedArray(const IdentitiesPtr& identities, - const util::Parameters& parameters, - const IndexU8& mask, - const ContentPtr& content, - bool valid_when, - int64_t length, - bool lsb_order); - - /// @brief Mask in which each bit represents a missing value (`None`) - /// or a valid value (from #content). - /// - /// The interpretation depends on #valid_when; only bits that are - /// equal to #valid_when are not `None`. (Any non-zero value of #valid_when - /// is equivalent to a `1` bit.) - const IndexU8 - mask() const; - - /// @brief Data to be masked; `mask[i]` corresponds to `content[i*8]` - /// through `content[i*8 + 7]` (inclusive) for all `i`. - const ContentPtr - content() const; - - /// @brief Interpretation of the boolean bytes in #mask as `None` or - /// valid values from #content. Only boolean bytes that are equal to - /// valid_when are not `None`. (Any non-zero value of a boolean byte - /// and `valid_when` are equivalent.) - bool - valid_when() const; - - /// @brief If `true`, the bits in each byte of the #mask are - /// taken to be in - /// [Least Significant Bit (LSB)](https://en.wikipedia.org/wiki/Bit_numbering#LSB_0_bit_numbering) - /// order; if `false`, they are taken to be in - /// [Most Significant Bit (MSB)](https://en.wikipedia.org/wiki/Bit_numbering#MSB_0_bit_numbering) - /// order. - bool - lsb_order() const; - - /// @brief Return an array with the same type as #content with `None` - /// values removed. - const ContentPtr - project() const; - - /// @brief Performs a set-union of a given `mask` with the missing values - /// and calls #project. - /// - /// @param mask A byte mask that is valid when `0`, `None` when `1`. - const ContentPtr - project(const Index8& mask) const; - - /// @brief Expands the #mask to a byte-valued mask with a fixed - /// interpretation: missing values are `1` and valid values are `0` - /// (as though #valid_when were `false`). - const Index8 - bytemask() const; - - /// @brief If the #content also has OptionType, combine the #mask with - /// the #content's indicator of missing values; also combine if the - /// #content is a non-OptionType {@link IndexedArrayOf IndexedArray}. - /// - /// This is a shallow operation: it only checks the content one level deep. - const ContentPtr - simplify_optiontype() const; - - /// @brief Converts this array into a ByteMaskedArray. - const std::shared_ptr - toByteMaskedArray() const; - - /// @brief Converts this array into an - /// {@link IndexedArrayOf IndexedOptionArray} with the same missing values. - const std::shared_ptr> - toIndexedOptionArray64() const; - - /// @brief User-friendly name of this class: `"BitMaskedArray"`. - const std::string - classname() const override; - - void - setidentities() override; - - void - setidentities(const IdentitiesPtr& identities) override; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - const FormPtr - form(bool materialize) const override; - - kernel::lib - kernels() const override; - - void - caches(std::vector& out) const override; - - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - void - tojson_part(ToJson& builder, bool include_beginendlist) const override; - - void - nbytes_part(std::map& largest) const override; - - /// @copydoc Content::length() - /// - /// Note that this is an input parameter. - int64_t - length() const override; - - const ContentPtr - shallow_copy() const override; - - const ContentPtr - deep_copy(bool copyarrays, - bool copyindexes, - bool copyidentities) const override; - - void - check_for_iteration() const override; - - const ContentPtr - getitem_nothing() const override; - - const ContentPtr - getitem_at(int64_t at) const override; - - const ContentPtr - getitem_at_nowrap(int64_t at) const override; - - const ContentPtr - getitem_range(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_range_nowrap(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_field(const std::string& key) const override; - - const ContentPtr - getitem_field(const std::string& key, - const Slice& only_fields) const override; - - const ContentPtr - getitem_fields(const std::vector& keys) const override; - - const ContentPtr - getitem_fields(const std::vector& keys, - const Slice& only_fields) const override; - - const ContentPtr - getitem_next(const SliceItemPtr& head, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - carry(const Index64& carry, bool allow_lazy) const override; - - int64_t - purelist_depth() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - // operations - const std::string - validityerror(const std::string& path) const override; - - /// @copydoc Content::shallow_simplify() - /// - /// For BitMaskedArray, this method returns #simplify_optiontype. - const ContentPtr - shallow_simplify() const override; - - const ContentPtr - num(int64_t axis, int64_t depth) const override; - - const std::pair - offsets_and_flattened(int64_t axis, int64_t depth) const override; - - bool - mergeable(const ContentPtr& other, bool mergebool) const override; - - bool - referentially_equal(const ContentPtr& other) const override; - - const ContentPtr - reverse_merge(const ContentPtr& other) const override; - - const ContentPtr - mergemany(const ContentPtrVec& others) const override; - - const SliceItemPtr - asslice() const override; - - const ContentPtr - fillna(const ContentPtr& value) const override; - - const ContentPtr - rpad(int64_t target, int64_t axis, int64_t depth) const override; - - const ContentPtr - rpad_and_clip(int64_t target, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - reduce_next(const Reducer& reducer, - int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool mask, - bool keepdims) const override; - - const ContentPtr - sort_next(int64_t negaxis, - const Index64& starts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - argsort_next(int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - localindex(int64_t axis, int64_t depth) const override; - - const ContentPtr - combinations(int64_t n, - bool replacement, - const util::RecordLookupPtr& recordlookup, - const util::Parameters& parameters, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - getitem_next(const SliceAt& at, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceRange& range, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceArray64& array, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceJagged64& jagged, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceArray64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceMissing64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceJagged64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - copy_to(kernel::lib ptr_lib) const override; - - const ContentPtr - numbers_to_type(const std::string& name) const override; - - /// @brief Returns 'true' if all components of the array are unique - bool - is_unique() const override; - - /// @brief Returns an array where all components are unique - const ContentPtr - unique() const override; - - /// @brief Returns 'true' if subranges are equal - bool - is_subrange_equal(const Index64& start, const Index64& stop) const override; - - private: - /// @brief See #mask. - const IndexU8 mask_; - /// @brief See #content. - const ContentPtr content_; - /// @brief See #valid_when. - const bool valid_when_; - /// @brief See #length. - const int64_t length_; - /// @brief See #order. - const bool lsb_order_; - }; - -} - -#endif // AWKWARD_BITMASKEDARRAY_H_ diff --git a/include/awkward/array/ByteMaskedArray.h b/include/awkward/array/ByteMaskedArray.h deleted file mode 100644 index e034b3e2c7..0000000000 --- a/include/awkward/array/ByteMaskedArray.h +++ /dev/null @@ -1,466 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_BYTEMASKEDARRAY_H_ -#define AWKWARD_BYTEMASKEDARRAY_H_ - -#include -#include -#include - -#include "awkward/common.h" -#include "awkward/Slice.h" -#include "awkward/Index.h" -#include "awkward/Content.h" - -namespace awkward { - template - class IndexedArrayOf; - - /// @class ByteMaskedForm - /// - /// @brief Form describing ByteMaskedArray. - class LIBAWKWARD_EXPORT_SYMBOL ByteMaskedForm: public Form { - public: - /// @brief Creates a ByteMaskedForm. See ByteMaskedArray for documentation. - ByteMaskedForm(bool has_identities, - const util::Parameters& parameters, - const FormKey& form_key, - Index::Form mask, - const FormPtr& content, - bool valid_when); - - Index::Form - mask() const; - - const FormPtr - content() const; - - bool - valid_when() const; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - void - tojson_part(ToJson& builder, bool verbose) const override; - - const FormPtr - shallow_copy() const override; - - const FormPtr - with_form_key(const FormKey& form_key) const override; - - const std::string - purelist_parameter(const std::string& key) const override; - - bool - purelist_isregular() const override; - - int64_t - purelist_depth() const override; - - bool - dimension_optiontype() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - bool - equal(const FormPtr& other, - bool check_identities, - bool check_parameters, - bool check_form_key, - bool compatibility_check) const override; - - const FormPtr - getitem_field(const std::string& key) const override; - - const FormPtr - getitem_fields(const std::vector& keys) const override; - - const FormPtr - simplify_optiontype() const; - - private: - Index::Form mask_; - const FormPtr content_; - bool valid_when_; - }; - - /// @class ByteMaskedArray - /// - /// @brief Represents potentially missing data by overlaying a byte #mask - /// over its #content. - /// - /// See #ByteMaskedArray for the meaning of each parameter. - class LIBAWKWARD_EXPORT_SYMBOL ByteMaskedArray: public Content { - public: - /// @brief Creates an ByteMaskedArray from a full set of parameters. - /// - /// @param identities Optional Identities for each element of the array - /// (may be `nullptr`). - /// @param parameters String-to-JSON map that augments the meaning of this - /// array. - /// @param mask Mask in which each byte represents a missing value (`None`) - /// or a valid value (from #content). - /// The interpretation depends on #valid_when; only boolean bytes that are - /// equal to #valid_when are not `None`. - /// @param content Data to be masked; `mask[i]` corresponds to `content[i]` - /// for all `i`. - /// @param valid_when Interpretation of the boolean bytes in #mask as - /// `None` or valid values from #content. Only boolean bytes that are - /// equal to valid_when are not `None`. - /// - /// Any non-zero value of a boolean byte and #valid_when are equivalent. - ByteMaskedArray(const IdentitiesPtr& identities, - const util::Parameters& parameters, - const Index8& mask, - const ContentPtr& content, - bool valid_when); - - /// @brief Mask in which each byte represents a missing value (`None`) - /// or a valid value (from #content). - /// - /// The interpretation depends on #valid_when; only boolean bytes that are - /// equal to #valid_when are not `None`. (Any non-zero value of a boolean - /// byte and #valid_when are equivalent.) - const Index8 - mask() const; - - /// @brief Data to be masked; `mask[i]` corresponds to `content[i]` for - /// all `i`. - const ContentPtr - content() const; - - /// @brief Interpretation of the boolean bytes in #mask as `None` or - /// valid values from #content. Only boolean bytes that are equal to - /// valid_when are not `None`. (Any non-zero value of a boolean byte - /// and `valid_when` are equivalent.) - bool - valid_when() const; - - /// @brief Return an array with the same type as #content with `None` - /// values removed. - const ContentPtr - project() const; - - /// @brief Performs a set-union of a given `mask` with the missing values - /// and calls #project. - /// - /// @param mask A byte mask that is valid when `0`, `None` when `1`. - const ContentPtr - project(const Index8& mask) const; - - /// @brief Returns a byte #mask with a fixed interpretation: missing - /// values are `1` and valid values are `0` (as though #valid_when were - /// `false`). - const Index8 - bytemask() const; - - /// @brief If the #content also has OptionType, combine the #mask with - /// the #content's indicator of missing values; also combine if the - /// #content is a non-OptionType {@link IndexedArrayOf IndexedArray}. - /// - /// This is a shallow operation: it only checks the content one level deep. - const ContentPtr - simplify_optiontype() const; - - /// @brief Converts this array into an - /// {@link IndexedArrayOf IndexedOptionArray} with the same missing values. - const std::shared_ptr> - toIndexedOptionArray64() const; - - /// @brief User-friendly name of this class: `"ByteMaskedArray"`. - const std::string - classname() const override; - - void - setidentities() override; - - void - setidentities(const IdentitiesPtr& identities) override; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - const FormPtr - form(bool materialize) const override; - - kernel::lib - kernels() const override; - - void - caches(std::vector& out) const override; - - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - void - tojson_part(ToJson& builder, bool include_beginendlist) const override; - - void - nbytes_part(std::map& largest) const override; - - /// @copydoc Content::length() - /// - /// Equal to `len(mask)`. - int64_t - length() const override; - - const ContentPtr - shallow_copy() const override; - - const ContentPtr - deep_copy(bool copyarrays, - bool copyindexes, - bool copyidentities) const override; - - void - check_for_iteration() const override; - - const ContentPtr - getitem_nothing() const override; - - const ContentPtr - getitem_at(int64_t at) const override; - - const ContentPtr - getitem_at_nowrap(int64_t at) const override; - - const ContentPtr - getitem_range(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_range_nowrap(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_field(const std::string& key) const override; - - const ContentPtr - getitem_field(const std::string& key, - const Slice& only_fields) const override; - - const ContentPtr - getitem_fields(const std::vector& keys) const override; - - const ContentPtr - getitem_fields(const std::vector& keys, - const Slice& only_fields) const override; - - const ContentPtr - getitem_next(const SliceItemPtr& head, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - carry(const Index64& carry, bool allow_lazy) const override; - - int64_t - purelist_depth() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - // operations - const std::string - validityerror(const std::string& path) const override; - - /// @copydoc Content::shallow_simplify() - /// - /// For ByteMaskedArray, this method Returns #simplify_optiontype. - const ContentPtr - shallow_simplify() const override; - - const ContentPtr - num(int64_t axis, int64_t depth) const override; - - const std::pair - offsets_and_flattened(int64_t axis, int64_t depth) const override; - - bool - mergeable(const ContentPtr& other, bool mergebool) const override; - - bool - referentially_equal(const ContentPtr& other) const override; - - const ContentPtr - reverse_merge(const ContentPtr& other) const override; - - const ContentPtr - mergemany(const ContentPtrVec& others) const override; - - const SliceItemPtr - asslice() const override; - - const ContentPtr - fillna(const ContentPtr& value) const override; - - const ContentPtr - rpad(int64_t target, int64_t axis, int64_t depth) const override; - - const ContentPtr - rpad_and_clip(int64_t target, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - reduce_next(const Reducer& reducer, - int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool mask, - bool keepdims) const override; - - const ContentPtr - sort_next(int64_t negaxis, - const Index64& starts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - argsort_next(int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - localindex(int64_t axis, int64_t depth) const override; - - const ContentPtr - combinations(int64_t n, - bool replacement, - const util::RecordLookupPtr& recordlookup, - const util::Parameters& parameters, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - getitem_next(const SliceAt& at, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceRange& range, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceArray64& array, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceJagged64& jagged, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceArray64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceMissing64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceJagged64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - copy_to(kernel::lib ptr_lib) const override; - - const ContentPtr - numbers_to_type(const std::string& name) const override; - - /// @brief Returns 'true' if all components of the array are unique - bool - is_unique() const override; - - /// @brief Returns an array where all components are unique - const ContentPtr - unique() const override; - - /// @brief Returns 'true' if subranges are equal - bool - is_subrange_equal(const Index64& start, const Index64& stop) const override; - - protected: - template - const ContentPtr - getitem_next_jagged_generic(const Index64& slicestarts, - const Index64& slicestops, - const S& slicecontent, - const Slice& tail) const; - - const std::pair - nextcarry_outindex(int64_t& numnull) const; - - private: - /// @brief See #mask. - const Index8 mask_; - /// @brief See #content. - const ContentPtr content_; - /// @brief See #valid_when. - const bool valid_when_; - }; - -} - -#endif // AWKWARD_BYTEMASKEDARRAY_H_ diff --git a/include/awkward/array/EmptyArray.h b/include/awkward/array/EmptyArray.h deleted file mode 100644 index bd2226b613..0000000000 --- a/include/awkward/array/EmptyArray.h +++ /dev/null @@ -1,367 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_EMPTYARRAY_H_ -#define AWKWARD_EMPTYARRAY_H_ - -#include -#include -#include - -#include "awkward/common.h" -#include "awkward/Slice.h" -#include "awkward/Content.h" - -namespace awkward { - class NumpyArray; - - /// @class EmptyForm - /// - /// @brief Form describing EmptyArray. - class LIBAWKWARD_EXPORT_SYMBOL EmptyForm: public Form { - public: - /// @brief Creates a EmptyForm. See EmptyArray for documentation. - EmptyForm(bool has_identities, - const util::Parameters& parameters, - const FormKey& form_key); - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - void - tojson_part(ToJson& builder, bool verbose) const override; - - const FormPtr - shallow_copy() const override; - - const FormPtr - with_form_key(const FormKey& form_key) const override; - - const std::string - purelist_parameter(const std::string& key) const override; - - bool - purelist_isregular() const override; - - int64_t - purelist_depth() const override; - - bool - dimension_optiontype() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - bool - equal(const FormPtr& other, - bool check_identities, - bool check_parameters, - bool check_form_key, - bool compatibility_check) const override; - - const FormPtr - getitem_field(const std::string& key) const override; - - const FormPtr - getitem_fields(const std::vector& keys) const override; - - }; - - /// @class EmptyArray - /// - /// @brief Represents an array with length zero and (perhaps as a - /// consequence) UnknownType. - /// - /// See #EmptyArray for the meaning of each parameter. - class LIBAWKWARD_EXPORT_SYMBOL EmptyArray: public Content { - public: - /// @brief Creates an EmptyArray from a full set of parameters. - /// - /// @param identities Optional Identities for each element of the array - /// (may be `nullptr`). - /// @param parameters String-to-JSON map that augments the meaning of this - /// array. - EmptyArray(const IdentitiesPtr& identities, - const util::Parameters& parameters); - - /// @brief Converts this array into a NumpyArray with a given - /// {NumpyArray#format format}. - const std::shared_ptr - toNumpyArray(const std::string& format, - ssize_t itemsize, - util::dtype npdtype) const; - - /// @brief User-friendly name of this class: `"EmptyArray"`. - const std::string - classname() const override; - - void - setidentities() override; - - void - setidentities(const IdentitiesPtr& identities) override; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - const FormPtr - form(bool materialize) const override; - - kernel::lib - kernels() const override; - - void - caches(std::vector& out) const override; - - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - void - tojson_part(ToJson& builder, bool include_beginendlist) const override; - - void - nbytes_part(std::map& largest) const override; - - int64_t - length() const override; - - const ContentPtr - shallow_copy() const override; - - const ContentPtr - deep_copy(bool copyarrays, - bool copyindexes, - bool copyidentities) const override; - - void - check_for_iteration() const override; - - const ContentPtr - getitem_nothing() const override; - - const ContentPtr - getitem_at(int64_t at) const override; - - const ContentPtr - getitem_at_nowrap(int64_t at) const override; - - const ContentPtr - getitem_range(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_range_nowrap(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_field(const std::string& key) const override; - - const ContentPtr - getitem_field(const std::string& key, - const Slice& only_fields) const override; - - const ContentPtr - getitem_fields(const std::vector& keys) const override; - - const ContentPtr - getitem_fields(const std::vector& keys, - const Slice& only_fields) const override; - - const ContentPtr - carry(const Index64& carry, bool allow_lazy) const override; - - int64_t - purelist_depth() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - // operations - const std::string - validityerror(const std::string& path) const override; - - /// @copydoc Content::shallow_simplify() - /// - /// For EmptyArray, this method returns #shallow_copy (pass-through). - const ContentPtr - shallow_simplify() const override; - - const ContentPtr - num(int64_t axis, int64_t depth) const override; - - const std::pair - offsets_and_flattened(int64_t axis, int64_t depth) const override; - - bool - mergeable(const ContentPtr& other, bool mergebool) const override; - - bool - referentially_equal(const ContentPtr& other) const override; - - const ContentPtr - mergemany(const ContentPtrVec& others) const override; - - const SliceItemPtr - asslice() const override; - - const ContentPtr - fillna(const ContentPtr& value) const override; - - const ContentPtr - rpad(int64_t target, int64_t axis, int64_t depth) const override; - - const ContentPtr - rpad_and_clip(int64_t target, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - reduce_next(const Reducer& reducer, - int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool mask, - bool keepdims) const override; - - const ContentPtr - sort_next(int64_t negaxis, - const Index64& starts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - argsort_next(int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - localindex(int64_t axis, int64_t depth) const override; - - const ContentPtr - combinations(int64_t n, - bool replacement, - const util::RecordLookupPtr& recordlookup, - const util::Parameters& parameters, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - getitem_next(const SliceAt& at, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceRange& range, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceArray64& array, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceField& field, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceFields& fields, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceJagged64& jagged, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceArray64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceMissing64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceJagged64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - copy_to(kernel::lib ptr_lib) const override; - - const ContentPtr - numbers_to_type(const std::string& name) const override; - - /// @brief Returns 'true' if all components of the array are unique - bool - is_unique() const override; - - /// @brief Returns an array where all components are unique - const ContentPtr - unique() const override; - - /// @brief Returns 'true' if subranges are equal - bool - is_subrange_equal(const Index64& start, const Index64& stop) const override; - - }; - -} - -#endif // AWKWARD_EMPTYARRAY_H_ diff --git a/include/awkward/array/IndexedArray.h b/include/awkward/array/IndexedArray.h deleted file mode 100644 index 847cc937ac..0000000000 --- a/include/awkward/array/IndexedArray.h +++ /dev/null @@ -1,568 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_INDEXEDARRAY_H_ -#define AWKWARD_INDEXEDARRAY_H_ - -#include -#include -#include - -#include "awkward/common.h" -#include "awkward/Slice.h" -#include "awkward/Index.h" -#include "awkward/Content.h" - -namespace awkward { - /// @class IndexedForm - /// - /// @brief Form describing IndexedArray (with `OPTION = false`). - class LIBAWKWARD_EXPORT_SYMBOL IndexedForm: public Form { - public: - /// @brief Creates a IndexedForm. See {@link IndexedArrayOf IndexedArray} - /// for documentation. - IndexedForm(bool has_identities, - const util::Parameters& parameters, - const FormKey& form_key, - Index::Form index, - const FormPtr& content); - - Index::Form - index() const; - - const FormPtr - content() const; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - void - tojson_part(ToJson& builder, bool verbose) const override; - - const FormPtr - shallow_copy() const override; - - const FormPtr - with_form_key(const FormKey& form_key) const override; - - const std::string - purelist_parameter(const std::string& key) const override; - - bool - purelist_isregular() const override; - - int64_t - purelist_depth() const override; - - bool - dimension_optiontype() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - bool - equal(const FormPtr& other, - bool check_identities, - bool check_parameters, - bool check_form_key, - bool compatibility_check) const override; - - const FormPtr - getitem_field(const std::string& key) const override; - - const FormPtr - getitem_fields(const std::vector& keys) const override; - - const FormPtr - simplify_optiontype() const; - - private: - Index::Form index_; - const FormPtr content_; - }; - - /// @class IndexedOptionForm - /// - /// @brief Form describing IndexedOptionArray. - class LIBAWKWARD_EXPORT_SYMBOL IndexedOptionForm: public Form { - public: - /// @brief Creates a IndexedOptionForm. See IndexedArray for documentation. - IndexedOptionForm(bool has_identities, - const util::Parameters& parameters, - const FormKey& form_key, - Index::Form index, - const FormPtr& content); - - Index::Form index() const; - - const FormPtr content() const; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - void - tojson_part(ToJson& builder, bool verbose) const override; - - const FormPtr - shallow_copy() const override; - - const FormPtr - with_form_key(const FormKey& form_key) const override; - - const std::string - purelist_parameter(const std::string& key) const override; - - bool - purelist_isregular() const override; - - int64_t - purelist_depth() const override; - - bool - dimension_optiontype() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - bool - equal(const FormPtr& other, - bool check_identities, - bool check_parameters, - bool check_form_key, - bool compatibility_check) const override; - - const FormPtr - getitem_field(const std::string& key) const override; - - const FormPtr - getitem_fields(const std::vector& keys) const override; - - const FormPtr - simplify_optiontype() const; - - private: - Index::Form index_; - const FormPtr content_; - }; - - /// @class IndexedArrayOf - /// - /// @brief Filters, rearranges, and/or duplicates items in its #content - /// through an #index, which has the same effect as lazily-applied #carry. - /// - /// If `ISOPTION = true`, the array is an IndexedOptionArray with OptionType, - /// and negative values in the #index correspond to `None`. Otherwise, the - /// IndexedArray has the same type as its #content. - /// - /// See #IndexedArrayOf for the meaning of each parameter. - template - class -#ifdef AWKWARD_INDEXEDARRAY_NO_EXTERN_TEMPLATE - LIBAWKWARD_EXPORT_SYMBOL -#endif - IndexedArrayOf: public Content { - public: - /// @brief Creates an IndexedArray or IndexedOptionArray from a full set - /// of parameters. - /// - /// @param identities Optional Identities for each element of the array - /// (may be `nullptr`). - /// @param parameters String-to-JSON map that augments the meaning of this - /// array. - /// @param index Item positions to be filtered, rearranged, duplicated, or - /// masked as `None`. - /// If #isoption is `true`, negative values are interpreted as `None`. - /// If #isoption is `false`, negative values are invalid. Values - /// greater than or equal to `len(content)` are invalid in either case. - /// @param content Data to be filtered, rearranged, and/or duplicated. - /// Values in `content[i]` where `i` is not in `index` are - /// "unreachable;" they do not exist in the high level view. - IndexedArrayOf(const IdentitiesPtr& identities, - const util::Parameters& parameters, - const IndexOf& index, - const ContentPtr& content); - - /// @brief Item positions to be filtered, rearranged, duplicated, or - /// masked as `None`. - /// - /// If #isoption is `true`, negative values are interpreted as `None`. - /// If #isoption is `false`, negative values are invalid. Values - /// greater than or equal to `len(content)` are invalid in either case. - const IndexOf - index() const; - - /// @brief Data to be filtered, rearranged, and/or duplicated. - /// - /// Values in `content[i]` where `i` is not in `index` are - /// "unreachable;" they do not exist in the high level view. - const ContentPtr - content() const; - - /// @brief Returns `true` if this array is an IndexedOptionArray32 or - /// IndexedOptionArray64. - bool - isoption() const; - - /// @brief Eagerly applies the #index as a #carry, removing `None` - /// elements if an IndexedOptionArray. - const ContentPtr - project() const; - - /// @brief Performs a set-union of a given `mask` with the missing values - /// (if an IndexedOptionArray) and calls #project. - /// - /// @param mask A byte mask that is valid when `0`, `None` when `1`. - const ContentPtr - project(const Index8& mask) const; - - /// @brief Returns an {@link IndexOf Index8} in which each byte represents - /// missing values with `1` and non-missing values with `0`. The mask - /// is all `0` if this is an IndexedArray. - const Index8 - bytemask() const; - - /// @brief If this is an IndexedOptionArray and the #content also has - /// OptionType, combine the two indicators of missing values into a single - /// OptionType array. If this is an IndexedArray and the #content is also - /// an IndexedArray, combine the two #index arrays. - /// - /// This is a shallow operation: it only checks the content one level deep. - const ContentPtr - simplify_optiontype() const; - - /// @brief Returns the value of #index at a given position. - T - index_at_nowrap(int64_t at) const; - - /// @brief User-friendly name of this class: `"IndexedArray32"`, - /// `"IndexedArrayU32"`, `"IndexedArray64"`, - /// `"IndexedOptionArray32"`, or `"IndexedOptionArray64"`. - const std::string - classname() const override; - - void - setidentities() override; - - void - setidentities(const IdentitiesPtr& identities) override; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - const FormPtr - form(bool materialize) const override; - - kernel::lib - kernels() const override; - - void - caches(std::vector& out) const override; - - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - void - tojson_part(ToJson& builder, bool include_beginendlist) const override; - - void - nbytes_part(std::map& largest) const override; - - /// @copydoc Content::length() - /// - /// Equal to `len(index)`. - int64_t - length() const override; - - const ContentPtr - shallow_copy() const override; - - const ContentPtr - deep_copy(bool copyarrays, - bool copyindexes, - bool copyidentities) const override; - - void - check_for_iteration() const override; - - const ContentPtr - getitem_nothing() const override; - - const ContentPtr - getitem_at(int64_t at) const override; - - const ContentPtr - getitem_at_nowrap(int64_t at) const override; - - const ContentPtr - getitem_range(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_range_nowrap(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_field(const std::string& key) const override; - - const ContentPtr - getitem_field(const std::string& key, - const Slice& only_fields) const override; - - const ContentPtr - getitem_fields(const std::vector& keys) const override; - - const ContentPtr - getitem_fields(const std::vector& keys, - const Slice& only_fields) const override; - - const ContentPtr - getitem_next(const SliceItemPtr& head, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - carry(const Index64& carry, bool allow_lazy) const override; - - int64_t - purelist_depth() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - // operations - const std::string - validityerror(const std::string& path) const override; - - /// @copydoc Content::shallow_simplify() - /// - /// For {@link IndexedArrayOf IndexedArray} and - /// {@link IndexedArrayOf IndexedOptionArray}, this method returns - /// #simplify_optiontype. - const ContentPtr - shallow_simplify() const override; - - const ContentPtr - num(int64_t axis, int64_t depth) const override; - - const std::pair - offsets_and_flattened(int64_t axis, int64_t depth) const override; - - bool - mergeable(const ContentPtr& other, bool mergebool) const override; - - bool - referentially_equal(const ContentPtr& other) const override; - - const ContentPtr - reverse_merge(const ContentPtr& other) const override; - - const std::pair - merging_strategy(const ContentPtrVec& others) const override; - - const ContentPtr - mergemany(const ContentPtrVec& others) const override; - - const SliceItemPtr - asslice() const override; - - const ContentPtr - fillna(const ContentPtr& value) const override; - - const ContentPtr - rpad(int64_t target, int64_t axis, int64_t depth) const override; - - const ContentPtr - rpad_and_clip(int64_t target, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - reduce_next(const Reducer& reducer, - int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool mask, - bool keepdims) const override; - - const ContentPtr - sort_next(int64_t negaxis, - const Index64& starts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - argsort_next(int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - localindex(int64_t axis, int64_t depth) const override; - - const ContentPtr - combinations(int64_t n, - bool replacement, - const util::RecordLookupPtr& recordlookup, - const util::Parameters& parameters, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - getitem_next(const SliceAt& at, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceRange& range, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceArray64& array, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceJagged64& jagged, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceArray64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceMissing64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceJagged64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - copy_to(kernel::lib ptr_lib) const override; - - const ContentPtr - numbers_to_type(const std::string& name) const override; - - /// @brief Returns 'true' if all components of the array are unique - bool - is_unique() const override; - - /// @brief Returns an array where all components are unique - const ContentPtr - unique() const override; - - /// @brief Returns 'true' if subranges are equal - bool - is_subrange_equal(const Index64& start, const Index64& stop) const override; - - protected: - template - const ContentPtr - getitem_next_jagged_generic(const Index64& slicestarts, - const Index64& slicestops, - const S& slicecontent, - const Slice& tail) const; - - const std::pair> - nextcarry_outindex(int64_t& numnull) const; - - private: - /// @brief See #index. - const IndexOf index_; - /// @brief See #content. - const ContentPtr content_; - }; - -#ifndef AWKWARD_INDEXEDARRAY_NO_EXTERN_TEMPLATE - extern template class IndexedArrayOf; - extern template class IndexedArrayOf; - extern template class IndexedArrayOf; - extern template class IndexedArrayOf; - extern template class IndexedArrayOf; -#endif - - using IndexedArray32 = IndexedArrayOf; - using IndexedArrayU32 = IndexedArrayOf; - using IndexedArray64 = IndexedArrayOf; - using IndexedOptionArray32 = IndexedArrayOf; - using IndexedOptionArray64 = IndexedArrayOf; -} - -#endif // AWKWARD_INDEXEDARRAY_H_ diff --git a/include/awkward/array/ListArray.h b/include/awkward/array/ListArray.h deleted file mode 100644 index cdd7950e1c..0000000000 --- a/include/awkward/array/ListArray.h +++ /dev/null @@ -1,486 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_LISTARRAY_H_ -#define AWKWARD_LISTARRAY_H_ - -#include - -#include "awkward/common.h" -#include "awkward/Index.h" -#include "awkward/Identities.h" -#include "awkward/Content.h" - -namespace awkward { - /// @class ListForm - /// - /// @brief Form describing ListArray. - class LIBAWKWARD_EXPORT_SYMBOL ListForm: public Form { - public: - /// @brief Creates a ListForm. See {@link ListArrayOf LinkArray} for - /// documentation. - ListForm(bool has_identities, - const util::Parameters& parameters, - const FormKey& form_key, - Index::Form starts, - Index::Form stops, - const FormPtr& content); - - Index::Form - starts() const; - - Index::Form - stops() const; - - const FormPtr - content() const; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - void - tojson_part(ToJson& builder, bool verbose) const override; - - const FormPtr - shallow_copy() const override; - - const FormPtr - with_form_key(const FormKey& form_key) const override; - - const std::string - purelist_parameter(const std::string& key) const override; - - bool - purelist_isregular() const override; - - int64_t - purelist_depth() const override; - - bool - dimension_optiontype() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - bool - equal(const FormPtr& other, - bool check_identities, - bool check_parameters, - bool check_form_key, - bool compatibility_check) const override; - - const FormPtr - getitem_field(const std::string& key) const override; - - const FormPtr - getitem_fields(const std::vector& keys) const override; - - private: - Index::Form starts_; - Index::Form stops_; - const FormPtr content_; - }; - - /// @class ListArrayOf - /// - /// @brief Represents an array of nested lists that can have different - /// lengths using two indexes named #starts and #stops. - /// - /// The use of two indexes, #starts and #stops, allows the #content to be - /// non-contiguous, out-of-order, and possibly overlapping. - /// - /// See #ListArrayOf for the meaning of each parameter. - template - class -#ifdef AWKWARD_LISTARRAY_NO_EXTERN_TEMPLATE - LIBAWKWARD_EXPORT_SYMBOL -#endif - ListArrayOf: public Content { - public: - /// @brief Creates a ListArray from a full set of parameters. - /// - /// @param identities Optional Identities for each element of the array - /// (may be `nullptr`). - /// @param parameters String-to-JSON map that augments the meaning of this - /// array. - /// @param starts Positions where each nested list starts in the #content. - /// @param stops Positions where each nested list stops in the #content. - /// The `starts` and `stops` may be in any order, they may repeat elements, - /// may represent partially or completely overlapping ranges of the - /// #content, and they may leave "unreachable" gaps between lists. - /// If `starts[i] == stops[i]`, there is no constraint on the value of - /// `starts[i]`. Otherwise, `0 <= starts[i] < len(content)` and - /// `0 <= stops[i] <= len(content)`. - /// @param content Data referenced by the #starts and #stops to build - /// nested lists. - /// The `content` does not necessarily represent a flattened version of - /// this array because a single element may belong to multiple lists or - /// no list at all. - ListArrayOf(const IdentitiesPtr& identities, - const util::Parameters& parameters, - const IndexOf& starts, - const IndexOf& stops, - const ContentPtr& content); - - /// @brief Positions where each nested list starts in the #content. - /// - /// The `starts` may be in any order, they may repeat elements, may - /// represent partially or completely overlapping ranges of the #content, - /// and they may leave "unreachable" gaps between lists. - /// - /// If `starts[i] == stops[i]`, there is no constraint on the value of - /// `starts[i]`. Otherwise, `0 <= starts[i] < len(content)`. - const IndexOf - starts() const; - - /// @brief Positions where each nested list stops in the #content. - /// - /// The `stops` may be in any order, they may repeat elements, may - /// represent partially or completely overlapping ranges of the #content, - /// and they may leave "unreachable" gaps between lists. - /// - /// If `starts[i] == stops[i]`, there is no constraint on the value of - /// `stops[i]`. Otherwise, `0 <= stops[i] <= len(content)`. - const IndexOf - stops() const; - - /// @brief Data referenced by the #starts and #stops to build nested lists. - /// - /// The `content` does not necessarily represent a flattened version of - /// this array because a single element may belong to multiple lists or - /// no list at all. - const ContentPtr - content() const; - - /// @brief Returns 64-bit offsets, possibly starting with `offsets[0] = 0`, - /// that would represent this array's #starts and #stops if the #content - /// were replaced by a contiguous copy. - /// - /// @param start_at_zero If `true`, the first offset will be `0`, meaning - /// there are no "unreachable" elements in the `content` that corresponds - /// to these offsets. - Index64 - compact_offsets64(bool start_at_zero) const; - - /// @brief Moves #content elements if necessary to match a given set of - /// `offsets` and return a {@link ListOffsetArrayOf ListOffsetArray} that - /// matches. - /// - /// As indicated by the name, this is a basic element of broadcasting. - /// - /// Since the output is a {@link ListOffsetArrayOf ListOffsetArray}, this - /// operation produces contiguous output, replacing multiply-referenced - /// items with copied items and removing unreachable gaps between items. - const ContentPtr - broadcast_tooffsets64(const Index64& offsets) const; - - /// @brief Converts this array to a RegularArray if all nested lists have - /// the same size (error otherwise). - /// - /// Since the output is a RegularArray, this - /// operation produces contiguous output, replacing multiply-referenced - /// items with copied items and removing unreachable gaps before and - /// between items. - const ContentPtr - toRegularArray() const; - - /// @brief Returns this array as a - /// {@link ListOffsetArrayOf ListOffsetArray} with - /// 64-bit {@link ListOffsetArrayOf#offsets offsets} and possibly starting - /// with `offsets[0] = 0`; a #shallow_copy if possible. - /// - /// @param start_at_zero If `true`, the first offset will be `0`, meaning - /// there are no "unreachable" elements in the `content` that corresponds - /// to these offsets. - /// - /// Since the output is a {@link ListOffsetArrayOf ListOffsetArray}, this - /// operation produces contiguous output, replacing multiply-referenced - /// items with copied items and removing unreachable gaps between items. - const ContentPtr - toListOffsetArray64(bool start_at_zero) const; - - /// @brief User-friendly name of this class: `"ListArray32"`, - /// `"ListArrayU32"`, or `"ListArray64"`. - const std::string - classname() const override; - - void - setidentities() override; - - void - setidentities(const IdentitiesPtr& identities) override; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - const FormPtr - form(bool materialize) const override; - - kernel::lib - kernels() const override; - - void - caches(std::vector& out) const override; - - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - void - tojson_part(ToJson& builder, bool include_beginendlist) const override; - - void - nbytes_part(std::map& largest) const override; - - /// @copydoc Content::length() - /// - /// Equal to `len(starts)`. - int64_t - length() const override; - - const ContentPtr - shallow_copy() const override; - - const ContentPtr - deep_copy(bool copyarrays, - bool copyindexes, - bool copyidentities) const override; - - void - check_for_iteration() const override; - - const ContentPtr - getitem_nothing() const override; - - const ContentPtr - getitem_at(int64_t at) const override; - - const ContentPtr - getitem_at_nowrap(int64_t at) const override; - - const ContentPtr - getitem_range(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_range_nowrap(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_field(const std::string& key) const override; - - const ContentPtr - getitem_field(const std::string& key, - const Slice& only_fields) const override; - - const ContentPtr - getitem_fields(const std::vector& keys) const override; - - const ContentPtr - getitem_fields(const std::vector& keys, - const Slice& only_fields) const override; - - const ContentPtr - carry(const Index64& carry, bool allow_lazy) const override; - - int64_t - purelist_depth() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - // operations - const std::string - validityerror(const std::string& path) const override; - - /// @copydoc Content::shallow_simplify() - /// - /// For {@link ListArrayOf ListArray}, this method returns - /// #shallow_copy (pass-through). - const ContentPtr - shallow_simplify() const override; - - const ContentPtr - num(int64_t axis, int64_t depth) const override; - - const std::pair - offsets_and_flattened(int64_t axis, int64_t depth) const override; - - bool - mergeable(const ContentPtr& other, bool mergebool) const override; - - bool - referentially_equal(const ContentPtr& other) const override; - - const ContentPtr - mergemany(const ContentPtrVec& others) const override; - - const SliceItemPtr - asslice() const override; - - const ContentPtr - fillna(const ContentPtr& value) const override; - - const ContentPtr - rpad(int64_t target, int64_t axis, int64_t depth) const override; - - const ContentPtr - rpad_and_clip(int64_t target, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - reduce_next(const Reducer& reducer, - int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool mask, - bool keepdims) const override; - - const ContentPtr - sort_next(int64_t negaxis, - const Index64& starts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - argsort_next(int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - localindex(int64_t axis, int64_t depth) const override; - - const ContentPtr - combinations(int64_t n, - bool replacement, - const util::RecordLookupPtr& recordlookup, - const util::Parameters& parameters, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - getitem_next(const SliceAt& at, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceRange& range, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceArray64& array, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceJagged64& jagged, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceArray64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceMissing64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceJagged64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - copy_to(kernel::lib ptr_lib) const override; - - const ContentPtr - numbers_to_type(const std::string& name) const override; - - /// @brief Returns 'true' if all components of the array are unique - bool - is_unique() const override; - - /// @brief Returns an array where all components are unique - const ContentPtr - unique() const override; - - /// @brief Returns 'true' if subranges are equal - bool - is_subrange_equal(const Index64& start, const Index64& stop) const override; - - private: - /// @brief See #starts. - const IndexOf starts_; - /// @brief See #stops. - const IndexOf stops_; - /// @brief See #content. - const ContentPtr content_; - }; - -#ifndef AWKWARD_LISTARRAY_NO_EXTERN_TEMPLATE - extern template class ListArrayOf; - extern template class ListArrayOf; - extern template class ListArrayOf; -#endif - - using ListArray32 = ListArrayOf; - using ListArrayU32 = ListArrayOf; - using ListArray64 = ListArrayOf; -} - -#endif // AWKWARD_LISTARRAY_H_ diff --git a/include/awkward/array/ListOffsetArray.h b/include/awkward/array/ListOffsetArray.h deleted file mode 100644 index 226e43e9e8..0000000000 --- a/include/awkward/array/ListOffsetArray.h +++ /dev/null @@ -1,473 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_LISTOFFSETARRAY_H_ -#define AWKWARD_LISTOFFSETARRAY_H_ - -#include - -#include "awkward/common.h" -#include "awkward/Index.h" -#include "awkward/Identities.h" -#include "awkward/Content.h" - -namespace awkward { - /// @class ListOffsetForm - /// - /// @brief Form describing ListOffsetArray. - class LIBAWKWARD_EXPORT_SYMBOL ListOffsetForm: public Form { - public: - /// @brief Creates a ListOffsetForm. See - /// {@link ListOffsetArrayOf ListOffsetArray} for documentation. - ListOffsetForm(bool has_identities, - const util::Parameters& parameters, - const FormKey& form_key, - Index::Form offsets, - const FormPtr& content); - - Index::Form - offsets() const; - - const FormPtr - content() const; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - void - tojson_part(ToJson& builder, bool verbose) const override; - - const FormPtr - shallow_copy() const override; - - const FormPtr - with_form_key(const FormKey& form_key) const override; - - const std::string - purelist_parameter(const std::string& key) const override; - - bool - purelist_isregular() const override; - - int64_t - purelist_depth() const override; - - bool - dimension_optiontype() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - bool - equal(const FormPtr& other, - bool check_identities, - bool check_parameters, - bool check_form_key, - bool compatibility_check) const override; - - const FormPtr - getitem_field(const std::string& key) const override; - - const FormPtr - getitem_fields(const std::vector& keys) const override; - - private: - Index::Form offsets_; - const FormPtr content_; - }; - - /// @class ListOffsetArrayOf - /// - /// @brief Represents an array of nested lists that can have different - /// lengths using one index named #offsets. - /// - /// A single #offsets index requires the #content to be contiguous, in-order, - /// and non-overlapping, though it need not start at zero (there can be - /// "unreachable" elements before the first visible item if - /// `offsets[0] != 0`). - /// - /// See #ListOffsetArrayOf for the meaning of each parameter. - template - class -#ifdef AWKWARD_LISTOFFSETARRAY_NO_EXTERN_TEMPLATE - LIBAWKWARD_EXPORT_SYMBOL -#endif - ListOffsetArrayOf: public Content { - public: - /// @brief Creates a ListOffsetArray from a full set of parameters. - /// - /// @param identities Optional Identities for each element of the array - /// (may be `nullptr`). - /// @param parameters String-to-JSON map that augments the meaning of this - /// array. - /// @param offsets Positions where one nested list stops and the next - /// starts in the #content; the `offsets` must be monotonically increasing. - /// The length of `offsets` is one greater than the length of the array it - /// represents, and as such must always have at least one element. - /// @param content Data contained within all nested lists as a contiguous - /// array. - /// Values in `content[i]` where `i < offsets[0]` are "unreachable," and - /// don't exist in the high level view, as are any where - /// `i >= offsets[len(offsets) - 1]`. - ListOffsetArrayOf(const IdentitiesPtr& identities, - const util::Parameters& parameters, - const IndexOf& offsets, - const ContentPtr& content, - bool represents_regular = false); - - /// @brief Positions where one nested list stops and the next starts in - /// the #content; the `offsets` must be monotonically increasing. - /// - /// The length of `offsets` is one greater than the length of the array it - /// represents, and as such must always have at least one element. - const IndexOf - offsets() const; - - /// @brief Data contained within all nested lists as a contiguous array. - /// - /// Values in `content[i]` where `i < offsets[0]` are "unreachable," and - /// don't exist in the high level view, as are any where - /// `i >= offsets[len(offsets) - 1]`. - const ContentPtr - content() const; - - /// @brief Starting positions of each nested list, similar to - /// {@link ListArrayOf#starts ListArray::starts}, but derived from - /// #offsets. - /// - /// This is a view of all but the last element of #offsets. - const IndexOf - starts() const; - - /// @brief Stopping positions of each nested list, similar to - /// {@link ListArrayOf#stops ListArray::stops}, but derived from - /// #offsets. - /// - /// This is a view of all but the first element of #offsets. - const IndexOf - stops() const; - - /// @brief Returns 64-bit offsets, possibly starting with `offsets[0] = 0`. - /// - /// If the #offsets of this array satisfies the constraint, it is not - /// copied. Otherwise, a new {@link IndexOf Index64} is returned. - /// - /// @param start_at_zero If `true`, the first offset will be `0`, meaning - /// there are no "unreachable" elements in the `content` that corresponds - /// to these offsets. - Index64 - compact_offsets64(bool start_at_zero) const; - - /// @brief Moves #content elements if necessary to match a given set of - /// `offsets` and return a {@link ListOffsetArrayOf ListOffsetArray} that - /// matches. - /// - /// As indicated by the name, this is a basic element of broadcasting. - const ContentPtr - broadcast_tooffsets64(const Index64& offsets) const; - - /// @brief Converts this array to a RegularArray if all nested lists have - /// the same size (error otherwise). - const ContentPtr - toRegularArray() const; - - /// @brief Returns a {@link ListOffsetArrayOf ListOffsetArray} with - /// 64-bit #offsets and possibly starting with `offsets[0] = 0`; a - /// #shallow_copy if possible. - /// - /// @param start_at_zero If `true`, the first offset will be `0`, meaning - /// there are no "unreachable" elements in the `content` that corresponds - /// to these offsets. - const ContentPtr - toListOffsetArray64(bool start_at_zero) const; - - /// @brief User-friendly name of this class: `"ListOffsetArray32"`, - /// `"ListOffsetArrayU32"`, or `"ListOffsetArray64"`. - const std::string - classname() const override; - - void - setidentities() override; - - void - setidentities(const IdentitiesPtr& identities) override; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - const FormPtr - form(bool materialize) const override; - - kernel::lib - kernels() const override; - - void - caches(std::vector& out) const override; - - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - void - tojson_part(ToJson& builder, bool include_beginendlist) const override; - - void - nbytes_part(std::map& largest) const override; - - /// @copydoc Content::length() - /// - /// Equal to `len(offsets) - 1`. - int64_t - length() const override; - - const ContentPtr - shallow_copy() const override; - - const ContentPtr - deep_copy(bool copyarrays, - bool copyindexes, - bool copyidentities) const override; - - void - check_for_iteration() const override; - - const ContentPtr - getitem_nothing() const override; - - const ContentPtr - getitem_at(int64_t at) const override; - - const ContentPtr - getitem_at_nowrap(int64_t at) const override; - - const ContentPtr - getitem_range(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_range_nowrap(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_field(const std::string& key) const override; - - const ContentPtr - getitem_field(const std::string& key, - const Slice& only_fields) const override; - - const ContentPtr - getitem_fields(const std::vector& keys) const override; - - const ContentPtr - getitem_fields(const std::vector& keys, - const Slice& only_fields) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceItemPtr& slicecontent, - const Slice& tail) const override; - - const ContentPtr - carry(const Index64& carry, bool allow_lazy) const override; - - int64_t - purelist_depth() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - // operations - const std::string - validityerror(const std::string& path) const override; - - /// @copydoc Content::shallow_simplify() - /// - /// For {@link ListOffsetArrayOf ListOffsetArray}, this method returns - /// #shallow_copy (pass-through). - const ContentPtr - shallow_simplify() const override; - - const ContentPtr - num(int64_t axis, int64_t depth) const override; - - const std::pair - offsets_and_flattened(int64_t axis, int64_t depth) const override; - - bool - mergeable(const ContentPtr& other, bool mergebool) const override; - - bool - referentially_equal(const ContentPtr& other) const override; - - const ContentPtr - mergemany(const ContentPtrVec& others) const override; - - const SliceItemPtr - asslice() const override; - - const ContentPtr - fillna(const ContentPtr& value) const override; - - const ContentPtr - rpad(int64_t target, int64_t axis, int64_t depth) const override; - - const ContentPtr - rpad_and_clip(int64_t target, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - reduce_next(const Reducer& reducer, - int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool mask, - bool keepdims) const override; - - const ContentPtr - sort_next(int64_t negaxis, - const Index64& starts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - argsort_next(int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - localindex(int64_t axis, int64_t depth) const override; - - const ContentPtr - combinations(int64_t n, - bool replacement, - const util::RecordLookupPtr& recordlookup, - const util::Parameters& parameters, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - getitem_next(const SliceAt& at, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceRange& range, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceArray64& array, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceJagged64& jagged, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceArray64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceMissing64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceJagged64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - copy_to(kernel::lib ptr_lib) const override; - - const ContentPtr - numbers_to_type(const std::string& name) const override; - - /// @brief Returns 'true' if all components of the array are unique - bool - is_unique() const override; - - /// @brief Returns an array where all components are unique - const ContentPtr - unique() const override; - - /// @brief Returns 'true' if subranges are equal - bool - is_subrange_equal(const Index64& start, const Index64& stop) const override; - - private: - /// @brief See #offsets. - const IndexOf offsets_; - /// @brief See #content. - const ContentPtr content_; - const bool represents_regular_; - }; - -#ifndef AWKWARD_LISTOFFSETARRAY_NO_EXTERN_TEMPLATE - extern template class ListOffsetArrayOf; - extern template class ListOffsetArrayOf; - extern template class ListOffsetArrayOf; -#endif - - using ListOffsetArray32 = ListOffsetArrayOf; - using ListOffsetArrayU32 = ListOffsetArrayOf; - using ListOffsetArray64 = ListOffsetArrayOf; -} - -#endif // AWKWARD_LISTOFFSETARRAY_H_ diff --git a/include/awkward/array/None.h b/include/awkward/array/None.h deleted file mode 100644 index 7db0c52b38..0000000000 --- a/include/awkward/array/None.h +++ /dev/null @@ -1,334 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_NONE_H_ -#define AWKWARD_NONE_H_ - -#include -#include -#include - -#include "awkward/common.h" -#include "awkward/Slice.h" -#include "awkward/Content.h" - -namespace awkward { - /// @class None - /// - /// @brief Represents a scalar missing value, which is `None` in Python. - /// - /// Nearly all of the methods raise runtime errors. See - /// {@link Content#isscalar Content::isscalar}. - class LIBAWKWARD_EXPORT_SYMBOL None: public Content { - public: - /// @brief Creates a None instance. - None(); - - /// @copydoc Content::isscalar() - /// - /// Always returns `true`. - bool - isscalar() const override; - - /// @brief User-friendly name of this class: `"None"`. - const std::string - classname() const override; - - /// @exception std::runtime_error is always thrown - void - setidentities() override; - - /// @exception std::runtime_error is always thrown - void - setidentities(const IdentitiesPtr& identities) override; - - /// @exception std::runtime_error is always thrown - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - /// @exception std::runtime_error is always thrown - const FormPtr - form(bool materialize) const override; - - kernel::lib - kernels() const override; - - void - caches(std::vector& out) const override; - - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - void - tojson_part(ToJson& builder, bool include_beginendlist) const override; - - /// @exception std::runtime_error is always thrown - void - nbytes_part(std::map& largest) const override; - - /// Always returns `-1`. - int64_t - length() const override; - - const ContentPtr - shallow_copy() const override; - - const ContentPtr - deep_copy(bool copyarrays, - bool copyindexes, - bool copyidentities) const override; - - void - check_for_iteration() const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_nothing() const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_at(int64_t at) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_at_nowrap(int64_t at) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_range(int64_t start, int64_t stop) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_range_nowrap(int64_t start, int64_t stop) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_field(const std::string& key) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_field(const std::string& key, - const Slice& only_fields) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_fields(const std::vector& keys) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_fields(const std::vector& keys, - const Slice& only_fields) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - carry(const Index64& carry, bool allow_lazy) const override; - - /// @exception std::runtime_error is always thrown - int64_t - purelist_depth() const override; - - /// @exception std::runtime_error is always thrown - const std::pair - minmax_depth() const override; - - /// @exception std::runtime_error is always thrown - const std::pair - branch_depth() const override; - - /// @exception std::runtime_error is always thrown - int64_t - numfields() const override; - - /// @exception std::runtime_error is always thrown - int64_t - fieldindex(const std::string& key) const override; - - /// @exception std::runtime_error is always thrown - const std::string - key(int64_t fieldindex) const override; - - /// @exception std::runtime_error is always thrown - bool - haskey(const std::string& key) const override; - - /// @exception std::runtime_error is always thrown - const std::vector - keys() const override; - - /// @exception std::runtime_error is always thrown - bool - istuple() const override; - - // operations - - /// @exception std::runtime_error is always thrown - const std::string - validityerror(const std::string& path) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - shallow_simplify() const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - num(int64_t axis, int64_t depth) const override; - - /// @exception std::runtime_error is always thrown - const std::pair - offsets_and_flattened(int64_t axis, int64_t depth) const override; - - /// @exception std::runtime_error is always thrown - bool - mergeable(const ContentPtr& other, bool mergebool) const override; - - /// @exception std::runtime_error is always thrown - bool - referentially_equal(const ContentPtr& other) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - mergemany(const ContentPtrVec& others) const override; - - /// @exception std::runtime_error is always thrown - const SliceItemPtr - asslice() const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - fillna(const ContentPtr& value) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - rpad(int64_t target, int64_t axis, int64_t depth) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - rpad_and_clip(int64_t target, - int64_t axis, - int64_t depth) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - reduce_next(const Reducer& reducer, - int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool mask, - bool keepdims) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - sort_next(int64_t negaxis, - const Index64& starts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - argsort_next(int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - localindex(int64_t axis, int64_t depth) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - combinations(int64_t n, - bool replacement, - const util::RecordLookupPtr& recordlookup, - const util::Parameters& parameters, - int64_t axis, - int64_t depth) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_next(const SliceAt& at, - const Slice& tail, - const Index64& advanced) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_next(const SliceRange& range, - const Slice& tail, - const Index64& advanced) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_next(const SliceArray64& array, - const Slice& tail, - const Index64& advanced) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_next(const SliceField& field, - const Slice& tail, - const Index64& advanced) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_next(const SliceFields& fields, - const Slice& tail, - const Index64& advanced) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_next(const SliceJagged64& jagged, - const Slice& tail, - const Index64& advanced) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceArray64& slicecontent, - const Slice& tail) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceMissing64& slicecontent, - const Slice& tail) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceJagged64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - copy_to(kernel::lib ptr_lib) const override; - - const ContentPtr - numbers_to_type(const std::string& name) const override; - - /// @brief Returns 'true' if all components of the array are unique - bool - is_unique() const override; - - /// @brief Returns an array where all components are unique - const ContentPtr - unique() const override; - - /// @brief Returns 'true' if subranges are equal - bool - is_subrange_equal(const Index64& start, const Index64& stop) const override; - - }; - - /// A constant value with type None. - extern const ContentPtr none; -} - -#endif // AWKWARD_NONE_H_ diff --git a/include/awkward/array/NumpyArray.h b/include/awkward/array/NumpyArray.h deleted file mode 100644 index 11584fbf90..0000000000 --- a/include/awkward/array/NumpyArray.h +++ /dev/null @@ -1,870 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_NUMPYARRAY_H_ -#define AWKWARD_NUMPYARRAY_H_ - -#include -#include -#include - -#include "awkward/common.h" -#include "awkward/Slice.h" -#include "awkward/Content.h" - -namespace awkward { - /// @class NumpyForm - /// - /// @brief Form describing NumpyArray. - class LIBAWKWARD_EXPORT_SYMBOL NumpyForm: public Form { - public: - /// @brief Creates a NumpyForm. See NumpyArray for documentation. - NumpyForm(bool has_identities, - const util::Parameters& parameters, - const FormKey& form_key, - const std::vector& inner_shape, - int64_t itemsize, - const std::string& format, - util::dtype dtype); - - const std::vector - inner_shape() const; - - int64_t - itemsize() const; - - const std::string - format() const; - - util::dtype - dtype() const; - - const std::string - primitive() const; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - const std::string - tostring() const override; - - const std::string - tojson(bool pretty, bool verbose) const override; - - void - tojson_part(ToJson& builder, bool verbose) const override; - - void - tojson_part(ToJson& builder, bool verbose, bool toplevel) const; - - const FormPtr - shallow_copy() const override; - - const FormPtr - with_form_key(const FormKey& form_key) const override; - - const std::string - purelist_parameter(const std::string& key) const override; - - bool - purelist_isregular() const override; - - int64_t - purelist_depth() const override; - - bool - dimension_optiontype() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - bool - equal(const FormPtr& other, - bool check_identities, - bool check_parameters, - bool check_form_key, - bool compatibility_check) const override; - - const FormPtr - getitem_field(const std::string& key) const override; - - const FormPtr - getitem_fields(const std::vector& keys) const override; - - private: - const std::vector inner_shape_; - int64_t itemsize_; - const std::string format_; - const util::dtype dtype_; - }; - - /// @class NumpyArray - /// - /// @brief Represents a rectilinear numerical array that can be converted to - /// and from NumPy without loss of information or copying the underlying - /// buffer. - /// - /// See #NumpyArray for the meaning of each parameter. - /// - /// Any NumPy array can be passed through Awkward Array operations, even - /// slicing, but operations that have to interpret the array's values (such - /// as reducers like "sum" and "max") only work on numeric types: - /// - /// - 32-bit and 64-bit floating point numbers - /// - 8-bit, 16-bit, 32-bit, and 64-bit signed and unsigned integers - /// - 8-bit booleans - /// - ///(native endian only). - class LIBAWKWARD_EXPORT_SYMBOL NumpyArray: public Content { - public: - - /// @brief Creates a NumpyArray from a full set of parameters. - /// - /// @param identities Optional Identities for each element of the array - /// (may be `nullptr`). - /// @param parameters String-to-JSON map that augments the meaning of this - /// array. - /// @param ptr Reference-counted pointer to the array buffer. - /// @param shape Number of elements in each dimension. A one-dimensional - /// array has a shape of length one. A zero-length shape represents a - /// numerical scalar, which is only valid as an output (immediately - /// converted into a number in Python). Each element in shape must be - /// non-negative. If not scalar, the total number of elements in the array - /// is the product of the shape (which can be zero). - /// @param strides Length of each dimension in number of bytes. The length - /// of strides must match the length of `shape`. Strides may be zero or - /// negative, but they must be multiples of itemsize. An array is only - /// "contiguous" if `strides[i] == itemsize * prod(shape[i + 1:])` for all - /// valid `i`. - /// @param byteoffset Location of item zero in the buffer, relative to - /// #ptr, measured in bytes, rather than number of elements (must be a - /// multiple of `itemsize`). We keep this information in two parameters - /// (#ptr and #byteoffset) rather than moving #ptr so that #ptr can be - /// reference counted among all arrays that use the same buffer. - /// @param itemsize Number of bytes per item; should agree with the format. - /// @param format String representing the NumPy dtype (as defined by - /// pybind11). Note that 32-bit systems and Windows use "`q/Q`" for - /// signed/unsigned 64-bit and "`l/L`" for 32-bit, while all other systems - /// use "`l/L`" for 64-bit and "`i/I`" for 32-bit. - /// @param dtype Enumeration for the type without the platform-dependence - /// that `format` has. - /// @param ptr_lib Indicates the kernel libraries to use for this `ptr`. - /// - /// Note that the integer type for all of these parameters is `ssize_t`, - /// for consistency with pybind11. Most integers in Awkward are `int64_t`. - NumpyArray(const IdentitiesPtr& identities, - const util::Parameters& parameters, - const std::shared_ptr& ptr, - const std::vector& shape, - const std::vector& strides, - ssize_t byteoffset, - ssize_t itemsize, - const std::string& format, - util::dtype dtype, - const kernel::lib ptr_lib); - - /// @brief Creates a NumpyArray from an {@link IndexOf Index8}. - explicit NumpyArray(const Index8 index); - /// @brief Creates a NumpyArray from an {@link IndexOf IndexU8}. - explicit NumpyArray(const IndexU8 index); - /// @brief Creates a NumpyArray from an {@link IndexOf Index32}. - explicit NumpyArray(const Index32 index); - /// @brief Creates a NumpyArray from an {@link IndexOf IndexU32}. - explicit NumpyArray(const IndexU32 index); - /// @brief Creates a NumpyArray from an {@link IndexOf Index64}. - explicit NumpyArray(const Index64 index); - - /// @brief Reference-counted pointer to the array buffer. - const std::shared_ptr - ptr() const; - - /// @param ptr_lib Indicates the kernel libraries to use for this `ptr`. - kernel::lib - ptr_lib() const; - - /// @brief Raw pointer to the beginning of data (i.e. offset accounted for). - void* - data() const; - - /// @brief Number of elements in each dimension. A one-dimensional - /// array has a shape of length one. - /// - /// A zero-length shape represents a - /// numerical scalar, which is only valid as an output (immediately - /// converted into a number in Python). Each element in shape must be - /// non-negative. If not scalar, the total number of elements in the array - /// is the product of the shape (which can be zero). - /// - /// Note that the integer type is `ssize_t` for consistency with pybind11. - /// Most integers in Awkward are `int64_t`. - const std::vector - shape() const; - - /// @brief Length of each dimension in number of bytes. - /// - /// The length - /// of strides must match the length of `shape`. Strides may be zero or - /// negative, but they must be multiples of itemsize. An array is only - /// "contiguous" if `strides[i] == itemsize * prod(shape[i + 1:])` for all - /// valid `i`. - /// - /// Note that the integer type is `ssize_t` for consistency with pybind11. - /// Most integers in Awkward are `int64_t`. - const std::vector - strides() const; - - /// @brief Location of item zero in the buffer, relative to - /// `ptr`, measured in bytes, rather than number of elements (must be a - /// multiple of `itemsize`). - /// - /// We keep this information in two parameters - /// (`ptr` and `byteoffset`) rather than moving `ptr` so that `ptr` can be - /// reference counted among all arrays that use the same buffer. - /// - /// Note that the integer type is `ssize_t` for consistency with pybind11. - /// Most integers in Awkward are `int64_t`. - ssize_t - byteoffset() const; - - /// @brief Number of bytes per item; should agree with the format. - /// - /// Note that the integer type is `ssize_t` for consistency with pybind11. - /// Most integers in Awkward are `int64_t`. - ssize_t - itemsize() const; - - /// @brief String representing the NumPy dtype (as defined by - /// pybind11). - /// - /// Note that 32-bit systems and Windows use "`q/Q`" for - /// signed/unsigned 64-bit and "`l/L`" for 32-bit, while all other systems - /// use "`l/L`" for 64-bit and "`i/I`" for 32-bit. - const std::string - format() const; - - /// @param dtype Enumeration for the type without the platform-dependence - /// that `format` has. - util::dtype - dtype() const; - - /// @brief The number of dimensions, which is `shape.size()`. - /// - /// Note that the integer type is `ssize_t` for consistency with pybind11. - /// Most integers in Awkward are `int64_t`. - ssize_t - ndim() const; - - /// @brief Returns `true` if any element of the #shape is zero; `false` - /// otherwise. - /// - /// Note that a NumpyArray can be empty with non-zero #length. - bool - isempty() const; - - /// @brief The length of the array (or scalar, if `shape.empty()`) in - /// bytes. - /// - /// If scalar, the return value is equal to #itemsize; otherwise, it is - /// equal to `shape[0] * strides[0]`. - ssize_t - bytelength() const; - - /// @brief Dereferences a selected item as a `uint8_t`. - /// - /// Note that the integer type is `ssize_t` for consistency with pybind11. - /// Most integers in Awkward are `int64_t`. - uint8_t - getbyte(ssize_t at) const; - - /// @brief A contiguous version of this array with multidimensional - /// #shape replaced by nested RegularArray nodes. - /// - /// If the #shape has zero dimensions (it's a scalar), it is passed through - /// unaffected. - const ContentPtr - toRegularArray() const; - - /// @brief Returns `true` if the #shape is zero-dimensional; `false` otherwise. - bool - isscalar() const override; - - /// @brief User-friendly name of this class: `"NumpyArray"`. - const std::string - classname() const override; - - void - setidentities() override; - - void - setidentities(const IdentitiesPtr& identities) override; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - const FormPtr - form(bool materialize) const override; - - kernel::lib - kernels() const override; - - void - caches(std::vector& out) const override; - - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - void - tojson_part(ToJson& builder, bool include_beginendlist) const override; - - void - nbytes_part(std::map& largest) const override; - - int64_t - length() const override; - - const ContentPtr - shallow_copy() const override; - - const ContentPtr - deep_copy(bool copyarrays, - bool copyindexes, - bool copyidentities) const override; - - void - check_for_iteration() const override; - - const ContentPtr - getitem_nothing() const override; - - const ContentPtr - getitem_at(int64_t at) const override; - - const ContentPtr - getitem_at_nowrap(int64_t at) const override; - - const ContentPtr - getitem_range(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_range_nowrap(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_field(const std::string& key) const override; - - const ContentPtr - getitem_field(const std::string& key, - const Slice& only_fields) const override; - - const ContentPtr - getitem_fields(const std::vector& keys) const override; - - const ContentPtr - getitem_fields(const std::vector& keys, - const Slice& only_fields) const override; - - const ContentPtr - getitem(const Slice& where) const override; - - const ContentPtr - getitem_next(const SliceItemPtr& head, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - carry(const Index64& carry, bool allow_lazy) const override; - - int64_t - purelist_depth() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - // operations - const std::string - validityerror(const std::string& path) const override; - - /// @copydoc Content::shallow_simplify() - /// - /// For NumpyArray, this method returns #shallow_copy (pass-through). - const ContentPtr - shallow_simplify() const override; - - const ContentPtr - num(int64_t axis, int64_t depth) const override; - - const std::pair - offsets_and_flattened(int64_t axis, int64_t depth) const override; - - bool - mergeable(const ContentPtr& other, bool mergebool) const override; - - bool - referentially_equal(const ContentPtr& other) const override; - - const ContentPtr - mergemany(const ContentPtrVec& others) const override; - - const SliceItemPtr - asslice() const override; - - const ContentPtr - fillna(const ContentPtr& value) const override; - - const ContentPtr - rpad(int64_t target, int64_t axis, int64_t depth) const override; - - const ContentPtr - rpad_and_clip(int64_t target, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - reduce_next(const Reducer& reducer, - int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool mask, - bool keepdims) const override; - - const ContentPtr - sort_next(int64_t negaxis, - const Index64& starts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - as_unique_strings(const Index64& offsets) const; - - const ContentPtr - argsort_next(int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - localindex(int64_t axis, int64_t depth) const override; - - const ContentPtr - combinations(int64_t n, - bool replacement, - const util::RecordLookupPtr& recordlookup, - const util::Parameters& parameters, - int64_t axis, - int64_t depth) const override; - - /// @brief Returns `true` if this array is contiguous; `false` otherwise. - /// - /// An array is "contiguous" if - /// `strides[i] = itemsize * prod(shape[i + 1:])` - /// for all `i` in the #shape and #strides. - /// - /// This means that there are no unreachable gaps between values and - /// each user-visible value is represented by one value in memory. - /// - /// It does not mean that #byteoffset is `0` or the #length covers the - /// entire allocated buffer. There may be unreachable elements before - /// or after the user-visible data. - bool - iscontiguous() const; - - /// @brief A contiguous version of this array (or this array if - /// `iscontiguous()`). - /// - /// An array is "contiguous" if - /// `strides[i] = itemsize * prod(shape[i + 1:])` - /// for all `i` in the #shape and #strides. - /// - /// This means that there are no unreachable gaps between values and - /// each user-visible value is represented by one value in memory. - /// - /// It does not mean that #byteoffset is `0` or the #length covers the - /// entire allocated buffer. There may be unreachable elements before - /// or after the user-visible data. - const NumpyArray - contiguous() const; - - /// @brief Inhibited general function (see 7 argument `getitem_next` - /// specific to NumpyArray). - const ContentPtr - getitem_next(const SliceAt& at, - const Slice& tail, - const Index64& advanced) const override; - - /// @brief Inhibited general function (see 7 argument `getitem_next` - /// specific to NumpyArray). - const ContentPtr - getitem_next(const SliceRange& range, - const Slice& tail, - const Index64& advanced) const override; - - /// @brief Inhibited general function (see 7 argument `getitem_next` - /// specific to NumpyArray). - const ContentPtr - getitem_next(const SliceArray64& array, - const Slice& tail, - const Index64& advanced) const override; - - /// @brief Inhibited general function (see 7 argument `getitem_next` - /// specific to NumpyArray). - const ContentPtr - getitem_next(const SliceField& field, - const Slice& tail, - const Index64& advanced) const override; - - /// @brief Inhibited general function (see 7 argument `getitem_next` - /// specific to NumpyArray). - const ContentPtr - getitem_next(const SliceFields& fields, - const Slice& tail, - const Index64& advanced) const override; - - /// @brief Inhibited general function (see 7 argument `getitem_next` - /// specific to NumpyArray). - const ContentPtr - getitem_next(const SliceJagged64& jagged, - const Slice& tail, - const Index64& advanced) const override; - - /// @brief An utility function to create a new instance of NumpyArray on the - /// GPU identical to this one. - const ContentPtr - copy_to(kernel::lib ptr_lib) const override; - - const ContentPtr - numbers_to_type(const std::string& name) const override; - - /// @brief Returns 'true' if all components of the array are unique - bool - is_unique() const override; - - /// @brief Returns an array where all components are unique - const ContentPtr - unique() const override; - - /// @brief Returns 'true' if subranges are equal - bool - is_subrange_equal(const Index64& starts, const Index64& stops) const override; - - protected: - /// @brief Internal function that propagates the derivation of a contiguous - /// version of this array from one axis to the next. - /// - /// This may be thought of as a specialized application of #carry indexed - /// by byte positions, rather than item positions. (If it had been written - /// after #getitem_next and #carry, it probably would have used $carry.) - const NumpyArray - contiguous_next(const Index64& bytepos) const; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis by propagating strides (non-advanced indexing only). - /// - /// @param head First element of the Slice tuple. - /// @param tail The rest of the elements of the Slice tuple. - /// @param length The length of the output array (after propagating - /// through all axis levels). - const NumpyArray - getitem_bystrides(const SliceItemPtr& head, - const Slice& tail, - int64_t length) const; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis by propagating strides (non-advanced indexing only). - /// - /// See generic #getitem_bystrides for details. - const NumpyArray - getitem_bystrides(const SliceAt& at, - const Slice& tail, - int64_t length) const; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis by propagating strides (non-advanced indexing only). - /// - /// See generic #getitem_bystrides for details. - const NumpyArray - getitem_bystrides(const SliceRange& range, - const Slice& tail, - int64_t length) const; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis by propagating strides (non-advanced indexing only). - /// - /// See generic #getitem_bystrides for details. - const NumpyArray - getitem_bystrides(const SliceEllipsis& ellipsis, - const Slice& tail, - int64_t length) const; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis by propagating strides (non-advanced indexing only). - /// - /// See generic #getitem_bystrides for details. - const NumpyArray - getitem_bystrides(const SliceNewAxis& newaxis, - const Slice& tail, - int64_t length) const; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis by building up a `carry` {@link IndexOf Index}. - /// - /// @param head First element of the Slice tuple. - /// @param tail The rest of the elements of the Slice tuple. - /// @param carry The filter/rearrangement/duplication {@link IndexOf Index} - /// that will be applied to the last axis. - /// @param advanced If empty, no array slices (integer or boolean) have - /// been encountered yet; otherwise, positions in any subsequent array - /// slices to select. - /// @param length The length of the output array (after propagating - /// through all axis levels). - /// @param stride The size of the data to carry at each item of the - /// carry {@link IndexOf Index}. - /// @param first If `true`, this axis is the first axis to be considered. - /// - /// In the [NumPy documentation](https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#integer-array-indexing), - /// advanced indexes are described as iterating "as one," which requires - /// an {@link IndexOf Index} to be propagated when implemented recursively. - /// - /// Identities are only sliced at the `first` axis. - const NumpyArray - getitem_next(const SliceItemPtr& head, - const Slice& tail, - const Index64& carry, - const Index64& advanced, - int64_t length, - int64_t stride, - bool first) const; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis by building up a `carry` {@link IndexOf Index}. - /// - /// See generic #getitem_bystrides for details. - const NumpyArray - getitem_next(const SliceAt& at, - const Slice& tail, - const Index64& carry, - const Index64& advanced, - int64_t length, - int64_t stride, - bool first) const; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis by building up a `carry` {@link IndexOf Index}. - /// - /// See generic #getitem_bystrides for details. - const NumpyArray - getitem_next(const SliceRange& range, - const Slice& tail, - const Index64& carry, - const Index64& advanced, - int64_t length, - int64_t stride, - bool first) const; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis by building up a `carry` {@link IndexOf Index}. - /// - /// See generic #getitem_bystrides for details. - const NumpyArray - getitem_next(const SliceEllipsis& ellipsis, - const Slice& tail, - const Index64& carry, - const Index64& advanced, - int64_t length, - int64_t stride, - bool first) const; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis by building up a `carry` {@link IndexOf Index}. - /// - /// See generic #getitem_bystrides for details. - const NumpyArray - getitem_next(const SliceNewAxis& newaxis, - const Slice& tail, - const Index64& carry, - const Index64& advanced, - int64_t length, - int64_t stride, - bool first) const; - - /// @brief Internal function that propagates a generic #getitem request - /// through one axis by building up a `carry` {@link IndexOf Index}. - /// - /// See generic #getitem_bystrides for details. - const NumpyArray - getitem_next(const SliceArray64& array, - const Slice& tail, - const Index64& carry, - const Index64& advanced, - int64_t length, - int64_t stride, - bool first) const; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceArray64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceMissing64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceJagged64& slicecontent, - const Slice& tail) const override; - - /// @brief Internal function to fill JSON with boolean values. - void - tojson_boolean(ToJson& builder, bool include_beginendlist) const; - - /// @brief Internal function to fill JSON with integer values. - template - void - tojson_integer(ToJson& builder, bool include_beginendlist) const; - - /// @brief Internal function to fill JSON with floating-point values. - template - void - tojson_real(ToJson& builder, bool include_beginendlist) const; - - /// @brief Internal function to fill JSON with complex values. - template - void - tojson_complex(ToJson& builder, bool include_beginendlist) const; - - /// @brief Internal function to fill JSON with string values. - void - tojson_string(ToJson& builder, bool include_beginendlist) const; - - private: - - /// @brief std::sort uses intro-sort - /// std::stable_sort uses mergesort - template - const std::shared_ptr index_sort(const T* data, - int64_t length, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const; - - template - const std::shared_ptr array_sort(const T* data, - int64_t length, - const Index64& starts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const; - template - const std::shared_ptr array_unique(const T* data, - int64_t length, - const Index64& starts, - const Index64& parents, - int64_t& outlength) const; - - template - const std::shared_ptr string_unique(const T* data, - int64_t length, - const Index64& offsets, - Index64& outoffsets, - int64_t& outlength) const; - - template - bool subranges_equal(const T* data, - int64_t length, - const Index64& starts, - const Index64& stops) const; - - template - const std::shared_ptr as_type(const T* data, - int64_t length, - const util::dtype dtype) const; - - template - const std::shared_ptr cast_to_type(const FROM* data, - int64_t length) const; - - const ContentPtr - sort_data(bool ascending, - bool stable) const; - - const ContentPtr - unique_data() const; - - /// @brief See #ptr. - std::shared_ptr ptr_; - /// @brief See #ptr_li - const kernel::lib ptr_lib_; - /// @brief See #shape. - std::vector shape_; - /// @brief See #strides. - std::vector strides_; - /// @brief See #byteoffset. - ssize_t byteoffset_; - /// @brief See #itemsize. - const ssize_t itemsize_; - /// @brief See #format. - const std::string format_; - /// @brief See #dtype. - const util::dtype dtype_; - - }; -} - -#endif // AWKWARD_NUMPYARRAY_H_ diff --git a/include/awkward/array/Record.h b/include/awkward/array/Record.h deleted file mode 100644 index 17d738d7c2..0000000000 --- a/include/awkward/array/Record.h +++ /dev/null @@ -1,373 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_RECORD_H_ -#define AWKWARD_RECORD_H_ - -#include "awkward/common.h" -#include "awkward/array/RecordArray.h" - -namespace awkward { - /// @class Record - /// - /// @brief Represents a tuple or record, a scalar value from RecordArray. - /// - /// Many of the methods raise runtime errors. See - /// {@link Content#isscalar Content::isscalar}. - class LIBAWKWARD_EXPORT_SYMBOL Record: public Content { - public: - /// @brief Creates a Record from a full set of parameters. - /// - /// @param array A reference to the array in which this tuple/record - /// resides (not a copy, shares reference count). - /// @param at The position in the #array where this tuple/record - /// resides. - Record(const std::shared_ptr array, int64_t at); - - /// @brief A reference to the array in which this tuple/record - /// resides (not a copy, shares reference count). - const std::shared_ptr - array() const; - - /// @brief The position in the #array where this tuple/record - /// resides. - int64_t - at() const; - - /// @brief Returns a `std::vector>` of each - /// field at this record position (#at). - /// - /// The values might be scalars, such as zero-dimensional NumpyArray, - /// None, or another Record. - const ContentPtrVec - contents() const; - - /// @brief The #array's - /// {@link RecordArray#recordlookup RecordArray::recordlookup}. - const util::RecordLookupPtr - recordlookup() const; - - /// @brief Returns `true` if #recordlookup is `nullptr`; `false` otherwise. - bool - istuple() const override; - - /// @copydoc Content::isscalar() - /// - /// Always returns `true`. - bool - isscalar() const override; - - /// @brief User-friendly name of this class: `"Record"`. - const std::string - classname() const override; - - const IdentitiesPtr - identities() const override; - - /// @exception std::runtime_error is always thrown - void - setidentities() override; - - /// @exception std::runtime_error is always thrown - void - setidentities(const IdentitiesPtr& identities) override; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - const FormPtr - form(bool materialize) const override; - - kernel::lib - kernels() const override; - - void - caches(std::vector& out) const override; - - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - void - tojson_part(ToJson& builder, bool include_beginendlist) const override; - - void - nbytes_part(std::map& largest) const override; - - int64_t - length() const override; - - const ContentPtr - shallow_copy() const override; - - const ContentPtr - deep_copy(bool copyarrays, - bool copyindexes, - bool copyidentities) const override; - - void - check_for_iteration() const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_nothing() const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_at(int64_t at) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_at_nowrap(int64_t at) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_range(int64_t start, int64_t stop) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_range_nowrap(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_field(const std::string& key) const override; - - const ContentPtr - getitem_field(const std::string& key, - const Slice& only_fields) const override; - - const ContentPtr - getitem_fields(const std::vector& keys) const override; - - const ContentPtr - getitem_fields(const std::vector& keys, - const Slice& only_fields) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - carry(const Index64& carry, bool allow_lazy) const override; - - bool - dimension_optiontype() const override; - - int64_t - purelist_depth() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - // operations - const std::string - validityerror(const std::string& path) const override; - - /// For Record, this method returns #shallow_copy (pass-through). - const ContentPtr - shallow_simplify() const override; - - const int64_t - axis_wrap_if_negative(int64_t axis) const; - - const ContentPtr - num(int64_t axis, int64_t depth) const override; - - /// @exception std::runtime_error is always thrown - const std::pair - offsets_and_flattened(int64_t axis, int64_t depth) const override; - - /// @exception std::runtime_error is always thrown - bool - mergeable(const ContentPtr& other, bool mergebool) const override; - - bool - referentially_equal(const ContentPtr& other) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - mergemany(const ContentPtrVec& others) const override; - - /// @exception std::runtime_error is always thrown - const SliceItemPtr - asslice() const override; - - const ContentPtr - fillna(const ContentPtr& value) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - rpad(int64_t target, int64_t axis, int64_t depth) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - rpad_and_clip(int64_t target, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - reduce_next(const Reducer& reducer, - int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool mask, - bool keepdims) const override; - - const ContentPtr - sort_next(int64_t negaxis, - const Index64& starts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - argsort_next(int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - localindex(int64_t axis, int64_t depth) const override; - - const ContentPtr - combinations(int64_t n, - bool replacement, - const util::RecordLookupPtr& recordlookup, - const util::Parameters& parameters, - int64_t axis, - int64_t depth) const override; - - /// @brief Returns the field at a given index. - /// - /// Equivalent to `contents[fieldindex]`. - const ContentPtr - field(int64_t fieldindex) const; - - /// @brief Returns the field at a given key name. - /// - /// Equivalent to `contents[fieldindex]`. - const ContentPtr - field(const std::string& key) const; - - /// @brief Returns all fields. - /// - /// Equivalent to `contents`. - const ContentPtrVec - fields() const; - - /// @brief Returns key, field pairs for all fields. - const std::vector> - fielditems() const; - - /// @brief Returns this Record without #recordlookup, converting any - /// records into tuples. - const std::shared_ptr - astuple() const; - - const ContentPtr - getitem(const Slice& where) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_next(const SliceAt& at, - const Slice& tail, - const Index64& advanced) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_next(const SliceRange& range, - const Slice& tail, - const Index64& advanced) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_next(const SliceArray64& array, - const Slice& tail, - const Index64& advanced) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_next(const SliceField& field, - const Slice& tail, - const Index64& advanced) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_next(const SliceFields& fields, - const Slice& tail, - const Index64& advanced) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_next(const SliceJagged64& jagged, - const Slice& tail, - const Index64& advanced) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceArray64& slicecontent, - const Slice& tail) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceMissing64& slicecontent, - const Slice& tail) const override; - - /// @exception std::runtime_error is always thrown - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceJagged64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - copy_to(kernel::lib ptr_lib) const override; - - const ContentPtr - numbers_to_type(const std::string& name) const override; - - /// @brief Returns 'true' if all components of the array are unique - bool - is_unique() const override; - - /// @brief Returns an array where all components are unique - const ContentPtr - unique() const override; - - /// @brief Returns 'true' if subranges are equal - bool - is_subrange_equal(const Index64& start, const Index64& stop) const override; - - private: - /// @brief See #array. - const std::shared_ptr array_; - /// @brief See #at. - int64_t at_; - }; -} - -#endif // AWKWARD_RECORD_H_ diff --git a/include/awkward/array/RecordArray.h b/include/awkward/array/RecordArray.h deleted file mode 100644 index beede4cef2..0000000000 --- a/include/awkward/array/RecordArray.h +++ /dev/null @@ -1,503 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_RECORDARRAY_H_ -#define AWKWARD_RECORDARRAY_H_ - -#include -#include -#include - -#include "awkward/common.h" -#include "awkward/Identities.h" -#include "awkward/Content.h" - -namespace awkward { - /// @class RecordForm - /// - /// @brief Form describing RecordArray (not a Record). - class LIBAWKWARD_EXPORT_SYMBOL RecordForm: public Form { - public: - /// @brief Creates a RecordForm. See RecordArray (not Record) for - /// documentation. - RecordForm(bool has_identities, - const util::Parameters& parameters, - const FormKey& form_key, - const util::RecordLookupPtr& recordlookup, - const std::vector& contents); - - const util::RecordLookupPtr - recordlookup() const; - - const std::vector - contents() const; - - bool - istuple() const override; - - const FormPtr - content(int64_t fieldindex) const; - - const FormPtr - content(const std::string& key) const; - - const std::vector> - items() const; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - void - tojson_part(ToJson& builder, bool verbose) const override; - - const FormPtr - shallow_copy() const override; - - const FormPtr - with_form_key(const FormKey& form_key) const override; - - const std::string - purelist_parameter(const std::string& key) const override; - - bool - purelist_isregular() const override; - - int64_t - purelist_depth() const override; - - bool - dimension_optiontype() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - equal(const FormPtr& other, - bool check_identities, - bool check_parameters, - bool check_form_key, - bool compatibility_check) const override; - - const FormPtr - getitem_field(const std::string& key) const override; - - const FormPtr - getitem_fields(const std::vector& keys) const override; - - private: - const util::RecordLookupPtr recordlookup_; - const std::vector contents_; - }; - - /// @class RecordArray - /// - /// @brief Represents an array of tuples or records, in which a tuple - /// has a fixed number of differently typed fields and a record has - /// a named set of differently typed fields. - /// - /// See #RecordArray for the meaning of each parameter. - /// - /// Tuples and records are distinguished by the absence or presence of a - /// #recordlookup (`std::vector`) that associates key names - /// with each field. - /// - /// Fields are always ordered, whether tuples or records. - class LIBAWKWARD_EXPORT_SYMBOL RecordArray: - public Content, - public std::enable_shared_from_this { - public: - /// @brief Creates a RecordArray from a full set of parameters. - /// - /// @param identities Optional Identities for each element of the array - /// (may be `nullptr`). - /// @param parameters String-to-JSON map that augments the meaning of this - /// array. - /// @param contents `std::vector` of Content instances representing the - /// (ordered) fields. - /// @param recordlookup A `std::shared_ptr>` - /// optional list of key names. - /// @param length The length of the RecordArray; must be less than or - /// equal to the lengths of all #contents. - /// @param caches A list of all #VirtualArray caches contained within - /// this structure, so that they don't have to be searched repeatedly. - /// If absent (`nullptr`), the data are tuples; otherwise, they are - /// records. The number of names must match the number of #contents. - /// @param length The length of the array, breaking ambiguities between - /// #contents of different lengths and essential if there are zero fields. - RecordArray(const IdentitiesPtr& identities, - const util::Parameters& parameters, - const ContentPtrVec& contents, - const util::RecordLookupPtr& recordlookup, - int64_t length, - const std::vector& caches); - - /// @brief Creates a RecordArray in which #caches is derived from - /// the #contents. - RecordArray(const IdentitiesPtr& identities, - const util::Parameters& parameters, - const ContentPtrVec& contents, - const util::RecordLookupPtr& recordlookup, - int64_t length); - - /// @brief Creates a RecordArray in which #length is the minimum - /// length of the #contents or zero if there are no #contents. - RecordArray(const IdentitiesPtr& identities, - const util::Parameters& parameters, - const ContentPtrVec& contents, - const util::RecordLookupPtr& recordlookup); - - /// @brief `std::vector` of Content instances representing the - /// (ordered) fields. - const ContentPtrVec - contents() const; - - /// @brief A `std::shared_ptr>` - /// optional list of key names. - /// If absent (`nullptr`), the data are tuples; otherwise, they are - /// records. The number of names must match the number of #contents. - const util::RecordLookupPtr - recordlookup() const; - - /// @brief Returns `true` if #recordlookup is `nullptr`; `false` otherwise. - bool - istuple() const override; - - /// @brief Returns a RecordArray with an additional or a replaced field - /// at index `where` with value `what`. - /// - /// This "setitem" method does not change the original array; and the - /// output references most of the original data (without copying). - const ContentPtr - setitem_field(int64_t where, const ContentPtr& what) const; - - /// @brief Returns a RecordArray with an additional or a replaced field - /// at key name `where` with value `what`. - /// - /// This "setitem" method does not change the original array; and the - /// output references most of the original data (without copying). - const ContentPtr - setitem_field(const std::string& where, const ContentPtr& what) const; - - /// @brief User-friendly name of this class: `"RecordArray"`. - const std::string - classname() const override; - - void - setidentities() override; - - void - setidentities(const IdentitiesPtr& identities) override; - - const FormPtr - form(bool materialize) const override; - - kernel::lib - kernels() const override; - - void - caches(std::vector& out) const override; - - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - void - tojson_part(ToJson& builder, bool include_beginendlist) const override; - - void - nbytes_part(std::map& largest) const override; - - /// @copydoc Content::length() - /// - /// Note that this is an input parameter. - int64_t - length() const override; - - const ContentPtr - shallow_copy() const override; - - const ContentPtr - deep_copy(bool copyarrays, - bool copyindexes, - bool copyidentities) const override; - - void - check_for_iteration() const override; - - const ContentPtr - getitem_nothing() const override; - - const ContentPtr - getitem_at(int64_t at) const override; - - const ContentPtr - getitem_at_nowrap(int64_t at) const override; - - const ContentPtr - getitem_range(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_range_nowrap(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_field(const std::string& key) const override; - - const ContentPtr - getitem_field(const std::string& key, - const Slice& only_fields) const override; - - const ContentPtr - getitem_fields(const std::vector& keys) const override; - - const ContentPtr - getitem_fields(const std::vector& keys, - const Slice& only_fields) const override; - - const ContentPtr - getitem_next(const SliceItemPtr& head, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - carry(const Index64& carry, bool allow_lazy) const override; - - int64_t - purelist_depth() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - // operations - const std::string - validityerror(const std::string& path) const override; - - /// @copydoc Content::shallow_simplify() - /// - /// For RecordArray, this method returns #shallow_copy (pass-through). - const ContentPtr - shallow_simplify() const override; - - const ContentPtr - num(int64_t axis, int64_t depth) const override; - - const std::pair - offsets_and_flattened(int64_t axis, int64_t depth) const override; - - bool - mergeable(const ContentPtr& other, bool mergebool) const override; - - bool - referentially_equal(const ContentPtr& other) const override; - - const ContentPtr - mergemany(const ContentPtrVec& others) const override; - - const SliceItemPtr - asslice() const override; - - const ContentPtr - fillna(const ContentPtr& value) const override; - - const ContentPtr - rpad(int64_t target, int64_t axis, int64_t depth) const override; - - const ContentPtr - rpad_and_clip(int64_t target, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - reduce_next(const Reducer& reducer, - int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool mask, - bool keepdims) const override; - - const ContentPtr - sort_next(int64_t negaxis, - const Index64& starts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - argsort_next(int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - localindex(int64_t axis, int64_t depth) const override; - - const ContentPtr - combinations(int64_t n, - bool replacement, - const util::RecordLookupPtr& recordlookup, - const util::Parameters& parameters, - int64_t axis, - int64_t depth) const override; - - /// @brief Returns the field at a given index (without trimming it to - /// have the same #length as this RecordArray). - /// - /// Equivalent to `contents[fieldindex]`. - const ContentPtr - field(int64_t fieldindex) const; - - /// @brief Returns the field with a given key name (without trimming it to - /// have the same #length as this RecordArray). - /// - /// Equivalent to `contents[fieldindex(key)]`. - const ContentPtr - field(const std::string& key) const; - - /// @brief Returns all the fields (without trimming them to have the same - /// #length as this RecordArray). - /// - /// Equivalent to `contents`. - const ContentPtrVec - fields() const; - - /// @brief Returns key, field pairs for all fields (without trimming them - /// to have the same #length as this RecordArray). - const std::vector> - fielditems() const; - - /// @brief Returns this RecordArray without #recordlookup, converting any - /// records into tuples. - const std::shared_ptr - astuple() const; - - const ContentPtr - getitem_next(const SliceAt& at, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceRange& range, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceArray64& array, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceField& field, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceFields& fields, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceJagged64& jagged, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceArray64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceMissing64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceJagged64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - copy_to(kernel::lib ptr_lib) const override; - - const ContentPtr - numbers_to_type(const std::string& name) const override; - - /// @brief Returns 'true' if all components of the array are unique - bool - is_unique() const override; - - /// @brief Returns an array where all components are unique - const ContentPtr - unique() const override; - - /// @brief Returns 'true' if subranges are equal - bool - is_subrange_equal(const Index64& start, const Index64& stop) const override; - - protected: - template - const ContentPtr - getitem_next_jagged_generic(const Index64& slicestarts, - const Index64& slicestops, - const S& slicecontent, - const Slice& tail) const; - - private: - /// @brief See #contents. - const ContentPtrVec contents_; - /// @brief See #recordlookup. - const util::RecordLookupPtr recordlookup_; - /// @brief See #length. - int64_t length_; - /// @brief See #caches. - const std::vector caches_; - }; -} - -#endif // AWKWARD_RECORDARRAY_H_ diff --git a/include/awkward/array/RegularArray.h b/include/awkward/array/RegularArray.h deleted file mode 100644 index 6b53c49466..0000000000 --- a/include/awkward/array/RegularArray.h +++ /dev/null @@ -1,429 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_REGULARARRAY_H_ -#define AWKWARD_REGULARARRAY_H_ - -#include -#include -#include - -#include "awkward/common.h" -#include "awkward/Slice.h" -#include "awkward/Content.h" - -namespace awkward { - /// @class RegularForm - /// - /// @brief Form describing RegularArray. - class LIBAWKWARD_EXPORT_SYMBOL RegularForm: public Form { - public: - /// @brief Creates a RegularForm. See RegularArray for documentation. - RegularForm(bool has_identities, - const util::Parameters& parameters, - const FormKey& form_key, - const FormPtr& content, - int64_t size); - - const FormPtr - content() const; - - int64_t - size() const; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - void - tojson_part(ToJson& builder, bool verbose) const override; - - const FormPtr - shallow_copy() const override; - - const FormPtr - with_form_key(const FormKey& form_key) const override; - - const std::string - purelist_parameter(const std::string& key) const override; - - bool - purelist_isregular() const override; - - int64_t - purelist_depth() const override; - - bool - dimension_optiontype() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - bool - equal(const FormPtr& other, - bool check_identities, - bool check_parameters, - bool check_form_key, - bool compatibility_check) const override; - - const FormPtr - getitem_field(const std::string& key) const override; - - const FormPtr - getitem_fields(const std::vector& keys) const override; - - private: - const FormPtr content_; - int64_t size_; - }; - - /// @class RegularArray - /// - /// @brief Represents an array of nested lists that all have the same - /// length using a scalar #size, rather than an index. - /// - /// The #content must be contiguous, in-order, and non-overlapping, and - /// it must also start at zero. - /// - /// See #RegularArray for the meaning of each parameter. - class LIBAWKWARD_EXPORT_SYMBOL RegularArray: public Content { - public: - /// @brief Creates a RegularArray from a full set of parameters. - /// - /// @param identities Optional Identities for each element of the array - /// (may be `nullptr`). - /// @param parameters String-to-JSON map that augments the meaning of this - /// array. - /// @param content Data contained within all nested lists as a contiguous - /// array. - /// Values in `content[i]` where `i >= length * size` are "unreachable," - /// and don't exist in the high level view. - /// @param size Length of the equally sized nested lists. - /// @param zeros_length If `size == 0`, this is the length of the array; otherwise, - /// the length of the array is derived as the floor of length / size. - RegularArray(const IdentitiesPtr& identities, - const util::Parameters& parameters, - const ContentPtr& content, - int64_t size, - int64_t zeros_length); - - /// @brief Creates a RegularArray in which `zeros_length` is zero. - RegularArray(const IdentitiesPtr& identities, - const util::Parameters& parameters, - const ContentPtr& content, - int64_t size); - - /// @brief Data contained within all nested lists as a contiguous array. - /// - /// Values in `content[i]` where `i >= length * size` are "unreachable," - /// and don't exist in the high level view. - const ContentPtr - content() const; - - /// @brief Length of the equally sized nested lists. - int64_t - size() const; - - /// @brief Returns 64-bit offsets, possibly starting with `offsets[0] = 0`, - /// that would represent the spacing in this RegularArray. - /// - /// @param start_at_zero If `true`, the first offset will be `0`, meaning - /// there are no "unreachable" elements in the `content` that corresponds - /// to these offsets. - Index64 - compact_offsets64(bool start_at_zero) const; - - /// @brief Verify that a given set of `offsets` are regular - /// and return a {@link ListOffsetArrayOf ListOffsetArray} of this array - /// using those `offsets`. - /// - /// As indicated by the name, this is a basic element of broadcasting. - const ContentPtr - broadcast_tooffsets64(const Index64& offsets) const; - - /// @brief Effectively the same as #shallow_copy, but with the same name - /// as the equivalent - /// {@link ListArrayOf#toRegularArray ListArray::toRegularArray} and - /// {@link ListOffsetArrayOf#toRegularArray ListOffsetArray::toRegularArray}. - const ContentPtr - toRegularArray() const; - - /// @brief Converts this array into a - /// {@link ListOffsetArrayOf ListOffsetArray} by generating `offsets` that - /// are equivalent to its regular #size. - /// - /// @param start_at_zero If `true`, the first offset will be `0`, meaning - /// there are no "unreachable" elements in the `content` that corresponds - /// to these offsets. For a RegularArray, this would always be true. - const ContentPtr - toListOffsetArray64(bool start_at_zero) const; - - /// @brief User-friendly name of this class: `"RegularArray"`. - const std::string - classname() const override; - - void - setidentities() override; - - void - setidentities(const IdentitiesPtr& identities) override; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - const FormPtr - form(bool materialize) const override; - - kernel::lib - kernels() const override; - - void - caches(std::vector& out) const override; - - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - void - tojson_part(ToJson& builder, bool include_beginendlist) const override; - - void - nbytes_part(std::map& largest) const override; - - /// @copydoc Content::length() - /// - /// Equal to `floor(len(content) / size)` or `0` if `size == 0`. - int64_t - length() const override; - - const ContentPtr - shallow_copy() const override; - - const ContentPtr - deep_copy(bool copyarrays, - bool copyindexes, - bool copyidentities) const override; - - void - check_for_iteration() const override; - - const ContentPtr - getitem_nothing() const override; - - const ContentPtr - getitem_at(int64_t at) const override; - - const ContentPtr - getitem_at_nowrap(int64_t at) const override; - - const ContentPtr - getitem_range(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_range_nowrap(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_field(const std::string& key) const override; - - const ContentPtr - getitem_field(const std::string& key, - const Slice& only_fields) const override; - - const ContentPtr - getitem_fields(const std::vector& keys) const override; - - const ContentPtr - getitem_fields(const std::vector& keys, - const Slice& only_fields) const override; - - const ContentPtr - carry(const Index64& carry, bool allow_lazy) const override; - - int64_t - purelist_depth() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - // operations - const std::string - validityerror(const std::string& path) const override; - - /// @copydoc Content::shallow_simplify() - /// - /// For RegularArray, this method returns #shallow_copy (pass-through). - const ContentPtr - shallow_simplify() const override; - - const ContentPtr - num(int64_t axis, int64_t depth) const override; - - const std::pair - offsets_and_flattened(int64_t axis, int64_t depth) const override; - - bool - mergeable(const ContentPtr& other, bool mergebool) const override; - - bool - referentially_equal(const ContentPtr& other) const override; - - const ContentPtr - mergemany(const ContentPtrVec& others) const override; - - const SliceItemPtr - asslice() const override; - - const ContentPtr - fillna(const ContentPtr& value) const override; - - const ContentPtr - rpad(int64_t target, int64_t axis, int64_t depth) const override; - - const ContentPtr - rpad_and_clip(int64_t target, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - reduce_next(const Reducer& reducer, - int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool mask, - bool keepdims) const override; - - const ContentPtr - sort_next(int64_t negaxis, - const Index64& starts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - argsort_next(int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - localindex(int64_t axis, int64_t depth) const override; - - const ContentPtr - combinations(int64_t n, - bool replacement, - const util::RecordLookupPtr& recordlookup, - const util::Parameters& parameters, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - getitem_next(const SliceAt& at, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceRange& range, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceArray64& array, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceJagged64& jagged, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceArray64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceMissing64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceJagged64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - copy_to(kernel::lib ptr_lib) const override; - - const ContentPtr - numbers_to_type(const std::string& name) const override; - - /// @brief Returns 'true' if all components of the array are unique - bool - is_unique() const override; - - /// @brief Returns an array where all components are unique - const ContentPtr - unique() const override; - - /// @brief Returns 'true' if subranges are equal - bool - is_subrange_equal(const Index64& start, const Index64& stop) const override; - - private: - const ContentPtr content_; - int64_t size_; - int64_t length_; - }; -} - -#endif // AWKWARD_REGULARARRAY_H_ diff --git a/include/awkward/array/UnionArray.h b/include/awkward/array/UnionArray.h deleted file mode 100644 index 7f350ef036..0000000000 --- a/include/awkward/array/UnionArray.h +++ /dev/null @@ -1,493 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_UNIONARRAY_H_ -#define AWKWARD_UNIONARRAY_H_ - -#include -#include -#include - -#include "awkward/common.h" -#include "awkward/Slice.h" -#include "awkward/Index.h" -#include "awkward/Content.h" - -namespace awkward { - /// @class UnionForm - /// - /// @brief Form describing UnionArray. - class LIBAWKWARD_EXPORT_SYMBOL UnionForm: public Form { - public: - /// @brief Creates a UnionForm. See {@link UnionArrayOf UnionArray} for - /// documentation. - UnionForm(bool has_identities, - const util::Parameters& parameters, - const FormKey& form_key, - Index::Form tags, - Index::Form index, - const std::vector& contents); - - Index::Form - tags() const; - - Index::Form - index() const; - - const std::vector - contents() const; - - int64_t - numcontents() const; - - const FormPtr - content(int64_t index) const; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - void - tojson_part(ToJson& builder, bool verbose) const override; - - const FormPtr - shallow_copy() const override; - - const FormPtr - with_form_key(const FormKey& form_key) const override; - - const std::string - purelist_parameter(const std::string& key) const override; - - bool - purelist_isregular() const override; - - int64_t - purelist_depth() const override; - - bool - dimension_optiontype() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - bool - equal(const FormPtr& other, - bool check_identities, - bool check_parameters, - bool check_form_key, - bool compatibility_check) const override; - - const FormPtr - getitem_field(const std::string& key) const override; - - const FormPtr - getitem_fields(const std::vector& keys) const override; - - private: - Index::Form tags_; - Index::Form index_; - const std::vector contents_; - }; - - /// @class UnionArrayOf - /// - /// @brief Represents heterogeneous data by interleaving several #contents, - /// indicating which is relevant at a given position with #tags and - /// where to find each item in the #contents with an interleaved #index. - /// - /// See #UnionArrayOf for the meaning of each parameter. - /// - /// {@link UnionArrayOf UnionArrays} can be used to interleave data of the - /// same type, though #simplify_uniontype would combine such arrays to - /// simplify the representation. - template - class -#ifdef AWKWARD_UNIONARRAY_NO_EXTERN_TEMPLATE - LIBAWKWARD_EXPORT_SYMBOL -#endif - UnionArrayOf: public Content { - public: - /// @brief Generates an index in which `index[i] = i`. - static const IndexOf - sparse_index(int64_t len); - - /// @brief Generates an index in which `index[tags == i][i] = i`. - static const IndexOf - regular_index(const IndexOf& tags); - - /// @brief Generates tags and index for concatenating arrays with axis != 0. - static const std::pair, IndexOf> - nested_tags_index(const Index64& offsets, - const std::vector& counts); - - /// @brief Creates a UnionArrayOf from a full set of parameters. - /// - /// @param identities Optional Identities for each element of the array - /// (may be `nullptr`). - /// @param parameters String-to-JSON map that augments the meaning of this - /// array. - /// @param tags Small integers indicating which of the #contents to draw - /// from for each element of the heterogeneous array. - /// The #tags must all be non-negative and less than `len(contents)`. - /// @param index Positions within the #contents to find each item. - /// @param contents `std::vector` of Content instances representing each - /// of the possible types. - /// - /// For each `i`, this `array[i] = contents[tags[i]][index[i]]`. - UnionArrayOf(const IdentitiesPtr& identities, - const util::Parameters& parameters, - const IndexOf tags, - const IndexOf& index, - const ContentPtrVec& contents); - - /// @brief Small integers indicating which of the #contents to draw - /// from for each element of the heterogeneous array. - /// - /// The #tags must all be non-negative and less than `len(contents)`. - /// - /// For each `i`, this `array[i] = contents[tags[i]][index[i]]`. - const IndexOf - tags() const; - - /// @brief Positions within the #contents to find each item. - /// - /// For each `i`, this `array[i] = contents[tags[i]][index[i]]`. - const IndexOf - index() const; - - /// @brief `std::vector` of Content instances representing each - /// of the possible types. - const ContentPtrVec - contents() const; - - /// @brief The number of #contents. - int64_t - numcontents() const; - - /// @brief Returns `contents[index]`. - const ContentPtr - content(int64_t index) const; - - /// @brief Returns all items in the array corresponding to one of the - /// #contents, in the order that they appear in the array. - /// - /// Equivalent to `array[tags == index].shallow_simplify()`. - const ContentPtr - project(int64_t index) const; - - /// @brief If any of the #contents is also a - /// {@link UnionArrayOf UnionArray}, combine this array and its #contents - /// into a single-level {@link UnionArrayOf UnionArray}. - /// - /// This is a shallow operation: it only checks the content one level deep. - /// - /// @param merge If true, attempt to merge buffers recursively; otherwise, - /// only clean up UnionArray(UnionArray(...)), but leave potentially mergeable - /// buffers unmerged. If false, #mergeable isn't even tested (which avoids - /// materializing #VirtualArray too soon). - /// @param mergebool If true, consider booleans to be an integer type for - /// merging. - const ContentPtr - simplify_uniontype(bool merge, bool mergebool) const; - - /// @brief User-friendly name of this class: `"UnionArray8_32"`, - /// `"UnionArray8_U32"`, or `"UnionArray8_64"`. - const std::string - classname() const override; - - void - setidentities() override; - - void - setidentities(const IdentitiesPtr& identities) override; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - const FormPtr - form(bool materialize) const override; - - kernel::lib - kernels() const override; - - void - caches(std::vector& out) const override; - - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - void - tojson_part(ToJson& builder, bool include_beginendlist) const override; - - void - nbytes_part(std::map& largest) const override; - - /// @copydoc Content::length() - /// - /// Equal to `len(tags)`. - int64_t - length() const override; - - const ContentPtr - shallow_copy() const override; - - const ContentPtr - deep_copy(bool copyarrays, - bool copyindexes, - bool copyidentities) const override; - - void - check_for_iteration() const override; - - const ContentPtr - getitem_nothing() const override; - - const ContentPtr - getitem_at(int64_t at) const override; - - const ContentPtr - getitem_at_nowrap(int64_t at) const override; - - const ContentPtr - getitem_range(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_range_nowrap(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_field(const std::string& key) const override; - - const ContentPtr - getitem_field(const std::string& key, - const Slice& only_fields) const override; - - const ContentPtr - getitem_fields(const std::vector& keys) const override; - - const ContentPtr - getitem_fields(const std::vector& keys, - const Slice& only_fields) const override; - - const ContentPtr - getitem_next(const SliceItemPtr& head, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - carry(const Index64& carry, bool allow_lazy) const override; - - int64_t - purelist_depth() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - // operations - const std::string - validityerror(const std::string& path) const override; - - /// @copydoc Content::shallow_simplify() - /// - /// For {@link UnionArrayOf UnionArray}, this method returns - /// #simplify_uniontype. - const ContentPtr - shallow_simplify() const override; - - const ContentPtr - num(int64_t axis, int64_t depth) const override; - - const std::pair - offsets_and_flattened(int64_t axis, int64_t depth) const override; - - bool - mergeable(const ContentPtr& other, bool mergebool) const override; - - bool - referentially_equal(const ContentPtr& other) const override; - - const ContentPtr - reverse_merge(const ContentPtr& other) const override; - - const std::pair - merging_strategy(const ContentPtrVec& others) const override; - - const ContentPtr - mergemany(const ContentPtrVec& others) const override; - - const SliceItemPtr - asslice() const override; - - const ContentPtr - fillna(const ContentPtr& value) const override; - - const ContentPtr - rpad(int64_t target, int64_t axis, int64_t depth) const override; - - const ContentPtr - rpad_and_clip(int64_t target, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - reduce_next(const Reducer& reducer, - int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool mask, - bool keepdims) const override; - - const ContentPtr - sort_next(int64_t negaxis, - const Index64& starts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - argsort_next(int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - localindex(int64_t axis, int64_t depth) const override; - - const ContentPtr - combinations(int64_t n, - bool replacement, - const util::RecordLookupPtr& recordlookup, - const util::Parameters& parameters, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - getitem_next(const SliceAt& at, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceRange& range, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceArray64& array, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceJagged64& jagged, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceArray64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceMissing64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceJagged64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - copy_to(kernel::lib ptr_lib) const override; - - const ContentPtr - numbers_to_type(const std::string& name) const override; - - /// @brief Returns 'true' if all components of the array are unique - bool - is_unique() const override; - - /// @brief Returns an array where all components are unique - const ContentPtr - unique() const override; - - /// @brief Returns 'true' if subranges are equal - bool - is_subrange_equal(const Index64& start, const Index64& stop) const override; - - protected: - template - const ContentPtr - getitem_next_jagged_generic(const Index64& slicestarts, - const Index64& slicestops, - const S& slicecontent, - const Slice& tail) const; - - private: - const IndexOf tags_; - const IndexOf index_; - const ContentPtrVec contents_; - }; - -#ifndef AWKWARD_UNIONARRAY_NO_EXTERN_TEMPLATE - extern template class UnionArrayOf; - extern template class UnionArrayOf; - extern template class UnionArrayOf; -#endif - - using UnionArray8_32 = UnionArrayOf; - using UnionArray8_U32 = UnionArrayOf; - using UnionArray8_64 = UnionArrayOf; -} - -#endif // AWKWARD_UNIONARRAY_H_ diff --git a/include/awkward/array/UnmaskedArray.h b/include/awkward/array/UnmaskedArray.h deleted file mode 100644 index f5caecabf4..0000000000 --- a/include/awkward/array/UnmaskedArray.h +++ /dev/null @@ -1,417 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_UNMASKEDARRAY_H_ -#define AWKWARD_UNMASKEDARRAY_H_ - -#include -#include -#include - -#include "awkward/common.h" -#include "awkward/Slice.h" -#include "awkward/Index.h" -#include "awkward/Content.h" - -namespace awkward { - - class ByteMaskedArray; - - /// @class UnmaskedForm - /// - /// @brief Form describing UnmaskedArray. - class LIBAWKWARD_EXPORT_SYMBOL UnmaskedForm: public Form { - public: - /// @brief Creates a UnmaskedForm. See UnmaskedArray for documentation. - UnmaskedForm(bool has_identities, - const util::Parameters& parameters, - const FormKey& form_key, - const FormPtr& content); - - const FormPtr - content() const; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - void - tojson_part(ToJson& builder, bool verbose) const override; - - const FormPtr - shallow_copy() const override; - - const FormPtr - with_form_key(const FormKey& form_key) const override; - - const std::string - purelist_parameter(const std::string& key) const override; - - bool - purelist_isregular() const override; - - int64_t - purelist_depth() const override; - - bool - dimension_optiontype() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - bool - equal(const FormPtr& other, - bool check_identities, - bool check_parameters, - bool check_form_key, - bool compatibility_check) const override; - - const FormPtr - getitem_field(const std::string& key) const override; - - const FormPtr - getitem_fields(const std::vector& keys) const override; - - const FormPtr - simplify_optiontype() const; - - private: - const FormPtr content_; - }; - - /// @class UnmaskedArray - /// - /// @brief Converts #content of any type into an OptionType in which all - /// values happen to be valid. - /// - /// See #UnmaskedArray for the meaning of each parameter. - class LIBAWKWARD_EXPORT_SYMBOL UnmaskedArray: public Content { - public: - /// @brief Creates an UnmaskedArray from a full set of parameters. - /// - /// @param identities Optional Identities for each element of the array - /// (may be `nullptr`). - /// @param parameters String-to-JSON map that augments the meaning of this - /// array. - /// @param content Data to be converted to an OptionType. - UnmaskedArray(const IdentitiesPtr& identities, - const util::Parameters& parameters, - const ContentPtr& content); - - /// @brief Data to be converted to an OptionType. - const ContentPtr - content() const; - - /// @brief Equivalent to calling #content; removes OptionType but there are - /// no `None` values to remove. - const ContentPtr - project() const; - - /// @brief Applies a given `mask` and calls #project. - /// - /// @param mask A byte mask that is valid when `0`, `None` when `1`. - const ContentPtr - project(const Index8& mask) const; - - /// @brief Returns a byte mask of all `0` values (representing valid data). - const Index8 - bytemask() const; - - /// @brief If the #content also has OptionType, return the #content; - /// otherwise, return #shallow_copy. - /// - /// This is a shallow operation: it only checks the content one level deep. - const ContentPtr - simplify_optiontype() const; - - /// @brief Converts this array into a ByteMaskedArray. - const std::shared_ptr - toByteMaskedArray() const; - - /// @brief Converts this array into an - /// {@link IndexedArrayOf IndexedOptionArray} without missing values. - const ContentPtr - toIndexedOptionArray64() const; - - /// @brief User-friendly name of this class: `"UnmaskedArray"`. - const std::string - classname() const override; - - void - setidentities() override; - - void - setidentities(const IdentitiesPtr& identities) override; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - const FormPtr - form(bool materialize) const override; - - kernel::lib - kernels() const override; - - void - caches(std::vector& out) const override; - - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - void - tojson_part(ToJson& builder, bool include_beginendlist) const override; - - void - nbytes_part(std::map& largest) const override; - - int64_t - length() const override; - - const ContentPtr - shallow_copy() const override; - - const ContentPtr - deep_copy(bool copyarrays, - bool copyindexes, - bool copyidentities) const override; - - void - check_for_iteration() const override; - - const ContentPtr - getitem_nothing() const override; - - const ContentPtr - getitem_at(int64_t at) const override; - - const ContentPtr - getitem_at_nowrap(int64_t at) const override; - - const ContentPtr - getitem_range(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_range_nowrap(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_field(const std::string& key) const override; - - const ContentPtr - getitem_field(const std::string& key, - const Slice& only_fields) const override; - - const ContentPtr - getitem_fields(const std::vector& keys) const override; - - const ContentPtr - getitem_fields(const std::vector& keys, - const Slice& only_fields) const override; - - const ContentPtr - getitem_next(const SliceItemPtr& head, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - carry(const Index64& carry, bool allow_lazy) const override; - - int64_t - purelist_depth() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - // operations - const std::string - validityerror(const std::string& path) const override; - - /// @copydoc Content::shallow_simplify() - /// - /// For UnmaskedArray, this method returns #simplify_optiontype. - const ContentPtr - shallow_simplify() const override; - - const ContentPtr - num(int64_t axis, int64_t depth) const override; - - const std::pair - offsets_and_flattened(int64_t axis, int64_t depth) const override; - - bool - mergeable(const ContentPtr& other, bool mergebool) const override; - - bool - referentially_equal(const ContentPtr& other) const override; - - const ContentPtr - reverse_merge(const ContentPtr& other) const override; - - const ContentPtr - mergemany(const ContentPtrVec& others) const override; - - const SliceItemPtr - asslice() const override; - - const ContentPtr - fillna(const ContentPtr& value) const override; - - const ContentPtr - rpad(int64_t target, int64_t axis, int64_t depth) const override; - - const ContentPtr - rpad_and_clip(int64_t target, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - reduce_next(const Reducer& reducer, - int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool mask, - bool keepdims) const override; - - const ContentPtr - sort_next(int64_t negaxis, - const Index64& starts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - argsort_next(int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - localindex(int64_t axis, int64_t depth) const override; - - const ContentPtr - combinations(int64_t n, - bool replacement, - const util::RecordLookupPtr& recordlookup, - const util::Parameters& parameters, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - getitem_next(const SliceAt& at, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceRange& range, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceArray64& array, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceJagged64& jagged, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceArray64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceMissing64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceJagged64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - copy_to(kernel::lib ptr_lib) const override; - - const ContentPtr - numbers_to_type(const std::string& name) const override; - - /// @brief Returns 'true' if all components of the array are unique - bool - is_unique() const override; - - /// @brief Returns an array where all components are unique - const ContentPtr - unique() const override; - - /// @brief Returns 'true' if subranges are equal - bool - is_subrange_equal(const Index64& start, const Index64& stop) const override; - -protected: - template - const ContentPtr - getitem_next_jagged_generic(const Index64& slicestarts, - const Index64& slicestops, - const S& slicecontent, - const Slice& tail) const; - - private: - /// @brief See #content. - const ContentPtr content_; - - }; -} - -#endif // AWKWARD_UNMASKEDARRAY_H_ diff --git a/include/awkward/array/VirtualArray.h b/include/awkward/array/VirtualArray.h deleted file mode 100644 index a08361f14f..0000000000 --- a/include/awkward/array/VirtualArray.h +++ /dev/null @@ -1,467 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_VIRTUALARRAY_H_ -#define AWKWARD_VIRTUALARRAY_H_ - -#include -#include -#include - -#include "awkward/common.h" -#include "awkward/Slice.h" -#include "awkward/Content.h" -#include "awkward/virtual/ArrayGenerator.h" -#include "awkward/virtual/ArrayCache.h" - -namespace awkward { - /// @class VirtualForm - /// - /// @brief Form describing VirtualArray. - class LIBAWKWARD_EXPORT_SYMBOL VirtualForm: public Form { - public: - /// @brief Creates a VirtualForm. See VirtualArray for documentation. - VirtualForm(bool has_identities, - const util::Parameters& parameters, - const FormKey& form_key, - const FormPtr& form, - bool has_length); - - bool - has_form() const; - - const FormPtr - form() const; - - bool - has_length() const; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - void - tojson_part(ToJson& builder, bool verbose) const override; - - const FormPtr - shallow_copy() const override; - - const FormPtr - with_form_key(const FormKey& form_key) const override; - - const std::string - purelist_parameter(const std::string& key) const override; - - bool - purelist_isregular() const override; - - int64_t - purelist_depth() const override; - - bool - dimension_optiontype() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - bool - equal(const FormPtr& other, - bool check_identities, - bool check_parameters, - bool check_form_key, - bool compatibility_check) const override; - - const FormPtr - getitem_field(const std::string& key) const override; - - const FormPtr - getitem_fields(const std::vector& keys) const override; - - private: - const FormPtr form_; - bool has_length_; - }; - - /// @class VirtualArray - /// - /// @brief Represents an array that can be generated on demand. - /// - /// See #VirtualArray for the meaning of each parameter. - class LIBAWKWARD_EXPORT_SYMBOL VirtualArray: public Content { - public: - /// @brief Creates a VirtualArray from a full set of parameters. - /// - /// @param identities Optional Identities for each element of the array - /// (may be `nullptr`). - /// @param parameters String-to-JSON map that augments the meaning of this - /// array. - /// @param generator Function that materializes the array and possibly - /// checks it against an expected Form. - /// @param cache Temporary storage for materialized arrays to avoid calling - /// the #generator more than necessary. May be `nullptr`. - /// @param cache_key The key this VirtualArray will use when filling a - /// #cache. - VirtualArray(const IdentitiesPtr& identities, - const util::Parameters& parameters, - const ArrayGeneratorPtr& generator, - const ArrayCachePtr& cache, - const std::string& cache_key, - const kernel::lib ptr_lib = kernel::lib::cpu); - - /// @brief Creates a VirtualArray with an automatically assigned #cache_key - /// (unique per process). - VirtualArray(const IdentitiesPtr& identities, - const util::Parameters& parameters, - const ArrayGeneratorPtr& generator, - const ArrayCachePtr& cache, - const kernel::lib ptr_lib = kernel::lib::cpu); - - /// @brief Function that materializes the array and possibly - /// checks it against an expected Form. - const ArrayGeneratorPtr - generator() const; - - /// @brief Temporary storage for materialized arrays to avoid calling - /// the #generator more than necessary. May be `nullptr`. - const ArrayCachePtr - cache() const; - - const kernel::lib - ptr_lib() const; - - /// @brief Returns the array if it exists in the #cache; `nullptr` - /// otherwise. - /// - /// This method *does not* cause the array to be materialized if it is not. - const ContentPtr - peek_array() const; - - /// @brief Ensures that the array is generated and returns it. - /// - /// This method *does not* return `nullptr`. - const ContentPtr - array() const; - - /// @brief The key this VirtualArray will use when filling a #cache. - const std::string - cache_key() const; - - /// @brief User-friendly name of this class: `"VirtualArray"`. - const std::string - classname() const override; - - void - setidentities() override; - - void - setidentities(const IdentitiesPtr& identities) override; - - const TypePtr - type(const util::TypeStrs& typestrs) const override; - - const FormPtr - form(bool materialize) const override; - - kernel::lib - kernels() const override; - - void - caches(std::vector& out) const override; - - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - void - tojson_part(ToJson& builder, bool include_beginendlist) const override; - - /// @copydoc Content::nbytes_part - /// - /// The bytes of materialized arrays are not counted, so the - /// {@link Content#nbytes nbytes} of a VirtualArray is always zero. - void - nbytes_part(std::map& largest) const override; - - int64_t - length() const override; - - const ContentPtr - shallow_copy() const override; - - const ContentPtr - deep_copy(bool copyarrays, - bool copyindexes, - bool copyidentities) const override; - - void - check_for_iteration() const override; - - const ContentPtr - getitem_nothing() const override; - - const ContentPtr - getitem_at(int64_t at) const override; - - const ContentPtr - getitem_at_nowrap(int64_t at) const override; - - const ContentPtr - getitem_range(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_range_nowrap(int64_t start, int64_t stop) const override; - - const ContentPtr - getitem_field(const std::string& key) const override; - - const ContentPtr - getitem_field(const std::string& key, - const Slice& only_fields) const override; - - const ContentPtr - getitem_fields(const std::vector& keys) const override; - - const ContentPtr - getitem_fields(const std::vector& keys, - const Slice& only_fields) const override; - - const ContentPtr - getitem_next(const SliceItemPtr& head, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceItemPtr& slicecontent, - const Slice& tail) const override; - - const ContentPtr - carry(const Index64& carry, bool allow_lazy) const override; - - int64_t - purelist_depth() const override; - - const std::pair - minmax_depth() const override; - - const std::pair - branch_depth() const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - bool - istuple() const override; - - // operations - const std::string - validityerror(const std::string& path) const override; - - const ContentPtr - shallow_simplify() const override; - - const ContentPtr - num(int64_t axis, int64_t depth) const override; - - const std::pair - offsets_and_flattened(int64_t axis, int64_t depth) const override; - - bool - mergeable(const ContentPtr& other, bool mergebool) const override; - - bool - referentially_equal(const ContentPtr& other) const override; - - const ContentPtr - mergemany(const ContentPtrVec& others) const override; - - const SliceItemPtr - asslice() const override; - - const ContentPtr - fillna(const ContentPtr& value) const override; - - const ContentPtr - rpad(int64_t target, int64_t axis, int64_t depth) const override; - - const ContentPtr - rpad_and_clip(int64_t target, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - reduce_next(const Reducer& reducer, - int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool mask, - bool keepdims) const override; - - const ContentPtr - sort_next(int64_t negaxis, - const Index64& starts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - const ContentPtr - argsort_next(int64_t negaxis, - const Index64& starts, - const Index64& shifts, - const Index64& parents, - int64_t outlength, - bool ascending, - bool stable) const override; - - - const ContentPtr - localindex(int64_t axis, int64_t depth) const override; - - const ContentPtr - combinations(int64_t n, - bool replacement, - const util::RecordLookupPtr& recordlookup, - const util::Parameters& parameters, - int64_t axis, - int64_t depth) const override; - - const ContentPtr - getitem(const Slice& where) const override; - - const ContentPtr - getitem_next(const SliceAt& at, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceRange& range, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceArray64& array, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceField& field, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceFields& fields, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next(const SliceJagged64& jagged, - const Slice& tail, - const Index64& advanced) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceArray64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceMissing64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - getitem_next_jagged(const Index64& slicestarts, - const Index64& slicestops, - const SliceJagged64& slicecontent, - const Slice& tail) const override; - - const ContentPtr - copy_to(kernel::lib ptr_lib) const override; - - const ContentPtr - numbers_to_type(const std::string& name) const override; - - /// @brief Returns 'true' if all components of the array are unique - bool - is_unique() const override; - - /// @brief Returns an array where all components are unique - const ContentPtr - unique() const override; - - /// @brief Returns 'true' if subranges are equal - bool - is_subrange_equal(const Index64& start, const Index64& stop) const override; - - private: - /// @brief Forward selected purelist_parameters when making lazy slices - const util::Parameters - forward_parameters() const; - - /// @brief Set the copy of depth parameters to avoid materializing an array - /// that can't have a Form but can know its depth (lazy slices, mostly). - void - set_cache_depths_from(const VirtualArray* original); - - /// @brief Set the copy of depth parameters to avoid materializing an array - /// that can't have a Form but can know its depth (lazy slices, mostly). - void - set_cache_depths_from(const FormPtr& form); - - void - add_to_cache_depths(int64_t delta); - - /// @brief See #generator. - const ArrayGeneratorPtr generator_; - /// @brief See #cache. - const ArrayCachePtr cache_; - /// @brief See #cache_key. - const std::string cache_key_; - /// @brief See#ptr_lib - const kernel::lib ptr_lib_; - - /// @brief Keep a copy of depth parameters to avoid materializing an array - /// that can't have a Form but can know its depth (lazy slices, mostly). - std::vector cache_depths_; - }; - -} - -#endif // AWKWARD_VIRTUALARRAY_H_ diff --git a/include/awkward/cuda-utils.h b/include/awkward/cuda-utils.h deleted file mode 100644 index 3cbda81378..0000000000 --- a/include/awkward/cuda-utils.h +++ /dev/null @@ -1,29 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_CUDA_UTILS_H -#define AWKWARD_CUDA_UTILS_H - -#include "awkward/common.h" - -extern "C" { - EXPORT_SYMBOL ERROR awkward_cuda_ptr_device_num( - int64_t* device_num, - void* ptr); - - EXPORT_SYMBOL ERROR awkward_cuda_ptr_device_name( - char* name, - void* ptr); - - EXPORT_SYMBOL ERROR awkward_cuda_host_to_device( - void* to_ptr, - void* from_ptr, - int64_t bytelength); - - EXPORT_SYMBOL ERROR awkward_cuda_device_to_host( - void* to_ptr, - void* from_ptr, - int64_t bytelength); - -} - -#endif //AWKWARD_CUDA_UTILS_H diff --git a/include/awkward/forth/ForthMachine.h b/include/awkward/forth/ForthMachine.h index ce95009838..9b7de978c4 100644 --- a/include/awkward/forth/ForthMachine.h +++ b/include/awkward/forth/ForthMachine.h @@ -9,9 +9,6 @@ #include "awkward/common.h" #include "awkward/util.h" -#include "awkward/Content.h" -#include "awkward/array/NumpyArray.h" -#include "awkward/array/ListOffsetArray.h" #include "awkward/forth/ForthInputBuffer.h" #include "awkward/forth/ForthOutputBuffer.h" @@ -41,9 +38,13 @@ namespace awkward { source() const noexcept; /// @brief HERE - const ContentPtr + const std::vector bytecodes() const; + /// @brief HERE + const std::vector + bytecodes_offsets() const; + /// @brief HERE const std::string decompiled() const; @@ -167,54 +168,6 @@ namespace awkward { const std::shared_ptr output_at(int64_t index) const noexcept; - /// @brief HERE - const ContentPtr - output_NumpyArray_at(const std::string& name) const; - - /// @brief HERE - const ContentPtr - output_NumpyArray_at(int64_t index) const; - - /// @brief HERE - const Index8 - output_Index8_at(const std::string& name) const; - - /// @brief HERE - const Index8 - output_Index8_at(int64_t index) const; - - /// @brief HERE - const IndexU8 - output_IndexU8_at(const std::string& name) const; - - /// @brief HERE - const IndexU8 - output_IndexU8_at(int64_t index) const; - - /// @brief HERE - const Index32 - output_Index32_at(const std::string& name) const; - - /// @brief HERE - const Index32 - output_Index32_at(int64_t index) const; - - /// @brief HERE - const IndexU32 - output_IndexU32_at(const std::string& name) const; - - /// @brief HERE - const IndexU32 - output_IndexU32_at(int64_t index) const; - - /// @brief HERE - const Index64 - output_Index64_at(const std::string& name) const; - - /// @brief HERE - const Index64 - output_Index64_at(int64_t index) const; - /// @brief Returns a string at 'index'. /// The strings are defined with an 's"' core word. const std::string diff --git a/include/awkward/forth/ForthOutputBuffer.h b/include/awkward/forth/ForthOutputBuffer.h index e363f08f04..3a0bb8e714 100644 --- a/include/awkward/forth/ForthOutputBuffer.h +++ b/include/awkward/forth/ForthOutputBuffer.h @@ -3,11 +3,9 @@ #ifndef AWKWARD_FORTHOUTPUTBUFFER_H_ #define AWKWARD_FORTHOUTPUTBUFFER_H_ -// #include - #include "awkward/common.h" -#include "awkward/Content.h" -#include "awkward/Index.h" +#include "awkward/util.h" + namespace awkward { #define NATIVELY_BIG_ENDIAN (*(uint16_t *)"\0\xff" < 0x100) @@ -62,29 +60,8 @@ namespace awkward { virtual const std::shared_ptr ptr() const noexcept = 0; - /// @brief HERE - virtual const ContentPtr - toNumpyArray() const = 0; - - /// @brief HERE - virtual const Index8 - toIndex8() const = 0; - - /// @brief HERE - virtual const IndexU8 - toIndexU8() const = 0; - - /// @brief HERE - virtual const Index32 - toIndex32() const = 0; - - /// @brief HERE - virtual const IndexU32 - toIndexU32() const = 0; - - /// @brief HERE - virtual const Index64 - toIndex64() const = 0; + virtual util::dtype + dtype() const = 0; /// @brief HERE virtual void @@ -206,6 +183,9 @@ namespace awkward { virtual void write_add_int64(int64_t value) noexcept = 0; + virtual std::string + tostring() const = 0; + protected: int64_t length_; int64_t reserved_; @@ -223,23 +203,8 @@ namespace awkward { const std::shared_ptr ptr() const noexcept override; - const ContentPtr - toNumpyArray() const override; - - const Index8 - toIndex8() const override; - - const IndexU8 - toIndexU8() const override; - - const Index32 - toIndex32() const override; - - const IndexU32 - toIndexU32() const override; - - const Index64 - toIndex64() const override; + util::dtype + dtype() const override; void write_one_bool(bool value, bool byteswap) noexcept override; @@ -331,6 +296,8 @@ namespace awkward { void write_add_int64(int64_t value) noexcept override; + std::string tostring() const override; + private: /// @brief HERE diff --git a/include/awkward/io/json.h b/include/awkward/io/json.h index 6a9750be0c..fb54b41968 100644 --- a/include/awkward/io/json.h +++ b/include/awkward/io/json.h @@ -15,356 +15,6 @@ #include "awkward/util.h" namespace awkward { - /// @class ToJson - /// - /// Abstract base class for producing JSON data. - class LIBAWKWARD_EXPORT_SYMBOL ToJson { - public: - /// @brief Virtual destructor acts as a first non-inline virtual function - /// that determines a specific translation unit in which vtable shall be - /// emitted. - virtual ~ToJson(); - - /// @brief Append a `null` value. - virtual void - null() = 0; - /// @brief Append a boolean value `x`. - virtual void - boolean(bool x) = 0; - /// @brief Append an integer value `x`. - virtual void - integer(int64_t x) = 0; - /// @brief Append a real value `x`. - virtual void - real(double x) = 0; - /// @brief Append a complex value `x`. - virtual void - complex(std::complex x) = 0; - /// @brief Append a string value `x`. - virtual void - string(const char* x, int64_t length) = 0; - /// @brief Begin a list. - virtual void - beginlist() = 0; - /// @brief End the current list. - virtual void - endlist() = 0; - /// @brief Begin a record. - virtual void - beginrecord() = 0; - /// @brief Insert a key for a key-value pair. - virtual void - field(const char* x) = 0; - /// @brief End the current record. - virtual void - endrecord() = 0; - /// @brief Write raw JSON as a string. - virtual void - json(const char* data) = 0; - /// @brief Append a string value `x`. - void - string(const std::string& x); - /// @brief Insert a key for a key-value pair. - void - field(const std::string& x); - }; - - /// @class ToJsonString - /// - /// @brief Produces a JSON-formatted string. - class LIBAWKWARD_EXPORT_SYMBOL ToJsonString: public ToJson { - public: - /// @brief Creates a ToJsonString with a full set of parameters. - /// - /// @param maxdecimals Maximum number of decimals for floating-point - /// numbers or `-1` for full precision. - /// @param nan_string user-defined string for a not-a-number (NaN) value - /// representation in JSON format - /// @param infinity_string user-defined string for a positive infinity - /// representation in JSON format - /// @param minus_infinity_string user-defined string for a negative - /// infinity representation in JSON format - /// @param complex_real_string user-defined string for a complex number - /// real part representation in JSON format - /// @param complex_imag_string user-defined string for a complex number - /// imaginary part representation in JSON format - ToJsonString(int64_t maxdecimals, - const char* nan_string = nullptr, - const char* infinity_string = nullptr, - const char* minus_infinity_string = nullptr, - const char* complex_real_string = nullptr, - const char* complex_imag_string = nullptr); - /// @brief Empty destructor; required for some C++ reason. - ~ToJsonString(); - void - null() override; - void - boolean(bool x) override; - void - integer(int64_t x) override; - void - real(double x) override; - void - complex(std::complex x) override; - void - string(const char* x, int64_t length) override; - void - beginlist() override; - void - endlist() override; - void - beginrecord() override; - void - field(const char* x) override; - void - endrecord() override; - void - json(const char* data) override; - /// @brief Return the accumulated data as a string. - const std::string - tostring(); - private: - class Impl; - Impl* impl_; - const char* nan_string_; - const char* infinity_string_; - const char* minus_infinity_string_; - const char* complex_real_string_; - const char* complex_imag_string_; - }; - - /// @class ToJsonPrettyString - /// - /// @brief Produces a pretty JSON-formatted string. - class LIBAWKWARD_EXPORT_SYMBOL ToJsonPrettyString: public ToJson { - public: - /// @brief Creates a ToJsonPrettyString with a full set of parameters. - /// - /// @param maxdecimals Maximum number of decimals for floating-point - /// numbers or `-1` for full precision. - /// @param nan_string user-defined string for a not-a-number (NaN) value - /// representation in JSON format - /// @param infinity_string user-defined string for a positive infinity - /// representation in JSON format - /// @param minus_infinity_string user-defined string for a negative - /// infinity representation in JSON format - /// @param complex_real_string user-defined string for a complex number - /// real part representation in JSON format - /// @param complex_imag_string user-defined string for a complex number - /// imaginary part representation in JSON format - ToJsonPrettyString(int64_t maxdecimals, - const char* nan_string = nullptr, - const char* infinity_string = nullptr, - const char* minus_infinity_string = nullptr, - const char* complex_real_string = nullptr, - const char* complex_imag_string = nullptr); - /// @brief Empty destructor; required for some C++ reason. - ~ToJsonPrettyString(); - void - null() override; - void - boolean(bool x) override; - void - integer(int64_t x) override; - void - real(double x) override; - void - complex(std::complex x) override; - void - string(const char* x, int64_t length) override; - void - beginlist() override; - void - endlist() override; - void - beginrecord() override; - void - field(const char* x) override; - void - endrecord() override; - void - json(const char* data) override; - /// @brief Return the accumulated data as a string. - const std::string - tostring(); - private: - class Impl; - Impl* impl_; - const char* nan_string_; - const char* infinity_string_; - const char* minus_infinity_string_; - const char* complex_real_string_; - const char* complex_imag_string_; - }; - - /// @class ToJsonFile - /// - /// @brief Produces a JSON-formatted file. - class LIBAWKWARD_EXPORT_SYMBOL ToJsonFile: public ToJson { - public: - /// @brief Creates a ToJsonFile with a full set of parameters. - /// - /// @param destination C file handle to the file to write. - /// @param maxdecimals Maximum number of decimals for floating-point - /// numbers or `-1` for full precision. - /// @param buffersize Number of bytes for an intermediate buffer. - /// @param nan_string user-defined string for a not-a-number (NaN) value - /// representation in JSON format - /// @param infinity_string user-defined string for a positive infinity - /// representation in JSON format - /// @param minus_infinity_string user-defined string for a negative - /// infinity representation in JSON format - /// @param complex_real_string user-defined string for a complex number - /// real part representation in JSON format - /// @param complex_imag_string user-defined string for a complex number - /// imaginary part representation in JSON format - ToJsonFile(FILE* destination, - int64_t maxdecimals, - int64_t buffersize, - const char* nan_string = nullptr, - const char* infinity_string = nullptr, - const char* minus_infinity_string = nullptr, - const char* complex_real_string = nullptr, - const char* complex_imag_string = nullptr); - /// @brief Empty destructor; required for some C++ reason. - ~ToJsonFile(); - void - null() override; - void - boolean(bool x) override; - void - integer(int64_t x) override; - void - real(double x) override; - void - complex(std::complex x) override; - void - string(const char* x, int64_t length) override; - void - beginlist() override; - void - endlist() override; - void - beginrecord() override; - void - field(const char* x) override; - void - endrecord() override; - void - json(const char* data) override; - private: - class Impl; - Impl* impl_; - const char* nan_string_; - const char* infinity_string_; - const char* minus_infinity_string_; - const char* complex_real_string_; - const char* complex_imag_string_; - }; - - /// @class ToJsonPrettyFile - /// - /// @brief Produces a pretty JSON-formatted file. - class LIBAWKWARD_EXPORT_SYMBOL ToJsonPrettyFile: public ToJson { - public: - /// @brief Creates a ToJsonPrettyFile with a full set of parameters. - /// - /// @param destination C file handle to the file to write. - /// @param maxdecimals Maximum number of decimals for floating-point - /// numbers or `-1` for full precision. - /// @param buffersize Number of bytes for an intermediate buffer. - /// @param nan_string user-defined string for a not-a-number (NaN) value - /// representation in JSON format - /// @param infinity_string user-defined string for a positive infinity - /// representation in JSON format - /// @param minus_infinity_string user-defined string for a negative - /// infinity representation in JSON format - /// @param complex_real_string user-defined string for a complex number - /// real part representation in JSON format - /// @param complex_imag_string user-defined string for a complex number - /// imaginary part representation in JSON format - ToJsonPrettyFile(FILE* destination, - int64_t maxdecimals, - int64_t buffersize, - const char* nan_string = nullptr, - const char* infinity_string = nullptr, - const char* minus_infinity_string = nullptr, - const char* complex_real_string = nullptr, - const char* complex_imag_string = nullptr); - /// @brief Empty destructor; required for some C++ reason. - ~ToJsonPrettyFile(); - void - null() override; - void - boolean(bool x) override; - void - integer(int64_t x) override; - void - real(double x) override; - void - complex(std::complex x) override; - void - string(const char* x, int64_t length) override; - void - beginlist() override; - void - endlist() override; - void - beginrecord() override; - void - field(const char* x) override; - void - endrecord() override; - void - json(const char* data) override; - private: - class Impl; - Impl* impl_; - const char* nan_string_; - const char* infinity_string_; - const char* minus_infinity_string_; - const char* complex_real_string_; - const char* complex_imag_string_; - }; - - /// @brief Parses a JSON-encoded string using an - /// ArrayBuilder. - /// - /// @param source Null-terminated string containing any valid JSON data. - /// @param builder To build the array. - /// @param nan_string User-defined string for a not-a-number (NaN) value - /// representation in JSON format. - /// @param infinity_string User-defined string for a positive infinity - /// representation in JSON format. - /// @param minus_infinity_string User-defined string for a negative - /// infinity representation in JSON format. - LIBAWKWARD_EXPORT_SYMBOL int64_t - FromJsonString(const char* source, - ArrayBuilder& builder, - const char* nan_string = nullptr, - const char* infinity_string = nullptr, - const char* minus_infinity_string = nullptr); - - /// @brief Parses a JSON-encoded file using an - /// ArrayBuilder. - /// - /// @param source C file handle to a file containing any valid JSON data. - /// @param builder To build the array. - /// @param buffersize Number of bytes for an intermediate buffer. - /// @param nan_string User-defined string for a not-a-number (NaN) value - /// representation in JSON format. - /// @param infinity_string User-defined string for a positive infinity - /// representation in JSON format. - /// @param minus_infinity_string User-defined string for a negative - /// infinity representation in JSON format. - LIBAWKWARD_EXPORT_SYMBOL int64_t - FromJsonFile(FILE* source, - ArrayBuilder& builder, - int64_t buffersize, - const char* nan_string = nullptr, - const char* infinity_string = nullptr, - const char* minus_infinity_string = nullptr); - /// @class FileLikeObject /// /// @brief Abstract class to represent a file-like object, something with diff --git a/include/awkward/io/uproot.h b/include/awkward/io/uproot.h deleted file mode 100644 index ce04c76112..0000000000 --- a/include/awkward/io/uproot.h +++ /dev/null @@ -1,17 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_IO_UPROOT_H_ -#define AWKWARD_IO_UPROOT_H_ - -#include "awkward/Index.h" -#include "awkward/Content.h" -#include "awkward/array/NumpyArray.h" - -namespace awkward { - LIBAWKWARD_EXPORT_SYMBOL const ContentPtr - uproot_issue_90(const Form& form, - const NumpyArray& data, - const Index32& byte_offsets); -} - -#endif // AWKWARD_IO_UPROOT_H_ diff --git a/include/awkward/kernel-dispatch.h b/include/awkward/kernel-dispatch.h deleted file mode 100644 index ee59bc0c17..0000000000 --- a/include/awkward/kernel-dispatch.h +++ /dev/null @@ -1,1868 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_KERNEL_DISPATCH_H_ -#define AWKWARD_KERNEL_DISPATCH_H_ - -#include "awkward/common.h" -#include "awkward/util.h" -#include "awkward/kernel-utils.h" -#include "awkward/kernels.h" - -#include - -#ifndef _MSC_VER - #include "dlfcn.h" -#endif - -namespace awkward { - namespace kernel { - - enum class lib { - cpu, - cuda, - size - }; - - class LibraryPathCallback { - public: - LibraryPathCallback() = default; - virtual std::string library_path() = 0; - }; - - class LibraryCallback { - public: - LibraryCallback(); - - void add_library_path_callback( - kernel::lib ptr_lib, - const std::shared_ptr &callback); - - std::string awkward_library_path(kernel::lib ptr_lib); - - private: - std::map>> lib_path_callbacks; - std::mutex lib_path_callbacks_mutex; - }; - - extern std::shared_ptr lib_callback; - - /// @brief Internal utility function to return an opaque ptr if an handle is - /// acquired for the specified ptr_lib. If not, then it raises an appropriate - /// exception - void* acquire_handle(kernel::lib ptr_lib); - - /// @brief Internal utility function to return an opaque ptr if an symbol is - /// found for the corresponding handle. If not, then it raises an appropriate - /// exception - void* acquire_symbol(void* handle, const std::string& symbol_name); - - /// @class array_deleter - /// - /// @brief Used as a `std::shared_ptr` deleter (second argument) to - /// overload `delete ptr` with `delete[] ptr`. - /// - /// This is necessary for `std::shared_ptr` to contain array buffers. - /// - /// See also - /// - cuda_array_deleter, which deletes an array on a GPU. - /// - no_deleter, which does not free memory at all (for borrowed - /// references). - /// - pyobject_deleter, which reduces the reference count of a - /// Python object when there are no more C++ shared pointers - /// referencing it. - template - class LIBAWKWARD_EXPORT_SYMBOL array_deleter { - public: - /// @brief Called by `std::shared_ptr` when its reference count reaches - /// zero. - void operator()(T const *ptr) { - awkward_free(reinterpret_cast(ptr)); - } - }; - - /// @class cuda_array_deleter - /// - /// @brief Used as a `std::shared_ptr` deleter (second argument) to - /// overload `delete ptr` with `cudaFree`. - /// - /// This is necessary for `std::shared_ptr` to contain array buffers. - /// - /// See also - /// - array_deleter, which deletes array buffers in main memory. - /// - no_deleter, which does not free memory at all (for borrowed - /// references). - /// - pyobject_deleter, which reduces the reference count of a - /// Python object when there are no more C++ shared pointers - /// referencing it. - template - class LIBAWKWARD_EXPORT_SYMBOL cuda_array_deleter { - public: - /// @brief Called by `std::shared_ptr` when its reference count reaches - /// zero. - void operator()(T const *ptr) { - auto handle = acquire_handle(lib::cuda); - typedef decltype(awkward_free) functor_type; - auto* awkward_free_fcn = reinterpret_cast( - acquire_symbol(handle, "awkward_free")); - (*awkward_free_fcn)(reinterpret_cast(ptr)); - } - }; - - /// @class no_deleter - /// - /// @brief Used as a `std::shared_ptr` deleter (second argument) to - /// overload `delete ptr` with nothing (no dereferencing). - /// - /// This could be used to pass borrowed references with the same - /// C++ type as owned references. - /// - /// See also - /// - array_deleter, which frees array buffers, rather than objects. - /// - cuda_array_deleter, which frees array buffers on GPUs. - /// - pyobject_deleter, which reduces the reference count of a - /// Python object when there are no more C++ shared pointers - /// referencing it. - template - class LIBAWKWARD_EXPORT_SYMBOL no_deleter { - public: - /// @brief Called by `std::shared_ptr` when its reference count reaches - /// zero. - void operator()(T const *ptr) { } - }; - - /// @brief Returns the number of the device associated with the pointer - const int64_t - lib_device_num( - kernel::lib ptr_lib, - void* ptr); - - /// @brief Produces a element for 'tostring' to indicate the kernel - /// library. - const std::string lib_tostring( - kernel::lib ptr_lib, - void* ptr, - const std::string& indent, - const std::string& pre, - const std::string& post); - - /// @brief Internal Function an array buffer from library `FROM` to library - /// `TO`, usually between main memory and a GPU. - /// - /// @note This function has not been implemented to handle Multi-GPU setups. - ERROR copy_to( - kernel::lib to_lib, - kernel::lib from_lib, - void* to_ptr, - void* from_ptr, - int64_t bytelength); - - /// @brief FIXME - const std::string - fully_qualified_cache_key( - kernel::lib ptr_lib, - const std::string& cache_key); - - /// @brief Internal Function to allocate an empty array of a given length - /// with a given type. The `bytelength` parameter is the number of bytes, - /// so be sure to multiply by sizeof(...) when using this function. - /// - /// @note This function has not been implemented to handle Multi-GPU setups. - template - std::shared_ptr malloc( - kernel::lib ptr_lib, - int64_t bytelength) { - if (ptr_lib == lib::cpu) { - return std::shared_ptr( - reinterpret_cast(awkward_malloc(bytelength)), - kernel::array_deleter()); - } - else if (ptr_lib == lib::cuda) { - auto handle = acquire_handle(lib::cuda); - typedef decltype(awkward_malloc) functor_type; - auto* awkward_malloc_fcn = reinterpret_cast( - acquire_symbol(handle, "awkward_malloc")); - return std::shared_ptr( - reinterpret_cast((*awkward_malloc_fcn)(bytelength)), - kernel::cuda_array_deleter()); - } - else { - throw std::runtime_error( - std::string("unrecognized ptr_lib in ptr_alloc")); - } - } - - template - using UniquePtrDeleter = decltype(kernel::array_deleter()); - template - using UniquePtr = std::unique_ptr>; - - template - UniquePtr unique_malloc( - kernel::lib ptr_lib, - int64_t bytelength) { - if (ptr_lib == lib::cpu) { - return UniquePtr( - reinterpret_cast(awkward_malloc(bytelength)), - kernel::array_deleter()); - } - else { - throw std::runtime_error( - std::string("unrecognized ptr_lib in ptr_alloc")); - } - } - - /////////////////////////////////// awkward/kernels/getitem.h - - /// @brief Internal utility kernel to avoid raw pointer access. - template - T NumpyArray_getitem_at0( - kernel::lib ptr_lib, - T* ptr); - - // FIXME: move regularize_rangeslice to common.h; it's not a kernel. - void regularize_rangeslice( - int64_t* start, - int64_t* stop, - bool posstep, - bool hasstart, - bool hasstop, - int64_t length); - - ERROR regularize_arrayslice_64( - kernel::lib ptr_lib, - int64_t* flatheadptr, - int64_t lenflathead, - int64_t length); - - template - ERROR Index_iscontiguous( - kernel::lib ptr_lib, - bool* result, - const T* fromindex, - int64_t length); - - template - ERROR Index_to_Index64( - kernel::lib ptr_lib, - int64_t* toptr, - const T* fromptr, - int64_t length); - - template - ERROR Index_carry_64( - kernel::lib ptr_lib, - T* toindex, - const T* fromindex, - const int64_t* carry, - int64_t lenfromindex, - int64_t length); - - template - ERROR Index_carry_nocheck_64( - kernel::lib ptr_lib, - T* toindex, - const T* fromindex, - const int64_t* carry, - int64_t length); - - ERROR slicearray_ravel_64( - kernel::lib ptr_lib, - int64_t* toptr, - const int64_t* fromptr, - int64_t ndim, - const int64_t* shape, - const int64_t* strides); - - ERROR slicemissing_check_same( - kernel::lib ptr_lib, - bool* same, - const int8_t* bytemask, - const int64_t* missingindex, - int64_t length); - - template - ERROR carry_arange( - kernel::lib ptr_lib, - T* toptr, - int64_t length); - - template - ERROR Identities_getitem_carry_64( - kernel::lib ptr_lib, - ID* newidentitiesptr, - const ID* identitiesptr, - const int64_t* carryptr, - int64_t lencarry, - int64_t width, - int64_t length); - - ERROR NumpyArray_contiguous_init_64( - kernel::lib ptr_lib, - int64_t* toptr, - int64_t skip, - int64_t stride); - - ERROR NumpyArray_copy( - kernel::lib ptr_lib, - uint8_t* toptr, - const uint8_t* fromptr, - int64_t len); - - ERROR NumpyArray_contiguous_copy_64( - kernel::lib ptr_lib, - uint8_t* toptr, - const uint8_t* fromptr, - int64_t len, - int64_t stride, - const int64_t* pos); - - ERROR NumpyArray_contiguous_copy_from_many_64( - kernel::lib ptr_lib, - uint8_t* toptr, - const uint8_t** fromptrs, - int64_t* fromlens, - int64_t len, - int64_t stride, - const int64_t* pos); - - ERROR NumpyArray_contiguous_next_64( - kernel::lib ptr_lib, - int64_t* topos, - const int64_t* frompos, - int64_t len, - int64_t skip, - int64_t stride); - - ERROR NumpyArray_getitem_next_null_64( - kernel::lib ptr_lib, - uint8_t* toptr, - const uint8_t* fromptr, - int64_t len, - int64_t stride, - const int64_t* pos); - - ERROR NumpyArray_getitem_next_at_64( - kernel::lib ptr_lib, - int64_t* nextcarryptr, - const int64_t* carryptr, - int64_t lencarry, - int64_t skip, - int64_t at); - - ERROR NumpyArray_getitem_next_range_64( - kernel::lib ptr_lib, - int64_t* nextcarryptr, - const int64_t* carryptr, - int64_t lencarry, - int64_t lenhead, - int64_t skip, - int64_t start, - int64_t step); - - ERROR NumpyArray_getitem_next_range_advanced_64( - kernel::lib ptr_lib, - int64_t* nextcarryptr, - int64_t* nextadvancedptr, - const int64_t* carryptr, - const int64_t* advancedptr, - int64_t lencarry, - int64_t lenhead, - int64_t skip, - int64_t start, - int64_t step); - - ERROR NumpyArray_getitem_next_array_64( - kernel::lib ptr_lib, - int64_t* nextcarryptr, - int64_t* nextadvancedptr, - const int64_t* carryptr, - const int64_t* flatheadptr, - int64_t lencarry, - int64_t lenflathead, - int64_t skip); - - ERROR NumpyArray_getitem_next_array_advanced_64( - kernel::lib ptr_lib, - int64_t* nextcarryptr, - const int64_t* carryptr, - const int64_t* advancedptr, - const int64_t* flatheadptr, - int64_t lencarry, - int64_t skip); - - ERROR NumpyArray_getitem_boolean_numtrue( - kernel::lib ptr_lib, - int64_t* numtrue, - const int8_t* fromptr, - int64_t length, - int64_t stride); - - ERROR NumpyArray_getitem_boolean_nonzero_64( - kernel::lib ptr_lib, - int64_t* toptr, - const int8_t* fromptr, - int64_t length, - int64_t stride); - - template - ERROR ListArray_getitem_next_at_64( - kernel::lib ptr_lib, - int64_t* tocarry, - const T* fromstarts, - const T* fromstops, - int64_t lenstarts, - int64_t at); - - - template - ERROR ListArray_getitem_next_range_carrylength( - kernel::lib ptr_lib, - int64_t* carrylength, - const T* fromstarts, - const T* fromstops, - int64_t lenstarts, - int64_t start, - int64_t stop, - int64_t step); - - template - ERROR ListArray_getitem_next_range_64( - kernel::lib ptr_lib, - T* tooffsets, - int64_t* tocarry, - const T* fromstarts, - const T* fromstops, - int64_t lenstarts, - int64_t start, - int64_t stop, - int64_t step); - - - template - ERROR ListArray_getitem_next_range_counts_64( - kernel::lib ptr_lib, - int64_t* total, - const T* fromoffsets, - int64_t lenstarts); - - - template - ERROR ListArray_getitem_next_range_spreadadvanced_64( - kernel::lib ptr_lib, - int64_t* toadvanced, - const int64_t* fromadvanced, - const T* fromoffsets, - int64_t lenstarts); - - - template - ERROR ListArray_getitem_next_array_64( - kernel::lib ptr_lib, - int64_t* tocarry, - int64_t* toadvanced, - const T* fromstarts, - const T* fromstops, - const int64_t* fromarray, - int64_t lenstarts, - int64_t lenarray, - int64_t lencontent); - - - template - ERROR ListArray_getitem_next_array_advanced_64( - kernel::lib ptr_lib, - int64_t* tocarry, - int64_t* toadvanced, - const T* fromstarts, - const T* fromstops, - const int64_t* fromarray, - const int64_t* fromadvanced, - int64_t lenstarts, - int64_t lenarray, - int64_t lencontent); - - - template - ERROR ListArray_getitem_carry_64( - kernel::lib ptr_lib, - T* tostarts, - T* tostops, - const T* fromstarts, - const T* fromstops, - const int64_t* fromcarry, - int64_t lenstarts, - int64_t lencarry); - - ERROR RegularArray_getitem_next_at_64( - kernel::lib ptr_lib, - int64_t* tocarry, - int64_t at, - int64_t len, - int64_t size); - - ERROR RegularArray_getitem_next_range_64( - kernel::lib ptr_lib, - int64_t* tocarry, - int64_t regular_start, - int64_t step, - int64_t len, - int64_t size, - int64_t nextsize); - - ERROR RegularArray_getitem_next_range_spreadadvanced_64( - kernel::lib ptr_lib, - int64_t* toadvanced, - const int64_t* fromadvanced, - int64_t len, - int64_t nextsize); - - ERROR RegularArray_getitem_next_array_regularize_64( - kernel::lib ptr_lib, - int64_t* toarray, - const int64_t* fromarray, - int64_t lenarray, - int64_t size); - - ERROR RegularArray_getitem_next_array_64( - kernel::lib ptr_lib, - int64_t* tocarry, - int64_t* toadvanced, - const int64_t* fromarray, - int64_t len, - int64_t lenarray, - int64_t size); - - ERROR RegularArray_getitem_next_array_advanced_64( - kernel::lib ptr_lib, - int64_t* tocarry, - int64_t* toadvanced, - const int64_t* fromadvanced, - const int64_t* fromarray, - int64_t len, - int64_t lenarray, - int64_t size); - - ERROR RegularArray_getitem_carry_64( - kernel::lib ptr_lib, - int64_t* tocarry, - const int64_t* fromcarry, - int64_t lencarry, - int64_t size); - - template - ERROR IndexedArray_numnull( - kernel::lib ptr_lib, - int64_t* numnull, - const T* fromindex, - int64_t lenindex); - - template - ERROR IndexedArray_index_of_nulls( - kernel::lib ptr_lib, - int64_t* toindex, - const T* fromindex, - int64_t lenindex, - const int64_t* parents, - const int64_t* starts); - - template - ERROR IndexedArray_getitem_nextcarry_outindex_64( - kernel::lib ptr_lib, - int64_t* tocarry, - T* toindex, - const T* fromindex, - int64_t lenindex, - int64_t lencontent); - - template - ERROR IndexedArray_getitem_nextcarry_outindex_mask_64( - kernel::lib ptr_lib, - int64_t* tocarry, - int64_t* toindex, - const T* fromindex, - int64_t lenindex, - int64_t lencontent); - - ERROR ListOffsetArray_getitem_adjust_offsets_64( - kernel::lib ptr_lib, - int64_t* tooffsets, - int64_t* tononzero, - const int64_t* fromoffsets, - int64_t length, - const int64_t* nonzero, - int64_t nonzerolength); - - ERROR ListOffsetArray_getitem_adjust_offsets_index_64( - kernel::lib ptr_lib, - int64_t* tooffsets, - int64_t* tononzero, - const int64_t* fromoffsets, - int64_t length, - const int64_t* index, - int64_t indexlength, - const int64_t* nonzero, - int64_t nonzerolength, - const int8_t* originalmask, - int64_t masklength); - - ERROR IndexedArray_getitem_adjust_outindex_64( - kernel::lib ptr_lib, - int8_t* tomask, - int64_t* toindex, - int64_t* tononzero, - const int64_t* fromindex, - int64_t fromindexlength, - const int64_t* nonzero, - int64_t nonzerolength); - - template - ERROR IndexedArray_getitem_nextcarry_64( - kernel::lib ptr_lib, - int64_t* tocarry, - const T* fromindex, - int64_t lenindex, - int64_t lencontent); - - - template - ERROR IndexedArray_getitem_carry_64( - kernel::lib ptr_lib, - T* toindex, - const T* fromindex, - const int64_t* fromcarry, - int64_t lenindex, - int64_t lencarry); - - template - ERROR UnionArray_regular_index_getsize( - kernel::lib ptr_lib, - int64_t* size, - const T* fromtags, - int64_t length); - - template - ERROR UnionArray_regular_index( - kernel::lib ptr_lib, - I* toindex, - I* current, - int64_t size, - const T* fromtags, - int64_t length); - - template - ERROR UnionArray_project_64( - kernel::lib ptr_lib, - int64_t* lenout, - int64_t* tocarry, - const T* fromtags, - const I* fromindex, - int64_t length, - int64_t which); - - ERROR missing_repeat_64( - kernel::lib ptr_lib, - int64_t* outindex, - const int64_t* index, - int64_t indexlength, - int64_t repetitions, - int64_t regularsize); - - ERROR RegularArray_getitem_jagged_expand_64( - kernel::lib ptr_lib, - int64_t* multistarts, - int64_t * multistops, - const int64_t* singleoffsets, - int64_t regularsize, - int64_t regularlength); - - template - ERROR ListArray_getitem_jagged_expand_64( - kernel::lib ptr_lib, - int64_t* multistarts, - int64_t* multistops, - const int64_t* singleoffsets, - int64_t* tocarry, - const T* fromstarts, - const T* fromstops, - int64_t jaggedsize, - int64_t length); - - ERROR ListArray_getitem_jagged_carrylen_64( - kernel::lib ptr_lib, - int64_t* carrylen, - const int64_t* slicestarts, - const int64_t* slicestops, - int64_t sliceouterlen); - - template - ERROR ListArray_getitem_jagged_apply_64( - kernel::lib ptr_lib, - int64_t* tooffsets, - int64_t* tocarry, - const int64_t* slicestarts, - const int64_t* slicestops, - int64_t sliceouterlen, - const int64_t* sliceindex, - int64_t sliceinnerlen, - const T* fromstarts, - const T* fromstops, - int64_t contentlen); - - ERROR ListArray_getitem_jagged_numvalid_64( - kernel::lib ptr_lib, - int64_t* numvalid, - const int64_t* slicestarts, - const int64_t* slicestops, - int64_t length, - const int64_t* missing, - int64_t missinglength); - - ERROR ListArray_getitem_jagged_shrink_64( - kernel::lib ptr_lib, - int64_t* tocarry, - int64_t* tosmalloffsets, - int64_t* tolargeoffsets, - const int64_t* slicestarts, - const int64_t* slicestops, - int64_t length, - const int64_t* missing); - - template - ERROR ListArray_getitem_jagged_descend_64( - kernel::lib ptr_lib, - int64_t* tooffsets, - const int64_t* slicestarts, - const int64_t* slicestops, - int64_t sliceouterlen, - const T* fromstarts, - const T* fromstops); - - template - T index_getitem_at_nowrap( - kernel::lib ptr_lib, - T* ptr, - int64_t at); - - template - void index_setitem_at_nowrap( - kernel::lib ptr_lib, - T* ptr, - int64_t at, - T value); - - ERROR ByteMaskedArray_getitem_carry_64( - kernel::lib ptr_lib, - int8_t* tomask, - const int8_t* frommask, - int64_t lenmask, - const int64_t* fromcarry, - int64_t lencarry); - - ERROR ByteMaskedArray_numnull( - kernel::lib ptr_lib, - int64_t* numnull, - const int8_t* mask, - int64_t length, - bool validwhen); - - ERROR ByteMaskedArray_getitem_nextcarry_64( - kernel::lib ptr_lib, - int64_t* tocarry, - const int8_t* mask, - int64_t length, - bool validwhen); - - ERROR ByteMaskedArray_getitem_nextcarry_outindex_64( - kernel::lib ptr_lib, - int64_t* tocarry, - int64_t* toindex, - const int8_t* mask, - int64_t length, - bool validwhen); - - ERROR ByteMaskedArray_toIndexedOptionArray64( - kernel::lib ptr_lib, - int64_t* toindex, - const int8_t* mask, - int64_t length, - bool validwhen); - - ERROR Content_getitem_next_missing_jagged_getmaskstartstop( - kernel::lib ptr_lib, - int64_t* index_in, - int64_t* offsets_in, - int64_t* mask_out, - int64_t* starts_out, - int64_t* stops_out, - int64_t length); - - template - ERROR MaskedArray_getitem_next_jagged_project( - kernel::lib ptr_lib, - T* index, - int64_t* starts_in, - int64_t* stops_in, - int64_t* starts_out, - int64_t* stops_out, - int64_t length); - - /////////////////////////////////// awkward/kernels/identities.h - - template - ERROR new_Identities( - kernel::lib ptr_lib, - T* toptr, - int64_t length); - - template - ERROR Identities_to_Identities64( - kernel::lib ptr_lib, - int64_t* toptr, - const T* fromptr, - int64_t length, - int64_t width); - - template - ERROR Identities_from_ListOffsetArray( - kernel::lib ptr_lib, - C* toptr, - const C* fromptr, - const T* fromoffsets, - int64_t tolength, - int64_t fromlength, - int64_t fromwidth); - - template - ERROR Identities_from_ListArray( - kernel::lib ptr_lib, - bool* uniquecontents, - C* toptr, - const C* fromptr, - const T* fromstarts, - const T* fromstops, - int64_t tolength, - int64_t fromlength, - int64_t fromwidth); - - template - ERROR Identities_from_RegularArray( - kernel::lib ptr_lib, - ID* toptr, - const ID* fromptr, - int64_t size, - int64_t tolength, - int64_t fromlength, - int64_t fromwidth); - - - template - ERROR Identities_from_IndexedArray( - kernel::lib ptr_lib, - bool* uniquecontents, - C* toptr, - const C* fromptr, - const T* fromindex, - int64_t tolength, - int64_t fromlength, - int64_t fromwidth); - - - template - ERROR Identities_from_UnionArray( - kernel::lib ptr_lib, - bool* uniquecontents, - C* toptr, - const C* fromptr, - const T* fromtags, - const I* fromindex, - int64_t tolength, - int64_t fromlength, - int64_t fromwidth, - int64_t which); - - template - ERROR Identities_extend( - kernel::lib ptr_lib, - ID* toptr, - const ID* fromptr, - int64_t fromlength, - int64_t tolength); - - /////////////////////////////////// awkward/kernels/operations.h - - template - ERROR ListArray_num_64( - kernel::lib ptr_lib, - int64_t* tonum, - const T* fromstarts, - const T* fromstops, - int64_t length); - - ERROR RegularArray_num_64( - kernel::lib ptr_lib, - int64_t* tonum, - int64_t size, - int64_t length); - - template - ERROR ListOffsetArray_flatten_offsets_64( - kernel::lib ptr_lib, - int64_t* tooffsets, - const T* outeroffsets, - int64_t outeroffsetslen, - const int64_t* inneroffsets, - int64_t inneroffsetslen); - - template - ERROR IndexedArray_flatten_none2empty_64( - kernel::lib ptr_lib, - int64_t* outoffsets, - const T* outindex, - int64_t outindexlength, - const int64_t* offsets, - int64_t offsetslength); - - - template - ERROR UnionArray_flatten_length_64( - kernel::lib ptr_lib, - int64_t* total_length, - const T* fromtags, - const I* fromindex, - int64_t length, - int64_t** offsetsraws); - - - template - ERROR UnionArray_nestedfill_tags_index_64( - kernel::lib ptr_lib, - T* totags, - I* toindex, - int64_t* tmpstarts, - T tag, - const int64_t* fromcounts, - int64_t length); - - - template - ERROR UnionArray_flatten_combine_64( - kernel::lib ptr_lib, - int8_t* totags, - int64_t* toindex, - int64_t* tooffsets, - const T* fromtags, - const I* fromindex, - int64_t length, - int64_t** offsetsraws); - - - template - ERROR IndexedArray_flatten_nextcarry_64( - kernel::lib ptr_lib, - int64_t* tocarry, - const T* fromindex, - int64_t lenindex, - int64_t lencontent); - - template - ERROR IndexedArray_overlay_mask8_to64( - kernel::lib ptr_lib, - int64_t* toindex, - const int8_t* mask, - const T* fromindex, - int64_t length); - - - template - ERROR IndexedArray_mask8( - kernel::lib ptr_lib, - int8_t* tomask, - const T* fromindex, - int64_t length); - - ERROR ByteMaskedArray_mask8( - kernel::lib ptr_lib, - int8_t* tomask, - const int8_t* frommask, - int64_t length, - bool validwhen); - - ERROR zero_mask8( - kernel::lib ptr_lib, - int8_t* tomask, - int64_t length); - - ERROR one_mask8( - kernel::lib ptr_lib, - int8_t* tomask, - int64_t length); - - template - ERROR IndexedArray_simplify32_to64( - kernel::lib ptr_lib, - int64_t* toindex, - const T* outerindex, - int64_t outerlength, - const int32_t* innerindex, - int64_t innerlength); - - - template - ERROR IndexedArray_simplifyU32_to64( - kernel::lib ptr_lib, - int64_t* toindex, - const T* outerindex, - int64_t outerlength, - const uint32_t* innerindex, - int64_t innerlength); - - - template - ERROR IndexedArray_simplify64_to64( - kernel::lib ptr_lib, - int64_t* toindex, - const T* outerindex, - int64_t outerlength, - const int64_t* innerindex, - int64_t innerlength); - - template - ERROR ListArray_compact_offsets_64( - kernel::lib ptr_lib, - int64_t* tooffsets, - const T* fromstarts, - const T* fromstops, - int64_t length); - - ERROR RegularArray_compact_offsets_64( - kernel::lib ptr_lib, - int64_t* tooffsets, - int64_t length, - int64_t size); - - template - ERROR ListOffsetArray_compact_offsets_64( - kernel::lib ptr_lib, - int64_t* tooffsets, - const T* fromoffsets, - int64_t length); - - - template - ERROR ListArray_broadcast_tooffsets_64( - kernel::lib ptr_lib, - int64_t* tocarry, - const int64_t* fromoffsets, - int64_t offsetslength, - const T* fromstarts, - const T* fromstops, - int64_t lencontent); - - ERROR RegularArray_broadcast_tooffsets_64( - kernel::lib ptr_lib, - const int64_t* fromoffsets, - int64_t offsetslength, - int64_t size); - - ERROR RegularArray_broadcast_tooffsets_size1_64( - kernel::lib ptr_lib, - int64_t* tocarry, - const int64_t* fromoffsets, - int64_t offsetslength); - - template - ERROR ListOffsetArray_toRegularArray( - kernel::lib ptr_lib, - int64_t* size, - const T* fromoffsets, - int64_t offsetslength); - - template - ERROR NumpyArray_fill( - kernel::lib ptr_lib, - TO* toptr, - int64_t tooffset, - const FROM* fromptr, - int64_t length); - - template - ERROR NumpyArray_fill_frombool( - kernel::lib ptr_lib, - TO* toptr, - int64_t tooffset, - const bool* fromptr, - int64_t length); - - template - ERROR NumpyArray_fill_tocomplex( - kernel::lib ptr_lib, - TO* toptr, - int64_t tooffset, - const FROM* fromptr, - int64_t length); - - template - ERROR NumpyArray_fill_fromcomplex( - kernel::lib ptr_lib, - TO* toptr, - int64_t tooffset, - const FROM* fromptr, - int64_t length); - - template - ERROR NumpyArray_fill_tocomplex_frombool( - kernel::lib ptr_lib, - TO* toptr, - int64_t tooffset, - const bool* fromptr, - int64_t length); - - template - ERROR NumpyArray_fill_scaled( - kernel::lib ptr_lib, - TO* toptr, - int64_t tooffset, - const FROM* fromptr, - int64_t length, - double scale); - - template - ERROR NumpyArray_rearrange_shifted( - kernel::lib ptr_lib, - TO* toptr, - const FROM* fromshifts, - int64_t length, - const FROM* fromoffsets, - int64_t offsetslength, - const FROM* fromparents, - int64_t parentslength, - const FROM* fromstarts, - int64_t startslength); - - template - ERROR ListArray_fill( - kernel::lib ptr_lib, - TO* tostarts, - int64_t tostartsoffset, - TO* tostops, - int64_t tostopsoffset, - const FROM* fromstarts, - const FROM* fromstops, - int64_t length, - int64_t base); - - template - ERROR IndexedArray_fill( - kernel::lib ptr_lib, - TO* toindex, - int64_t toindexoffset, - const FROM* fromindex, - int64_t length, - int64_t base); - - ERROR IndexedArray_fill_to64_count( - kernel::lib ptr_lib, - int64_t* toindex, - int64_t toindexoffset, - int64_t length, - int64_t base); - - ERROR UnionArray_filltags_to8_from8( - kernel::lib ptr_lib, - int8_t* totags, - int64_t totagsoffset, - const int8_t* fromtags, - int64_t length, - int64_t base); - - template - ERROR UnionArray_fillindex( - kernel::lib ptr_lib, - TO* toindex, - int64_t toindexoffset, - const FROM* fromindex, - int64_t length); - - ERROR UnionArray_filltags_to8_const( - kernel::lib ptr_lib, - int8_t* totags, - int64_t totagsoffset, - int64_t length, - int64_t base); - - ERROR UnionArray_fillindex_count_64( - kernel::lib ptr_lib, - int64_t* toindex, - int64_t toindexoffset, - int64_t length); - - template - ERROR UnionArray_simplify8_32_to8_64( - kernel::lib ptr_lib, - int8_t* totags, - int64_t* toindex, - const T* outertags, - const I* outerindex, - const int8_t* innertags, - const int32_t* innerindex, - int64_t towhich, - int64_t innerwhich, - int64_t outerwhich, - int64_t length, - int64_t base); - - - template - ERROR UnionArray_simplify8_U32_to8_64( - kernel::lib ptr_lib, - int8_t* totags, - int64_t* toindex, - const T* outertags, - const I* outerindex, - const int8_t* innertags, - const uint32_t* innerindex, - int64_t towhich, - int64_t innerwhich, - int64_t outerwhich, - int64_t length, - int64_t base); - - - template - ERROR UnionArray_simplify8_64_to8_64( - kernel::lib ptr_lib, - int8_t* totags, - int64_t* toindex, - const T* outertags, - const I* outerindex, - const int8_t* innertags, - const int64_t* innerindex, - int64_t towhich, - int64_t innerwhich, - int64_t outerwhich, - int64_t length, - int64_t base); - - - template - ERROR UnionArray_simplify_one_to8_64( - kernel::lib ptr_lib, - int8_t* totags, - int64_t* toindex, - const T* fromtags, - const I* fromindex, - int64_t towhich, - int64_t fromwhich, - int64_t length, - int64_t base); - - template - ERROR ListArray_validity( - kernel::lib ptr_lib, - const T* starts, - const T* stops, - int64_t length, - int64_t lencontent); - - - template - ERROR IndexedArray_validity( - kernel::lib ptr_lib, - const T* index, - int64_t length, - int64_t lencontent, - bool isoption); - - - template - ERROR UnionArray_validity( - kernel::lib ptr_lib, - const T* tags, - const I* index, - int64_t length, - int64_t numcontents, - const int64_t* lencontents); - - template - ERROR UnionArray_fillna_64( - kernel::lib ptr_lib, - int64_t* toindex, - const T* fromindex, - int64_t length); - - ERROR IndexedOptionArray_rpad_and_clip_mask_axis1_64( - kernel::lib ptr_lib, - int64_t* toindex, - const int8_t* frommask, - int64_t length); - - ERROR index_rpad_and_clip_axis0_64( - kernel::lib ptr_lib, - int64_t* toindex, - int64_t target, - int64_t length); - - ERROR index_rpad_and_clip_axis1_64( - kernel::lib ptr_lib, - int64_t* tostarts, - int64_t* tostops, - int64_t target, - int64_t length); - - ERROR Index_nones_as_index_64( - kernel::lib ptr_lib, - int64_t* toindex, - int64_t length); - - ERROR RegularArray_rpad_and_clip_axis1_64( - kernel::lib ptr_lib, - int64_t* toindex, - int64_t target, - int64_t size, - int64_t length); - - template - ERROR ListArray_min_range( - kernel::lib ptr_lib, - int64_t* tomin, - const T* fromstarts, - const T* fromstops, - int64_t lenstarts); - - template - ERROR ListArray_rpad_and_clip_length_axis1( - kernel::lib ptr_lib, - int64_t* tolength, - const T* fromstarts, - const T* fromstops, - int64_t target, - int64_t lenstarts); - - template - ERROR ListArray_rpad_axis1_64( - kernel::lib ptr_lib, - int64_t* toindex, - const T* fromstarts, - const T* fromstops, - T* tostarts, - T* tostops, - int64_t target, - int64_t length); - - template - ERROR ListOffsetArray_rpad_and_clip_axis1_64( - kernel::lib ptr_lib, - int64_t* toindex, - const T* fromoffsets, - int64_t length, - int64_t target); - - template - ERROR ListOffsetArray_rpad_length_axis1( - kernel::lib ptr_lib, - T* tooffsets, - const T* fromoffsets, - int64_t fromlength, - int64_t target, - int64_t* tolength); - - template - ERROR ListOffsetArray_rpad_axis1_64( - kernel::lib ptr_lib, - int64_t* toindex, - const T* fromoffsets, - int64_t fromlength, - int64_t target); - - ERROR localindex_64( - kernel::lib ptr_lib, - int64_t* toindex, - int64_t length); - - template - ERROR ListArray_localindex_64( - kernel::lib ptr_lib, - int64_t* toindex, - const T* offsets, - int64_t length); - - ERROR RegularArray_localindex_64( - kernel::lib ptr_lib, - int64_t* toindex, - int64_t size, - int64_t length); - - template - ERROR combinations( - kernel::lib ptr_lib, - T* toindex, - int64_t n, - bool replacement, - int64_t singlelen); - - template - ERROR ListArray_combinations_length_64( - kernel::lib ptr_lib, - int64_t* totallen, - int64_t* tooffsets, - int64_t n, - bool replacement, - const T* starts, - const T* stops, - int64_t length); - - template - ERROR ListArray_combinations_64( - kernel::lib ptr_lib, - int64_t** tocarry, - int64_t* toindex, - int64_t* fromindex, - int64_t n, - bool replacement, - const T* starts, - const T* stops, - int64_t length); - - ERROR RegularArray_combinations_64( - kernel::lib ptr_lib, - int64_t** tocarry, - int64_t* toindex, - int64_t* fromindex, - int64_t n, - bool replacement, - int64_t size, - int64_t length); - - ERROR ByteMaskedArray_overlay_mask8( - kernel::lib ptr_lib, - int8_t* tomask, - const int8_t* theirmask, - const int8_t* mymask, - int64_t length, - bool validwhen); - - ERROR BitMaskedArray_to_ByteMaskedArray( - kernel::lib ptr_lib, - int8_t* tobytemask, - const uint8_t* frombitmask, - int64_t bitmasklength, - bool validwhen, - bool lsb_order); - - ERROR BitMaskedArray_to_IndexedOptionArray64( - kernel::lib ptr_lib, - int64_t* toindex, - const uint8_t* frombitmask, - int64_t bitmasklength, - bool validwhen, - bool lsb_order); - - /////////////////////////////////// awkward/kernels/reducers.h - - ERROR reduce_count_64( - kernel::lib ptr_lib, - int64_t* toptr, - const int64_t* parents, - int64_t lenparents, - int64_t outlength); - - template - ERROR reduce_countnonzero_64( - kernel::lib ptr_lib, - int64_t* toptr, - const IN* fromptr, - const int64_t* parents, - int64_t lenparents, - int64_t outlength); - - template - ERROR reduce_sum_64( - kernel::lib ptr_lib, - OUT* toptr, - const IN* fromptr, - const int64_t* parents, - int64_t lenparents, - int64_t outlength); - - template - ERROR reduce_sum_bool_64( - kernel::lib ptr_lib, - bool* toptr, - const IN* fromptr, - const int64_t* parents, - int64_t lenparents, - int64_t outlength); - - template - ERROR reduce_prod_64( - kernel::lib ptr_lib, - OUT* toptr, - const IN* fromptr, - const int64_t* parents, - int64_t lenparents, - int64_t outlength); - - template - ERROR reduce_prod_bool_64( - kernel::lib ptr_lib, - bool* toptr, - const IN* fromptr, - const int64_t* parents, - int64_t lenparents, - int64_t outlength); - - template - ERROR reduce_min_64( - kernel::lib ptr_lib, - OUT* toptr, - const IN* fromptr, - const int64_t* parents, - int64_t lenparents, - int64_t outlength, - OUT identity); - - template - ERROR reduce_max_64( - kernel::lib ptr_lib, - OUT* toptr, - const IN* fromptr, - const int64_t* parents, - int64_t lenparents, - int64_t outlength, - OUT identity); - - template - ERROR reduce_argmin_64( - kernel::lib ptr_lib, - OUT* toptr, - const IN* fromptr, - const int64_t* parents, - int64_t lenparents, - int64_t outlength); - - template - ERROR reduce_argmax_64( - kernel::lib ptr_lib, - OUT* toptr, - const IN* fromptr, - const int64_t* parents, - int64_t lenparents, - int64_t outlength); - - ERROR content_reduce_zeroparents_64( - kernel::lib ptr_lib, - int64_t* toparents, - int64_t length); - - ERROR ListOffsetArray_reduce_global_startstop_64( - kernel::lib ptr_lib, - int64_t* globalstart, - int64_t* globalstop, - const int64_t* offsets, - int64_t length); - - ERROR ListOffsetArray_reduce_nonlocal_maxcount_offsetscopy_64( - kernel::lib ptr_lib, - int64_t* maxcount, - int64_t* offsetscopy, - const int64_t* offsets, - int64_t length); - - ERROR ListOffsetArray_reduce_nonlocal_preparenext_64( - kernel::lib ptr_lib, - int64_t* nextcarry, - int64_t* nextparents, - int64_t nextlen, - int64_t* maxnextparents, - int64_t* distincts, - int64_t distinctslen, - int64_t* offsetscopy, - const int64_t* offsets, - int64_t length, - const int64_t* parents, - int64_t maxcount); - - ERROR ListOffsetArray_reduce_nonlocal_nextstarts_64( - kernel::lib ptr_lib, - int64_t* nextstarts, - const int64_t* nextparents, - int64_t nextlen); - - ERROR ListOffsetArray_reduce_nonlocal_findgaps_64( - kernel::lib ptr_lib, - int64_t* gaps, - const int64_t* parents, - int64_t lenparents); - - ERROR ListOffsetArray_reduce_nonlocal_outstartsstops_64( - kernel::lib ptr_lib, - int64_t* outstarts, - int64_t* outstops, - const int64_t* distincts, - int64_t lendistincts, - const int64_t* gaps, - int64_t outlength); - - ERROR ListOffsetArray_reduce_nonlocal_nextshifts_64( - kernel::lib ptr_lib, - int64_t* nummissing, - int64_t* missing, - int64_t* nextshifts, - const int64_t* offsets, - int64_t length, - const int64_t* starts, - const int64_t* parents, - int64_t maxcount, - int64_t nextlen, - const int64_t* nextcarry); - - ERROR ListOffsetArray_reduce_local_nextparents_64( - kernel::lib ptr_lib, - int64_t* nextparents, - const int64_t* offsets, - int64_t length); - - ERROR ListOffsetArray_reduce_local_outoffsets_64( - kernel::lib ptr_lib, - int64_t* outoffsets, - const int64_t* parents, - int64_t lenparents, - int64_t outlength); - - template - ERROR IndexedArray_reduce_next_64( - kernel::lib ptr_lib, - int64_t* nextcarry, - int64_t* nextparents, - int64_t* outindex, - const T* index, - int64_t* parents, - int64_t length); - - template - ERROR IndexedArray_reduce_next_nonlocal_nextshifts_64( - kernel::lib ptr_lib, - int64_t* nextshifts, - const T* index, - int64_t length); - - template - ERROR IndexedArray_reduce_next_nonlocal_nextshifts_fromshifts_64( - kernel::lib ptr_lib, - int64_t* nextshifts, - const T* index, - int64_t length, - const int64_t* shifts); - - ERROR IndexedArray_reduce_next_fix_offsets_64( - kernel::lib ptr_lib, - int64_t* outoffsets, - const int64_t* starts, - int64_t startslength, - int64_t outindexlength); - - ERROR NumpyArray_reduce_adjust_starts_64( - kernel::lib ptr_lib, - int64_t* toptr, - int64_t outlength, - const int64_t* parents, - const int64_t* starts); - - ERROR NumpyArray_reduce_adjust_starts_shifts_64( - kernel::lib ptr_lib, - int64_t* toptr, - int64_t outlength, - const int64_t* parents, - const int64_t* starts, - const int64_t* shifts); - - ERROR NumpyArray_reduce_mask_ByteMaskedArray_64( - kernel::lib ptr_lib, - int8_t* toptr, - const int64_t* parents, - int64_t lenparents, - int64_t outlength); - - ERROR NumpyArray_reduce_mask_ByteMaskedArray_64( - kernel::lib ptr_lib, - int8_t* toptr, - const int64_t* parents, - int64_t lenparents, - int64_t outlength); - - ERROR ByteMaskedArray_reduce_next_64( - kernel::lib ptr_lib, - int64_t* nextcarry, - int64_t* nextparents, - int64_t* outindex, - const int8_t* mask, - const int64_t* parents, - int64_t length, - bool validwhen); - - ERROR ByteMaskedArray_reduce_next_nonlocal_nextshifts_64( - kernel::lib ptr_lib, - int64_t* nextshifts, - const int8_t* mask, - int64_t length, - bool valid_when); - - ERROR ByteMaskedArray_reduce_next_nonlocal_nextshifts_fromshifts_64( - kernel::lib ptr_lib, - int64_t* nextshifts, - const int8_t* mask, - int64_t length, - bool valid_when, - const int64_t* shifts); - - /////////////////////////////////// awkward/kernels/sorting.h - - ERROR sorting_ranges( - kernel::lib ptr_lib, - int64_t* toindex, - int64_t tolength, - const int64_t* parents, - int64_t parentslength); - - ERROR sorting_ranges_length( - kernel::lib ptr_lib, - int64_t* tolength, - const int64_t* parents, - int64_t parentslength); - - template - ERROR unique( - kernel::lib ptr_lib, - T* toptr, - int64_t length, - int64_t* tolength); - - template - ERROR IndexedArray_ranges_next_64( - kernel::lib ptr_lib, - const T* index, - const int64_t* fromstarts, - const int64_t* fromstops, - int64_t length, - int64_t* tostarts, - int64_t* tostops, - int64_t* tolength); - - template - ERROR IndexedArray_ranges_carry_next_64( - kernel::lib ptr_lib, - const T* index, - const int64_t* fromstarts, - const int64_t* fromstops, - int64_t length, - int64_t* tocarry); - - template - ERROR NumpyArray_subrange_equal( - kernel::lib ptr_lib, - T* tmpptr, - const int64_t* fromstarts, - const int64_t* fromstops, - int64_t length, - bool* toequal); - - template - ERROR NumpyArray_quick_sort( - kernel::lib ptr_lib, - T* tmpptr, - int64_t* tmpbeg, - int64_t* tmpend, - const int64_t* fromstarts, - const int64_t* fromstops, - bool ascending, - int64_t length, - int64_t maxlevels); - - template - ERROR NumpyArray_quick_argsort( - kernel::lib ptr_lib, - int64_t* toptr, - const T* fromptr, - int64_t length, - int64_t* tmpbeg, - int64_t* tmpend, - const int64_t* offsets, - int64_t offsetslength, - bool ascending, - bool stable, - int64_t maxlevels); - - template - ERROR NumpyArray_argsort( - kernel::lib ptr_lib, - int64_t* toptr, - const T* fromptr, - int64_t length, - const int64_t* offsets, - int64_t offsetslength, - bool ascending, - bool stable); - - template - ERROR NumpyArray_sort( - kernel::lib ptr_lib, - T* toptr, - const T* fromptr, - int64_t length, - const int64_t* offsets, - int64_t offsetslength, - int64_t parentslength, - bool ascending, - bool stable); - - ERROR ListOffsetArray_argsort_strings( - kernel::lib ptr_lib, - int64_t* tocarry, - const int64_t* fromparents, - int64_t length, - const uint8_t* stringdata, - const int64_t* stringstarts, - const int64_t* stringstops, - bool is_stable, - bool is_ascending, - bool is_local); - - template - ERROR NumpyArray_sort_asstrings( - kernel::lib ptr_lib, - T* toptr, - const T* fromptr, - const int64_t* offsets, - int64_t offsetslength, - int64_t* outoffsets, - bool ascending, - bool stable); - - template - ERROR NumpyArray_unique_strings( - kernel::lib ptr_lib, - T* toptr, - const int64_t* offsets, - int64_t offsetslength, - int64_t* outoffsets, - int64_t* tolength); - - ERROR ListOffsetArray_local_preparenext_64( - kernel::lib ptr_lib, - int64_t* tocarry, - const int64_t* fromindex, - int64_t length); - - ERROR IndexedArray_local_preparenext_64( - kernel::lib ptr_lib, - int64_t* tocarry, - const int64_t* starts, - const int64_t* parents, - const int64_t parentslength, - const int64_t* nextparents, - const int64_t nextlen); - - } -} - -#endif //AWKWARD_KERNEL_DISPATCH_H_ diff --git a/include/awkward/kernel-utils.h b/include/awkward/kernel-utils.h index 5f568ac091..ee7068a399 100644 --- a/include/awkward/kernel-utils.h +++ b/include/awkward/kernel-utils.h @@ -6,86 +6,6 @@ #include "common.h" extern "C" { - EXPORT_SYMBOL int8_t - awkward_Index8_getitem_at_nowrap( - const int8_t* ptr, - int64_t at); - EXPORT_SYMBOL uint8_t - awkward_IndexU8_getitem_at_nowrap( - const uint8_t* ptr, - int64_t at); - EXPORT_SYMBOL int32_t - awkward_Index32_getitem_at_nowrap( - const int32_t* ptr, - int64_t at); - EXPORT_SYMBOL uint32_t - awkward_IndexU32_getitem_at_nowrap( - const uint32_t* ptr, - int64_t at); - EXPORT_SYMBOL int64_t - awkward_Index64_getitem_at_nowrap( - const int64_t* ptr, - int64_t at); - - EXPORT_SYMBOL void - awkward_Index8_setitem_at_nowrap( - int8_t* ptr, - int64_t at, - int8_t value); - EXPORT_SYMBOL void - awkward_IndexU8_setitem_at_nowrap( - uint8_t* ptr, - int64_t at, - uint8_t value); - EXPORT_SYMBOL void - awkward_Index32_setitem_at_nowrap( - int32_t* ptr, - int64_t at, - int32_t value); - EXPORT_SYMBOL void - awkward_IndexU32_setitem_at_nowrap( - uint32_t* ptr, - int64_t at, - uint32_t value); - EXPORT_SYMBOL void - awkward_Index64_setitem_at_nowrap( - int64_t* ptr, - int64_t at, - int64_t value); - - EXPORT_SYMBOL bool - awkward_NumpyArraybool_getitem_at0( - const bool* ptr); - EXPORT_SYMBOL int8_t - awkward_NumpyArray8_getitem_at0( - const int8_t* ptr); - EXPORT_SYMBOL uint8_t - awkward_NumpyArrayU8_getitem_at0( - const uint8_t* ptr); - EXPORT_SYMBOL int16_t - awkward_NumpyArray16_getitem_at0( - const int16_t* ptr); - EXPORT_SYMBOL uint16_t - awkward_NumpyArrayU16_getitem_at0( - const uint16_t* ptr); - EXPORT_SYMBOL int32_t - awkward_NumpyArray32_getitem_at0( - const int32_t* ptr); - EXPORT_SYMBOL uint32_t - awkward_NumpyArrayU32_getitem_at0( - const uint32_t* ptr); - EXPORT_SYMBOL int64_t - awkward_NumpyArray64_getitem_at0( - const int64_t* ptr); - EXPORT_SYMBOL uint64_t - awkward_NumpyArrayU64_getitem_at0( - const uint64_t* ptr); - EXPORT_SYMBOL float - awkward_NumpyArrayfloat32_getitem_at0( - const float* ptr); - EXPORT_SYMBOL double - awkward_NumpyArrayfloat64_getitem_at0( - const double* ptr); EXPORT_SYMBOL void awkward_regularize_rangeslice( @@ -108,9 +28,6 @@ extern "C" { bool replacement ); - EXPORT_SYMBOL void* awkward_malloc(int64_t bytelength); - EXPORT_SYMBOL void awkward_free(void const *ptr); - } #endif // AWKWARD_KERNEL_UTILS_H_ diff --git a/include/awkward/layoutbuilder/BitMaskedArrayBuilder.h b/include/awkward/layoutbuilder/BitMaskedArrayBuilder.h deleted file mode 100644 index 6f9292c15b..0000000000 --- a/include/awkward/layoutbuilder/BitMaskedArrayBuilder.h +++ /dev/null @@ -1,133 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_BITMASKEDARRAYBUILDER_H_ -#define AWKWARD_BITMASKEDARRAYBUILDER_H_ - -#include "awkward/layoutbuilder/FormBuilder.h" - -namespace awkward { - - /// @class BitMaskedArrayBuilder - /// - /// @brief BitMaskedArray builder from a Bit Masked JSON Form - template - class LIBAWKWARD_EXPORT_SYMBOL BitMaskedArrayBuilder : public FormBuilder { - public: - /// @brief Creates a BitMaskedArrayBuilder from a full set of parameters. - BitMaskedArrayBuilder(const FormBuilderPtr content, - const util::Parameters& parameters, - const std::string& form_key, - const std::string attribute = "mask", - const std::string partition = "0"); - - /// @brief User-friendly name of this class. - const std::string - classname() const override; - - const std::string - to_buffers(BuffersContainer& container, const ForthOutputBufferMap& outputs) const override; - - /// @brief AwkwardForth virtual machine instructions of the data outputs. - const std::string - vm_output() const override; - - /// @brief AwkwardForth virtual machine data output key. - const std::string - vm_output_data() const override; - - /// @brief AwkwardForth virtual machine instructions of the array builder function. - const std::string - vm_func() const override; - - /// @brief The array builder VM function name. - const std::string - vm_func_name() const override; - - /// @brief The array builder VM function type. - const std::string - vm_func_type() const override; - - /// @brief AwkwardForth virtual machine instructions to retrieve the data from - /// the VM stack. - const std::string - vm_from_stack() const override; - - /// @brief Error messages in the AwkwardForth virtual machine instructions. - const std::string - vm_error() const override; - - /// @brief Adds a boolean value `x` to the accumulated data. - void - boolean(bool x, LayoutBuilderPtr builder) override; - - /// @brief Adds an integer value `x` to the accumulated data. - void - int64(int64_t x, LayoutBuilderPtr builder) override; - - /// @brief Adds a real value `x` to the accumulated data. - void - float64(double x, LayoutBuilderPtr builder) override; - - /// @brief Adds a complex value `x` to the accumulated data. - void - complex(std::complex x, LayoutBuilderPtr builder) override; - - /// @brief Adds an unencoded bytestring `x` in STL format to the - /// accumulated data. - void - bytestring(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Adds a UTF-8 encoded bytestring `x` in STL format to the - /// accumulated data. - void - string(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Begins building a nested list. - void - begin_list(LayoutBuilderPtr builder) override; - - /// @brief Ends a nested list. - void - end_list(LayoutBuilderPtr builder) override; - - /// @brief Returns this Form content builder. - const - FormBuilderPtr content() const { return content_; } - - /// @brief String-to-JSON map that augments the meaning of this - /// builder Form. - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - const util::Parameters& - form_parameters() const { return parameters_; } - - ssize_t - len(const ForthOutputBufferMap& outputs) const override { - return content().get()->len(outputs); - } - - private: - /// @brief This Form content builder - const FormBuilderPtr content_; - - /// @brief This Form parameters - const util::Parameters parameters_; - - /// @brief AwkwardForth virtual machine instructions - /// generated from the Form. - /// - /// An output buffer name is - /// "part{partition}-{form_key}-{attribute}" - std::string vm_output_data_; - std::string vm_output_; - std::string vm_func_name_; - std::string vm_func_; - std::string vm_func_type_; - std::string vm_data_from_stack_; - std::string vm_error_; - }; -} - -#endif // AWKWARD_BITMASKEDARRAYBUILDER_H_ diff --git a/include/awkward/layoutbuilder/ByteMaskedArrayBuilder.h b/include/awkward/layoutbuilder/ByteMaskedArrayBuilder.h deleted file mode 100644 index f49abf6606..0000000000 --- a/include/awkward/layoutbuilder/ByteMaskedArrayBuilder.h +++ /dev/null @@ -1,132 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_BYTEMASKEDARRAYBUILDER_H_ -#define AWKWARD_BYTEMASKEDARRAYBUILDER_H_ - -#include "awkward/layoutbuilder/FormBuilder.h" - -namespace awkward { - - /// @class ByteMaskedArrayBuilder - /// - /// @brief - template - class LIBAWKWARD_EXPORT_SYMBOL ByteMaskedArrayBuilder : public FormBuilder { - public: - /// @brief Creates a ByteMaskedArrayBuilder from a full set of parameters. - ByteMaskedArrayBuilder(const FormBuilderPtr content, - const util::Parameters& parameters, - const std::string& form_key, - const std::string attribute = "mask", - const std::string partition = "0"); - - /// @brief User-friendly name of this class. - const std::string - classname() const override; - - const std::string - to_buffers(BuffersContainer& container, const ForthOutputBufferMap& outputs) const override; - - /// @brief AwkwardForth virtual machine instructions of the data outputs. - const std::string - vm_output() const override; - - /// @brief The data output key. - const std::string - vm_output_data() const override; - - /// @brief AwkwardForth virtual machine instructions of the array builder function. - const std::string - vm_func() const override; - - /// @brief The array builder VM function name. - const std::string - vm_func_name() const override; - - /// @brief The array builder VM function type. - const std::string - vm_func_type() const override; - - /// @brief AwkwardForth virtual machine instructions to retrieve the data from - /// the VM stack. - const std::string - vm_from_stack() const override; - - /// @brief Error messages in the AwkwardForth virtual machine instructions. - const std::string - vm_error() const override; - - /// @brief Adds a boolean value `x` to the accumulated data. - void - boolean(bool x, LayoutBuilderPtr builder) override; - - /// @brief Adds an integer value `x` to the accumulated data. - void - int64(int64_t x, LayoutBuilderPtr builder) override; - - /// @brief Adds a real value `x` to the accumulated data. - void - float64(double x, LayoutBuilderPtr builder) override; - - /// @brief Adds a complex value `x` to the accumulated data. - void - complex(std::complex x, LayoutBuilderPtr builder) override; - - /// @brief Adds an unencoded bytestring `x` in STL format to the - /// accumulated data. - void - bytestring(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Adds a UTF-8 encoded bytestring `x` in STL format to the - /// accumulated data. - void - string(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Begins building a nested list. - void - begin_list(LayoutBuilderPtr builder) override; - - /// @brief Ends a nested list. - void - end_list(LayoutBuilderPtr builder) override; - - const FormBuilderPtr content() const { return content_; } - - /// @brief String-to-JSON map that augments the meaning of this - /// builder Form. - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - const util::Parameters& - form_parameters() const { return parameters_; } - - ssize_t - len(const ForthOutputBufferMap& outputs) const override { - return content().get()->len(outputs); - } - - private: - /// @brief This Json Form content builder - const FormBuilderPtr content_; - - /// @brief This Form parameters - const util::Parameters parameters_; - - /// @brief Forth virtual machine instructions - /// generated from the Json Form - /// - /// An output buffer name is - /// "part{partition}-{form_key}-{attribute}" - std::string vm_output_data_; - std::string vm_output_; - std::string vm_func_name_; - std::string vm_func_; - std::string vm_func_type_; - std::string vm_data_from_stack_; - std::string vm_error_; - }; - -} - -#endif // AWKWARD_BYTEMASKEDARRAYBUILDER_H_ diff --git a/include/awkward/layoutbuilder/EmptyArrayBuilder.h b/include/awkward/layoutbuilder/EmptyArrayBuilder.h deleted file mode 100644 index 023f3c1fb0..0000000000 --- a/include/awkward/layoutbuilder/EmptyArrayBuilder.h +++ /dev/null @@ -1,119 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_EMPTYARRAYBUILDER_H_ -#define AWKWARD_EMPTYARRAYBUILDER_H_ - -#include "awkward/common.h" -#include "awkward/util.h" -#include "awkward/forth/ForthMachine.h" -#include "awkward/layoutbuilder/FormBuilder.h" - -#include - -namespace awkward { - - /// @class EmptyArrayBuilder - /// - /// @brief - template - class LIBAWKWARD_EXPORT_SYMBOL EmptyArrayBuilder : public FormBuilder { - public: - /// @brief Creates an EmptyArrayBuilder from a full set of parameters. - EmptyArrayBuilder(const util::Parameters& parameters); - - /// @brief User-friendly name of this class. - const std::string - classname() const override; - - const std::string - to_buffers(BuffersContainer& container, const ForthOutputBufferMap& outputs) const override; - - /// @brief AwkwardForth virtual machine instructions of the data outputs. - const std::string - vm_output() const override; - - /// @brief AwkwardForth virtual machine data output key. - const std::string - vm_output_data() const override; - - /// @brief AwkwardForth virtual machine instructions of the array builder function. - const std::string - vm_func() const override; - - /// @brief The array builder VM function name. - const std::string - vm_func_name() const override; - - /// @brief The array builder VM function type. - const std::string - vm_func_type() const override; - - /// @brief AwkwardForth virtual machine instructions to retrieve the data from - /// the VM stack. - const std::string - vm_from_stack() const override; - - /// @brief Error messages in the AwkwardForth virtual machine instructions. - const std::string - vm_error() const override; - - /// @brief Adds a boolean value `x` to the accumulated data. - void - boolean(bool x, LayoutBuilderPtr builder) override; - - /// @brief Adds an integer value `x` to the accumulated data. - void - int64(int64_t x, LayoutBuilderPtr builder) override; - - /// @brief Adds a real value `x` to the accumulated data. - void - float64(double x, LayoutBuilderPtr builder) override; - - /// @brief Adds a complex value `x` to the accumulated data. - void - complex(std::complex x, LayoutBuilderPtr builder) override; - - /// @brief Adds an unencoded bytestring `x` in STL format to the - /// accumulated data. - void - bytestring(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Adds a UTF-8 encoded bytestring `x` in STL format to the - /// accumulated data. - void - string(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Begins building a nested list. - void - begin_list(LayoutBuilderPtr builder) override; - - /// @brief Ends a nested list. - void - end_list(LayoutBuilderPtr builder) override; - - /// @brief String-to-JSON map that augments the meaning of this - /// builder Form. - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - const util::Parameters& - form_parameters() const { return parameters_; } - - ssize_t - len(const ForthOutputBufferMap& outputs) const override { - return 0; - } - - private: - /// @brief This Form parameters - const util::Parameters parameters_; - /// @brief An empty command. - std::string vm_empty_command_; - /// @brief An error message. - std::string vm_error_; - }; - -} - -#endif // AWKWARD_EMPTYARRAYBUILDER_H_ diff --git a/include/awkward/layoutbuilder/FormBuilder.h b/include/awkward/layoutbuilder/FormBuilder.h deleted file mode 100644 index 23d77e164c..0000000000 --- a/include/awkward/layoutbuilder/FormBuilder.h +++ /dev/null @@ -1,181 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_FORMBUILDER_H_ -#define AWKWARD_FORMBUILDER_H_ - -#include -#include -#include -#include -#include "awkward/forth/ForthMachine.h" -#include "awkward/forth/ForthOutputBuffer.h" -#include "awkward/builder/Builder.h" - -namespace awkward { - - using ForthOutputBufferMap = std::map>; - - template class LayoutBuilder; - - template - using LayoutBuilderPtr = LayoutBuilder*; - - /// @class FormBuilder - /// - /// @brief Abstract base class for nodes within a LayoutBuilder - /// Every builder will have an output buffer based on the - /// key_format="part{partition}-{form_key}-{attribute}" - /// - template - class LIBAWKWARD_EXPORT_SYMBOL FormBuilder { - public: - /// @brief Virtual destructor acts as a first non-inline virtual function - /// that determines a specific translation unit in which vtable shall be - /// emitted. - virtual ~FormBuilder(); - - /// @brief User-friendly name of this class. - virtual const std::string - classname() const = 0; - - /// @brief Copy the current snapshot into the BuffersContainer and - /// return a Form as a std::string (JSON). - virtual const std::string - to_buffers(BuffersContainer& container, const ForthOutputBufferMap& outputs) const = 0; - - /// @brief The builder's output buffer length. - virtual ssize_t - len(const ForthOutputBufferMap& outputs) const = 0; - - virtual bool - is_complex() const { - return false; - } - - // /// @brief The Form describing the array. - // virtual const FormPtr - // form() const = 0; - - /// @brief AwkwardForth virtual machine instructions of the data outputs. - virtual const std::string - vm_output() const = 0; - - /// @brief AwkwardForth virtual machine data output key. - virtual const std::string - vm_output_data() const = 0; - - /// @brief AwkwardForth virtual machine instructions of the array builder function. - virtual const std::string - vm_func() const = 0; - - /// @brief The array builder VM function name. - virtual const std::string - vm_func_name() const = 0; - - /// @brief The array builder VM function type. - virtual const std::string - vm_func_type() const = 0; - - /// @brief AwkwardForth virtual machine instructions to retrieve the data from - /// the VM stack. - virtual const std::string - vm_from_stack() const = 0; - - /// @brief Error messages in the AwkwardForth virtual machine instructions. - virtual const std::string - vm_error() const = 0; - - /// @brief Adds an integer value `x` to the accumulated data. - virtual void - tag(int8_t x) { - throw std::runtime_error( - std::string("FormBuilder 'tag' is not implemented yet")); - } - - /// @brief Adds a boolean value `x` to the accumulated data. - virtual void - boolean(bool x, LayoutBuilderPtr builder) { - throw std::runtime_error( - std::string("FormBuilder 'boolean' is not implemented yet")); - } - - /// @brief Adds an integer value `x` to the accumulated data. - virtual void - int64(int64_t x, LayoutBuilderPtr builder) { - throw std::runtime_error( - std::string("FormBuilder 'int64' is not implemented yet")); - } - - /// @brief Adds a real value `x` to the accumulated data. - virtual void - float64(double x, LayoutBuilderPtr builder) { - throw std::runtime_error( - std::string("FormBuilder 'float64' is not implemented yet")); - } - - /// @brief Adds a complex value `x` to the accumulated data. - virtual void - complex(std::complex x, LayoutBuilderPtr builder) { - throw std::runtime_error( - std::string("FormBuilder 'complex' is not implemented yet")); - } - - /// @brief Adds an unencoded bytestring `x` in STL format to the - /// accumulated data. - virtual void - bytestring(const std::string& x, LayoutBuilderPtr builder) { - throw std::runtime_error( - std::string("FormBuilder 'bytestring' is not implemented yet")); - } - - /// @brief Adds a UTF-8 encoded bytestring `x` in STL format to the - /// accumulated data. - virtual void - string(const std::string& x, LayoutBuilderPtr builder) { - throw std::runtime_error( - std::string("FormBuilder 'string' is not implemented yet")); - } - - /// @brief Begins building a nested list. - virtual void - begin_list(LayoutBuilderPtr builder) { - throw std::runtime_error( - std::string("FormBuilder 'begin_list' is not implemented yet")); - } - - /// @brief Ends a nested list. - virtual void - end_list(LayoutBuilderPtr builder) { - throw std::runtime_error( - std::string("FormBuilder 'end_list' is not implemented yet")); - } - - /// @brief If `true`, this node has started but has not finished a - /// multi-step command (e.g. `begin_list ... end_list`). - virtual bool - active() { - return false; - } - - /// @brief FIXME: find if it's already implemented in utils - virtual std::string - parameters_as_string(const util::Parameters& parameters) const { - std::stringstream p; - if (!parameters.empty()) { - p << "\"parameters\": {"; - for (auto const &pair: parameters) { - p << "\"" << pair.first << "\": " << pair.second << " "; - } - p << "}, "; - } - return p.str(); - } - - }; - - template - using FormBuilderPtr = std::shared_ptr>; - -} - -#endif // AWKWARD_FORMBUILDER_H_ diff --git a/include/awkward/layoutbuilder/IndexedArrayBuilder.h b/include/awkward/layoutbuilder/IndexedArrayBuilder.h deleted file mode 100644 index 515384243e..0000000000 --- a/include/awkward/layoutbuilder/IndexedArrayBuilder.h +++ /dev/null @@ -1,147 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_INDEXEDARRAYBUILDER_H_ -#define AWKWARD_INDEXEDARRAYBUILDER_H_ - -#include "awkward/layoutbuilder/FormBuilder.h" - -#include - -namespace awkward { - - /// @class IndexedArrayBuilder - /// - /// @brief - template - class LIBAWKWARD_EXPORT_SYMBOL IndexedArrayBuilder : public FormBuilder { - public: - /// @brief Creates an IndexedArrayBuilder from a full set of parameters. - IndexedArrayBuilder(const FormBuilderPtr content, - const util::Parameters& parameters, - const std::string& json_form_key, - const std::string& json_form_index, - bool is_categorical, - const std::string attribute = "index", - const std::string partition = "0"); - - /// @brief User-friendly name of this class. - const std::string - classname() const override; - - const std::string - to_buffers(BuffersContainer& container, const ForthOutputBufferMap& outputs) const override; - - /// @brief AwkwardForth virtual machine instructions of the data outputs. - const std::string - vm_output() const override; - - /// @brief AwkwardForth virtual machine data output key. - const std::string - vm_output_data() const override; - - /// @brief AwkwardForth virtual machine instructions of the array builder function. - const std::string - vm_func() const override; - - /// @brief The array builder VM function name. - const std::string - vm_func_name() const override; - - /// @brief The array builder VM function type. - const std::string - vm_func_type() const override; - - /// @brief AwkwardForth virtual machine instructions to retrieve the data from - /// the VM stack. - const std::string - vm_from_stack() const override; - - /// @brief Error messages in the AwkwardForth virtual machine instructions. - const std::string - vm_error() const override; - - /// @brief Adds a boolean value `x` to the accumulated data. - void - boolean(bool x, LayoutBuilderPtr builder) override; - - /// @brief Adds an integer value `x` to the accumulated data. - void - int64(int64_t x, LayoutBuilderPtr builder) override; - - /// @brief Adds a real value `x` to the accumulated data. - void - float64(double x, LayoutBuilderPtr builder) override; - - /// @brief Adds a complex value `x` to the accumulated data. - void - complex(std::complex x, LayoutBuilderPtr builder) override; - - /// @brief Adds an unencoded bytestring `x` in STL format to the - /// accumulated data. - void - bytestring(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Adds a UTF-8 encoded bytestring `x` in STL format to the - /// accumulated data. - void - string(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Begins building a nested list. - void - begin_list(LayoutBuilderPtr builder) override; - - /// @brief Ends a nested list. - void - end_list(LayoutBuilderPtr builder) override; - - const - FormBuilderPtr content() const { return content_; } - - const std::string& - form_index() const { return form_index_; } - - const util::Parameters& - form_parameters() const { return parameters_; } - - const std::string& - form_key() const {return form_key_; } - - ssize_t - len(const ForthOutputBufferMap& outputs) const override { - auto search = outputs.find(vm_output_data()); - if (search != outputs.end()) { - return (ssize_t)search->second.get()->len(); - } - return 0; - } - - private: - /// @brief This Json Form content builder - const FormBuilderPtr content_; - - /// @brief This Form parameters - const util::Parameters parameters_; - - /// @brief If 'true', this array type is categorical. - bool is_categorical_; - - const std::string form_index_; - const std::string form_key_; - - /// @brief AwkwardForth virtual machine instructions - /// generated from the Json Form. - /// - /// An output buffer name is - /// "part{partition}-{form_key}-{attribute}" - std::string vm_output_data_; - std::string vm_output_; - std::string vm_func_name_; - std::string vm_func_; - std::string vm_func_type_; - std::string vm_data_from_stack_; - std::string vm_error_; - }; - -} - -#endif // AWKWARD_INDEXEDARRAYBUILDER_H_ diff --git a/include/awkward/layoutbuilder/IndexedOptionArrayBuilder.h b/include/awkward/layoutbuilder/IndexedOptionArrayBuilder.h deleted file mode 100644 index 5459da8fef..0000000000 --- a/include/awkward/layoutbuilder/IndexedOptionArrayBuilder.h +++ /dev/null @@ -1,144 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_INDEXEDOPTIONARRAYBUILDER_H_ -#define AWKWARD_INDEXEDOPTIONARRAYBUILDER_H_ - -#include "awkward/layoutbuilder/FormBuilder.h" - -namespace awkward { - - /// @class IndexedOptionArrayBuilder - /// - /// @brief - template - class LIBAWKWARD_EXPORT_SYMBOL IndexedOptionArrayBuilder : public FormBuilder { - public: - /// @brief Creates an IndexedOptionArrayBuilder from a full set of parameters. - IndexedOptionArrayBuilder(const FormBuilderPtr content, - const util::Parameters& parameters, - const std::string& form_key, - const std::string& form_index, - bool is_categorical, - const std::string attribute = "index", - const std::string partition = "0"); - - /// @brief User-friendly name of this class. - const std::string - classname() const override; - - const std::string - to_buffers(BuffersContainer& container, const ForthOutputBufferMap& outputs) const override; - - /// @brief AwkwardForth virtual machine instructions of the data outputs. - const std::string - vm_output() const override; - - /// @brief AwkwardForth virtual machine data output key. - const std::string - vm_output_data() const override; - - /// @brief AwkwardForth virtual machine instructions of the array builder function. - const std::string - vm_func() const override; - - /// @brief The array builder VM function name. - const std::string - vm_func_name() const override; - - /// @brief The array builder VM function type. - const std::string - vm_func_type() const override; - - /// @brief AwkwardForth virtual machine instructions to retrieve the data from - /// the VM stack. - const std::string - vm_from_stack() const override; - - /// @brief Error messages in the AwkwardForth virtual machine instructions. - const std::string - vm_error() const override; - - /// @brief Adds a boolean value `x` to the accumulated data. - void - boolean(bool x, LayoutBuilderPtr builder) override; - - /// @brief Adds an integer value `x` to the accumulated data. - void - int64(int64_t x, LayoutBuilderPtr builder) override; - - /// @brief Adds a real value `x` to the accumulated data. - void - float64(double x, LayoutBuilderPtr builder) override; - - /// @brief Adds a complex value `x` to the accumulated data. - void - complex(std::complex x, LayoutBuilderPtr builder) override; - - /// @brief Adds an unencoded bytestring `x` in STL format to the - /// accumulated data. - void - bytestring(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Adds a UTF-8 encoded bytestring `x` in STL format to the - /// accumulated data. - void - string(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Begins building a nested list. - void - begin_list(LayoutBuilderPtr builder) override; - - /// @brief Ends a nested list. - void - end_list(LayoutBuilderPtr builder) override; - - const - FormBuilderPtr content() const { return content_; } - - const std::string& - form_index() const { return form_index_; } - - const util::Parameters& - form_parameters() const { return parameters_; } - - const std::string& - form_key() const {return form_key_; } - - ssize_t - len(const ForthOutputBufferMap& outputs) const override { - auto search = outputs.find(vm_output_data()); - if (search != outputs.end()) { - return (ssize_t)search->second.get()->len(); - } - return 0; - } - - private: - /// @brief This Form layout builder - const FormBuilderPtr content_; - - /// @brief This Form parameters - const util::Parameters parameters_; - - /// @brief If 'true', this array type is categorical. - bool is_categorical_; - - const std::string form_index_; - const std::string form_key_; - - void validate() const; - - /// @brief Forth virtual machine instructions - /// generated from the Form - std::string vm_output_data_; - std::string vm_output_; - std::string vm_func_name_; - std::string vm_func_; - std::string vm_func_type_; - std::string vm_data_from_stack_; - std::string vm_error_; - }; - -} - -#endif // AWKWARD_INDEXEDOPTIONARRAYBUILDER_H_ diff --git a/include/awkward/layoutbuilder/LayoutBuilder.h b/include/awkward/layoutbuilder/LayoutBuilder.h deleted file mode 100644 index 195f65a81d..0000000000 --- a/include/awkward/layoutbuilder/LayoutBuilder.h +++ /dev/null @@ -1,320 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_LayoutBuilder_H_ -#define AWKWARD_LayoutBuilder_H_ - -#include "awkward/common.h" -#include "awkward/util.h" -#include "awkward/forth/ForthMachine.h" -#include "awkward/layoutbuilder/FormBuilder.h" - -#include - -namespace awkward { - - using ForthOutputBufferMap = std::map>; - - const std::string - index_form_to_name(const std::string& form_index); - - const std::string - index_form_to_vm_format(const std::string& form_index); - - enum class state : std::int32_t { - int64 = 0, - float64 = 1, - begin_list = 2, - end_list = 3, - boolean = 4, - int8 = 5, - int16 = 6, - int32 = 7, - uint8 = 8, - uint16 = 9, - uint32 = 10, - uint64 = 11, - float16 = 12, - float32 = 13, - float128 = 14, - complex64 = 15, - complex128 = 16, - complex256 = 17, - null = 18, - index = 19, - tag = 20, - datetime64 = 21, - timedelta64 = 22 - }; - using utype = std::underlying_type::type; - - const std::string - primitive_to_state(const std::string& name); - - const std::string - primitive_to_vm_format(const std::string& name); - - /// @class LayoutBuilder - /// - /// @brief User interface to the FormBuilder system: the LayoutBuilder is a - /// fixed reference while the FormBuilder subclass instances change in - /// response to accumulating data. - template - class LIBAWKWARD_EXPORT_SYMBOL LayoutBuilder { - public: - /// @brief Creates an LayoutBuilder from a full set of parameters. - /// - /// @param form The Form that defines the Array to be build. - /// @param initial The Array builder initial. - /// @param vm_init If 'true' the Virtual Machine is instantiated on - /// construction. If 'false' an external Virtial Machine must be connected - /// to the builder. The flag is used for debugging. - LayoutBuilder(const std::string& json_form, - const int64_t initial, - bool vm_init = true); - - const std::string& - json_form() const { - return json_form_; - } - - /// @brief Copy the current snapshot into the BuffersContainer and - /// return a Form as a std::string (JSON). - const std::string - to_buffers(BuffersContainer& container) const; - - /// @brief Connects a Virtual Machine if it was not initialized before. - void - connect(const std::shared_ptr>& vm); - - /// @brief Prints debug information from the Virtual Machine stack. - void - debug_step() const; - - /// @brief Returns an AwkwardForth source code generated from the 'Form' and - /// passed to the 'ForthMachine' virtual machine. - const std::string - vm_source() const; - - /// @brief - const std::shared_ptr> - vm() const; - - /// @brief Current length of the accumulated array. - int64_t - length() const; - - /// @brief - void - pre_snapshot() const; - - /// @brief Adds a `null` value to the accumulated data. - void - null(); - - /// @brief Adds a boolean value `x` to the accumulated data. - void - boolean(bool x); - - /// @brief Adds an integer value `x` to the accumulated data. - void - int64(int64_t x); - - /// @brief Adds a real value `x` to the accumulated data. - void - float64(double x); - - /// @brief Adds a complex value `x` to the accumulated data. - void - complex(std::complex x); - - /// @brief Adds an unencoded, null-terminated bytestring value `x` to the - /// accumulated data. - void - bytestring(const char* x); - - /// @brief Adds an unencoded bytestring value `x` with a given `length` - /// to the accumulated data. - /// - /// The string does not need to be null-terminated. - void - bytestring(const char* x, int64_t length); - - /// @brief Adds an unencoded bytestring `x` in STL format to the - /// accumulated data. - void - bytestring(const std::string& x); - - /// @brief Adds a UTF-8 encoded, null-terminated bytestring value `x` to - /// the accumulated data. - void - string(const char* x); - - /// @brief Adds a UTF-8 encoded bytestring value `x` with a given `length` - /// to the accumulated data. - /// - /// The string does not need to be null-terminated. - void - string(const char* x, int64_t length); - - /// @brief Adds a UTF-8 encoded bytestring `x` in STL format to the - /// accumulated data. - void - string(const std::string& x); - - /// @brief Begins building a nested list. - /// - /// The first 'beginlist' puts AwkwardForth VM into a state that expects - /// another 'beginlist' or 'endlist'. - /// The second puts the VM into a state that expects 'int64', etc. - /// or 'endlist'. - void - begin_list(); - - /// @brief Begins building a nested list. - void - add_begin_list(); - - /// @brief Ends a nested list. - void - end_list(); - - /// @brief Ends a nested list. - void - add_end_list(); - - /// @brief Sets the pointer to a given tag `tag`; the next - /// command will fill that slot. - void - tag(int8_t tag); - - /// @brief Issues an 'index' vm command. The value 'x' is pushed to - /// the VM stack, it is not added to the accumulated data, e.g. - /// the VM output buffer. - /// - /// This is used to build a 'categorical' array. - void - index(int64_t x); - - /// @brief Finds an index of a data in a VM output buffer. - /// This is used to build a 'categorical' array. - template - bool - find_index_of(D x, const std::string& vm_output_data) { - auto const& outputs = vm_.get()->outputs(); - auto search = outputs.find(vm_output_data); - if (search != outputs.end()) { - auto data = std::static_pointer_cast(search->second.get()->ptr()); - auto size = search->second.get()->len(); - for (int64_t i = 0; i < size; i++) { - if (data.get()[i] == x) { - index(i); - return true; - } - } - } - return false; - } - - /// @brief Adds a boolean value `x` to the accumulated data. - void - add_bool(bool x); - - /// @brief Adds an int64_t value `x` to the accumulated data. - void - add_int64(int64_t x); - - /// @brief Adds a double value `x` to the accumulated data. - void - add_double(double x); - - /// @brief Adds a complex value `x` to the accumulated data. - void - add_complex(std::complex x); - - /// @brief Adds a string value `x` to the accumulated data. - void - add_string(const std::string& x); - - /// @brief Generates next unique ID - static int64_t - next_id(); - - /// @brief Generates a user-defined error ID - static int64_t - next_error_id(); - - /// @brief Resume Virtual machine run. - void - resume() const; - - // @brief Root node of the FormBuilder tree. - const FormBuilderPtr builder() const { return builder_; } - - protected: - /// @brief A unique ID to use when Form nodes do not have Form key - /// defined. - static int64_t - next_node_id; - - /// @brief An error ID to be used to generate a user 'halt' message. - static int64_t - error_id; - - private: - /// @brief Generates an Array builder from a Form. - FormBuilderPtr - form_builder_from_json(const std::string& json_form); - - /// @brief - template - FormBuilderPtr - from_json(const JSON& json_doc); - - /// @ brief Initialise Layout Builder from a JSON Form. - void - initialise_builder(const std::string& json_form); - - /// @ brief Initialise Virtual machine. - void - initialise(); - - /// @brief Place data of a type 'T' to the VM output buffer. - template - void - set_data(D x); - - /// @brief The Form that defines the Array to be build. - const std::string json_form_; - - /// See #initial. - int64_t initial_; - - /// @brief Root node of the FormBuilder tree. - FormBuilderPtr builder_; - - /// @brief Virtual machine. - std::shared_ptr> vm_; - - /// @brief Virtual machine input buffers. - std::map> vm_inputs_map_; - - /// @brief Input data label. - std::string vm_input_data_; - - /// @brief Virtual machine source code. - std::string vm_source_; - - /// @brief Virtual machine errors to ignore. - std::set ignore_; - - /// @brief Virtual machine output buffers. - ForthOutputBufferMap vm_outputs_map_; - - }; - - using LayoutBuilder32 = LayoutBuilder; - using LayoutBuilder64 = LayoutBuilder; - -} - -#endif // AWKWARD_LayoutBuilder_H_ diff --git a/include/awkward/layoutbuilder/ListArrayBuilder.h b/include/awkward/layoutbuilder/ListArrayBuilder.h deleted file mode 100644 index 2994521f2e..0000000000 --- a/include/awkward/layoutbuilder/ListArrayBuilder.h +++ /dev/null @@ -1,147 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_LISTARRAYBUILDER_H_ -#define AWKWARD_LISTARRAYBUILDER_H_ - -#include "awkward/layoutbuilder/FormBuilder.h" - -namespace awkward { - - /// @class ListArrayBuilder - /// - /// @brief - template - class LIBAWKWARD_EXPORT_SYMBOL ListArrayBuilder : public FormBuilder { - public: - /// @brief Creates a ListArrayBuilder from a full set of parameters. - ListArrayBuilder(FormBuilderPtr content, - const util::Parameters& parameters, - const std::string& form_key, - const std::string& form_starts, - const std::string attribute = "offsets", - const std::string partition = "0"); - - /// @brief User-friendly name of this class. - const std::string - classname() const override; - - const std::string - to_buffers(BuffersContainer& container, const ForthOutputBufferMap& outputs) const override; - - /// @brief AwkwardForth virtual machine instructions of the data outputs. - const std::string - vm_output() const override; - - /// @brief AwkwardForth virtual machine data output key. - const std::string - vm_output_data() const override; - - /// @brief AwkwardForth virtual machine instructions of the array builder function. - const std::string - vm_func() const override; - - /// @brief The array builder VM function name. - const std::string - vm_func_name() const override; - - /// @brief The array builder VM function type. - const std::string - vm_func_type() const override; - - /// @brief AwkwardForth virtual machine instructions to retrieve the data from - /// the VM stack. - const std::string - vm_from_stack() const override; - - /// @brief Error messages in the AwkwardForth virtual machine instructions. - const std::string - vm_error() const override; - - /// @brief Adds a boolean value `x` to the accumulated data. - void - boolean(bool x, LayoutBuilderPtr builder) override; - - /// @brief Adds an integer value `x` to the accumulated data. - void - int64(int64_t x, LayoutBuilderPtr builder) override; - - /// @brief Adds a real value `x` to the accumulated data. - void - float64(double x, LayoutBuilderPtr builder) override; - - /// @brief Adds a complex value `x` to the accumulated data. - void - complex(std::complex x, LayoutBuilderPtr builder) override; - - /// @brief Adds an unencoded bytestring `x` in STL format to the - /// accumulated data. - void - bytestring(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Adds a UTF-8 encoded bytestring `x` in STL format to the - /// accumulated data. - void - string(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Begins building a nested list. - void - begin_list(LayoutBuilderPtr builder) override; - - /// @brief Ends a nested list. - void - end_list(LayoutBuilderPtr builder) override; - - /// @brief true if the builder is accumulating data - bool - active() override; - - const - FormBuilderPtr content() const { return content_; } - - const std::string& - form_starts() const { return form_starts_; } - - const util::Parameters& - form_parameters() const { return parameters_; } - - const std::string& - form_key() const {return form_key_; } - - ssize_t - len(const ForthOutputBufferMap& outputs) const override { - auto search = outputs.find(vm_output_data()); - if (search != outputs.end()) { - return (ssize_t)search->second.get()->len(); - } - return 0; - } - - private: - /// @brief This Form content builder - FormBuilderPtr content_; - - /// @brief This Form parameters - const util::Parameters parameters_; - - /// @brief 'true' if this builder has received a 'begin_list' command. - /// 'false' if the builder either has not received a 'begin_list' command - /// or has received an 'end_list' command. - bool begun_; - - const std::string form_starts_; - const std::string form_key_; - - /// @brief Forth virtual machine instructions - /// generated from the Form - std::string vm_output_data_; - std::string vm_output_; - std::string vm_func_name_; - std::string vm_func_; - std::string vm_func_type_; - std::string vm_data_from_stack_; - std::string vm_error_; - }; - -} - -#endif // AWKWARD_LISTARRAYBUILDER_H_ diff --git a/include/awkward/layoutbuilder/ListOffsetArrayBuilder.h b/include/awkward/layoutbuilder/ListOffsetArrayBuilder.h deleted file mode 100644 index d07d905467..0000000000 --- a/include/awkward/layoutbuilder/ListOffsetArrayBuilder.h +++ /dev/null @@ -1,156 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_LISTOFFSETARRAYBUILDER_H_ -#define AWKWARD_LISTOFFSETARRAYBUILDER_H_ - -#include "awkward/layoutbuilder/FormBuilder.h" - -namespace awkward { - - /// @class ListOffsetArrayBuilder - /// - /// @brief - template - class LIBAWKWARD_EXPORT_SYMBOL ListOffsetArrayBuilder : public FormBuilder { - public: - /// @brief Creates a ListOffsetArrayBuilder from a full set of parameters. - ListOffsetArrayBuilder(FormBuilderPtr content, - const util::Parameters& parameters, - const std::string& form_key, - const std::string& form_offsets, - bool is_string_builder, - const std::string attribute = "offsets", - const std::string partition = "0"); - - /// @brief User-friendly name of this class. - const std::string - classname() const override; - - const std::string - to_buffers(BuffersContainer& container, const ForthOutputBufferMap& outputs) const override; - - /// @brief AwkwardForth virtual machine instructions of the data outputs. - const std::string - vm_output() const override; - - /// @brief AwkwardForth virtual machine data output key. - const std::string - vm_output_data() const override; - - /// @brief AwkwardForth virtual machine instructions of the array builder function. - const std::string - vm_func() const override; - - /// @brief The array builder VM function name. - const std::string - vm_func_name() const override; - - /// @brief The array builder VM function type. - const std::string - vm_func_type() const override; - - /// @brief AwkwardForth virtual machine instructions to retrieve the data from - /// the VM stack. - const std::string - vm_from_stack() const override; - - /// @brief Error messages in the AwkwardForth virtual machine instructions. - const std::string - vm_error() const override; - - /// @brief Adds a boolean value `x` to the accumulated data. - void - boolean(bool x, LayoutBuilderPtr builder) override; - - /// @brief Adds an integer value `x` to the accumulated data. - void - int64(int64_t x, LayoutBuilderPtr builder) override; - - /// @brief Adds a real value `x` to the accumulated data. - void - float64(double x, LayoutBuilderPtr builder) override; - - /// @brief Adds a complex value `x` to the accumulated data. - void - complex(std::complex x, LayoutBuilderPtr builder) override; - - /// @brief Adds an unencoded bytestring `x` in STL format to the - /// accumulated data. - void - bytestring(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Adds a UTF-8 encoded bytestring `x` in STL format to the - /// accumulated data. - void - string(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Begins building a nested list. - void - begin_list(LayoutBuilderPtr builder) override; - - /// @brief Ends a nested list. - void - end_list(LayoutBuilderPtr builder) override; - - /// @brief true if the builder is accumulating data - bool - active() override; - - const FormBuilderPtr content() const { return content_; } - - const std::string& - form_offsets() const { return form_offsets_; } - - const util::Parameters& - form_parameters() const { return parameters_; } - - const std::string& - form_key() const {return form_key_; } - - ssize_t - len(const ForthOutputBufferMap& outputs) const override { - auto search = outputs.find(vm_output_data()); - if (search != outputs.end()) { - return (ssize_t)search->second.get()->len() - 1; - } - return 0; - } - - private: - /// @brief This Form content builder - FormBuilderPtr content_; - - /// @brief This Form parameters - const util::Parameters parameters_; - - /// @brief 'true' if this builder 'array' parameter is 'string', - /// 'false' otherwise. - bool is_string_builder_; - - const std::string form_offsets_; - - /// @brief 'true' if this builder has received a 'begin_list' command. - /// 'false' if the builder either has not received a 'begin_list' command - /// or has received an 'end_list' command. - bool begun_; - - /// @brief an output buffer name is - /// "part{partition}-{form_key}-{attribute}" - const std::string form_key_; - const std::string attribute_; - const std::string partition_; - - /// @brief Forth virtual machine instructions - /// generated from the Form - std::string vm_output_; - std::string vm_output_data_; - std::string vm_func_; - std::string vm_func_name_; - std::string vm_func_type_; - std::string vm_data_from_stack_; - std::string vm_error_; - }; - -} - -#endif // AWKWARD_LISTOFFSETARRAYBUILDER_H_ diff --git a/include/awkward/layoutbuilder/NumpyArrayBuilder.h b/include/awkward/layoutbuilder/NumpyArrayBuilder.h deleted file mode 100644 index 686438a031..0000000000 --- a/include/awkward/layoutbuilder/NumpyArrayBuilder.h +++ /dev/null @@ -1,155 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_NUMPYARRAYBUILDER_H_ -#define AWKWARD_NUMPYARRAYBUILDER_H_ - -#include "awkward/layoutbuilder/FormBuilder.h" - -namespace awkward { - - /// @class NumpyArrayBuilder - /// - /// @brief - template - class LIBAWKWARD_EXPORT_SYMBOL NumpyArrayBuilder : public FormBuilder { - public: - /// @brief Creates a NumpyArrayBuilder from a full set of parameters. - NumpyArrayBuilder(const util::Parameters& parameters, - const std::string& form_key, - const std::string& form_dtype, - const std::string& form_dtype_state, - const std::string& form_dtype_to_vm_format, - const std::string attribute = "data", - const std::string partition = "0"); - - /// @brief User-friendly name of this class. - const std::string - classname() const override; - - const std::string - to_buffers(BuffersContainer& container, const ForthOutputBufferMap& outputs) const override; - - /// @brief AwkwardForth virtual machine instructions of the data outputs. - const std::string - vm_output() const override; - - /// @brief AwkwardForth virtual machine data output key. - const std::string - vm_output_data() const override; - - /// @brief AwkwardForth virtual machine instructions of the array builder function. - const std::string - vm_func() const override; - - /// @brief The array builder VM function name. - const std::string - vm_func_name() const override; - - /// @brief The array builder VM function type. - const std::string - vm_func_type() const override; - - /// @brief AwkwardForth virtual machine instructions to retrieve the data from - /// the VM stack. - const std::string - vm_from_stack() const override; - - /// @brief Error messages in the AwkwardForth virtual machine instructions. - const std::string - vm_error() const override; - - /// @brief Adds a boolean value `x` to the accumulated data. - void - boolean(bool x, LayoutBuilderPtr builder) override; - - /// @brief Adds an integer value `x` to the accumulated data. - void - int64(int64_t x, LayoutBuilderPtr builder) override; - - /// @brief Adds a real value `x` to the accumulated data. - void - float64(double x, LayoutBuilderPtr builder) override; - - /// @brief Adds a complex value `x` to the accumulated data. - void - complex(std::complex x, LayoutBuilderPtr builder) override; - - /// @brief Adds an unencoded bytestring `x` in STL format to the - /// accumulated data. - void - bytestring(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Adds a UTF-8 encoded bytestring `x` in STL format to the - /// accumulated data. - void - string(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Begins building a nested list. - void - begin_list(LayoutBuilderPtr builder) override; - - /// @brief Ends a nested list. - void - end_list(LayoutBuilderPtr builder) override; - - const util::Parameters& - form_parameters() const { return parameters_; } - - const std::string& - form_key() const {return form_key_; } - - const std::string& - form_primitive() const {return form_primitive_; } - - ssize_t - itemsize() const { - if (form_primitive() == "float64") { - return sizeof(double); - } else if (form_primitive() == "int64") { - return sizeof(int64_t); - } else if (form_primitive() == "complex128") { - return sizeof(std::complex); - } else if (form_primitive() == "bool") { - return sizeof(bool); - } - return util::dtype_to_itemsize(util::name_to_dtype(form_primitive())); - } - - ssize_t - len(const ForthOutputBufferMap& outputs) const override { - auto search = outputs.find(vm_output_data()); - if (search != outputs.end()) { - return (is_complex() ? - (ssize_t)search->second.get()->len() >> 1 : - (ssize_t)search->second.get()->len()); - } - return 0; - } - - bool - is_complex() const override { - return is_complex_; - } - - private: - - /// @brief This Form parameters - const util::Parameters parameters_; - const std::string form_key_; - const std::string form_primitive_; - bool is_complex_; - - /// @brief AwkwardForth virtual machine instructions - /// generated from the Form - std::string vm_output_; - std::string vm_output_data_; - std::string vm_func_; - std::string vm_func_name_; - std::string vm_func_type_; - std::string vm_data_from_stack_; - std::string vm_error_; - }; - -} - -#endif // AWKWARD_NUMPYARRAYBUILDER_H_ diff --git a/include/awkward/layoutbuilder/RecordArrayBuilder.h b/include/awkward/layoutbuilder/RecordArrayBuilder.h deleted file mode 100644 index 9effb7129f..0000000000 --- a/include/awkward/layoutbuilder/RecordArrayBuilder.h +++ /dev/null @@ -1,144 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_RECORDARRAYBUILDER_H_ -#define AWKWARD_RECORDARRAYBUILDER_H_ - -#include "awkward/layoutbuilder/FormBuilder.h" - -namespace awkward { - - /// @class RecordArrayBuilder - /// - /// @brief - template - class LIBAWKWARD_EXPORT_SYMBOL RecordArrayBuilder : public FormBuilder { - public: - /// @brief Creates a RecordArrayBuilder from a full set of parameters. - RecordArrayBuilder(const std::vector>& contents, - const util::RecordLookupPtr recordlookup, - const util::Parameters& parameters, - const std::string& form_key, - const std::string attribute = "record", - const std::string partition = "0"); - - /// @brief User-friendly name of this class. - const std::string - classname() const override; - - const std::string - to_buffers(BuffersContainer& container, const ForthOutputBufferMap& outputs) const override; - - /// @brief AwkwardForth virtual machine instructions of the data outputs. - const std::string - vm_output() const override; - - /// @brief AwkwardForth virtual machine data output key. - const std::string - vm_output_data() const override; - - /// @brief AwkwardForth virtual machine instructions of the array builder function. - const std::string - vm_func() const override; - - /// @brief The array builder VM function name. - const std::string - vm_func_name() const override; - - /// @brief The array builder VM function type. - const std::string - vm_func_type() const override; - - /// @brief AwkwardForth virtual machine instructions to retrieve the data from - /// the VM stack. - const std::string - vm_from_stack() const override; - - /// @brief Error messages in the AwkwardForth virtual machine instructions. - const std::string - vm_error() const override; - - /// @brief Adds a boolean value `x` to the accumulated data. - void - boolean(bool x, LayoutBuilderPtr builder) override; - - /// @brief Adds an integer value `x` to the accumulated data. - void - int64(int64_t x, LayoutBuilderPtr builder) override; - - /// @brief Adds a real value `x` to the accumulated data. - void - float64(double x, LayoutBuilderPtr builder) override; - - /// @brief Adds a complex value `x` to the accumulated data. - void - complex(std::complex x, LayoutBuilderPtr builder) override; - - /// @brief Adds an unencoded bytestring `x` in STL format to the - /// accumulated data. - void - bytestring(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Adds a UTF-8 encoded bytestring `x` in STL format to the - /// accumulated data. - void - string(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Begins building a nested list. - void - begin_list(LayoutBuilderPtr builder) override; - - /// @brief Ends a nested list. - void - end_list(LayoutBuilderPtr builder) override; - - /// @brief If `true`, this node's content has started but has not finished a - /// multi-step command (e.g. `begin_list ... end_list`). - bool - active() override; - - const std::vector>& contents() const { return contents_; } - - const util::RecordLookupPtr& form_recordlookup() const { return form_recordlookup_; } - - const util::Parameters& - form_parameters() const { return parameters_; } - - const std::string& - form_key() const {return form_key_; } - - ssize_t - len(const ForthOutputBufferMap& outputs) const override; - - private: - /// @brief Keeps track of a field index. - int64_t field_index(); - - /// @brief This Form content builders - std::vector> contents_; - std::vector fields_; - const util::RecordLookupPtr form_recordlookup_; - - /// @brief This Form parameters - const util::Parameters parameters_; - - /// @brief This builder Form - const std::string form_; - const std::string form_key_; - int64_t field_index_; - int64_t contents_size_; - std::vector list_field_index_; - - /// @brief Forth virtual machine instructions - /// generated from the Form - std::string vm_output_data_; - std::string vm_output_; - std::string vm_func_name_; - std::string vm_func_; - std::string vm_func_type_; - std::string vm_data_from_stack_; - std::string vm_error_; - }; - -} - -#endif // AWKWARD_RECORDARRAYBUILDER_H_ diff --git a/include/awkward/layoutbuilder/RegularArrayBuilder.h b/include/awkward/layoutbuilder/RegularArrayBuilder.h deleted file mode 100644 index 4c85df56d3..0000000000 --- a/include/awkward/layoutbuilder/RegularArrayBuilder.h +++ /dev/null @@ -1,143 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_REGULARARRAYBUILDER_H_ -#define AWKWARD_REGULARARRAYBUILDER_H_ - -#include "awkward/layoutbuilder/FormBuilder.h" - -namespace awkward { - - /// @class RegularArrayBuilder - /// - /// @brief - template - class LIBAWKWARD_EXPORT_SYMBOL RegularArrayBuilder : public FormBuilder { - public: - /// @brief Creates a RegularArrayBuilder from a full set of parameters. - RegularArrayBuilder(const FormBuilderPtr content, - const util::Parameters& parameters, - const std::string& form_key, - const int64_t size, - const std::string attribute = "regular", - const std::string partition = "0"); - - /// @brief User-friendly name of this class. - const std::string - classname() const override; - - const std::string - to_buffers(BuffersContainer& container, const ForthOutputBufferMap& outputs) const override; - - /// @brief AwkwardForth virtual machine instructions of the data outputs. - const std::string - vm_output() const override; - - /// @brief AwkwardForth virtual machine data output key. - const std::string - vm_output_data() const override; - - /// @brief AwkwardForth virtual machine instructions of the array builder function. - const std::string - vm_func() const override; - - /// @brief The array builder VM function name. - const std::string - vm_func_name() const override; - - /// @brief The array builder VM function type. - const std::string - vm_func_type() const override; - - /// @brief AwkwardForth virtual machine instructions to retrieve the data from - /// the VM stack. - const std::string - vm_from_stack() const override; - - /// @brief Error messages in the AwkwardForth virtual machine instructions. - const std::string - vm_error() const override; - - /// @brief Adds a boolean value `x` to the accumulated data. - void - boolean(bool x, LayoutBuilderPtr builder) override; - - /// @brief Adds an integer value `x` to the accumulated data. - void - int64(int64_t x, LayoutBuilderPtr builder) override; - - /// @brief Adds a real value `x` to the accumulated data. - void - float64(double x, LayoutBuilderPtr builder) override; - - /// @brief Adds a complex value `x` to the accumulated data. - void - complex(std::complex x, LayoutBuilderPtr builder) override; - - /// @brief Adds an unencoded bytestring `x` in STL format to the - /// accumulated data. - void - bytestring(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Adds a UTF-8 encoded bytestring `x` in STL format to the - /// accumulated data. - void - string(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Begins building a nested list. - void - begin_list(LayoutBuilderPtr builder) override; - - /// @brief Ends a nested list. - void - end_list(LayoutBuilderPtr builder) override; - - /// @brief - const - FormBuilderPtr content() const { return content_; } - - /// @brief - const util::Parameters& - form_parameters() const { return parameters_; } - - const std::string& - form_key() const {return form_key_; } - - /// @brief - const int64_t - form_size() const { return form_size_; } - - ssize_t - len(const ForthOutputBufferMap& outputs) const override { - auto search = outputs.find(content().get()->vm_output_data()); - if (search != outputs.end()) { - auto length = content().get()->is_complex() ? - (ssize_t)search->second.get()->len() >> 1 : - (ssize_t)search->second.get()->len(); - return length / form_size_; - } - return 0; - } - - private: - /// @brief This Form content builder - const FormBuilderPtr content_; - - /// @brief This Form parameters - const util::Parameters parameters_; - const std::string form_key_; - const int64_t form_size_; - - /// @brief Forth virtual machine instructions - /// generated from the Form - std::string vm_output_data_; - std::string vm_output_; - std::string vm_func_name_; - std::string vm_func_; - std::string vm_func_type_; - std::string vm_data_from_stack_; - std::string vm_error_; - }; - -} - -#endif // AWKWARD_REGULARARRAYBUILDER_H_ diff --git a/include/awkward/layoutbuilder/UnionArrayBuilder.h b/include/awkward/layoutbuilder/UnionArrayBuilder.h deleted file mode 100644 index 059a18cde2..0000000000 --- a/include/awkward/layoutbuilder/UnionArrayBuilder.h +++ /dev/null @@ -1,151 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_UNIONARRAYBUILDER_H_ -#define AWKWARD_UNIONARRAYBUILDER_H_ - -#include "awkward/layoutbuilder/FormBuilder.h" - -namespace awkward { - - /// @class UnionArrayBuilder - /// - /// @brief - template - class LIBAWKWARD_EXPORT_SYMBOL UnionArrayBuilder : public FormBuilder { - public: - /// @brief Creates a UnionArrayBuilder from a full set of parameters. - UnionArrayBuilder(const std::vector>& contents, - const util::Parameters& parameters, - const std::string& form_key, - const std::string& form_tags, - const std::string& form_index, - const std::string attribute = "union", - const std::string partition = "0"); - - /// @brief User-friendly name of this class. - const std::string - classname() const override; - - const std::string - to_buffers(BuffersContainer& container, const ForthOutputBufferMap& outputs) const override; - - /// @brief AwkwardForth virtual machine instructions of the data outputs. - const std::string - vm_output() const override; - - /// @brief AwkwardForth virtual machine data output key. - const std::string - vm_output_data() const override; - - /// @brief AwkwardForth virtual machine instructions of the array builder function. - const std::string - vm_func() const override; - - /// @brief The array builder VM function name. - const std::string - vm_func_name() const override; - - /// @brief The array builder VM function type. - const std::string - vm_func_type() const override; - - /// @brief AwkwardForth virtual machine instructions to retrieve the data from - /// the VM stack. - const std::string - vm_from_stack() const override; - - /// @brief Error messages in the AwkwardForth virtual machine instructions. - const std::string - vm_error() const override; - - /// @brief Sets the tag for next input data. - void - tag(int8_t x) override; - - /// @brief Adds a boolean value `x` to the accumulated data. - void - boolean(bool x, LayoutBuilderPtr builder) override; - - /// @brief Adds an integer value `x` to the accumulated data. - void - int64(int64_t x, LayoutBuilderPtr builder) override; - - /// @brief Adds a real value `x` to the accumulated data. - void - float64(double x, LayoutBuilderPtr builder) override; - - /// @brief Adds a complex value `x` to the accumulated data. - void - complex(std::complex x, LayoutBuilderPtr builder) override; - - /// @brief Adds an unencoded bytestring `x` in STL format to the - /// accumulated data. - void - bytestring(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Adds a UTF-8 encoded bytestring `x` in STL format to the - /// accumulated data. - void - string(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Begins building a nested list. - void - begin_list(LayoutBuilderPtr builder) override; - - /// @brief Ends a nested list. - void - end_list(LayoutBuilderPtr builder) override; - - const std::vector>& - contents() const { return contents_; } - - const std::string& - vm_output_tags() const { return vm_output_tags_; } - - const std::string& - form_index() const { return form_index_; } - - const util::Parameters& - form_parameters() const { return parameters_; } - - const std::string& - form_key() const {return form_key_; } - - ssize_t - len(const ForthOutputBufferMap& outputs) const override { - auto search = outputs.find(vm_output_tags()); - if (search != outputs.end()) { - return (ssize_t)search->second.get()->len(); - } - return 0; - } - - private: - /// @brief This Form content builders - std::vector> contents_; - - /// @brief This Form parameters - const util::Parameters parameters_; - const std::string form_key_; - - /// @brief UnionArray tag - int8_t tag_; - - const std::string form_index_; - - /// @brief Forth virtual machine instructions - /// generated from the Form - std::string vm_output_data_; - std::string vm_output_; - std::string vm_func_name_; - std::string vm_func_; - std::string vm_func_type_; - std::string vm_data_from_stack_; - std::string vm_output_index_; - std::string vm_output_tags_; - std::string vm_error_; - }; - -} - -#endif // AWKWARD_UNIONARRAYBUILDER_H_ diff --git a/include/awkward/layoutbuilder/UnmaskedArrayBuilder.h b/include/awkward/layoutbuilder/UnmaskedArrayBuilder.h deleted file mode 100644 index f3301d1193..0000000000 --- a/include/awkward/layoutbuilder/UnmaskedArrayBuilder.h +++ /dev/null @@ -1,135 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_UNMASKEDARRAYBUILDER_H_ -#define AWKWARD_UNMASKEDARRAYBUILDER_H_ - -#include "awkward/layoutbuilder/FormBuilder.h" - -namespace awkward { - - /// @class UnmaskedArrayBuilder - /// - /// @brief - template - class LIBAWKWARD_EXPORT_SYMBOL UnmaskedArrayBuilder : public FormBuilder { - public: - /// @brief Creates an UnmaskedArrayBuilder from a full set of parameters. - UnmaskedArrayBuilder(FormBuilderPtr content, - const util::Parameters& parameters, - const std::string& form_key, - const std::string attribute = "mask", - const std::string partition = "0"); - - /// @brief User-friendly name of this class. - const std::string - classname() const override; - - const std::string - to_buffers(BuffersContainer& container, const ForthOutputBufferMap& outputs) const override; - - /// @brief AwkwardForth virtual machine instructions of the data outputs. - const std::string - vm_output() const override; - - /// @brief AwkwardForth virtual machine data output key. - const std::string - vm_output_data() const override; - - /// @brief AwkwardForth virtual machine instructions of the array builder function. - const std::string - vm_func() const override; - - /// @brief The array builder VM function name. - const std::string - vm_func_name() const override; - - /// @brief The array builder VM function type. - const std::string - vm_func_type() const override; - - /// @brief AwkwardForth virtual machine instructions to retrieve the data from - /// the VM stack. - const std::string - vm_from_stack() const override; - - /// @brief Error messages in the AwkwardForth virtual machine instructions. - const std::string - vm_error() const override; - - /// @brief Adds a boolean value `x` to the accumulated data. - void - boolean(bool x, LayoutBuilderPtr builder) override; - - /// @brief Adds an integer value `x` to the accumulated data. - void - int64(int64_t x, LayoutBuilderPtr builder) override; - - /// @brief Adds a real value `x` to the accumulated data. - void - float64(double x, LayoutBuilderPtr builder) override; - - /// @brief Adds a complex value `x` to the accumulated data. - void - complex(std::complex x, LayoutBuilderPtr builder) override; - - /// @brief Adds an unencoded bytestring `x` in STL format to the - /// accumulated data. - void - bytestring(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Adds a UTF-8 encoded bytestring `x` in STL format to the - /// accumulated data. - void - string(const std::string& x, LayoutBuilderPtr builder) override; - - /// @brief Begins building a nested list. - void - begin_list(LayoutBuilderPtr builder) override; - - /// @brief Ends a nested list. - void - end_list(LayoutBuilderPtr builder) override; - - /// @brief Returns this Form content builder. - const - FormBuilderPtr content() const { return content_; } - - /// @brief String-to-JSON map that augments the meaning of this - /// builder Form. - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - const util::Parameters& - form_parameters() const { return parameters_; } - - ssize_t - len(const ForthOutputBufferMap& outputs) const override { - auto search = outputs.find(content().get()->vm_output_data()); - if (search != outputs.end()) { - return (ssize_t)search->second.get()->len(); - } - return 0; - } - - private: - /// @brief This Form content builder - FormBuilderPtr content_; - - /// @brief This Form parameters - const util::Parameters& parameters_; - - /// @brief Forth virtual machine instructions - /// generated from the Form - std::string vm_output_data_; - std::string vm_output_; - std::string vm_func_name_; - std::string vm_func_; - std::string vm_func_type_; - std::string vm_data_from_stack_; - std::string vm_error_; - }; - -} - -#endif // AWKWARD_UNMASKEDARRAYBUILDER_H_ diff --git a/include/awkward/partition/IrregularlyPartitionedArray.h b/include/awkward/partition/IrregularlyPartitionedArray.h deleted file mode 100644 index 728d809710..0000000000 --- a/include/awkward/partition/IrregularlyPartitionedArray.h +++ /dev/null @@ -1,60 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_IRREGULARLYPARTITIONEDARRAY_H_ -#define AWKWARD_IRREGULARLYPARTITIONEDARRAY_H_ - -#include "awkward/partition/PartitionedArray.h" - -namespace awkward { - /// @class IrregularlyPartitionedArray - /// - /// @brief PartitionedArray of arbitrary length partitions. - class LIBAWKWARD_EXPORT_SYMBOL IrregularlyPartitionedArray: public PartitionedArray { - public: - IrregularlyPartitionedArray(const ContentPtrVec& partitions, - const std::vector stops); - - /// @brief Logical index where each partition ends. - /// - /// An IrregularlyPartitionedArray could be described in terms of - /// {@link ListOffsetArrayOf#offsets ListOffsetArray::offsets}, - /// but the first entry would always be zero. Hence, - /// {@link ListArrayOf#stops ListArray::stops} is sufficient. - const std::vector - stops() const; - - int64_t - start(int64_t partitionid) const override; - - int64_t - stop(int64_t partitionid) const override; - - void - partitionid_index_at(int64_t at, - int64_t& partitionid, - int64_t& index) const override; - - PartitionedArrayPtr - repartition(const std::vector& stops) const override; - - const std::string - classname() const override; - - const std::string - tostring() const override; - - int64_t - length() const override; - - const PartitionedArrayPtr - shallow_copy() const override; - - const PartitionedArrayPtr - copy_to(kernel::lib ptr_lib) const override; - - private: - const std::vector stops_; - }; -} - -#endif // AWKWARD_IRREGULARLYPARTITIONEDARRAY_H_ diff --git a/include/awkward/partition/PartitionedArray.h b/include/awkward/partition/PartitionedArray.h deleted file mode 100644 index c5f93a6fe9..0000000000 --- a/include/awkward/partition/PartitionedArray.h +++ /dev/null @@ -1,167 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_PARTITIONEDARRAY_H_ -#define AWKWARD_PARTITIONEDARRAY_H_ - -#include "awkward/Content.h" - -namespace awkward { - class PartitionedArray; - using PartitionedArrayPtr = std::shared_ptr; - - /// @class PartitionedArray - /// - /// @brief Abstract superclass of all PartitionedArray node types. - /// PartitionedArrays contain a list of Content, but Content cannot contain - /// PartitionedArrays. - class LIBAWKWARD_EXPORT_SYMBOL PartitionedArray { - public: - PartitionedArray(const ContentPtrVec& partitions); - - /// @brief Virtual destructor acts as a first non-inline virtual function - /// that determines a specific translation unit in which vtable shall be - /// emitted. - virtual ~PartitionedArray(); - - /// @brief The partitions as a `std::vector>`. - const ContentPtrVec - partitions() const; - - /// @brief The number of partitions in this array. - int64_t - numpartitions() const; - - /// @brief Returns a single partition as a `std::shared_ptr`. - const ContentPtr - partition(int64_t partitionid) const; - - /// @brief Logical starting index for a given partitionid. - virtual int64_t - start(int64_t partitionid) const = 0; - - /// @brief Logical stopping index for a given partitionid. - virtual int64_t - stop(int64_t partitionid) const = 0; - - /// @brief Gets the partitionid and index for a given logical position in - /// the full array, without handling negative indexing or bounds-checking. - virtual void - partitionid_index_at(int64_t at, - int64_t& partitionid, - int64_t& index) const = 0; - - /// @brief Returns this array with a specified (irregular) partitioning. - virtual PartitionedArrayPtr - repartition(const std::vector& stops) const = 0; - - /// @brief User-friendly name of this class. - virtual const std::string - classname() const = 0; - - /// @brief Returns a string representation of this array (multi-line XML). - /// - /// Although this XML string has detail about every node in the tree, - /// it does not show all elements in the array buffers and therefore - /// does not scale with the size of the dataset (i.e. it is safe to - /// print to the screen). - /// - /// Thus, it's also not a storage format: see #tojson. - virtual const std::string - tostring() const = 0; - - /// @brief Returns a JSON representation of this array. - /// - /// @param pretty If `true`, add spacing to make the JSON human-readable. - /// If `false`, return a compact representation. - /// @param maxdecimals Maximum number of decimals for floating-point - /// numbers or `-1` for no limit. - /// - /// Although the JSON output contains all of the data from the array - /// (and therefore might not be safe to print to the screen), it - /// does not preserve the type information of an array. In particular, - /// the distinction between ListType and RegularType is lost. - const std::string - tojson(bool pretty, int64_t maxdecimals) const; - - /// @brief Writes a JSON representation of this array to a `destination` - /// file. - /// - /// @param destination The file to write into. - /// @param pretty If `true`, add spacing to make the JSON human-readable. - /// If `false`, return a compact representation. - /// @param maxdecimals Maximum number of decimals for floating-point - /// numbers or `-1` for no limit. - /// @param buffersize Size of a temporary buffer in bytes. - /// - /// Although the JSON output contains all of the data from the array - /// (and therefore might not be safe to print to the screen), it - /// does not preserve the type information of an array. In particular, - /// the distinction between ListType and RegularType is lost. - void - tojson(FILE* destination, - bool pretty, - int64_t maxdecimals, - int64_t buffersize) const; - - /// @brief The length of the full array, summed over all partitions. - virtual int64_t - length() const = 0; - - /// @brief Copies this node without copying any nodes hierarchically - /// nested within it or any array/index/identity buffers. - /// - /// See also #deep_copy. - virtual const PartitionedArrayPtr - shallow_copy() const = 0; - - /// @brief Returns the element at a given position in the array, handling - /// negative indexing and bounds-checking like Python. - /// - /// The first item in the array is at `0`, the second at `1`, the last at - /// `-1`, the penultimate at `-2`, etc. - const ContentPtr - getitem_at(int64_t at) const; - - /// @brief Returns the element at a given position in the array, without - /// handling negative indexing or bounds-checking. - /// - /// If the array has Identities, the identity bounds are checked. - const ContentPtr - getitem_at_nowrap(int64_t at) const; - - /// @brief Subinterval of this array, handling negative indexing - /// and bounds-checking like Python. - /// - /// The first item in the array is at `0`, the second at `1`, the last at - /// `-1`, the penultimate at `-2`, etc. - /// - /// Ranges beyond the array are not an error; they are trimmed to - /// `start = 0` on the left and `stop = length() - 1` on the right. - /// - /// This operation only affects the node metadata; its calculation time - /// does not scale with the size of the array. - const PartitionedArrayPtr - getitem_range(int64_t start, int64_t stop, int64_t step) const; - - /// @brief Subinterval of this array, without handling negative - /// indexing or bounds-checking. - /// - /// If the array has Identities, the identity bounds are checked. - /// - /// This operation only affects the node metadata; its calculation time - /// does not scale with the size of the array. - const PartitionedArrayPtr - getitem_range_nowrap(int64_t start, int64_t stop, int64_t step) const; - - /// @brief Recursively copies components of the array from main memory to a - /// GPU (if `ptr_lib == kernel::lib::cuda`) or to main memory (if - /// `ptr_lib == kernel::lib::cpu`) if those components are not already there. - virtual const PartitionedArrayPtr - copy_to(kernel::lib ptr_lib) const = 0; - - protected: - const ContentPtrVec partitions_; - }; -} - -#endif // AWKWARD_PARTITIONEDARRAY_H_ diff --git a/include/awkward/python/content.h b/include/awkward/python/content.h index b4fbcbc819..fcc405be7e 100644 --- a/include/awkward/python/content.h +++ b/include/awkward/python/content.h @@ -8,33 +8,11 @@ #include #include "awkward/builder/ArrayBuilder.h" -#include "awkward/layoutbuilder/LayoutBuilder.h" -#include "awkward/Iterator.h" -#include "awkward/Content.h" -#include "awkward/array/EmptyArray.h" -#include "awkward/array/IndexedArray.h" -#include "awkward/array/ByteMaskedArray.h" -#include "awkward/array/BitMaskedArray.h" -#include "awkward/array/UnmaskedArray.h" -#include "awkward/array/ListArray.h" -#include "awkward/array/ListOffsetArray.h" -#include "awkward/array/None.h" -#include "awkward/array/NumpyArray.h" -#include "awkward/array/Record.h" -#include "awkward/array/RecordArray.h" -#include "awkward/array/RegularArray.h" -#include "awkward/array/UnionArray.h" -#include "awkward/array/VirtualArray.h" +#include "awkward/util.h" namespace py = pybind11; namespace ak = awkward; -py::object -box(const std::shared_ptr& content); - -std::shared_ptr -unbox_content(const py::handle& obj); - template std::string repr(const T& self) { @@ -56,23 +34,10 @@ dict2parameters(const py::object& in); py::dict parameters2dict(const ak::util::Parameters& in); -/// @brief Converts Python objects in a slice into a C++ Slice. -ak::Slice - toslice(py::object obj); - /// @brief Makes an ArrayBuilder class in Python that mirrors the one in C++. py::class_ make_ArrayBuilder(const py::handle& m, const std::string& name); -/// @brief Makes a LayoutBuilder class in Python that mirrors the one in C++. -template -py::class_> - make_LayoutBuilder(const py::handle& m, const std::string& name); - -/// @brief Makes an Iterator class in Python that mirrors the one in C++. -py::class_> - make_Iterator(const py::handle& m, const std::string& name); - namespace { class NumpyBuffersContainer: public ak::BuffersContainer { public: @@ -146,118 +111,4 @@ namespace { } } -/// @class PersistentSharedPtr -/// -/// @brief Array nodes are frequently copied, but for some applications -/// (one in Numba) it's better to keep a persistent `std::shared_ptr`. -class PersistentSharedPtr { -public: - /// @brief Creates a PersistentSharedPtr from a `std::shared_ptr` to a - /// Content array. - PersistentSharedPtr(const std::shared_ptr& ptr); - - /// @brief Returns a layout object (Content in Python) from this #ptr. - py::object - layout() const; - - /// @brief Returns a raw pointer to the persistent `std::shared_ptr` - /// (a raw pointer to a smart pointer). - size_t - ptr() const; - -private: - /// @brief The wrapped `std::shared_ptr`. - const std::shared_ptr ptr_; -}; - -/// @brief Makes a PersistentSharedPtr class in Python that mirrors the one -/// in C++. -py::class_ - make_PersistentSharedPtr(const py::handle& m, const std::string& name); - -/// @brief Makes an abstract Content class in Python that mirrors the one -/// in C++. -py::class_> - make_Content(const py::handle& m, const std::string& name); - -/// @brief Makes an EmptyArray in Python that mirrors the one in C++. -py::class_, ak::Content> - make_EmptyArray(const py::handle& m, const std::string& name); - -/// @brief Makes IndexedArray32, IndexedArrayU32, IndexedArray64, -/// IndexedOptionArray32, and IndexedOptionArray64 classes in Python that -/// mirror IndexedArrayOf in C++. -template -py::class_, - std::shared_ptr>, - ak::Content> - make_IndexedArrayOf(const py::handle& m, const std::string& name); - -/// @brief Makes a ByteMaskedArray in Python that mirrors the one in C++. -py::class_, - ak::Content> - make_ByteMaskedArray(const py::handle& m, const std::string& name); - -/// @brief Makes a BitMaskedArray in Python that mirrors the one in C++. -py::class_, - ak::Content> - make_BitMaskedArray(const py::handle& m, const std::string& name); - -/// @brief Makes a UnmaskedArray in Python that mirrors the one in C++. -py::class_, - ak::Content> - make_UnmaskedArray(const py::handle& m, const std::string& name); - -/// @brief Makes ListArray32, ListArrayU32, and ListArray64 classes in -/// Python that mirror ListArrayOf in C++. -template -py::class_, - std::shared_ptr>, - ak::Content> - make_ListArrayOf(const py::handle& m, const std::string& name); - -/// @brief Makes ListOffsetArray32, ListOffsetArrayU32, and ListOffsetArray64 -/// classes in Python that mirror ListOffsetArrayOf in C++. -template -py::class_, - std::shared_ptr>, - ak::Content> - make_ListOffsetArrayOf(const py::handle& m, const std::string& name); - -/// @brief Makes a NumpyArray in Python that mirrors the one in C++. -py::class_, ak::Content> - make_NumpyArray(const py::handle& m, const std::string& name); - -/// @brief Makes a Record in Python that mirrors the one in C++. -/// -/// Note that the Python Record class does not inherit from the Python -/// Content class, although Record inherits from Content in C++. Ideally, -/// we'd prefer scalars to not have the same type as arrays, but that's -/// easier to do in Python. -py::class_> - make_Record(const py::handle& m, const std::string& name); - -/// @brief Makes a RecordArray in Python that mirrors the one in C++. -py::class_, ak::Content> - make_RecordArray(const py::handle& m, const std::string& name); - -/// @brief Makes a RegularArray in Python that mirrors the one in C++. -py::class_, ak::Content> - make_RegularArray(const py::handle& m, const std::string& name); - -/// @brief Makes UnionArray8_32, UnionArray8_U32, and UnionArray8_64 classes -/// in Python that mirror UnionArrayOf in C++. -template -py::class_, - std::shared_ptr>, - ak::Content> - make_UnionArrayOf(const py::handle& m, const std::string& name); - -/// @brief Makes a VirtualArray in Python that mirrors the one in C++. -py::class_, ak::Content> - make_VirtualArray(const py::handle& m, const std::string& name); - #endif // AWKWARDPY_CONTENT_H_ diff --git a/include/awkward/python/dlpack_util.h b/include/awkward/python/dlpack_util.h deleted file mode 100644 index 0b7689e71a..0000000000 --- a/include/awkward/python/dlpack_util.h +++ /dev/null @@ -1,29 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARDPY_DLPACK_UTIL_H_ -#define AWKWARDPY_DLPACK_UTIL_H_ - -#include "awkward/util.h" - -#include "dlpack/dlpack.h" - -namespace py = pybind11; -namespace ak = awkward; - -namespace awkward { - namespace dlpack { - DLDataType - data_type_dispatch(ak::util::dtype dt); - - DLContext - device_context_dispatch(ak::kernel::lib ptr_lib, void* ptr); - - void - dlpack_deleter(DLManagedTensor* tensor); - - void - pycapsule_deleter(PyObject* dltensor); - } -} - -#endif diff --git a/include/awkward/python/forms.h b/include/awkward/python/forms.h deleted file mode 100644 index 40adb9253a..0000000000 --- a/include/awkward/python/forms.h +++ /dev/null @@ -1,67 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARDPY_FORMS_H_ -#define AWKWARDPY_FORMS_H_ - -#include - -#include "awkward/Content.h" -#include "awkward/array/BitMaskedArray.h" -#include "awkward/array/ByteMaskedArray.h" -#include "awkward/array/EmptyArray.h" -#include "awkward/array/IndexedArray.h" -#include "awkward/array/ListArray.h" -#include "awkward/array/ListOffsetArray.h" -#include "awkward/array/NumpyArray.h" -#include "awkward/array/RecordArray.h" -#include "awkward/array/RegularArray.h" -#include "awkward/array/UnionArray.h" -#include "awkward/array/UnmaskedArray.h" -#include "awkward/array/VirtualArray.h" - -namespace py = pybind11; -namespace ak = awkward; - -py::class_> -make_Form(const py::handle& m, const std::string& name); - -py::class_, ak::Form> -make_BitMaskedForm(const py::handle& m, const std::string& name); - -py::class_, ak::Form> -make_ByteMaskedForm(const py::handle& m, const std::string& name); - -py::class_, ak::Form> -make_EmptyForm(const py::handle& m, const std::string& name); - -py::class_, ak::Form> -make_IndexedForm(const py::handle& m, const std::string& name); - -py::class_, ak::Form> -make_IndexedOptionForm(const py::handle& m, const std::string& name); - -py::class_, ak::Form> -make_ListForm(const py::handle& m, const std::string& name); - -py::class_, ak::Form> -make_ListOffsetForm(const py::handle& m, const std::string& name); - -py::class_, ak::Form> -make_NumpyForm(const py::handle& m, const std::string& name); - -py::class_, ak::Form> -make_RecordForm(const py::handle& m, const std::string& name); - -py::class_, ak::Form> -make_RegularForm(const py::handle& m, const std::string& name); - -py::class_, ak::Form> -make_UnionForm(const py::handle& m, const std::string& name); - -py::class_, ak::Form> -make_UnmaskedForm(const py::handle& m, const std::string& name); - -py::class_, ak::Form> -make_VirtualForm(const py::handle& m, const std::string& name); - -#endif // AWKWARDPY_FORMS_H_ diff --git a/include/awkward/python/identities.h b/include/awkward/python/identities.h deleted file mode 100644 index ad307cb6d0..0000000000 --- a/include/awkward/python/identities.h +++ /dev/null @@ -1,23 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARDPY_IDENTITIES_H_ -#define AWKWARDPY_IDENTITIES_H_ - -#include -#include "awkward/Identities.h" - -namespace py = pybind11; -namespace ak = awkward; - -/// @brief Creates a single identity as a Python tuple of integers and strings. -template -py::tuple - identity(const T& self); - -/// @brief Makes Identities32 and Identities64 classes in Python that mirror -/// IdentitiesOf in C++. -template -py::class_> - make_IdentitiesOf(const py::handle& m, const std::string& name); - -#endif // AWKWARDPY_IDENTITIES_H_ diff --git a/include/awkward/python/index.h b/include/awkward/python/index.h deleted file mode 100644 index 32d8575362..0000000000 --- a/include/awkward/python/index.h +++ /dev/null @@ -1,21 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARDPY_INDEX_H_ -#define AWKWARDPY_INDEX_H_ - -#include - -#include - -#include "awkward/Index.h" - -namespace py = pybind11; -namespace ak = awkward; - -/// @brief Makes Index32, IndexU32, Index64 classes in Python that mirror -/// IndexOf in C++. -template -py::class_> - make_IndexOf(const py::handle& m, const std::string& name); - -#endif // AWKWARDPY_INDEX_H_ diff --git a/include/awkward/python/io.h b/include/awkward/python/io.h index 0b78b28cf4..bd7ed6c6f4 100644 --- a/include/awkward/python/io.h +++ b/include/awkward/python/io.h @@ -7,19 +7,10 @@ namespace py = pybind11; -void -make_fromjson(py::module& m, const std::string& name); - -void -make_fromjsonfile(py::module& m, const std::string& name); - void make_fromjsonobj(py::module& m, const std::string& name); void make_fromjsonobj_schema(py::module& m, const std::string& name); -void -make_uproot_issue_90(py::module& m); - #endif // AWKWARDPY_IO_H_ diff --git a/include/awkward/python/partition.h b/include/awkward/python/partition.h deleted file mode 100644 index b87102f826..0000000000 --- a/include/awkward/python/partition.h +++ /dev/null @@ -1,28 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARDPY_PARTITION_H_ -#define AWKWARDPY_PARTITION_H_ - -#include - -#include - -#include "awkward/partition/PartitionedArray.h" -#include "awkward/partition/IrregularlyPartitionedArray.h" - -namespace py = pybind11; -namespace ak = awkward; - -/// @brief Makes an abstract PartitionedArray class in Python that mirrors the -/// one in C++. -py::class_> - make_PartitionedArray(const py::handle& m, const std::string& name); - -/// @brief Makes an IrregularlyPartitionedArray in Python that mirrors the one -/// in C++. -py::class_, - ak::PartitionedArray> - make_IrregularlyPartitionedArray(const py::handle& m, const std::string& name); - -#endif // AWKWARDPY_PARTITION_H_ diff --git a/include/awkward/python/startup.h b/include/awkward/python/startup.h deleted file mode 100644 index 5ebc4b7a0b..0000000000 --- a/include/awkward/python/startup.h +++ /dev/null @@ -1,25 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARDPY_STARTUP_H_ -#define AWKWARDPY_STARTUP_H_ - -#include - -#include "awkward/kernel-dispatch.h" - -namespace py = pybind11; -namespace ak = awkward; - -class StartupLibraryPathCallback : public ak::kernel::LibraryPathCallback { -public: - StartupLibraryPathCallback() = default; - - std::string library_path() override; -private: - std::string library_path_; -}; - -void -make_startup(py::module& m, const std::string& name); - -#endif // AWKWARDPY_STARTUP_H_ diff --git a/include/awkward/python/types.h b/include/awkward/python/types.h deleted file mode 100644 index 280a9799cb..0000000000 --- a/include/awkward/python/types.h +++ /dev/null @@ -1,49 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARDPY_TYPES_H_ -#define AWKWARDPY_TYPES_H_ - -#include - -#include "awkward/type/Type.h" -#include "awkward/type/ArrayType.h" -#include "awkward/type/ListType.h" -#include "awkward/type/OptionType.h" -#include "awkward/type/PrimitiveType.h" -#include "awkward/type/RecordType.h" -#include "awkward/type/RegularType.h" -#include "awkward/type/UnionType.h" -#include "awkward/type/UnknownType.h" -#include "awkward/python/util.h" - -namespace py = pybind11; -namespace ak = awkward; - -py::class_> -make_Type(const py::handle& m, const std::string& name); - -py::class_, ak::Type> -make_ArrayType(const py::handle& m, const std::string& name); - -py::class_, ak::Type> -make_ListType(const py::handle& m, const std::string& name); - -py::class_, ak::Type> -make_OptionType(const py::handle& m, const std::string& name); - -py::class_, ak::Type> -make_PrimitiveType(const py::handle& m, const std::string& name); - -py::class_, ak::Type> -make_RecordType(const py::handle& m, const std::string& name); - -py::class_, ak::Type> -make_RegularType(const py::handle& m, const std::string& name); - -py::class_, ak::Type> -make_UnionType(const py::handle& m, const std::string& name); - -py::class_, ak::Type> -make_UnknownType(const py::handle& m, const std::string& name); - -#endif // AWKWARDPY_TYPES_H_ diff --git a/include/awkward/python/util.h b/include/awkward/python/util.h index ec413530c3..84c4b8df03 100644 --- a/include/awkward/python/util.h +++ b/include/awkward/python/util.h @@ -20,22 +20,18 @@ /// reference count is held for all C++ references to the object. /// /// See also -/// - kernel::array_deleter, which frees array buffers, rather +/// - array_deleter, which frees array buffers, rather /// than objects. -/// - kernel::no_deleter, which does not free memory at all (for -/// borrowed references). template class pyobject_deleter { public: /// @brief Creates a pyobject_deleter and calls `Py_INCREF(ptr)`. pyobject_deleter(PyObject *pyobj): pyobj_(pyobj) { - // std::cout << "pyobject INCREF of " << pyobj_ << std::endl; Py_INCREF(pyobj_); } /// @brief Called by `std::shared_ptr` when its reference count reaches /// zero. void operator()(T const *p) { - // std::cout << "pyobject DECREF of " << pyobj_ << std::endl; Py_DECREF(pyobj_); } private: diff --git a/include/awkward/python/virtual.h b/include/awkward/python/virtual.h deleted file mode 100644 index 3b36b7e07d..0000000000 --- a/include/awkward/python/virtual.h +++ /dev/null @@ -1,109 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARDPY_VIRTUAL_H_ -#define AWKWARDPY_VIRTUAL_H_ - -#include - -#include "awkward/virtual/ArrayGenerator.h" -#include "awkward/virtual/ArrayCache.h" - -namespace py = pybind11; -namespace ak = awkward; - -////////// PyArrayGenerator - -class PyArrayGenerator: public ak::ArrayGenerator { -public: - PyArrayGenerator(const ak::FormPtr& form, - int64_t length, - const py::object& callable, - const py::tuple& args, - const py::dict& kwargs); - - const py::object - callable() const; - - const py::tuple - args() const; - - const py::dict - kwargs() const; - - const ak::ContentPtr - generate() const override; - - void - caches(std::vector& out) const override; - - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - const std::shared_ptr - shallow_copy() const override; - - const std::shared_ptr - with_form(const ak::FormPtr& form) const override; - - const std::shared_ptr - with_length(int64_t length) const override; - - const std::shared_ptr - with_callable(const py::object& callable) const; - - const std::shared_ptr - with_args(const py::tuple& args) const; - - const std::shared_ptr - with_kwargs(const py::dict& kwargs) const; - - virtual bool - referentially_equal(const ak::ArrayGeneratorPtr& other) const override; - -private: - const py::object callable_; - const py::tuple args_; - const py::dict kwargs_; -}; - -py::class_> -make_PyArrayGenerator(const py::handle& m, const std::string& name); - -////////// SliceGenerator - -py::class_> -make_SliceGenerator(const py::handle& m, const std::string& name); - -////////// PyArrayCache - -class PyArrayCache: public ak::ArrayCache { -public: - PyArrayCache(const py::object& mutablemapping); - - const py::object - mutablemapping() const; - - ak::ContentPtr - get(const std::string& key) const override; - - void - set(const std::string& key, const ak::ContentPtr& value) override; - - bool - is_broken() const override; - - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - -private: - const py::object mutablemapping_; -}; - -py::class_> -make_PyArrayCache(const py::handle& m, const std::string& name); - -#endif // AWKWARDPY_VIRTUAL_H_ diff --git a/include/awkward/type/ArrayType.h b/include/awkward/type/ArrayType.h deleted file mode 100644 index e6fcf64ff4..0000000000 --- a/include/awkward/type/ArrayType.h +++ /dev/null @@ -1,77 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_ARRAYTYPE_H_ -#define AWKWARD_ARRAYTYPE_H_ - -#include "awkward/common.h" -#include "awkward/util.h" -#include "awkward/type/Type.h" - -namespace awkward { - /// @class ArrayType - /// - /// @brief Describes the high level type of a user-facing array, i.e. - /// `ak.Array` in Python, as opposed to Content. The #length of the array - /// is part of its type. - /// - /// No Content nodes have this type. The #length makes it non-composable. - class LIBAWKWARD_EXPORT_SYMBOL ArrayType: public Type { - public: - /// @brief Create an ArrayType with a full set of parameters. - /// - /// @param parameters Custom parameters (not used). - /// @param typestr Optional string that overrides the default string - /// representation (missing if empty). - /// @param type The Type of the composable Content. - /// @param length The length of the array. - ArrayType(const util::Parameters& parameters, - const std::string& typestr, - const TypePtr& type, - int64_t length); - - /// @brief The Type of the composable Content. - const TypePtr - type() const; - - /// @brief The length of the array. - int64_t - length() const; - - std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - const TypePtr - shallow_copy() const override; - - bool - equal(const TypePtr& other, bool check_parameters) const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - const ContentPtr - empty() const override; - - private: - /// @brief See #type. - TypePtr type_; - /// @brief See #length. - int64_t length_; - }; -} - -#endif // AWKWARD_ARRAYTYPE_H_ diff --git a/include/awkward/type/ListType.h b/include/awkward/type/ListType.h deleted file mode 100644 index a2c6be896c..0000000000 --- a/include/awkward/type/ListType.h +++ /dev/null @@ -1,70 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_LISTTYPE_H_ -#define AWKWARD_LISTTYPE_H_ - -#include "awkward/common.h" -#include "awkward/util.h" -#include "awkward/type/Type.h" - -namespace awkward { - /// @class ListType - /// - /// @brief Describes the high level type of lists of variable length, as - /// opposed to RegularType. - /// - /// {@link ListArrayOf ListArray} and - /// {@link ListOffsetArrayOf ListOffsetArray} nodes have this type. - class LIBAWKWARD_EXPORT_SYMBOL ListType: public Type { - public: - /// @brief Create a ListType with a full set of parameters. - /// - /// @param parameters Custom parameters inherited from the Content that - /// this type describes. - /// @param typestr Optional string that overrides the default string - /// representation (missing if empty). - /// @param type The Type of the nested lists. - ListType(const util::Parameters& parameters, - const std::string& typestr, - const TypePtr& type); - - /// @brief The Type of the nested lists. - const TypePtr - type() const; - - std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - const TypePtr - shallow_copy() const override; - - bool - equal(const TypePtr& other, bool check_parameters) const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - const ContentPtr - empty() const override; - - private: - /// @brief See #type. - const TypePtr type_; - }; -} - -#endif // AWKWARD_LISTTYPE_H_ diff --git a/include/awkward/type/OptionType.h b/include/awkward/type/OptionType.h deleted file mode 100644 index 70283e2530..0000000000 --- a/include/awkward/type/OptionType.h +++ /dev/null @@ -1,70 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_OPTIONTYPE_H_ -#define AWKWARD_OPTIONTYPE_H_ - -#include "awkward/common.h" -#include "awkward/util.h" -#include "awkward/type/Type.h" - -namespace awkward { - /// @class OptionType - /// - /// @brief Describes the high level type of data with possible missing - /// values, represented by `None` in python. - /// - /// {@link IndexedArrayOf IndexedOptionArray}, ByteMaskedArray, - /// BitMaskedArray, and UnmaskedArray nodes have this type. - class LIBAWKWARD_EXPORT_SYMBOL OptionType: public Type { - public: - /// @brief Create an OptionType with a full set of parameters. - /// - /// @param parameters Custom parameters inherited from the Content that - /// this type describes. - /// @param typestr Optional string that overrides the default string - /// representation (missing if empty). - /// @param type The Type of the non-missing data. - OptionType(const util::Parameters& parameters, - const std::string& typestr, - const TypePtr& type); - - /// @brief The Type of the non-missing data. - const TypePtr - type() const; - - std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - const TypePtr - shallow_copy() const override; - - bool - equal(const TypePtr& other, bool check_parameters) const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - const ContentPtr - empty() const override; - - private: - /// @brief See #type. - const TypePtr type_; - }; -} - -#endif // AWKWARD_OPTIONTYPE_H_ diff --git a/include/awkward/type/PrimitiveType.h b/include/awkward/type/PrimitiveType.h deleted file mode 100644 index 8677338608..0000000000 --- a/include/awkward/type/PrimitiveType.h +++ /dev/null @@ -1,69 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_PRIMITIVETYPE_H_ -#define AWKWARD_PRIMITIVETYPE_H_ - -#include "awkward/common.h" -#include "awkward/util.h" -#include "awkward/type/Type.h" - -namespace awkward { - /// @class PrimitiveType - /// - /// @brief Describes the high level type of an array that contains fixed-size - /// items, such as numbers or booleans. - /// - /// NumpyArray and {@link RawArrayOf RawArray} nodes have this type. - class LIBAWKWARD_EXPORT_SYMBOL PrimitiveType: public Type { - public: - /// Constructs a PrimitiveType with a full set of parameters. - /// - /// @param parameters Custom parameters inherited from the Content that - /// this type describes. - /// @param typestr Optional string that overrides the default string - /// representation (missing if empty). - /// @param dtype The tag that defines this PrimitiveType. - PrimitiveType(const util::Parameters& parameters, - const std::string& typestr, util::dtype dtype); - - /// @brief The tag that defines this PrimitiveType. - util::dtype - dtype() const; - - std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - const TypePtr - shallow_copy() const override; - - bool - equal(const TypePtr& other, bool check_parameters) const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - const ContentPtr - empty() const override; - - private: - /// @brief See #dtype. - const util::dtype dtype_; - }; - -} - -#endif // AWKWARD_PRIMITIVETYPE_H_ diff --git a/include/awkward/type/RecordType.h b/include/awkward/type/RecordType.h deleted file mode 100644 index df47434f1e..0000000000 --- a/include/awkward/type/RecordType.h +++ /dev/null @@ -1,126 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_RECORDTYPE_H_ -#define AWKWARD_RECORDTYPE_H_ - -#include -#include - -#include "awkward/common.h" -#include "awkward/util.h" -#include "awkward/type/Type.h" - -namespace awkward { - /// @class RecordType - /// - /// @brief Describes the high level type of data containing tuples or - /// records. - /// - /// RecordArray nodes have this type. - class LIBAWKWARD_EXPORT_SYMBOL RecordType: public Type { - public: - /// @brief Create an RecordArray with a full set of parameters. - /// - /// @param parameters Custom parameters inherited from the Content that - /// this type describes. - /// @param typestr Optional string that overrides the default string - /// representation (missing if empty). - /// @param types The Type of each field (in order). - /// @param recordlookup A `std::shared_ptr>` - /// optional list of key names. - /// If absent (`nullptr`), the data are tuples; otherwise, they are - /// records. The number of names must match the number of #types. - RecordType(const util::Parameters& parameters, - const std::string& typestr, - const std::vector& types, - const util::RecordLookupPtr& recordlookup); - - /// @brief Creates a RecordArray without a #recordlookup (set it to - /// `nullptr`). - /// - /// See #RecordType for a full list of parameters. - RecordType(const util::Parameters& parameters, - const std::string& typestr, - const std::vector& types); - - /// @brief The Type of each field (in order). - const std::vector - types() const; - - /// @brief A `std::shared_ptr>` - /// optional list of key names. - /// - /// If absent (`nullptr`), the data are tuples; otherwise, they are - /// records. The number of names must match the number of #types. - const util::RecordLookupPtr - recordlookup() const; - - /// @brief Returns `true` if #recordlookup is `nullptr`; `false` otherwise. - bool - istuple() const; - - std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - const TypePtr - shallow_copy() const override; - - bool - equal(const TypePtr& other, bool check_parameters) const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - const ContentPtr - empty() const override; - - /// @brief Returns the field at a given index. - /// - /// Equivalent to `types[fieldindex]`. - const TypePtr - field(int64_t fieldindex) const; - - /// @brief Returns the field with a given key name. - /// - /// Equivalent to `types[fieldindex(key)]`. - const TypePtr - field(const std::string& key) const; - - /// @brief Returns all the fields. - /// - /// Equivalent to `types`. - const std::vector - fields() const; - - /// @brief Returns key, field pairs for all fields. - const std::vector> - fielditems() const; - - /// @brief Returns this RecordType without #recordlookup, converting any - /// records into tuples. - const TypePtr - astuple() const; - - private: - /// @brief See #types. - const std::vector types_; - /// @brief See #recordlookup. - const util::RecordLookupPtr recordlookup_; - }; -} - -#endif // AWKWARD_RECORDTYPE_H_ diff --git a/include/awkward/type/RegularType.h b/include/awkward/type/RegularType.h deleted file mode 100644 index f1809f2888..0000000000 --- a/include/awkward/type/RegularType.h +++ /dev/null @@ -1,81 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_REGULARTYPE_H_ -#define AWKWARD_REGULARTYPE_H_ - -#include - -#include "awkward/common.h" -#include "awkward/util.h" -#include "awkward/type/Type.h" - -namespace awkward { - /// @class RegularType - /// - /// @brief Describes the high level type of lists of a given length, as - /// opposed to ListType. - /// - /// RegularArray nodes have this type. - class LIBAWKWARD_EXPORT_SYMBOL RegularType: public Type { - public: - /// @brief Create a RegularType with a full set of parameters. - /// - /// @param parameters Custom parameters inherited from the Content that - /// this type describes. - /// @param typestr Optional string that overrides the default string - /// representation (missing if empty). - /// @param type The Type of the nested lists. - /// @param size The length of each list (which is part of the type - /// specification). - RegularType(const util::Parameters& parameters, - const std::string& typestr, - const TypePtr& type, - int64_t size); - - /// @brief The Type of the nested lists. - const TypePtr - type() const; - - /// @brief The length of each list (which is part of the type - /// specification). - int64_t - size() const; - - std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - const TypePtr - shallow_copy() const override; - - bool - equal(const TypePtr& other, bool check_parameters) const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - const ContentPtr - empty() const override; - - private: - /// @brief See #type. - const TypePtr type_; - /// @brief See #size. - const int64_t size_; - }; -} - -#endif // AWKWARD_REGULARTYPE_H_ diff --git a/include/awkward/type/Type.h b/include/awkward/type/Type.h deleted file mode 100644 index 6305a1514b..0000000000 --- a/include/awkward/type/Type.h +++ /dev/null @@ -1,229 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_TYPE_H_ -#define AWKWARD_TYPE_H_ - -#include -#include -#include - -#include "awkward/common.h" -#include "awkward/util.h" - -namespace awkward { - class Content; - using ContentPtr = std::shared_ptr; - - class Type; - using TypePtr = std::shared_ptr; - - /// @class Type - /// - /// @brief Abstract superclass of all high level types (flat hierarchy). - class LIBAWKWARD_EXPORT_SYMBOL Type { - public: - /// @brief Called by all subclass constructors; assigns #parameters and - /// #typestr upon construction. - Type(const util::Parameters& parameters, const std::string& typestr); - - /// @brief Virtual destructor acts as a first non-inline virtual function - /// that determines a specific translation unit in which vtable shall be - /// emitted. - virtual ~Type(); - - /// @brief Internal function to build an output string for #tostring. - /// - /// @param indent Indentation depth as a string of spaces. - /// @param pre Prefix string, usually an opening XML tag. - /// @param post Postfix string, usually a closing XML tag and carriage - /// return. - virtual std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const = 0; - - /// @brief Copies this Type without copying any hierarchically nested - /// types. - virtual const TypePtr - shallow_copy() const = 0; - - /// @brief Returns `true` if this type is equal to `other`; `false` - /// otherwise. - /// - /// @param other The other Type. - /// @param check_parameters If `true`, types must have the same - /// #parameters to be considered equal; if `false`, types do not check - /// #parameters. - virtual bool - equal(const TypePtr& other, bool check_parameters) const = 0; - - /// @brief The number of fields in the first nested tuple or - /// records or `-1` if this array does not contain a RecordType. - virtual int64_t - numfields() const = 0; - - /// @brief The position of a tuple or record key name if this array - /// contains a RecordType. - virtual int64_t - fieldindex(const std::string& key) const = 0; - - /// @brief The record name associated with a given field index or - /// the tuple index as a string (e.g. `"0"`, `"1"`, `"2"`) if a tuple. - /// - /// Raises an error if the array does not contain a RecordType. - virtual const std::string - key(int64_t fieldindex) const = 0; - - /// @brief Returns `true` if the type contains a RecordType with the - /// specified `key`; `false` otherwise. - virtual bool - haskey(const std::string& key) const = 0; - - /// @brief A list of RecordType keys or an empty list if this - /// type does not contain a RecordType. - virtual const std::vector - keys() const = 0; - - /// @brief Returns an empty array (Content) with this type. - virtual const ContentPtr - empty() const = 0; - - /// @brief Get one parameter from this type. - /// - /// If the `key` does not exist, this function returns `"null"`. - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - const util::Parameters - parameters() const; - - /// @brief Assign one parameter for this type (in-place). - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - /// - /// @note This mutability is temporary: - /// [scikit-hep/awkward-1.0#117](https://github.com/scikit-hep/awkward-1.0/issues/177) - /// Eventually, this interface will be deprecated and all Content - /// instances will be immutable. - void - setparameters(const util::Parameters& parameters); - - /// @brief Custom parameters inherited from the Content that - /// this type describes. - /// - /// If the `key` does not exist, this function returns `"null"`. - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - const std::string - parameter(const std::string& key) const; - - /// @brief Assign one parameter to this type (in-place). - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - /// - /// @note This mutability is temporary: - /// [scikit-hep/awkward-1.0#117](https://github.com/scikit-hep/awkward-1.0/issues/177) - /// Eventually, this interface will be deprecated and all Content - /// instances will be immutable. - void - setparameter(const std::string& key, const std::string& value); - - /// @brief Returns `true` if the parameter associated with `key` exists - /// and is equal to `value`; `false` otherwise. - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - /// - /// Equality is checked at the level of JSON DOMs. The `value` does not - /// need to be exactly the same string; it needs to have equivalent JSON - /// value. - bool - parameter_equals(const std::string& key, const std::string& value) const; - - /// @brief Returns `true` if all parameters of this type are equal - /// to the `other` parameters. - /// - /// Keys are simple strings, but values are JSON-encoded strings. - /// For this reason, values that represent single strings are - /// double-quoted: e.g. `"\"actual_value\""`. - /// - /// Equality is checked at the level of JSON DOMs. The `value` does not - /// need to be exactly the same string; it needs to have equivalent JSON - /// value. - /// - /// If `check_all`, every parameter is checked; otherwise, only - /// `"__array__"` and `"__record__"` are checked. - bool - parameters_equal(const util::Parameters& other, bool check_all) const; - - /// @brief Returns `true` if the parameter associated with `key` is a - /// string; `false` otherwise. - bool - parameter_isstring(const std::string& key) const; - - /// @brief Returns `true` if the parameter associated with `key` is a - /// string that matches `[A-Za-z_][A-Za-z_0-9]*`; `false` otherwise. - bool - parameter_isname(const std::string& key) const; - - /// @brief Returns the parameter associated with `key` as a string if - /// #parameter_isstring; raises an error otherwise. - const std::string - parameter_asstring(const std::string& key) const; - - /// @brief Returns a string representation of the type as a - /// [Datashape](https://datashape.readthedocs.io/en/latest/) or its - /// #typestr overload (if non-empty). - const std::string - tostring() const; - - /// @brief Returns a string showing a side-by-side comparison of two types, - /// highlighting differences. - /// - /// @note This function does not align types side-by-side. - const std::string - compare(TypePtr supertype); - - /// @brief Optional string that overrides the default string - /// representation (missing if empty). - const std::string - typestr() const; - - protected: - /// @brief Internal function that replaces `output` in-place with the - /// #typestr and returns `true` if the #typestr is not missing (i.e. - /// empty); otherwise, it leaves `output` untouched and returns `false`. - bool - get_typestr(std::string& output) const; - - /// @brief Internal function to determine if there are no parameters - /// *except* `__categorical__`. - bool - parameters_empty() const; - - /// @brief Internal function that wraps `output` with `categorical[type=` - /// and `]` if `__categorical__` is `true`; passes through otherwise. - std::string - wrap_categorical(const std::string& output) const; - - /// @brief Internal function to format parameters as part of the #tostring - /// string. - const std::string - string_parameters() const; - - /// @brief See #parameters. - util::Parameters parameters_; - /// @brief See #typestr. - const std::string typestr_; - }; -} - -#endif // AWKWARD_TYPE_H_ diff --git a/include/awkward/type/UnionType.h b/include/awkward/type/UnionType.h deleted file mode 100644 index 385d949106..0000000000 --- a/include/awkward/type/UnionType.h +++ /dev/null @@ -1,78 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_UNIONTYPE_H_ -#define AWKWARD_UNIONTYPE_H_ - -#include - -#include "awkward/common.h" -#include "awkward/util.h" -#include "awkward/type/Type.h" - -namespace awkward { - /// @class UnionType - /// - /// @brief Describes the high level type of heterogeneous data. - /// - /// {@link UnionArrayOf UnionArray} nodes have this type. - class LIBAWKWARD_EXPORT_SYMBOL UnionType: public Type { - public: - /// @brief Create an UnionArray with a full set of parameters. - /// - /// @param parameters Custom parameters inherited from the Content that - /// this type describes. - /// @param typestr Optional string that overrides the default string - /// representation (missing if empty). - /// @param types The Type of each possibility. - UnionType(const util::Parameters& parameters, - const std::string& typestr, - const std::vector& types); - - /// @brief The Type of each possibility. - const std::vector - types() const; - - /// @brief The number of possible types. - int64_t - numtypes() const; - - /// @brief Returns the type at a given index. - const TypePtr - type(int64_t index) const; - - std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - const TypePtr - shallow_copy() const override; - - bool - equal(const TypePtr& other, bool check_parameters) const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - const ContentPtr - empty() const override; - - private: - /// @brief See #types. - const std::vector types_; - }; -} - -#endif // AWKWARD_OPTIONTYPE_H_ diff --git a/include/awkward/type/UnknownType.h b/include/awkward/type/UnknownType.h deleted file mode 100644 index b80d77394b..0000000000 --- a/include/awkward/type/UnknownType.h +++ /dev/null @@ -1,60 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_UNKNOWNTYPE_H_ -#define AWKWARD_UNKNOWNTYPE_H_ - -#include "awkward/common.h" -#include "awkward/util.h" -#include "awkward/type/Type.h" - -namespace awkward { - /// @class UnknownType - /// - /// @brief Describes the high level type of data with whose type is not - /// known, usually because an ArrayBuilder did not have any instances - /// to sample. - /// - /// EmptyArray nodes have this type. - class LIBAWKWARD_EXPORT_SYMBOL UnknownType: public Type { - public: - /// @brief Create an OptionType with a full set of parameters. - /// - /// @param parameters Custom parameters inherited from the Content that - /// this type describes. - /// @param typestr Optional string that overrides the default string - /// representation (missing if empty). - UnknownType(const util::Parameters& parameters, - const std::string& typestr); - - std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - const TypePtr - shallow_copy() const override; - - bool - equal(const TypePtr& other, bool check_parameters) const override; - - int64_t - numfields() const override; - - int64_t - fieldindex(const std::string& key) const override; - - const std::string - key(int64_t fieldindex) const override; - - bool - haskey(const std::string& key) const override; - - const std::vector - keys() const override; - - const ContentPtr - empty() const override; - }; -} - -#endif // AWKWARD_LISTTYPE_H_ diff --git a/include/awkward/util.h b/include/awkward/util.h index 7947b0da61..117a60b112 100644 --- a/include/awkward/util.h +++ b/include/awkward/util.h @@ -15,10 +15,6 @@ #endif namespace awkward { - class Identities; - template - class IndexOf; - namespace util { /// @brief NumPy dtypes that can be interpreted within Awkward C++ /// (only the primitive, fixed-width types). Non-native-endian types @@ -93,11 +89,9 @@ namespace awkward { /// @param err The Error struct from a cpu-kernel. /// @param classname The name of this class to include in the error /// message. - /// @param id The Identities to include in the error message. void handle_error(const struct Error &err, - const std::string &classname = std::string(""), - const Identities *id = nullptr); + const std::string &classname = std::string("")); /// @brief Puts quotation marks around a string and escapes the appropriate /// characters. @@ -112,20 +106,6 @@ namespace awkward { std::string quote(const std::string& x); - /// @brief Converts an `offsets` index (from - /// {@link ListOffsetArrayOf ListOffsetArray}, for instance) into a - /// `starts` index by viewing it with the last element dropped. - template - IndexOf - make_starts(const IndexOf &offsets); - - /// @brief Converts an `offsets` index (from - /// {@link ListOffsetArrayOf ListOffsetArray}, for instance) into a - /// `stops` index by viewing it with the first element dropped. - template - IndexOf - make_stops(const IndexOf& offsets); - using RecordLookup = std::vector; using RecordLookupPtr = std::shared_ptr; @@ -245,6 +225,29 @@ namespace awkward { size }; + /// @class array_deleter + /// + /// @brief Used as a `std::shared_ptr` deleter (second argument) to + /// overload `delete ptr` with `delete[] ptr`. + /// + /// This is necessary for `std::shared_ptr` to contain array buffers. + /// + /// See also + /// - pyobject_deleter, which reduces the reference count of a + /// Python object when there are no more C++ shared pointers + /// referencing it. + template + class LIBAWKWARD_EXPORT_SYMBOL array_deleter { + public: + /// @brief Called by `std::shared_ptr` when its reference count reaches + /// zero. + void + operator()(T const* ptr) { + uint8_t const* in = reinterpret_cast(ptr); + delete [] in; + } + }; + } } diff --git a/include/awkward/virtual/ArrayCache.h b/include/awkward/virtual/ArrayCache.h deleted file mode 100644 index 66b790a636..0000000000 --- a/include/awkward/virtual/ArrayCache.h +++ /dev/null @@ -1,54 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_ARRAYCACHE_H_ -#define AWKWARD_ARRAYCACHE_H_ - -#include "awkward/Content.h" - -namespace awkward { - /// @class ArrayCache - /// - /// @brief Abstract superclass of cache for VirtualArray, defining - /// the interface. - /// - /// The main implementation, PyArrayCache, is passed through pybind11 to - /// Python to work with cachetools and MutableMapping, but in principle, pure - /// C++ caches could be written. - class LIBAWKWARD_EXPORT_SYMBOL ArrayCache { - public: - /// @brief Returns a new key that is globally unique in the current - /// process. - /// - /// If process-independent keys are needed, they can be bound to - /// VirtualArrays by explicitly setting the - /// {@link VirtualArray#cache_key VirtualArray::cache_key}. - static const std::string - newkey(); - - /// @brief Attempts to get an array; may be `nullptr` if not available. - virtual ContentPtr - get(const std::string& key) const = 0; - - /// @brief Writes or overwrites an array at `key`. - virtual void - set(const std::string& key, const ContentPtr& value) = 0; - - /// @brief Returns true if the cache cannot be used for any reason. - virtual bool - is_broken() const = 0; - - virtual const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const = 0; - }; - - using ArrayCachePtr = std::shared_ptr; - - // Note: if you're creating a pure C++ cache (and it's not ridiculously - // large), define it in this file and implement it in - // src/libawkward/virtual/ArrayCache.cpp. - -} - -#endif // AWKWARD_ARRAYCACHE_H_ diff --git a/include/awkward/virtual/ArrayGenerator.h b/include/awkward/virtual/ArrayGenerator.h deleted file mode 100644 index d1799cfe53..0000000000 --- a/include/awkward/virtual/ArrayGenerator.h +++ /dev/null @@ -1,149 +0,0 @@ -// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -#ifndef AWKWARD_ARRAYGENERATOR_H_ -#define AWKWARD_ARRAYGENERATOR_H_ - -#include "awkward/Slice.h" -#include "awkward/Content.h" -#include "awkward/virtual/ArrayCache.h" - -namespace awkward { - ////////// ArrayGenerator - - class ArrayGenerator; - using ArrayGeneratorPtr = std::shared_ptr; - - /// @class ArrayGenerator - /// - /// @brief Abstract superclass to generate arrays for VirtualArray, defining - /// the interface. - /// - /// The main implementation, PyArrayGenerator, is passed through pybind11 to - /// Python to work with Python functions and lambdas, but in principle, pure - /// C++ generators could be written. - class LIBAWKWARD_EXPORT_SYMBOL ArrayGenerator { - public: - /// @brief Called by subclasses to set the #form of an ArrayGenerator. - /// - /// The #form can be `nullptr`, in which case the generated array can have - /// any Form and any Type, but doing so would cause VirtualArray to - /// materialize in more circumstances, undermining its usefulness. - /// - /// Similarly, the #length can be specified to avoid materializing a - /// VirtualArray when its length must be known. Any negative value, - /// such as -1, is interpreted as "unknown." - ArrayGenerator(const FormPtr& form, int64_t length); - - /// @brief Virtual destructor acts as a first non-inline virtual function - /// that determines a specific translation unit in which vtable shall be - /// emitted. - virtual ~ArrayGenerator(); - - /// @brief The Form the generated array is expected to take; may be - /// `nullptr`. - const FormPtr - form() const; - - /// @brief The length the generated array is expected to have; may - /// be negative to indicate that the length is unknown. - int64_t - length() const; - - /// @brief Creates an array but does not check it against the #form. - virtual const ContentPtr - generate() const = 0; - - /// @brief Creates an array and checks it against the #form. - /// If form was not available initially, no check is made and the form - /// inferred from the result is saved in case it is useful later - const ContentPtr - generate_and_check(); - - /// @brief Accumulates all the unique #ArrayCache objects from nested - /// #VirtualArray nodes. (Uniqueness is determined by pointer value.) - virtual void - caches(std::vector& out) const = 0; - - /// @brief Returns a string representation of this ArrayGenerator. - virtual const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const = 0; - - /// @brief Copies this ArrayGenerator, referencing any contents. - virtual const std::shared_ptr - shallow_copy() const = 0; - - /// @brief Return a copy of this ArrayGenerator with a different form - /// (or a now-known form, whereas it might have been unknown before). - virtual const std::shared_ptr - with_form(const FormPtr& form) const = 0; - - /// @brief Return a copy of this ArrayGenerator with a different length - /// (or a now-known length, whereas it might have been unknown before). - virtual const std::shared_ptr - with_length(int64_t length) const = 0; - - /// @brief Returns `true` if this generator has all the same buffers and - /// parameters as `other`; `false` otherwise. - /// - /// @param other The generator to compare this with. - virtual bool - referentially_equal(const ArrayGeneratorPtr& other) const = 0; - - protected: - const FormPtr form_; - FormPtr inferred_form_{nullptr}; - int64_t length_; - }; - - ////////// SliceGenerator - - /// @class SliceGenerator - /// - /// @brief Generator for lazy slicing. Used to avoid materializing a - /// VirtualArray before its content is needed (in case its content is - /// never needed). - class LIBAWKWARD_EXPORT_SYMBOL SliceGenerator: public ArrayGenerator { - public: - SliceGenerator(const FormPtr& form, - int64_t length, - const ContentPtr& content, - const Slice& slice); - - const ContentPtr - content() const; - - const Slice - slice() const; - - const ContentPtr - generate() const override; - - void - caches(std::vector& out) const override; - - const std::string - tostring_part(const std::string& indent, - const std::string& pre, - const std::string& post) const override; - - const std::shared_ptr - shallow_copy() const override; - - const std::shared_ptr - with_form(const FormPtr& form) const override; - - const std::shared_ptr - with_length(int64_t length) const override; - - virtual bool - referentially_equal(const ArrayGeneratorPtr& other) const override; - - protected: - const ContentPtr content_; - const Slice slice_; - }; -} - -#endif // AWKWARD_ARRAYGENERATOR_H_ diff --git a/kernel-specification.yml b/kernel-specification.yml index 9e921dd8f3..f0daab7b99 100644 --- a/kernel-specification.yml +++ b/kernel-specification.yml @@ -153,27 +153,6 @@ kernels: automatic-tests: true manual-tests: [] - - name: awkward_ByteMaskedArray_getitem_carry - specializations: - - name: awkward_ByteMaskedArray_getitem_carry_64 - args: - - {name: tomask, type: "List[int8_t]", dir: out} - - {name: frommask, type: "Const[List[int8_t]]", dir: in, role: ByteMaskedArray-mask} - - {name: lenmask, type: "int64_t", dir: in, role: ByteMaskedArray-length} - - {name: fromcarry, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: lencarry, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_ByteMaskedArray_getitem_carry( - tomask, frommask, lenmask, fromcarry, lencarry - ): - for i in range(lencarry): - if fromcarry[i] >= lenmask: - raise ValueError("index out of range") - tomask[i] = frommask[fromcarry[i]] - automatic-tests: true - manual-tests: [] - - name: awkward_ByteMaskedArray_getitem_nextcarry specializations: - name: awkward_ByteMaskedArray_getitem_nextcarry_64 @@ -218,22 +197,6 @@ kernels: automatic-tests: true manual-tests: [] - - name: awkward_ByteMaskedArray_mask - specializations: - - name: awkward_ByteMaskedArray_mask8 - args: - - {name: tomask, type: "List[int8_t]", dir: out} - - {name: frommask, type: "Const[List[int8_t]]", dir: in, role: ByteMaskedArray-mask} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: validwhen, type: "bool", dir: in, role: ByteMaskedArray-valid_when} - description: null - definition: | - def awkward_ByteMaskedArray_mask(tomask, frommask, length, validwhen): - for i in range(length): - tomask[i] = (frommask[i] != 0) != validwhen - automatic-tests: true - manual-tests: [] - - name: awkward_ByteMaskedArray_numnull specializations: - name: awkward_ByteMaskedArray_numnull @@ -392,4238 +355,2947 @@ kernels: automatic-tests: true manual-tests: [] - - name: awkward_Identities32_to_Identities64 + - name: awkward_Index_iscontiguous specializations: - - name: awkward_Identities32_to_Identities64 + - name: awkward_Index32_iscontiguous args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: Identities-array} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: width, type: "int64_t", dir: in, role: default} + - {name: result, type: "List[bool]", dir: out} + - {name: fromindex, type: "Const[List[int32_t]]", dir: in} + - {name: length, type: "int64_t", dir: in} + - name: awkward_Index64_iscontiguous + args: + - {name: result, type: "List[bool]", dir: out} + - {name: fromindex, type: "Const[List[int64_t]]", dir: in} + - {name: length, type: "int64_t", dir: in} + - name: awkward_Index8_iscontiguous + args: + - {name: result, type: "List[bool]", dir: out} + - {name: fromindex, type: "Const[List[int8_t]]", dir: in} + - {name: length, type: "int64_t", dir: in} + - name: awkward_IndexU32_iscontiguous + args: + - {name: result, type: "List[bool]", dir: out} + - {name: fromindex, type: "Const[List[uint32_t]]", dir: in} + - {name: length, type: "int64_t", dir: in} + - name: awkward_IndexU8_iscontiguous + args: + - {name: result, type: "List[bool]", dir: out} + - {name: fromindex, type: "Const[List[uint8_t]]", dir: in} + - {name: length, type: "int64_t", dir: in} description: null definition: | - def awkward_Identities32_to_Identities64(toptr, fromptr, length, width): - for i in range(length * width): - toptr[i] = int(fromptr[i]) - automatic-tests: true + def awkward_Index_iscontiguous(result, fromindex, length): + result[0] = True + expecting = 0 + for i in range(length): + if fromindex[i] != expecting: + result[0] = False + return + expecting += 1 + automatic-tests: false manual-tests: [] - - name: awkward_Identities_extend + - name: awkward_IndexedArray_fill specializations: - - name: awkward_Identities32_extend + - name: awkward_IndexedArray_fill_to64_from32 args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: Identities-array} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: tolength, type: "int64_t", dir: in, role: default} - - name: awkward_Identities64_extend + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: toindexoffset, type: "int64_t", dir: in, role: default} + - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} + - {name: length, type: "int64_t", dir: in, role: default} + - {name: base, type: "int64_t", dir: in, role: default} + - name: awkward_IndexedArray_fill_to64_from64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: Identities-array} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: tolength, type: "int64_t", dir: in, role: default} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: toindexoffset, type: "int64_t", dir: in, role: default} + - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: length, type: "int64_t", dir: in, role: default} + - {name: base, type: "int64_t", dir: in, role: default} + - name: awkward_IndexedArray_fill_to64_fromU32 + args: + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: toindexoffset, type: "int64_t", dir: in, role: default} + - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: length, type: "int64_t", dir: in, role: default} + - {name: base, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_Identities_extend(toptr, fromptr, fromlength, tolength): - i = 0 - while i < fromlength: - toptr[i] = fromptr[i] - i = i + 1 - while i < tolength: - toptr[i] = -1 - i = i + 1 + def awkward_IndexedArray_fill(toindex, toindexoffset, fromindex, length, base): + for i in range(length): + fromval = fromindex[i] + toindex[toindexoffset + i] = -1 if fromval < 0 else float(fromval + base) automatic-tests: true manual-tests: [] - - name: awkward_Identities_from_IndexedArray + - name: awkward_IndexedArray_fill_count specializations: - - name: awkward_Identities32_from_IndexedArray32 - args: - - {name: uniquecontents, type: "List[bool]", dir: out} - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: Identities-array} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: tolength, type: "int64_t", dir: in, role: IndexedArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - name: awkward_Identities32_from_IndexedArray64 - args: - - {name: uniquecontents, type: "List[bool]", dir: out} - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: Identities-array} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: tolength, type: "int64_t", dir: in, role: IndexedArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - name: awkward_Identities32_from_IndexedArrayU32 + - name: awkward_IndexedArray_fill_to64_count args: - - {name: uniquecontents, type: "List[bool]", dir: out} - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: Identities-array} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: tolength, type: "int64_t", dir: in, role: IndexedArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - name: awkward_Identities64_from_IndexedArray32 + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: toindexoffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} + - {name: length, type: "int64_t", dir: in, role: default} + - {name: base, type: "int64_t", dir: in, role: default} + description: null + definition: | + def awkward_IndexedArray_fill_count(toindex, toindexoffset, length, base): + for i in range(length): + toindex[toindexoffset + i] = i + base + automatic-tests: true + manual-tests: [] + + - name: awkward_IndexedArray_flatten_nextcarry + specializations: + - name: awkward_IndexedArray32_flatten_nextcarry_64 args: - - {name: uniquecontents, type: "List[bool]", dir: out} - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: Identities-array} + - {name: tocarry, type: "List[int64_t]", dir: out} - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: tolength, type: "int64_t", dir: in, role: IndexedArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - name: awkward_Identities64_from_IndexedArray64 + - {name: lenindex, type: "int64_t", dir: in, role: default} + - {name: lencontent, type: "int64_t", dir: in, role: default} + - name: awkward_IndexedArray64_flatten_nextcarry_64 args: - - {name: uniquecontents, type: "List[bool]", dir: out} - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: Identities-array} + - {name: tocarry, type: "List[int64_t]", dir: out} - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: tolength, type: "int64_t", dir: in, role: IndexedArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - name: awkward_Identities64_from_IndexedArrayU32 + - {name: lenindex, type: "int64_t", dir: in, role: default} + - {name: lencontent, type: "int64_t", dir: in, role: default} + - name: awkward_IndexedArrayU32_flatten_nextcarry_64 args: - - {name: uniquecontents, type: "List[bool]", dir: out} - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: Identities-array} + - {name: tocarry, type: "List[int64_t]", dir: out} - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: tolength, type: "int64_t", dir: in, role: IndexedArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} + - {name: lenindex, type: "int64_t", dir: in, role: default} + - {name: lencontent, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_Identities_from_IndexedArray( - uniquecontents, toptr, fromptr, fromindex, tolength, fromlength, fromwidth - ): - for k in range(tolength * fromwidth): - toptr[k] = -1 - for i in range(fromlength): + def awkward_IndexedArray_flatten_nextcarry(tocarry, fromindex, lenindex, lencontent): + k = 0 + for i in range(lenindex): j = fromindex[i] - if j >= tolength: - raise ValueError("max(index) > len(content)") + if j >= lencontent: + raise ValueError("index out of range") else: if j >= 0: - if toptr[j * fromwidth] != -1: - uniquecontents[0] = False - return - for k in range(fromwidth): - toptr[(j * fromwidth) + k] = fromptr[(i * fromwidth) + k] - uniquecontents[0] = True + tocarry[k] = j + k = k + 1 automatic-tests: true manual-tests: [] - - name: awkward_Identities_from_ListArray + - name: awkward_IndexedArray_flatten_none2empty specializations: - - name: awkward_Identities32_from_ListArray32 - args: - - {name: uniquecontents, type: "List[bool]", dir: out} - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: Identities-array} - - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} - - {name: tolength, type: "int64_t", dir: in, role: ListArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - name: awkward_Identities32_from_ListArray64 - args: - - {name: uniquecontents, type: "List[bool]", dir: out} - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: Identities-array} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: tolength, type: "int64_t", dir: in, role: ListArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - name: awkward_Identities32_from_ListArrayU32 - args: - - {name: uniquecontents, type: "List[bool]", dir: out} - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: Identities-array} - - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} - - {name: tolength, type: "int64_t", dir: in, role: ListArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - name: awkward_Identities64_from_ListArray32 + - name: awkward_IndexedArray32_flatten_none2empty_64 args: - - {name: uniquecontents, type: "List[bool]", dir: out} - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: Identities-array} - - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} - - {name: tolength, type: "int64_t", dir: in, role: ListArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - name: awkward_Identities64_from_ListArray64 + - {name: outoffsets, type: "List[int64_t]", dir: out} + - {name: outindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} + - {name: outindexlength, type: "int64_t", dir: in, role: default} + - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: offsetslength, type: "int64_t", dir: in, role: default} + - name: awkward_IndexedArray64_flatten_none2empty_64 args: - - {name: uniquecontents, type: "List[bool]", dir: out} - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: Identities-array} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: tolength, type: "int64_t", dir: in, role: ListArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - name: awkward_Identities64_from_ListArrayU32 + - {name: outoffsets, type: "List[int64_t]", dir: out} + - {name: outindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: outindexlength, type: "int64_t", dir: in, role: default} + - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: offsetslength, type: "int64_t", dir: in, role: default} + - name: awkward_IndexedArrayU32_flatten_none2empty_64 args: - - {name: uniquecontents, type: "List[bool]", dir: out} - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: Identities-array} - - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} - - {name: tolength, type: "int64_t", dir: in, role: ListArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} + - {name: outoffsets, type: "List[int64_t]", dir: out} + - {name: outindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: outindexlength, type: "int64_t", dir: in, role: default} + - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: offsetslength, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_Identities_from_ListArray( - uniquecontents, - toptr, - fromptr, - fromstarts, - fromstops, - tolength, - fromlength, - fromwidth, + def awkward_IndexedArray_flatten_none2empty( + outoffsets, outindex, outindexlength, offsets, offsetslength ): - for k in range(tolength * (fromwidth + 1)): - toptr[k] = -1 - for i in range(fromlength): - start = fromstarts[i] - stop = fromstops[i] - if (start != stop) and (stop > tolength): - raise ValueError("max(stop) > len(content)") - for j in range(start, stop): - if toptr[(j * (fromwidth + 1)) + fromwidth] != -1: - uniquecontents[0] = False - return - for k in range(fromwidth): - toptr[(j * (fromwidth + 1)) + k] = fromptr[(i * fromwidth) + k] - toptr[(j * (fromwidth + 1)) + fromwidth] = float(j - start) - uniquecontents[0] = True + outoffsets[0] = offsets[0] + k = 1 + for i in range(outindexlength): + idx = outindex[i] + if idx < 0: + outoffsets[k] = outoffsets[k - 1] + k = k + 1 + else: + if (idx + 1) >= offsetslength: + raise ValueError("flattening offset out of range") + else: + count = offsets[idx + 1] - offsets[idx] + outoffsets[k] = outoffsets[k - 1] + count + k = k + 1 automatic-tests: true manual-tests: [] - - name: awkward_Identities_from_ListOffsetArray + - name: awkward_IndexedArray_getitem_nextcarry specializations: - - name: awkward_Identities32_from_ListOffsetArray32 - args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: Identities-array} - - {name: fromoffsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: tolength, type: "int64_t", dir: in, role: ListOffsetArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - name: awkward_Identities32_from_ListOffsetArray64 - args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: Identities-array} - - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: tolength, type: "int64_t", dir: in, role: ListOffsetArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - name: awkward_Identities32_from_ListOffsetArrayU32 - args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: Identities-array} - - {name: fromoffsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: tolength, type: "int64_t", dir: in, role: ListOffsetArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - name: awkward_Identities64_from_ListOffsetArray32 + - name: awkward_IndexedArray32_getitem_nextcarry_64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: Identities-array} - - {name: fromoffsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: tolength, type: "int64_t", dir: in, role: ListOffsetArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - name: awkward_Identities64_from_ListOffsetArray64 + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} + - {name: lenindex, type: "int64_t", dir: in, role: default} + - {name: lencontent, type: "int64_t", dir: in, role: default} + - name: awkward_IndexedArray64_getitem_nextcarry_64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: Identities-array} - - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: tolength, type: "int64_t", dir: in, role: ListOffsetArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - name: awkward_Identities64_from_ListOffsetArrayU32 + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: lenindex, type: "int64_t", dir: in, role: default} + - {name: lencontent, type: "int64_t", dir: in, role: default} + - name: awkward_IndexedArrayU32_getitem_nextcarry_64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: Identities-array} - - {name: fromoffsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: tolength, type: "int64_t", dir: in, role: ListOffsetArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: lenindex, type: "int64_t", dir: in, role: default} + - {name: lencontent, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_Identities_from_ListOffsetArray( - toptr, fromptr, fromoffsets, tolength, fromlength, fromwidth - ): - globalstart = fromoffsets[0] - globalstop = fromoffsets[fromlength] - for k in range(globalstart * (fromwidth + 1)): - toptr[k] = -1 - k = globalstop * (fromwidth + 1) - while k < (tolength * (fromwidth + 1)): - toptr[k] = -1 - k = k + 1 - for i in range(fromlength): - start = fromoffsets[i] - stop = fromoffsets[i + 1] - if (start != stop) and (stop > tolength): - raise ValueError("max(stop) > len(content)") - for j in range(start, stop): - for k in range(fromwidth): - toptr[(j * (fromwidth + 1)) + k] = fromptr[(i * fromwidth) + k] - toptr[(j * (fromwidth + 1)) + fromwidth] = float(j - start) + def awkward_IndexedArray_getitem_nextcarry(tocarry, fromindex, lenindex, lencontent): + k = 0 + for i in range(lenindex): + j = fromindex[i] + if (j < 0) or (j >= lencontent): + raise ValueError("index out of range") + else: + tocarry[k] = j + k = k + 1 automatic-tests: true manual-tests: [] - - name: awkward_Identities_from_RegularArray + - name: awkward_IndexedArray_getitem_nextcarry_outindex specializations: - - name: awkward_Identities32_from_RegularArray + - name: awkward_IndexedArray32_getitem_nextcarry_outindex_64 args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: Identities-array} - - {name: size, type: "int64_t", dir: in, role: RegularArray-size} - - {name: tolength, type: "int64_t", dir: in, role: default} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - name: awkward_Identities64_from_RegularArray + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: toindex, type: "List[int32_t]", dir: out} + - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} + - {name: lenindex, type: "int64_t", dir: in, role: default} + - {name: lencontent, type: "int64_t", dir: in, role: IndexedArray-length} + - name: awkward_IndexedArray64_getitem_nextcarry_outindex_64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: Identities-array} - - {name: size, type: "int64_t", dir: in, role: RegularArray-size} - - {name: tolength, type: "int64_t", dir: in, role: default} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: lenindex, type: "int64_t", dir: in, role: default} + - {name: lencontent, type: "int64_t", dir: in, role: IndexedArray-length} + - name: awkward_IndexedArrayU32_getitem_nextcarry_outindex_64 + args: + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: toindex, type: "List[uint32_t]", dir: out} + - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: lenindex, type: "int64_t", dir: in, role: default} + - {name: lencontent, type: "int64_t", dir: in, role: IndexedArray-length} description: null definition: | - def awkward_Identities_from_RegularArray( - toptr, fromptr, size, tolength, fromlength, fromwidth + def awkward_IndexedArray_getitem_nextcarry_outindex( + tocarry, toindex, fromindex, lenindex, lencontent ): - for i in range(fromlength): - for j in range(size): - for k in range(fromwidth): - toptr[(((i * size) + j) * (fromwidth + 1)) + k] = fromptr[ - (i * fromwidth) + k - ] - toptr[(((i * size) + j) * (fromwidth + 1)) + fromwidth] = float(j) - k = ((fromlength + 1) * size) * (fromwidth + 1) - while k < (tolength * (fromwidth + 1)): - toptr[k] = -1 - k = k + 1 + k = 0 + for i in range(lenindex): + j = fromindex[i] + if j >= lencontent: + raise ValueError("index out of range") + else: + if j < 0: + toindex[i] = -1 + else: + tocarry[k] = j + toindex[i] = float(k) + k = k + 1 automatic-tests: true manual-tests: [] - - name: awkward_Identities_from_UnionArray + - name: awkward_IndexedArray_local_preparenext_64 specializations: - - name: awkward_Identities32_from_UnionArray8_32 - args: - - {name: uniquecontents, type: "List[bool]", dir: out} - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: Identities-array} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: tolength, type: "int64_t", dir: in, role: IndexedArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - {name: which, type: "int64_t", dir: in, role: UnionArray-which} - - name: awkward_Identities32_from_UnionArray8_64 - args: - - {name: uniquecontents, type: "List[bool]", dir: out} - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: Identities-array} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: tolength, type: "int64_t", dir: in, role: IndexedArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - {name: which, type: "int64_t", dir: in, role: UnionArray-which} - - name: awkward_Identities32_from_UnionArray8_U32 + - name: awkward_IndexedArray_local_preparenext_64 args: - - {name: uniquecontents, type: "List[bool]", dir: out} - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: Identities-array} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: tolength, type: "int64_t", dir: in, role: IndexedArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - {name: which, type: "int64_t", dir: in, role: UnionArray-which} - - name: awkward_Identities64_from_UnionArray8_32 + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: starts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: parents, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: parentslength, type: "Const[int64_t]", dir: in, role: default} + - {name: nextparents, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: nextlen, type: "Const[int64_t]", dir: in, role: default} + description: null + definition: | + Insert Python definition here + automatic-tests: false + manual-tests: [] + + - name: awkward_IndexedArray_numnull + specializations: + - name: awkward_IndexedArray32_numnull args: - - {name: uniquecontents, type: "List[bool]", dir: out} - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: Identities-array} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: numnull, type: "List[int64_t]", dir: out} - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: tolength, type: "int64_t", dir: in, role: IndexedArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - {name: which, type: "int64_t", dir: in, role: UnionArray-which} - - name: awkward_Identities64_from_UnionArray8_64 + - {name: lenindex, type: "int64_t", dir: in, role: default} + - name: awkward_IndexedArray64_numnull args: - - {name: uniquecontents, type: "List[bool]", dir: out} - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: Identities-array} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: numnull, type: "List[int64_t]", dir: out} - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: tolength, type: "int64_t", dir: in, role: IndexedArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - {name: which, type: "int64_t", dir: in, role: UnionArray-which} - - name: awkward_Identities64_from_UnionArray8_U32 + - {name: lenindex, type: "int64_t", dir: in, role: default} + - name: awkward_IndexedArrayU32_numnull args: - - {name: uniquecontents, type: "List[bool]", dir: out} - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: Identities-array} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: numnull, type: "List[int64_t]", dir: out} - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: tolength, type: "int64_t", dir: in, role: IndexedArray-length} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: fromwidth, type: "int64_t", dir: in, role: default} - - {name: which, type: "int64_t", dir: in, role: UnionArray-which} + - {name: lenindex, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_Identities_from_UnionArray( - uniquecontents, - toptr, - fromptr, - fromtags, - fromindex, - tolength, - fromlength, - fromwidth, - which, - ): - for k in range(tolength * fromwidth): - toptr[k] = -1 - for i in range(fromlength): - if fromtags[i] == which: - j = fromindex[i] - if j >= tolength: - raise ValueError("max(index) > len(content)") - else: - if j < 0: - raise ValueError("min(index) < 0") - else: - if toptr[j * fromwidth] != -1: - uniquecontents[0] = False - return - for k in range(fromwidth): - toptr[(j * fromwidth) + k] = fromptr[(i * fromwidth) + k] - uniquecontents[0] = True + def awkward_IndexedArray_numnull(numnull, fromindex, lenindex): + numnull[0] = 0 + for i in range(lenindex): + if fromindex[i] < 0: + numnull[0] = numnull[0] + 1 automatic-tests: true manual-tests: [] - - name: awkward_Identities_getitem_carry + - name: awkward_IndexedArray_numnull_parents specializations: - - name: awkward_Identities32_getitem_carry_64 + - name: awkward_IndexedArray32_numnull_parents args: - - {name: newidentitiesptr, type: "List[int32_t]", dir: out} - - {name: identitiesptr, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: carryptr, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lencarry, type: "int64_t", dir: in, role: default} - - {name: width, type: "int64_t", dir: in, role: default} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_Identities64_getitem_carry_64 + - {name: numnull, type: "List[int64_t]", dir: out} + - {name: tolength, type: "List[int64_t]", dir: out} + - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} + - {name: lenindex, type: "int64_t", dir: in, role: default} + - name: awkward_IndexedArray64_numnull_parents args: - - {name: newidentitiesptr, type: "List[int64_t]", dir: out} - - {name: identitiesptr, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: carryptr, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lencarry, type: "int64_t", dir: in, role: default} - - {name: width, type: "int64_t", dir: in, role: default} - - {name: length, type: "int64_t", dir: in, role: default} + - {name: numnull, type: "List[int64_t]", dir: out} + - {name: tolength, type: "List[int64_t]", dir: out} + - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: lenindex, type: "int64_t", dir: in, role: default} + - name: awkward_IndexedArrayU32_numnull_parents + args: + - {name: numnull, type: "List[int64_t]", dir: out} + - {name: tolength, type: "List[int64_t]", dir: out} + - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: lenindex, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_Identities_getitem_carry( - newidentitiesptr, identitiesptr, carryptr, lencarry, width, length - ): - for i in range(lencarry): - if carryptr[i] >= length: - raise ValueError("index out of range") - for j in range(width): - newidentitiesptr[(width * i) + j] = identitiesptr[(width * carryptr[i]) + j] - automatic-tests: true + def awkward_IndexedArray_numnull_parents(numnull, tolength, fromindex, lenindex): + tolength[0] = 0 + for i in range(lenindex): + if fromindex[i] < 0: + numnull[i] = 1 + tolength[0] = tolength[0] + 1 + else: + numnull[i] = 0 + automatic-tests: false manual-tests: [] - - name: awkward_Index_iscontiguous + - name: awkward_IndexedArray_numnull_unique_64 specializations: - - name: awkward_Index32_iscontiguous - args: - - {name: result, type: "List[bool]", dir: out} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in} - - {name: length, type: "int64_t", dir: in} - - name: awkward_Index64_iscontiguous - args: - - {name: result, type: "List[bool]", dir: out} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in} - - {name: length, type: "int64_t", dir: in} - - name: awkward_Index8_iscontiguous - args: - - {name: result, type: "List[bool]", dir: out} - - {name: fromindex, type: "Const[List[int8_t]]", dir: in} - - {name: length, type: "int64_t", dir: in} - - name: awkward_IndexU32_iscontiguous - args: - - {name: result, type: "List[bool]", dir: out} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in} - - {name: length, type: "int64_t", dir: in} - - name: awkward_IndexU8_iscontiguous + - name: awkward_IndexedArray_numnull_unique_64 args: - - {name: result, type: "List[bool]", dir: out} - - {name: fromindex, type: "Const[List[uint8_t]]", dir: in} - - {name: length, type: "int64_t", dir: in} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: lenindex, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_Index_iscontiguous(result, fromindex, length): - result[0] = True - expecting = 0 - for i in range(length): - if fromindex[i] != expecting: - result[0] = False - return - expecting += 1 + def awkward_IndexedArray_numnull_unique_64(toindex, lenindex): + for i in range(lenindex): + toindex[i] = i + toindex[-1] = -1 automatic-tests: false manual-tests: [] - - name: awkward_Index_to_Index64 + - name: awkward_IndexedArray_index_of_nulls specializations: - - name: awkward_Index32_to_Index64 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_Index8_to_Index64 + - name: awkward_IndexedArray32_index_of_nulls args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_IndexU32_to_Index64 + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} + - {name: lenindex, type: "int64_t", dir: in, role: default} + - {name: parents, type: "Const[List[int64_t]]", dir: in} + - {name: starts, type: "Const[List[int64_t]]", dir: in} + - name: awkward_IndexedArray64_index_of_nulls args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_IndexU8_to_Index64 + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: lenindex, type: "int64_t", dir: in, role: default} + - {name: parents, type: "Const[List[int64_t]]", dir: in} + - {name: starts, type: "Const[List[int64_t]]", dir: in} + - name: awkward_IndexedArrayU32_index_of_nulls args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: lenindex, type: "int64_t", dir: in, role: default} + - {name: parents, type: "Const[List[int64_t]]", dir: in} + - {name: starts, type: "Const[List[int64_t]]", dir: in} description: null definition: | - def awkward_Index_to_Index64(toptr, fromptr, length): - for i in range(length): - toptr[i] = int(fromptr[i]) + def awkward_IndexedArray_index_of_nulls(toindex, fromindex, lenindex, parents, starts): + j = 0 + for i in range(lenindex): + if fromindex[i] < 0: + parent = parents[i] + start = starts[parent] + toindex[j] = i - start + j = j + 1 automatic-tests: true manual-tests: [] - - name: awkward_IndexedArray_fill + - name: awkward_IndexedArray_overlay_mask specializations: - - name: awkward_IndexedArray_fill_to64_from32 + - name: awkward_IndexedArray32_overlay_mask8_to64 args: - {name: toindex, type: "List[int64_t]", dir: out} - - {name: toindexoffset, type: "int64_t", dir: in, role: default} + - {name: mask, type: "Const[List[int8_t]]", dir: in, role: ByteMaskedArray-mask} - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArray_fill_to64_from64 + - name: awkward_IndexedArray64_overlay_mask8_to64 args: - {name: toindex, type: "List[int64_t]", dir: out} - - {name: toindexoffset, type: "int64_t", dir: in, role: default} + - {name: mask, type: "Const[List[int8_t]]", dir: in, role: ByteMaskedArray-mask} - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArray_fill_to64_fromU32 + - name: awkward_IndexedArrayU32_overlay_mask8_to64 args: - {name: toindex, type: "List[int64_t]", dir: out} - - {name: toindexoffset, type: "int64_t", dir: in, role: default} + - {name: mask, type: "Const[List[int8_t]]", dir: in, role: ByteMaskedArray-mask} - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_IndexedArray_fill(toindex, toindexoffset, fromindex, length, base): - for i in range(length): - fromval = fromindex[i] - toindex[toindexoffset + i] = -1 if fromval < 0 else float(fromval + base) - automatic-tests: true - manual-tests: [] - - - name: awkward_IndexedArray_fill_count - specializations: - - name: awkward_IndexedArray_fill_to64_count - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: toindexoffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_IndexedArray_fill_count(toindex, toindexoffset, length, base): + def awkward_IndexedArray_overlay_mask(toindex, mask, fromindex, length): for i in range(length): - toindex[toindexoffset + i] = i + base - automatic-tests: true + m = mask[i] + toindex[i] = -1 if m else fromindex[i] + automatic-tests: false manual-tests: [] - - name: awkward_IndexedArray_flatten_nextcarry + - name: awkward_IndexedArray_reduce_next_64 specializations: - - name: awkward_IndexedArray32_flatten_nextcarry_64 + - name: awkward_IndexedArray32_reduce_next_64 args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArray64_flatten_nextcarry_64 + - {name: nextcarry, type: "List[int64_t]", dir: out} + - {name: nextparents, type: "List[int64_t]", dir: out} + - {name: outindex, type: "List[int64_t]", dir: out} + - {name: index, type: "Const[List[int32_t]]", dir: in, role: reducer-index} + - {name: parents, type: "List[int64_t]", dir: in, role: reducer-parents} + - {name: length, type: "int64_t", dir: in, role: reducer-length} + - name: awkward_IndexedArray64_reduce_next_64 args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArrayU32_flatten_nextcarry_64 + - {name: nextcarry, type: "List[int64_t]", dir: out} + - {name: nextparents, type: "List[int64_t]", dir: out} + - {name: outindex, type: "List[int64_t]", dir: out} + - {name: index, type: "Const[List[int64_t]]", dir: in, role: reducer-index} + - {name: parents, type: "List[int64_t]", dir: in, role: reducer-parents} + - {name: length, type: "int64_t", dir: in, role: reducer-length} + - name: awkward_IndexedArrayU32_reduce_next_64 args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: default} + - {name: nextcarry, type: "List[int64_t]", dir: out} + - {name: nextparents, type: "List[int64_t]", dir: out} + - {name: outindex, type: "List[int64_t]", dir: out} + - {name: index, type: "Const[List[uint32_t]]", dir: in, role: reducer-index} + - {name: parents, type: "List[int64_t]", dir: in, role: reducer-parents} + - {name: length, type: "int64_t", dir: in, role: reducer-length} description: null definition: | - def awkward_IndexedArray_flatten_nextcarry(tocarry, fromindex, lenindex, lencontent): + def awkward_IndexedArray_reduce_next_64( + nextcarry, nextparents, outindex, index, parents, length + ): k = 0 - for i in range(lenindex): - j = fromindex[i] - if j >= lencontent: - raise ValueError("index out of range") + for i in range(length): + if index[i] >= 0: + nextcarry[k] = index[i] + nextparents[k] = parents[i] + outindex[i] = k + k = k + 1 else: - if j >= 0: - tocarry[k] = j - k = k + 1 + outindex[i] = -1 automatic-tests: true manual-tests: [] - - name: awkward_IndexedArray_flatten_none2empty + - name: awkward_IndexedArray_reduce_next_fix_offsets_64 specializations: - - name: awkward_IndexedArray32_flatten_none2empty_64 - args: - - {name: outoffsets, type: "List[int64_t]", dir: out} - - {name: outindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: outindexlength, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArray64_flatten_none2empty_64 - args: - - {name: outoffsets, type: "List[int64_t]", dir: out} - - {name: outindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: outindexlength, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArrayU32_flatten_none2empty_64 + - name: awkward_IndexedArray_reduce_next_fix_offsets_64 args: - {name: outoffsets, type: "List[int64_t]", dir: out} - - {name: outindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: outindexlength, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} + - {name: starts, type: "Const[List[int64_t]]", dir: in, role: reducer-starts} + - {name: startslength, type: "int64_t", dir: in, role: reducer-startslength} + - {name: outindexlength, type: "int64_t", dir: in, role: reducer-outindexlength} description: null definition: | - def awkward_IndexedArray_flatten_none2empty( - outoffsets, outindex, outindexlength, offsets, offsetslength + def awkward_IndexedArray_reduce_next_fix_offsets_64( + outoffsets, starts, startslength, outindexlength ): - outoffsets[0] = offsets[0] - k = 1 - for i in range(outindexlength): - idx = outindex[i] - if idx < 0: - outoffsets[k] = outoffsets[k - 1] - k = k + 1 - else: - if (idx + 1) >= offsetslength: - raise ValueError("flattening offset out of range") - else: - count = offsets[idx + 1] - offsets[idx] - outoffsets[k] = outoffsets[k - 1] + count - k = k + 1 + for i in range(startslength): + outoffsets[i] = starts[i] + outoffsets[startslength] = outindexlength automatic-tests: true manual-tests: [] - - name: awkward_IndexedArray_getitem_adjust_outindex + - name: awkward_IndexedArray_unique_next_index_and_offsets_64 specializations: - - name: awkward_IndexedArray_getitem_adjust_outindex_64 + - name: awkward_IndexedArray_unique_next_index_and_offsets_64 args: - - {name: tomask, type: "List[int8_t]", dir: out} - {name: toindex, type: "List[int64_t]", dir: out} - - {name: tononzero, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: fromindexlength, type: "int64_t", dir: in, role: default} - - {name: nonzero, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: nonzerolength, type: "int64_t", dir: in, role: default} + - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: reducer-starts} + - {name: fromnulls, type: "Const[List[int64_t]]", dir: in, role: reducer-starts} + - {name: startslength, type: "int64_t", dir: in, role: reducer-startslength} description: null definition: | - def awkward_IndexedArray_getitem_adjust_outindex( - tomask, toindex, tononzero, fromindex, fromindexlength, nonzero, nonzerolength + def awkward_IndexedArray_unique_next_index_and_offsets_64( + toindex, tooffsets, fromoffsets, fromnulls, startslength ): - j = 0 k = 0 - for i in range(fromindexlength): - fromval = fromindex[i] - tomask[i] = fromval < 0 - if fromval < 0: - toindex[k] = -1 - k = k + 1 - else: - if (j < nonzerolength) and (fromval == nonzero[j]): - tononzero[j] = fromval + (k - j) - toindex[k] = j - j = j + 1 - k = k + 1 - automatic-tests: true + ll = 0 + shift = 0 + toindex[0] = ll + tooffsets[0] = fromoffsets[0] + for i in range(startslength): + for _j in range(fromoffsets[i], fromoffsets[i + 1]): + toindex[k] = ll + k += 1 + ll += 1 + if fromnulls[k] == 1: + toindex[k] = -1 + k += 1 + shift += 1 + tooffsets[i + 1] = fromoffsets[i + 1] + shift + automatic-tests: false manual-tests: [] - - name: awkward_IndexedArray_getitem_carry + - name: awkward_IndexedArray_reduce_next_nonlocal_nextshifts_64 specializations: - - name: awkward_IndexedArray32_getitem_carry_64 + - name: awkward_IndexedArray32_reduce_next_nonlocal_nextshifts_64 args: - - {name: toindex, type: "List[int32_t]", dir: out} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: fromcarry, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - {name: lencarry, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArray64_getitem_carry_64 + - {name: nextshifts, type: "List[int64_t]", dir: out} + - {name: index, type: "Const[List[int32_t]]", dir: in, role: reducer-nextshifts} + - {name: length, type: "int64_t", dir: in, role: reducer-length} + - name: awkward_IndexedArray64_reduce_next_nonlocal_nextshifts_64 args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: fromcarry, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - {name: lencarry, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArrayU32_getitem_carry_64 + - {name: nextshifts, type: "List[int64_t]", dir: out} + - {name: index, type: "Const[List[int64_t]]", dir: in, role: reducer-nextshifts} + - {name: length, type: "int64_t", dir: in, role: reducer-length} + - name: awkward_IndexedArrayU32_reduce_next_nonlocal_nextshifts_64 args: - - {name: toindex, type: "List[uint32_t]", dir: out} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: fromcarry, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - {name: lencarry, type: "int64_t", dir: in, role: default} + - {name: nextshifts, type: "List[int64_t]", dir: out} + - {name: index, type: "Const[List[uint32_t]]", dir: in, role: reducer-nextshifts} + - {name: length, type: "int64_t", dir: in, role: reducer-length} description: null definition: | - def awkward_IndexedArray_getitem_carry( - toindex, fromindex, fromcarry, lenindex, lencarry - ): - for i in range(lencarry): - if fromcarry[i] >= lenindex: - raise ValueError("index out of range") - toindex[i] = float(fromindex[fromcarry[i]]) + def awkward_IndexedArray_reduce_next_nonlocal_nextshifts_64(nextshifts, index, length): + nullsum = 0 + k = 0 + for i in range(length): + if index[i] >= 0: + nextshifts[k] = nullsum + k = k + 1 + else: + nullsum = nullsum + 1 automatic-tests: true manual-tests: [] - - name: awkward_IndexedArray_getitem_nextcarry + - name: awkward_IndexedArray_reduce_next_nonlocal_nextshifts_fromshifts_64 specializations: - - name: awkward_IndexedArray32_getitem_nextcarry_64 + - name: awkward_IndexedArray32_reduce_next_nonlocal_nextshifts_fromshifts_64 args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArray64_getitem_nextcarry_64 + - {name: nextshifts, type: "List[int64_t]", dir: out} + - {name: index, type: "Const[List[int32_t]]", dir: in, role: reducer-nextshifts} + - {name: length, type: "int64_t", dir: in, role: reducer-length} + - {name: shifts, type: "Const[List[int64_t]]", dir: in, role: reducer-shifts} + - name: awkward_IndexedArray64_reduce_next_nonlocal_nextshifts_fromshifts_64 args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArrayU32_getitem_nextcarry_64 + - {name: nextshifts, type: "List[int64_t]", dir: out} + - {name: index, type: "Const[List[int64_t]]", dir: in, role: reducer-nextshifts} + - {name: length, type: "int64_t", dir: in, role: reducer-length} + - {name: shifts, type: "Const[List[int64_t]]", dir: in, role: reducer-shifts} + - name: awkward_IndexedArrayU32_reduce_next_nonlocal_nextshifts_fromshifts_64 args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: default} + - {name: nextshifts, type: "List[int64_t]", dir: out} + - {name: index, type: "Const[List[uint32_t]]", dir: in, role: reducer-nextshifts} + - {name: length, type: "int64_t", dir: in, role: reducer-length} + - {name: shifts, type: "Const[List[int64_t]]", dir: in, role: reducer-shifts} description: null definition: | - def awkward_IndexedArray_getitem_nextcarry(tocarry, fromindex, lenindex, lencontent): + def awkward_IndexedArray_reduce_next_nonlocal_nextshifts_fromshifts_64( + nextshifts, index, length, shifts + ): + nullsum = 0 k = 0 - for i in range(lenindex): - j = fromindex[i] - if (j < 0) or (j >= lencontent): - raise ValueError("index out of range") - else: - tocarry[k] = j + for i in range(length): + if index[i] >= 0: + nextshifts[k] = shifts[i] + nullsum k = k + 1 + else: + nullsum = nullsum + 1 automatic-tests: true manual-tests: [] - - name: awkward_IndexedArray_getitem_nextcarry_outindex + - name: awkward_IndexedArray_simplify specializations: - - name: awkward_IndexedArray32_getitem_nextcarry_outindex_64 - args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: toindex, type: "List[int32_t]", dir: out} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: IndexedArray-length} - - name: awkward_IndexedArray64_getitem_nextcarry_outindex_64 + - name: awkward_IndexedArray32_simplify32_to64 args: - - {name: tocarry, type: "List[int64_t]", dir: out} - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: IndexedArray-length} - - name: awkward_IndexedArrayU32_getitem_nextcarry_outindex_64 + - {name: outerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} + - {name: outerlength, type: "int64_t", dir: in, role: default} + - {name: innerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray2-index} + - {name: innerlength, type: "int64_t", dir: in, role: IndexedArray-length} + - name: awkward_IndexedArray32_simplify64_to64 args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: toindex, type: "List[uint32_t]", dir: out} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: IndexedArray-length} - description: null - definition: | - def awkward_IndexedArray_getitem_nextcarry_outindex( - tocarry, toindex, fromindex, lenindex, lencontent - ): - k = 0 - for i in range(lenindex): - j = fromindex[i] - if j >= lencontent: - raise ValueError("index out of range") - else: - if j < 0: - toindex[i] = -1 - else: - tocarry[k] = j - toindex[i] = float(k) - k = k + 1 - automatic-tests: true - manual-tests: [] - - - name: awkward_IndexedArray_getitem_nextcarry_outindex_mask - specializations: - - name: awkward_IndexedArray32_getitem_nextcarry_outindex_mask_64 + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: outerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} + - {name: outerlength, type: "int64_t", dir: in, role: default} + - {name: innerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray2-index} + - {name: innerlength, type: "int64_t", dir: in, role: IndexedArray-length} + - name: awkward_IndexedArray32_simplifyU32_to64 args: - - {name: tocarry, type: "List[int64_t]", dir: out} - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArray64_getitem_nextcarry_outindex_mask_64 + - {name: outerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} + - {name: outerlength, type: "int64_t", dir: in, role: default} + - {name: innerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray2-index} + - {name: innerlength, type: "int64_t", dir: in, role: IndexedArray-length} + - name: awkward_IndexedArray64_simplify32_to64 args: - - {name: tocarry, type: "List[int64_t]", dir: out} - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArrayU32_getitem_nextcarry_outindex_mask_64 + - {name: outerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: outerlength, type: "int64_t", dir: in, role: default} + - {name: innerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray2-index} + - {name: innerlength, type: "int64_t", dir: in, role: IndexedArray-length} + - name: awkward_IndexedArray64_simplify64_to64 args: - - {name: tocarry, type: "List[int64_t]", dir: out} - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: default} + - {name: outerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: outerlength, type: "int64_t", dir: in, role: default} + - {name: innerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray2-index} + - {name: innerlength, type: "int64_t", dir: in, role: IndexedArray-length} + - name: awkward_IndexedArray64_simplifyU32_to64 + args: + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: outerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: outerlength, type: "int64_t", dir: in, role: default} + - {name: innerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray2-index} + - {name: innerlength, type: "int64_t", dir: in, role: IndexedArray-length} + - name: awkward_IndexedArrayU32_simplify32_to64 + args: + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: outerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: outerlength, type: "int64_t", dir: in, role: default} + - {name: innerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray2-index} + - {name: innerlength, type: "int64_t", dir: in, role: IndexedArray-length} + - name: awkward_IndexedArrayU32_simplify64_to64 + args: + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: outerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: outerlength, type: "int64_t", dir: in, role: default} + - {name: innerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray2-index} + - {name: innerlength, type: "int64_t", dir: in, role: IndexedArray-length} + - name: awkward_IndexedArrayU32_simplifyU32_to64 + args: + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: outerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: outerlength, type: "int64_t", dir: in, role: default} + - {name: innerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray2-index} + - {name: innerlength, type: "int64_t", dir: in, role: IndexedArray-length} description: null definition: | - def awkward_IndexedArray_getitem_nextcarry_outindex_mask( - tocarry, toindex, fromindex, lenindex, lencontent + def awkward_IndexedArray_simplify( + toindex, outerindex, outerlength, innerindex, innerlength ): - k = 0 - for i in range(lenindex): - j = fromindex[i] - if j >= lencontent: - raise ValueError("index out of range") + for i in range(outerlength): + j = outerindex[i] + if j < 0: + toindex[i] = -1 else: - if j < 0: - toindex[i] = -1 + if j >= innerlength: + raise ValueError("index out of range") else: - tocarry[k] = j - toindex[i] = float(k) - k = k + 1 + toindex[i] = innerindex[j] automatic-tests: true manual-tests: [] - - name: awkward_IndexedArray_local_preparenext_64 + - name: awkward_IndexedArray_validity specializations: - - name: awkward_IndexedArray_local_preparenext_64 + - name: awkward_IndexedArray32_validity args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: starts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: parents, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: parentslength, type: "Const[int64_t]", dir: in, role: default} - - {name: nextparents, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: nextlen, type: "Const[int64_t]", dir: in, role: default} + - {name: index, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} + - {name: length, type: "int64_t", dir: in, role: default} + - {name: lencontent, type: "int64_t", dir: in, role: IndexedArray-length} + - {name: isoption, type: "bool", dir: in, role: ByteMaskedArray-valid_when} + - name: awkward_IndexedArray64_validity + args: + - {name: index, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: length, type: "int64_t", dir: in, role: default} + - {name: lencontent, type: "int64_t", dir: in, role: IndexedArray-length} + - {name: isoption, type: "bool", dir: in, role: ByteMaskedArray-valid_when} + - name: awkward_IndexedArrayU32_validity + args: + - {name: index, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: length, type: "int64_t", dir: in, role: default} + - {name: lencontent, type: "int64_t", dir: in, role: IndexedArray-length} + - {name: isoption, type: "bool", dir: in, role: ByteMaskedArray-valid_when} description: null definition: | - Insert Python definition here - automatic-tests: false + def awkward_IndexedArray_validity(index, length, lencontent, isoption): + for i in range(length): + idx = index[i] + if not (isoption): + if idx < 0: + raise ValueError("index[i] < 0") + if idx >= lencontent: + raise ValueError("index[i] >= len(content)") + automatic-tests: true manual-tests: [] - - name: awkward_IndexedArray_mask + - name: awkward_IndexedArray_ranges_next_64 specializations: - - name: awkward_IndexedArray32_mask8 + - name: awkward_IndexedArray32_ranges_next_64 args: - - {name: tomask, type: "List[int8_t]", dir: out} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} + - {name: index, type: "Const[List[int32_t]]", dir: in, role: rangesr-index} + - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArray64_mask8 + - {name: tostarts, type: "List[int64_t]", dir: out} + - {name: tostops, type: "List[int64_t]", dir: out} + - {name: tolength, type: "List[int64_t]", dir: out, role: default} + - name: awkward_IndexedArray64_ranges_next_64 args: - - {name: tomask, type: "List[int8_t]", dir: out} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: index, type: "Const[List[int64_t]]", dir: in, role: rangesr-index} + - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArrayU32_mask8 + - {name: tostarts, type: "List[int64_t]", dir: out} + - {name: tostops, type: "List[int64_t]", dir: out} + - {name: tolength, type: "List[int64_t]", dir: out, role: default} + - name: awkward_IndexedArrayU32_ranges_next_64 args: - - {name: tomask, type: "List[int8_t]", dir: out} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: index, type: "Const[List[uint32_t]]", dir: in, role: rangesr-index} + - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - {name: length, type: "int64_t", dir: in, role: default} + - {name: tostarts, type: "List[int64_t]", dir: out} + - {name: tostops, type: "List[int64_t]", dir: out} + - {name: tolength, type: "List[int64_t]", dir: out, role: default} description: null definition: | - def awkward_IndexedArray_mask(tomask, fromindex, length): + def awkward_IndexedArray_ranges_next_64( + index, fromstarts, fromstops, length, tostarts, tostops, tolength + ): + k = 0 for i in range(length): - tomask[i] = fromindex[i] < 0 - automatic-tests: true + stride = fromstops[i] - fromstarts[i] + tostarts[i] = k + for j in range(stride): + if index[fromstarts[i] + j] > 0: + k = k + 1 + tostops[i] = k + tolength = k + automatic-tests: false manual-tests: [] - - name: awkward_IndexedArray_numnull + + - name: awkward_IndexedArray_ranges_carry_next_64 specializations: - - name: awkward_IndexedArray32_numnull + - name: awkward_IndexedArray32_ranges_carry_next_64 args: - - {name: numnull, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArray64_numnull + - {name: index, type: "Const[List[int32_t]]", dir: in, role: rangesr-index} + - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: length, type: "int64_t", dir: in, role: default} + - {name: tocarry, type: "List[int64_t]", dir: out} + - name: awkward_IndexedArray64_ranges_carry_next_64 args: - - {name: numnull, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArrayU32_numnull + - {name: index, type: "Const[List[int64_t]]", dir: in, role: rangesr-index} + - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: length, type: "int64_t", dir: in, role: default} + - {name: tocarry, type: "List[int64_t]", dir: out} + - name: awkward_IndexedArrayU32_ranges_carry_next_64 args: - - {name: numnull, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} + - {name: index, type: "Const[List[uint32_t]]", dir: in, role: rangesr-index} + - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: length, type: "int64_t", dir: in, role: default} + - {name: tocarry, type: "List[int64_t]", dir: out} description: null definition: | - def awkward_IndexedArray_numnull(numnull, fromindex, lenindex): - numnull[0] = 0 - for i in range(lenindex): - if fromindex[i] < 0: - numnull[0] = numnull[0] + 1 - automatic-tests: true + def awkward_IndexedArray_ranges_carry_next_64( + index, fromstarts, fromstops, length, tocarry + ): + k = 0 + for i in range(length): + stride = fromstops[i] - fromstarts[i] + for j in range(stride): + if index[fromstarts[i] + j] > 0: + tocarry[k] = index[fromstarts[i] + j] + k = k + 1 + automatic-tests: false manual-tests: [] - - name: awkward_IndexedArray_numnull_parents + + - name: awkward_IndexedOptionArray_rpad_and_clip_mask_axis1 specializations: - - name: awkward_IndexedArray32_numnull_parents - args: - - {name: numnull, type: "List[int64_t]", dir: out} - - {name: tolength, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArray64_numnull_parents + - name: awkward_IndexedOptionArray_rpad_and_clip_mask_axis1_64 args: - - {name: numnull, type: "List[int64_t]", dir: out} - - {name: tolength, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArrayU32_numnull_parents - args: - - {name: numnull, type: "List[int64_t]", dir: out} - - {name: tolength, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: frommask, type: "Const[List[int8_t]]", dir: in, role: ByteMaskedArray-mask} + - {name: length, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_IndexedArray_numnull_parents(numnull, tolength, fromindex, lenindex): - tolength[0] = 0 - for i in range(lenindex): - if fromindex[i] < 0: - numnull[i] = 1 - tolength[0] = tolength[0] + 1 + def awkward_IndexedOptionArray_rpad_and_clip_mask_axis1(toindex, frommask, length): + count = 0 + for i in range(length): + if frommask[i]: + toindex[i] = -1 else: - numnull[i] = 0 - automatic-tests: false + toindex[i] = count + count = count + 1 + automatic-tests: true manual-tests: [] - - name: awkward_IndexedArray_numnull_unique_64 + - name: awkward_ListArray_broadcast_tooffsets specializations: - - name: awkward_IndexedArray_numnull_unique_64 + - name: awkward_ListArray32_broadcast_tooffsets_64 args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: lenindex, type: "int64_t", dir: in, role: default} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: offsetslength, type: "int64_t", dir: in, role: default} + - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} + - {name: lencontent, type: "int64_t", dir: in, role: ListArray-length} + - name: awkward_ListArray64_broadcast_tooffsets_64 + args: + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: offsetslength, type: "int64_t", dir: in, role: default} + - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: lencontent, type: "int64_t", dir: in, role: ListArray-length} + - name: awkward_ListArrayU32_broadcast_tooffsets_64 + args: + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: offsetslength, type: "int64_t", dir: in, role: default} + - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} + - {name: lencontent, type: "int64_t", dir: in, role: ListArray-length} description: null definition: | - def awkward_IndexedArray_numnull_unique_64(toindex, lenindex): - for i in range(lenindex): - toindex[i] = i - toindex[-1] = -1 - automatic-tests: false + def awkward_ListArray_broadcast_tooffsets( + tocarry, fromoffsets, offsetslength, fromstarts, fromstops, lencontent + ): + k = 0 + for i in range(offsetslength - 1): + start = int(fromstarts[i]) + stop = int(fromstops[i]) + if (start != stop) and (stop > lencontent): + raise ValueError("stops[i] > len(content)") + count = int(fromoffsets[i + 1] - fromoffsets[i]) + if count < 0: + raise ValueError("broadcast's offsets must be monotonically increasing") + if (stop - start) != count: + raise ValueError("cannot broadcast nested list") + for j in range(start, stop): + tocarry[k] = float(j) + k = k + 1 + automatic-tests: true manual-tests: [] - - name: awkward_IndexedArray_index_of_nulls + - name: awkward_ListArray_combinations specializations: - - name: awkward_IndexedArray32_index_of_nulls + - name: awkward_ListArray32_combinations_64 args: + - {name: tocarry, type: "List[List[int64_t]]", dir: out} - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - {name: parents, type: "Const[List[int64_t]]", dir: in} - - {name: starts, type: "Const[List[int64_t]]", dir: in} - - name: awkward_IndexedArray64_index_of_nulls + - {name: fromindex, type: "List[int64_t]", dir: in} + - {name: n, type: "int64_t", dir: in} + - {name: replacement, type: "bool", dir: in} + - {name: starts, type: "Const[List[int32_t]]", dir: in} + - {name: stops, type: "Const[List[int32_t]]", dir: in} + - {name: length, type: "int64_t", dir: in} + - name: awkward_ListArray64_combinations_64 args: + - {name: tocarry, type: "List[List[int64_t]]", dir: out} - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - {name: parents, type: "Const[List[int64_t]]", dir: in} + - {name: fromindex, type: "List[int64_t]", dir: in} + - {name: n, type: "int64_t", dir: in} + - {name: replacement, type: "bool", dir: in} - {name: starts, type: "Const[List[int64_t]]", dir: in} - - name: awkward_IndexedArrayU32_index_of_nulls + - {name: stops, type: "Const[List[int64_t]]", dir: in} + - {name: length, type: "int64_t", dir: in} + - name: awkward_ListArrayU32_combinations_64 args: + - {name: tocarry, type: "List[List[int64_t]]", dir: out} - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: lenindex, type: "int64_t", dir: in, role: default} - - {name: parents, type: "Const[List[int64_t]]", dir: in} - - {name: starts, type: "Const[List[int64_t]]", dir: in} + - {name: fromindex, type: "List[int64_t]", dir: in} + - {name: n, type: "int64_t", dir: in} + - {name: replacement, type: "bool", dir: in} + - {name: starts, type: "Const[List[uint32_t]]", dir: in} + - {name: stops, type: "Const[List[uint32_t]]", dir: in} + - {name: length, type: "int64_t", dir: in} description: null definition: | - def awkward_IndexedArray_index_of_nulls(toindex, fromindex, lenindex, parents, starts): - j = 0 - for i in range(lenindex): - if fromindex[i] < 0: - parent = parents[i] - start = starts[parent] - toindex[j] = i - start - j = j + 1 - automatic-tests: true + Insert Python definition here + automatic-tests: false manual-tests: [] - - name: awkward_IndexedArray_overlay_mask + - name: awkward_ListArray_combinations_length specializations: - - name: awkward_IndexedArray32_overlay_mask8_to64 + - name: awkward_ListArray32_combinations_length_64 args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: mask, type: "Const[List[int8_t]]", dir: in, role: ByteMaskedArray-mask} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} + - {name: totallen, type: "List[int64_t]", dir: out} + - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: n, type: "int64_t", dir: in, role: default} + - {name: replacement, type: "bool", dir: in, role: ByteMaskedArray-valid_when} + - {name: starts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} + - {name: stops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArray64_overlay_mask8_to64 + - name: awkward_ListArray64_combinations_length_64 args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: mask, type: "Const[List[int8_t]]", dir: in, role: ByteMaskedArray-mask} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: totallen, type: "List[int64_t]", dir: out} + - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: n, type: "int64_t", dir: in, role: default} + - {name: replacement, type: "bool", dir: in, role: ByteMaskedArray-valid_when} + - {name: starts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: stops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_IndexedArrayU32_overlay_mask8_to64 + - name: awkward_ListArrayU32_combinations_length_64 args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: mask, type: "Const[List[int8_t]]", dir: in, role: ByteMaskedArray-mask} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: totallen, type: "List[int64_t]", dir: out} + - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: n, type: "int64_t", dir: in, role: default} + - {name: replacement, type: "bool", dir: in, role: ByteMaskedArray-valid_when} + - {name: starts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} + - {name: stops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} - {name: length, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_IndexedArray_overlay_mask(toindex, mask, fromindex, length): + def awkward_ListArray_combinations_length( + totallen, tooffsets, n, replacement, starts, stops, length + ): + totallen[0] = 0 + tooffsets[0] = 0 for i in range(length): - m = mask[i] - toindex[i] = -1 if m else fromindex[i] - automatic-tests: false + size = int(stops[i] - starts[i]) + if replacement: + size += n - 1 + thisn = n + + if thisn > size: + combinationslen = 0 + else: + if thisn == size: + combinationslen = 1 + else: + if (thisn * 2) > size: + thisn = size - thisn + combinationslen = size + j = 2 + while j <= thisn: + combinationslen *= (size - j) + 1 + combinationslen /= j + j = j + 1 + totallen[0] = totallen[0] + combinationslen + tooffsets[i + 1] = tooffsets[i] + combinationslen + automatic-tests: true manual-tests: [] - - name: awkward_IndexedArray_reduce_next_64 + - name: awkward_ListArray_compact_offsets specializations: - - name: awkward_IndexedArray32_reduce_next_64 + - name: awkward_ListArray32_compact_offsets_64 args: - - {name: nextcarry, type: "List[int64_t]", dir: out} - - {name: nextparents, type: "List[int64_t]", dir: out} - - {name: outindex, type: "List[int64_t]", dir: out} - - {name: index, type: "Const[List[int32_t]]", dir: in, role: reducer-index} - - {name: parents, type: "List[int64_t]", dir: in, role: reducer-parents} - - {name: length, type: "int64_t", dir: in, role: reducer-length} - - name: awkward_IndexedArray64_reduce_next_64 + - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} + - {name: length, type: "int64_t", dir: in, role: default} + - name: awkward_ListArray64_compact_offsets_64 args: - - {name: nextcarry, type: "List[int64_t]", dir: out} - - {name: nextparents, type: "List[int64_t]", dir: out} - - {name: outindex, type: "List[int64_t]", dir: out} - - {name: index, type: "Const[List[int64_t]]", dir: in, role: reducer-index} - - {name: parents, type: "List[int64_t]", dir: in, role: reducer-parents} - - {name: length, type: "int64_t", dir: in, role: reducer-length} - - name: awkward_IndexedArrayU32_reduce_next_64 + - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: length, type: "int64_t", dir: in, role: default} + - name: awkward_ListArrayU32_compact_offsets_64 args: - - {name: nextcarry, type: "List[int64_t]", dir: out} - - {name: nextparents, type: "List[int64_t]", dir: out} - - {name: outindex, type: "List[int64_t]", dir: out} - - {name: index, type: "Const[List[uint32_t]]", dir: in, role: reducer-index} - - {name: parents, type: "List[int64_t]", dir: in, role: reducer-parents} - - {name: length, type: "int64_t", dir: in, role: reducer-length} + - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} + - {name: length, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_IndexedArray_reduce_next_64( - nextcarry, nextparents, outindex, index, parents, length - ): - k = 0 + def awkward_ListArray_compact_offsets(tooffsets, fromstarts, fromstops, length): + tooffsets[0] = 0 for i in range(length): - if index[i] >= 0: - nextcarry[k] = index[i] - nextparents[k] = parents[i] - outindex[i] = k - k = k + 1 - else: - outindex[i] = -1 + start = fromstarts[i] + stop = fromstops[i] + if stop < start: + raise ValueError("stops[i] < starts[i]") + tooffsets[i + 1] = tooffsets[i] + (stop - start) automatic-tests: true manual-tests: [] - - name: awkward_IndexedArray_reduce_next_fix_offsets_64 + - name: awkward_ListArray_fill specializations: - - name: awkward_IndexedArray_reduce_next_fix_offsets_64 + - name: awkward_ListArray_fill_to64_from32 args: - - {name: outoffsets, type: "List[int64_t]", dir: out} - - {name: starts, type: "Const[List[int64_t]]", dir: in, role: reducer-starts} - - {name: startslength, type: "int64_t", dir: in, role: reducer-startslength} - - {name: outindexlength, type: "int64_t", dir: in, role: reducer-outindexlength} + - {name: tostarts, type: "List[int64_t]", dir: out} + - {name: tostartsoffset, type: "int64_t", dir: in, role: default} + - {name: tostops, type: "List[int64_t]", dir: out} + - {name: tostopsoffset, type: "int64_t", dir: in, role: default} + - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} + - {name: length, type: "int64_t", dir: in, role: default} + - {name: base, type: "int64_t", dir: in, role: default} + - name: awkward_ListArray_fill_to64_from64 + args: + - {name: tostarts, type: "List[int64_t]", dir: out} + - {name: tostartsoffset, type: "int64_t", dir: in, role: default} + - {name: tostops, type: "List[int64_t]", dir: out} + - {name: tostopsoffset, type: "int64_t", dir: in, role: default} + - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: length, type: "int64_t", dir: in, role: default} + - {name: base, type: "int64_t", dir: in, role: default} + - name: awkward_ListArray_fill_to64_fromU32 + args: + - {name: tostarts, type: "List[int64_t]", dir: out} + - {name: tostartsoffset, type: "int64_t", dir: in, role: default} + - {name: tostops, type: "List[int64_t]", dir: out} + - {name: tostopsoffset, type: "int64_t", dir: in, role: default} + - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} + - {name: length, type: "int64_t", dir: in, role: default} + - {name: base, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_IndexedArray_reduce_next_fix_offsets_64( - outoffsets, starts, startslength, outindexlength + def awkward_ListArray_fill( + tostarts, + tostartsoffset, + tostops, + tostopsoffset, + fromstarts, + fromstops, + length, + base, ): - for i in range(startslength): - outoffsets[i] = starts[i] - outoffsets[startslength] = outindexlength + for i in range(length): + tostarts[tostartsoffset + i] = float(fromstarts[i] + base) + tostops[tostopsoffset + i] = float(fromstops[i] + base) automatic-tests: true manual-tests: [] - - name: awkward_IndexedArray_unique_next_index_and_offsets_64 + - name: awkward_ListArray_getitem_jagged_apply specializations: - - name: awkward_IndexedArray_unique_next_index_and_offsets_64 + - name: awkward_ListArray32_getitem_jagged_apply_64 args: - - {name: toindex, type: "List[int64_t]", dir: out} - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: reducer-starts} - - {name: fromnulls, type: "Const[List[int64_t]]", dir: in, role: reducer-starts} - - {name: startslength, type: "int64_t", dir: in, role: reducer-startslength} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: slicestarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: slicestops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: sliceouterlen, type: "int64_t", dir: in, role: ListArray-length} + - {name: sliceindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: sliceinnerlen, type: "int64_t", dir: in, role: IndexedArray-length} + - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray2-starts} + - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray2-stops} + - {name: contentlen, type: "int64_t", dir: in, role: ListArray2-length} + - name: awkward_ListArray64_getitem_jagged_apply_64 + args: + - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: slicestarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: slicestops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: sliceouterlen, type: "int64_t", dir: in, role: ListArray-length} + - {name: sliceindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: sliceinnerlen, type: "int64_t", dir: in, role: IndexedArray-length} + - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray2-starts} + - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray2-stops} + - {name: contentlen, type: "int64_t", dir: in, role: ListArray2-length} + - name: awkward_ListArrayU32_getitem_jagged_apply_64 + args: + - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: slicestarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: slicestops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: sliceouterlen, type: "int64_t", dir: in, role: ListArray-length} + - {name: sliceindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: sliceinnerlen, type: "int64_t", dir: in, role: IndexedArray-length} + - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray2-starts} + - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray2-stops} + - {name: contentlen, type: "int64_t", dir: in, role: ListArray2-length} description: null definition: | - def awkward_IndexedArray_unique_next_index_and_offsets_64( - toindex, tooffsets, fromoffsets, fromnulls, startslength + def awkward_ListArray_getitem_jagged_apply( + tooffsets, + tocarry, + slicestarts, + slicestops, + sliceouterlen, + sliceindex, + sliceinnerlen, + fromstarts, + fromstops, + contentlen, ): k = 0 - ll = 0 - shift = 0 - toindex[0] = ll - tooffsets[0] = fromoffsets[0] - for i in range(startslength): - for _j in range(fromoffsets[i], fromoffsets[i + 1]): - toindex[k] = ll - k += 1 - ll += 1 - if fromnulls[k] == 1: - toindex[k] = -1 - k += 1 - shift += 1 - tooffsets[i + 1] = fromoffsets[i + 1] + shift - automatic-tests: false + for i in range(sliceouterlen): + slicestart = slicestarts[i] + slicestop = slicestops[i] + tooffsets[i] = float(k) + if slicestart != slicestop: + if slicestop < slicestart: + raise ValueError("jagged slice's stops[i] < starts[i]") + if slicestop > sliceinnerlen: + raise ValueError("jagged slice's offsets extend beyond its content") + start = int(fromstarts[i]) + stop = int(fromstops[i]) + if stop < start: + raise ValueError("stops[i] < starts[i]") + if (start != stop) and (stop > contentlen): + raise ValueError("stops[i] > len(content)") + count = stop - start + for j in range(slicestart, slicestop): + index = int(sliceindex[j]) + if index < 0: + index += count + if not ((0 <= index) and (index < count)): + raise ValueError("index out of range") + tocarry[k] = start + index + k = k + 1 + tooffsets[i + 1] = float(k) + automatic-tests: true manual-tests: [] - - name: awkward_IndexedArray_reduce_next_nonlocal_nextshifts_64 + - name: awkward_ListArray_getitem_jagged_carrylen specializations: - - name: awkward_IndexedArray32_reduce_next_nonlocal_nextshifts_64 - args: - - {name: nextshifts, type: "List[int64_t]", dir: out} - - {name: index, type: "Const[List[int32_t]]", dir: in, role: reducer-nextshifts} - - {name: length, type: "int64_t", dir: in, role: reducer-length} - - name: awkward_IndexedArray64_reduce_next_nonlocal_nextshifts_64 - args: - - {name: nextshifts, type: "List[int64_t]", dir: out} - - {name: index, type: "Const[List[int64_t]]", dir: in, role: reducer-nextshifts} - - {name: length, type: "int64_t", dir: in, role: reducer-length} - - name: awkward_IndexedArrayU32_reduce_next_nonlocal_nextshifts_64 + - name: awkward_ListArray_getitem_jagged_carrylen_64 args: - - {name: nextshifts, type: "List[int64_t]", dir: out} - - {name: index, type: "Const[List[uint32_t]]", dir: in, role: reducer-nextshifts} - - {name: length, type: "int64_t", dir: in, role: reducer-length} + - {name: carrylen, type: "List[int64_t]", dir: out} + - {name: slicestarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: slicestops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: sliceouterlen, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_IndexedArray_reduce_next_nonlocal_nextshifts_64(nextshifts, index, length): - nullsum = 0 - k = 0 - for i in range(length): - if index[i] >= 0: - nextshifts[k] = nullsum - k = k + 1 - else: - nullsum = nullsum + 1 + def awkward_ListArray_getitem_jagged_carrylen( + carrylen, slicestarts, slicestops, sliceouterlen + ): + carrylen[0] = 0 + for i in range(sliceouterlen): + carrylen[0] = carrylen[0] + int(slicestops[i] - slicestarts[i]) automatic-tests: true manual-tests: [] - - name: awkward_IndexedArray_reduce_next_nonlocal_nextshifts_fromshifts_64 + - name: awkward_ListArray_getitem_jagged_descend specializations: - - name: awkward_IndexedArray32_reduce_next_nonlocal_nextshifts_fromshifts_64 + - name: awkward_ListArray32_getitem_jagged_descend_64 args: - - {name: nextshifts, type: "List[int64_t]", dir: out} - - {name: index, type: "Const[List[int32_t]]", dir: in, role: reducer-nextshifts} - - {name: length, type: "int64_t", dir: in, role: reducer-length} - - {name: shifts, type: "Const[List[int64_t]]", dir: in, role: reducer-shifts} - - name: awkward_IndexedArray64_reduce_next_nonlocal_nextshifts_fromshifts_64 + - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: slicestarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: slicestops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: sliceouterlen, type: "int64_t", dir: in, role: default} + - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray2-starts} + - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray2-stops} + - name: awkward_ListArray64_getitem_jagged_descend_64 args: - - {name: nextshifts, type: "List[int64_t]", dir: out} - - {name: index, type: "Const[List[int64_t]]", dir: in, role: reducer-nextshifts} - - {name: length, type: "int64_t", dir: in, role: reducer-length} - - {name: shifts, type: "Const[List[int64_t]]", dir: in, role: reducer-shifts} - - name: awkward_IndexedArrayU32_reduce_next_nonlocal_nextshifts_fromshifts_64 + - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: slicestarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: slicestops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: sliceouterlen, type: "int64_t", dir: in, role: default} + - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray2-starts} + - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray2-stops} + - name: awkward_ListArrayU32_getitem_jagged_descend_64 args: - - {name: nextshifts, type: "List[int64_t]", dir: out} - - {name: index, type: "Const[List[uint32_t]]", dir: in, role: reducer-nextshifts} - - {name: length, type: "int64_t", dir: in, role: reducer-length} - - {name: shifts, type: "Const[List[int64_t]]", dir: in, role: reducer-shifts} + - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: slicestarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: slicestops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: sliceouterlen, type: "int64_t", dir: in, role: default} + - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray2-starts} + - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray2-stops} description: null definition: | - def awkward_IndexedArray_reduce_next_nonlocal_nextshifts_fromshifts_64( - nextshifts, index, length, shifts + def awkward_ListArray_getitem_jagged_descend( + tooffsets, slicestarts, slicestops, sliceouterlen, fromstarts, fromstops ): - nullsum = 0 - k = 0 - for i in range(length): - if index[i] >= 0: - nextshifts[k] = shifts[i] + nullsum - k = k + 1 - else: - nullsum = nullsum + 1 + if sliceouterlen == 0: + tooffsets[0] = 0 + else: + tooffsets[0] = slicestarts[0] + for i in range(sliceouterlen): + slicecount = int(slicestops[i] - slicestarts[i]) + count = int(fromstops[i] - fromstarts[i]) + if slicecount != count: + raise ValueError( + "jagged slice inner length differs from array inner length" + ) + tooffsets[i + 1] = tooffsets[i] + float(count) automatic-tests: true manual-tests: [] - - name: awkward_IndexedArray_simplify + - name: awkward_ListArray_getitem_jagged_expand specializations: - - name: awkward_IndexedArray32_simplify32_to64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: outerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: outerlength, type: "int64_t", dir: in, role: default} - - {name: innerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray2-index} - - {name: innerlength, type: "int64_t", dir: in, role: IndexedArray-length} - - name: awkward_IndexedArray32_simplify64_to64 + - name: awkward_ListArray32_getitem_jagged_expand_64 args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: outerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: outerlength, type: "int64_t", dir: in, role: default} - - {name: innerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray2-index} - - {name: innerlength, type: "int64_t", dir: in, role: IndexedArray-length} - - name: awkward_IndexedArray32_simplifyU32_to64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: outerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: outerlength, type: "int64_t", dir: in, role: default} - - {name: innerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray2-index} - - {name: innerlength, type: "int64_t", dir: in, role: IndexedArray-length} - - name: awkward_IndexedArray64_simplify32_to64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: outerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: outerlength, type: "int64_t", dir: in, role: default} - - {name: innerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray2-index} - - {name: innerlength, type: "int64_t", dir: in, role: IndexedArray-length} - - name: awkward_IndexedArray64_simplify64_to64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: outerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: outerlength, type: "int64_t", dir: in, role: default} - - {name: innerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray2-index} - - {name: innerlength, type: "int64_t", dir: in, role: IndexedArray-length} - - name: awkward_IndexedArray64_simplifyU32_to64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: outerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: outerlength, type: "int64_t", dir: in, role: default} - - {name: innerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray2-index} - - {name: innerlength, type: "int64_t", dir: in, role: IndexedArray-length} - - name: awkward_IndexedArrayU32_simplify32_to64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: outerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: outerlength, type: "int64_t", dir: in, role: default} - - {name: innerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray2-index} - - {name: innerlength, type: "int64_t", dir: in, role: IndexedArray-length} - - name: awkward_IndexedArrayU32_simplify64_to64 + - {name: multistarts, type: "List[int64_t]", dir: out} + - {name: multistops, type: "List[int64_t]", dir: out} + - {name: singleoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} + - {name: jaggedsize, type: "int64_t", dir: in, role: ListArray-at} + - {name: length, type: "int64_t", dir: in, role: default} + - name: awkward_ListArray64_getitem_jagged_expand_64 args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: outerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: outerlength, type: "int64_t", dir: in, role: default} - - {name: innerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray2-index} - - {name: innerlength, type: "int64_t", dir: in, role: IndexedArray-length} - - name: awkward_IndexedArrayU32_simplifyU32_to64 + - {name: multistarts, type: "List[int64_t]", dir: out} + - {name: multistops, type: "List[int64_t]", dir: out} + - {name: singleoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: jaggedsize, type: "int64_t", dir: in, role: ListArray-at} + - {name: length, type: "int64_t", dir: in, role: default} + - name: awkward_ListArrayU32_getitem_jagged_expand_64 args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: outerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: outerlength, type: "int64_t", dir: in, role: default} - - {name: innerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray2-index} - - {name: innerlength, type: "int64_t", dir: in, role: IndexedArray-length} + - {name: multistarts, type: "List[int64_t]", dir: out} + - {name: multistops, type: "List[int64_t]", dir: out} + - {name: singleoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} + - {name: jaggedsize, type: "int64_t", dir: in, role: ListArray-at} + - {name: length, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_IndexedArray_simplify( - toindex, outerindex, outerlength, innerindex, innerlength + def awkward_ListArray_getitem_jagged_expand( + multistarts, + multistops, + singleoffsets, + tocarry, + fromstarts, + fromstops, + jaggedsize, + length, ): - for i in range(outerlength): - j = outerindex[i] - if j < 0: - toindex[i] = -1 - else: - if j >= innerlength: - raise ValueError("index out of range") - else: - toindex[i] = innerindex[j] + for i in range(length): + start = fromstarts[i] + stop = fromstops[i] + if stop < start: + raise ValueError("stops[i] < starts[i]") + if (stop - start) != jaggedsize: + raise ValueError("cannot fit jagged slice into nested list") + for j in range(jaggedsize): + multistarts[(i * jaggedsize) + j] = singleoffsets[j] + multistops[(i * jaggedsize) + j] = singleoffsets[j + 1] + tocarry[(i * jaggedsize) + j] = start + j automatic-tests: true manual-tests: [] - - name: awkward_IndexedArray_validity + - name: awkward_ListArray_getitem_jagged_numvalid specializations: - - name: awkward_IndexedArray32_validity - args: - - {name: index, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: IndexedArray-length} - - {name: isoption, type: "bool", dir: in, role: ByteMaskedArray-valid_when} - - name: awkward_IndexedArray64_validity - args: - - {name: index, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: IndexedArray-length} - - {name: isoption, type: "bool", dir: in, role: ByteMaskedArray-valid_when} - - name: awkward_IndexedArrayU32_validity + - name: awkward_ListArray_getitem_jagged_numvalid_64 args: - - {name: index, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: numvalid, type: "List[int64_t]", dir: out} + - {name: slicestarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: slicestops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - {name: length, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: IndexedArray-length} - - {name: isoption, type: "bool", dir: in, role: ByteMaskedArray-valid_when} + - {name: missing, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: missinglength, type: "int64_t", dir: in, role: IndexedArray-length} description: null definition: | - def awkward_IndexedArray_validity(index, length, lencontent, isoption): + def awkward_ListArray_getitem_jagged_numvalid( + numvalid, slicestarts, slicestops, length, missing, missinglength + ): + numvalid[0] = 0 for i in range(length): - idx = index[i] - if not (isoption): - if idx < 0: - raise ValueError("index[i] < 0") - if idx >= lencontent: - raise ValueError("index[i] >= len(content)") - automatic-tests: true + slicestart = slicestarts[i] + slicestop = slicestops[i] + if slicestart != slicestop: + if slicestop < slicestart: + raise ValueError("jagged slice's stops[i] < starts[i]") + if slicestop > missinglength: + raise ValueError("jagged slice's offsets extend beyond its content") + for j in range(slicestart, slicestop): + numvalid[0] = numvalid[0] + 1 if missing[j] >= 0 else 0 + automatic-tests: false manual-tests: [] - - name: awkward_IndexedArray_ranges_next_64 + - name: awkward_ListArray_getitem_jagged_shrink specializations: - - name: awkward_IndexedArray32_ranges_next_64 - args: - - {name: index, type: "Const[List[int32_t]]", dir: in, role: rangesr-index} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: tostarts, type: "List[int64_t]", dir: out} - - {name: tostops, type: "List[int64_t]", dir: out} - - {name: tolength, type: "List[int64_t]", dir: out, role: default} - - name: awkward_IndexedArray64_ranges_next_64 - args: - - {name: index, type: "Const[List[int64_t]]", dir: in, role: rangesr-index} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: tostarts, type: "List[int64_t]", dir: out} - - {name: tostops, type: "List[int64_t]", dir: out} - - {name: tolength, type: "List[int64_t]", dir: out, role: default} - - name: awkward_IndexedArrayU32_ranges_next_64 + - name: awkward_ListArray_getitem_jagged_shrink_64 args: - - {name: index, type: "Const[List[uint32_t]]", dir: in, role: rangesr-index} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: tosmalloffsets, type: "List[int64_t]", dir: out} + - {name: tolargeoffsets, type: "List[int64_t]", dir: out} + - {name: slicestarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: slicestops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - {name: length, type: "int64_t", dir: in, role: default} - - {name: tostarts, type: "List[int64_t]", dir: out} - - {name: tostops, type: "List[int64_t]", dir: out} - - {name: tolength, type: "List[int64_t]", dir: out, role: default} + - {name: missing, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} description: null definition: | - def awkward_IndexedArray_ranges_next_64( - index, fromstarts, fromstops, length, tostarts, tostops, tolength + def awkward_ListArray_getitem_jagged_shrink( + tocarry, tosmalloffsets, tolargeoffsets, slicestarts, slicestops, length, missing ): k = 0 + if length == 0: + tosmalloffsets[0] = 0 + tolargeoffsets[0] = 0 + else: + tosmalloffsets[0] = slicestarts[0] + tolargeoffsets[0] = slicestarts[0] for i in range(length): - stride = fromstops[i] - fromstarts[i] - tostarts[i] = k - for j in range(stride): - if index[fromstarts[i] + j] > 0: - k = k + 1 - tostops[i] = k - tolength = k - automatic-tests: false + slicestart = slicestarts[i] + slicestop = slicestops[i] + if slicestart != slicestop: + smallcount = 0 + for j in range(slicestart, slicestop): + if missing[j] >= 0: + tocarry[k] = j + k = k + 1 + smallcount = smallcount + 1 + tosmalloffsets[i + 1] = tosmalloffsets[i] + smallcount + else: + tosmalloffsets[i + 1] = tosmalloffsets[i] + tolargeoffsets[i + 1] = tolargeoffsets[i] + (slicestop - slicestart) + automatic-tests: true manual-tests: [] - - - name: awkward_IndexedArray_ranges_carry_next_64 + - name: awkward_ListArray_getitem_next_array specializations: - - name: awkward_IndexedArray32_ranges_carry_next_64 + - name: awkward_ListArray32_getitem_next_array_64 args: - - {name: index, type: "Const[List[int32_t]]", dir: in, role: rangesr-index} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: length, type: "int64_t", dir: in, role: default} - {name: tocarry, type: "List[int64_t]", dir: out} - - name: awkward_IndexedArray64_ranges_carry_next_64 + - {name: toadvanced, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} + - {name: fromarray, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - {name: lenarray, type: "int64_t", dir: in, role: default} + - {name: lencontent, type: "int64_t", dir: in, role: ListArray-length} + - name: awkward_ListArray64_getitem_next_array_64 args: - - {name: index, type: "Const[List[int64_t]]", dir: in, role: rangesr-index} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: length, type: "int64_t", dir: in, role: default} - {name: tocarry, type: "List[int64_t]", dir: out} - - name: awkward_IndexedArrayU32_ranges_carry_next_64 - args: - - {name: index, type: "Const[List[uint32_t]]", dir: in, role: rangesr-index} + - {name: toadvanced, type: "List[int64_t]", dir: out} - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: length, type: "int64_t", dir: in, role: default} + - {name: fromarray, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - {name: lenarray, type: "int64_t", dir: in, role: default} + - {name: lencontent, type: "int64_t", dir: in, role: ListArray-length} + - name: awkward_ListArrayU32_getitem_next_array_64 + args: - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: toadvanced, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} + - {name: fromarray, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - {name: lenarray, type: "int64_t", dir: in, role: default} + - {name: lencontent, type: "int64_t", dir: in, role: ListArray-length} description: null definition: | - def awkward_IndexedArray_ranges_carry_next_64( - index, fromstarts, fromstops, length, tocarry + def awkward_ListArray_getitem_next_array( + tocarry, + toadvanced, + fromstarts, + fromstops, + fromarray, + lenstarts, + lenarray, + lencontent, ): - k = 0 - for i in range(length): - stride = fromstops[i] - fromstarts[i] - for j in range(stride): - if index[fromstarts[i] + j] > 0: - tocarry[k] = index[fromstarts[i] + j] - k = k + 1 - automatic-tests: false - manual-tests: [] - - - - name: awkward_IndexedOptionArray_rpad_and_clip_mask_axis1 - specializations: - - name: awkward_IndexedOptionArray_rpad_and_clip_mask_axis1_64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: frommask, type: "Const[List[int8_t]]", dir: in, role: ByteMaskedArray-mask} - - {name: length, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_IndexedOptionArray_rpad_and_clip_mask_axis1(toindex, frommask, length): - count = 0 - for i in range(length): - if frommask[i]: - toindex[i] = -1 - else: - toindex[i] = count - count = count + 1 + for i in range(lenstarts): + if fromstops[i] < fromstarts[i]: + raise ValueError("stops[i] < starts[i]") + if (fromstarts[i] != fromstops[i]) and (fromstops[i] > lencontent): + raise ValueError("stops[i] > len(content)") + length = fromstops[i] - fromstarts[i] + for j in range(lenarray): + regular_at = fromarray[j] + if regular_at < 0: + regular_at += length + if not ((0 <= regular_at) and (regular_at < length)): + raise ValueError("index out of range") + tocarry[(i * lenarray) + j] = fromstarts[i] + regular_at + toadvanced[(i * lenarray) + j] = j automatic-tests: true manual-tests: [] - - name: awkward_ListArray_broadcast_tooffsets + - name: awkward_ListArray_getitem_next_array_advanced specializations: - - name: awkward_ListArray32_broadcast_tooffsets_64 + - name: awkward_ListArray32_getitem_next_array_advanced_64 args: - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} + - {name: toadvanced, type: "List[int64_t]", dir: out} - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} + - {name: fromarray, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: fromadvanced, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray2-offsets} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - {name: lenarray, type: "int64_t", dir: in, role: default} - {name: lencontent, type: "int64_t", dir: in, role: ListArray-length} - - name: awkward_ListArray64_broadcast_tooffsets_64 + - name: awkward_ListArray64_getitem_next_array_advanced_64 args: - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} + - {name: toadvanced, type: "List[int64_t]", dir: out} - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: fromarray, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: fromadvanced, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray2-offsets} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - {name: lenarray, type: "int64_t", dir: in, role: default} - {name: lencontent, type: "int64_t", dir: in, role: ListArray-length} - - name: awkward_ListArrayU32_broadcast_tooffsets_64 + - name: awkward_ListArrayU32_getitem_next_array_advanced_64 args: - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} + - {name: toadvanced, type: "List[int64_t]", dir: out} - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} + - {name: fromarray, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: fromadvanced, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray2-offsets} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - {name: lenarray, type: "int64_t", dir: in, role: default} - {name: lencontent, type: "int64_t", dir: in, role: ListArray-length} description: null definition: | - def awkward_ListArray_broadcast_tooffsets( - tocarry, fromoffsets, offsetslength, fromstarts, fromstops, lencontent + def awkward_ListArray_getitem_next_array_advanced( + tocarry, + toadvanced, + fromstarts, + fromstops, + fromarray, + fromadvanced, + lenstarts, + lenarray, + lencontent, ): - k = 0 - for i in range(offsetslength - 1): - start = int(fromstarts[i]) - stop = int(fromstops[i]) - if (start != stop) and (stop > lencontent): + for i in range(lenstarts): + if fromstops[i] < fromstarts[i]: + raise ValueError("stops[i] < starts[i]") + if (fromstarts[i] != fromstops[i]) and (fromstops[i] > lencontent): raise ValueError("stops[i] > len(content)") - count = int(fromoffsets[i + 1] - fromoffsets[i]) - if count < 0: - raise ValueError("broadcast's offsets must be monotonically increasing") - if (stop - start) != count: - raise ValueError("cannot broadcast nested list") - for j in range(start, stop): - tocarry[k] = float(j) - k = k + 1 + length = fromstops[i] - fromstarts[i] + regular_at = fromarray[fromadvanced[i]] + if regular_at < 0: + regular_at += length + if not ((0 <= regular_at) and (regular_at < length)): + raise ValueError("index out of range") + tocarry[i] = fromstarts[i] + regular_at + toadvanced[i] = i automatic-tests: true manual-tests: [] - - name: awkward_ListArray_combinations + - name: awkward_ListArray_getitem_next_at specializations: - - name: awkward_ListArray32_combinations_64 + - name: awkward_ListArray32_getitem_next_at_64 args: - - {name: tocarry, type: "List[List[int64_t]]", dir: out} - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "List[int64_t]", dir: in} - - {name: n, type: "int64_t", dir: in} - - {name: replacement, type: "bool", dir: in} - - {name: starts, type: "Const[List[int32_t]]", dir: in} - - {name: stops, type: "Const[List[int32_t]]", dir: in} - - {name: length, type: "int64_t", dir: in} - - name: awkward_ListArray64_combinations_64 + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - {name: at, type: "int64_t", dir: in, role: ListArray-at} + - name: awkward_ListArray64_getitem_next_at_64 args: - - {name: tocarry, type: "List[List[int64_t]]", dir: out} - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "List[int64_t]", dir: in} - - {name: n, type: "int64_t", dir: in} - - {name: replacement, type: "bool", dir: in} - - {name: starts, type: "Const[List[int64_t]]", dir: in} - - {name: stops, type: "Const[List[int64_t]]", dir: in} - - {name: length, type: "int64_t", dir: in} - - name: awkward_ListArrayU32_combinations_64 + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - {name: at, type: "int64_t", dir: in, role: ListArray-at} + - name: awkward_ListArrayU32_getitem_next_at_64 args: - - {name: tocarry, type: "List[List[int64_t]]", dir: out} - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "List[int64_t]", dir: in} - - {name: n, type: "int64_t", dir: in} - - {name: replacement, type: "bool", dir: in} - - {name: starts, type: "Const[List[uint32_t]]", dir: in} - - {name: stops, type: "Const[List[uint32_t]]", dir: in} - - {name: length, type: "int64_t", dir: in} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - {name: at, type: "int64_t", dir: in, role: ListArray-at} description: null definition: | - Insert Python definition here - automatic-tests: false + def awkward_ListArray_getitem_next_at(tocarry, fromstarts, fromstops, lenstarts, at): + for i in range(lenstarts): + length = fromstops[i] - fromstarts[i] + regular_at = at + if regular_at < 0: + regular_at += length + if not ((0 <= regular_at) and (regular_at < length)): + raise ValueError("index out of range") + tocarry[i] = fromstarts[i] + regular_at + automatic-tests: true manual-tests: [] - - name: awkward_ListArray_combinations_length + - name: awkward_ListArray_getitem_next_range specializations: - - name: awkward_ListArray32_combinations_length_64 + - name: awkward_ListArray32_getitem_next_range_64 args: - - {name: totallen, type: "List[int64_t]", dir: out} - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: n, type: "int64_t", dir: in, role: default} - - {name: replacement, type: "bool", dir: in, role: ByteMaskedArray-valid_when} - - {name: starts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} - - {name: stops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_ListArray64_combinations_length_64 + - {name: tooffsets, type: "List[int32_t]", dir: out} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: default} + - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: default} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - {name: start, type: "int64_t", dir: in, role: default} + - {name: stop, type: "int64_t", dir: in, role: default} + - {name: step, type: "int64_t", dir: in, role: default} + - name: awkward_ListArray64_getitem_next_range_64 args: - - {name: totallen, type: "List[int64_t]", dir: out} - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: n, type: "int64_t", dir: in, role: default} - - {name: replacement, type: "bool", dir: in, role: ByteMaskedArray-valid_when} - - {name: starts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: stops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_ListArrayU32_combinations_length_64 + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: default} + - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: default} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - {name: start, type: "int64_t", dir: in, role: default} + - {name: stop, type: "int64_t", dir: in, role: default} + - {name: step, type: "int64_t", dir: in, role: default} + - name: awkward_ListArrayU32_getitem_next_range_64 args: - - {name: totallen, type: "List[int64_t]", dir: out} - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: n, type: "int64_t", dir: in, role: default} - - {name: replacement, type: "bool", dir: in, role: ByteMaskedArray-valid_when} - - {name: starts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} - - {name: stops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} - - {name: length, type: "int64_t", dir: in, role: default} + - {name: tooffsets, type: "List[uint32_t]", dir: out} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: default} + - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: default} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - {name: start, type: "int64_t", dir: in, role: default} + - {name: stop, type: "int64_t", dir: in, role: default} + - {name: step, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_ListArray_combinations_length( - totallen, tooffsets, n, replacement, starts, stops, length + def awkward_ListArray_getitem_next_range( + tooffsets, tocarry, fromstarts, fromstops, lenstarts, start, stop, step ): - totallen[0] = 0 + k = 0 tooffsets[0] = 0 - for i in range(length): - size = int(stops[i] - starts[i]) - if replacement: - size += n - 1 - thisn = n - - if thisn > size: - combinationslen = 0 - else: - if thisn == size: - combinationslen = 1 - else: - if (thisn * 2) > size: - thisn = size - thisn - combinationslen = size - j = 2 - while j <= thisn: - combinationslen *= (size - j) + 1 - combinationslen /= j - j = j + 1 - totallen[0] = totallen[0] + combinationslen - tooffsets[i + 1] = tooffsets[i] + combinationslen + if step > 0: + for i in range(lenstarts): + length = fromstops[i] - fromstarts[i] + regular_start = start + regular_stop = stop + awkward_regularize_rangeslice( + regular_start, + regular_stop, + step > 0, + start != kSliceNone, + stop != kSliceNone, + length, + ) + j = regular_start + while j < regular_stop: + tocarry[k] = fromstarts[i] + j + k = k + 1 + j += step + tooffsets[i + 1] = float(k) + else: + for i in range(lenstarts): + length = fromstops[i] - fromstarts[i] + regular_start = start + regular_stop = stop + awkward_regularize_rangeslice( + regular_start, + regular_stop, + step > 0, + start != kSliceNone, + stop != kSliceNone, + length, + ) + j = regular_start + while j > regular_stop: + tocarry[k] = fromstarts[i] + j + k = k + 1 + j += step + tooffsets[i + 1] = float(k) + automatic-tests: false + manual-tests: [] + + - name: awkward_ListArray_getitem_next_range_carrylength + specializations: + - name: awkward_ListArray32_getitem_next_range_carrylength + args: + - {name: carrylength, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: default} + - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: default} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - {name: start, type: "int64_t", dir: in, role: default} + - {name: stop, type: "int64_t", dir: in, role: default} + - {name: step, type: "int64_t", dir: in, role: default} + - name: awkward_ListArray64_getitem_next_range_carrylength + args: + - {name: carrylength, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: default} + - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: default} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - {name: start, type: "int64_t", dir: in, role: default} + - {name: stop, type: "int64_t", dir: in, role: default} + - {name: step, type: "int64_t", dir: in, role: default} + - name: awkward_ListArrayU32_getitem_next_range_carrylength + args: + - {name: carrylength, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: default} + - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: default} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - {name: start, type: "int64_t", dir: in, role: default} + - {name: stop, type: "int64_t", dir: in, role: default} + - {name: step, type: "int64_t", dir: in, role: default} + description: null + definition: | + def awkward_ListArray_getitem_next_range_carrylength( + carrylength, fromstarts, fromstops, lenstarts, start, stop, step + ): + carrylength[0] = 0 + for i in range(lenstarts): + length = fromstops[i] - fromstarts[i] + regular_start = start + regular_stop = stop + awkward_regularize_rangeslice( + regular_start, + regular_stop, + step > 0, + start != kSliceNone, + stop != kSliceNone, + length, + ) + if step > 0: + j = regular_start + while j < regular_stop: + carrylength[0] = carrylength[0] + 1 + j += step + else: + j = regular_start + while j > regular_stop: + carrylength[0] = carrylength[0] + 1 + j += step + automatic-tests: false + manual-tests: [] + + - name: awkward_ListArray_getitem_next_range_counts + specializations: + - name: awkward_ListArray32_getitem_next_range_counts_64 + args: + - {name: total, type: "List[int64_t]", dir: out} + - {name: fromoffsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - name: awkward_ListArray64_getitem_next_range_counts_64 + args: + - {name: total, type: "List[int64_t]", dir: out} + - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - name: awkward_ListArrayU32_getitem_next_range_counts_64 + args: + - {name: total, type: "List[int64_t]", dir: out} + - {name: fromoffsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + description: null + definition: | + def awkward_ListArray_getitem_next_range_counts(total, fromoffsets, lenstarts): + total[0] = 0 + for i in range(lenstarts): + total[0] = (total[0] + fromoffsets[i + 1]) - fromoffsets[i] automatic-tests: true manual-tests: [] - - name: awkward_ListArray_compact_offsets + - name: awkward_ListArray_getitem_next_range_spreadadvanced specializations: - - name: awkward_ListArray32_compact_offsets_64 + - name: awkward_ListArray32_getitem_next_range_spreadadvanced_64 args: - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} + - {name: toadvanced, type: "List[int64_t]", dir: out} + - {name: fromadvanced, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: fromoffsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - name: awkward_ListArray64_getitem_next_range_spreadadvanced_64 + args: + - {name: toadvanced, type: "List[int64_t]", dir: out} + - {name: fromadvanced, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - name: awkward_ListArrayU32_getitem_next_range_spreadadvanced_64 + args: + - {name: toadvanced, type: "List[int64_t]", dir: out} + - {name: fromadvanced, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: fromoffsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + description: null + definition: | + def awkward_ListArray_getitem_next_range_spreadadvanced( + toadvanced, fromadvanced, fromoffsets, lenstarts + ): + for i in range(lenstarts): + count = fromoffsets[i + 1] - fromoffsets[i] + for j in range(count): + toadvanced[fromoffsets[i] + j] = fromadvanced[i] + automatic-tests: false + manual-tests: [] + + - name: awkward_ListArray_localindex + specializations: + - name: awkward_ListArray32_localindex_64 + args: + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: offsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_ListArray64_compact_offsets_64 + - name: awkward_ListArray64_localindex_64 args: - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_ListArrayU32_compact_offsets_64 + - name: awkward_ListArrayU32_localindex_64 args: - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: offsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} - {name: length, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_ListArray_compact_offsets(tooffsets, fromstarts, fromstops, length): - tooffsets[0] = 0 + def awkward_ListArray_localindex(toindex, offsets, length): for i in range(length): - start = fromstarts[i] - stop = fromstops[i] - if stop < start: - raise ValueError("stops[i] < starts[i]") - tooffsets[i + 1] = tooffsets[i] + (stop - start) + start = int(offsets[i]) + stop = int(offsets[i + 1]) + for j in range(start, stop): + toindex[j] = j - start automatic-tests: true manual-tests: [] - - name: awkward_ListArray_fill + - name: awkward_ListArray_min_range specializations: - - name: awkward_ListArray_fill_to64_from32 + - name: awkward_ListArray32_min_range args: - - {name: tostarts, type: "List[int64_t]", dir: out} - - {name: tostartsoffset, type: "int64_t", dir: in, role: default} - - {name: tostops, type: "List[int64_t]", dir: out} - - {name: tostopsoffset, type: "int64_t", dir: in, role: default} + - {name: tomin, type: "List[int64_t]", dir: out} - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} - - name: awkward_ListArray_fill_to64_from64 + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - name: awkward_ListArray64_min_range args: - - {name: tostarts, type: "List[int64_t]", dir: out} - - {name: tostartsoffset, type: "int64_t", dir: in, role: default} - - {name: tostops, type: "List[int64_t]", dir: out} - - {name: tostopsoffset, type: "int64_t", dir: in, role: default} + - {name: tomin, type: "List[int64_t]", dir: out} - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} - - name: awkward_ListArray_fill_to64_fromU32 + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - name: awkward_ListArrayU32_min_range args: - - {name: tostarts, type: "List[int64_t]", dir: out} - - {name: tostartsoffset, type: "int64_t", dir: in, role: default} - - {name: tostops, type: "List[int64_t]", dir: out} - - {name: tostopsoffset, type: "int64_t", dir: in, role: default} + - {name: tomin, type: "List[int64_t]", dir: out} - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} + - {name: lenstarts, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_ListArray_fill( - tostarts, - tostartsoffset, - tostops, - tostopsoffset, - fromstarts, - fromstops, - length, - base, - ): - for i in range(length): - tostarts[tostartsoffset + i] = float(fromstarts[i] + base) - tostops[tostopsoffset + i] = float(fromstops[i] + base) + def awkward_ListArray_min_range(tomin, fromstarts, fromstops, lenstarts): + shorter = fromstops[0] - fromstarts[0] + for i in range(1, lenstarts): + rangeval = fromstops[i] - fromstarts[i] + shorter = shorter if shorter < rangeval else rangeval + tomin[0] = shorter automatic-tests: true manual-tests: [] - - name: awkward_ListArray_getitem_carry + - name: awkward_ListArray_num specializations: - - name: awkward_ListArray32_getitem_carry_64 + - name: awkward_ListArray32_num_64 args: - - {name: tostarts, type: "List[int32_t]", dir: out} - - {name: tostops, type: "List[int32_t]", dir: out} + - {name: tonum, type: "List[int64_t]", dir: out} - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} - - {name: fromcarry, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenstarts, type: "int64_t", dir: in, role: ListOffsetArray-length} - - {name: lencarry, type: "int64_t", dir: in, role: default} - - name: awkward_ListArray64_getitem_carry_64 + - {name: length, type: "int64_t", dir: in, role: default} + - name: awkward_ListArray64_num_64 args: - - {name: tostarts, type: "List[int64_t]", dir: out} - - {name: tostops, type: "List[int64_t]", dir: out} + - {name: tonum, type: "List[int64_t]", dir: out} - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: fromcarry, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenstarts, type: "int64_t", dir: in, role: ListOffsetArray-length} - - {name: lencarry, type: "int64_t", dir: in, role: default} - - name: awkward_ListArrayU32_getitem_carry_64 + - {name: length, type: "int64_t", dir: in, role: default} + - name: awkward_ListArrayU32_num_64 args: - - {name: tostarts, type: "List[uint32_t]", dir: out} - - {name: tostops, type: "List[uint32_t]", dir: out} + - {name: tonum, type: "List[int64_t]", dir: out} - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} - - {name: fromcarry, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenstarts, type: "int64_t", dir: in, role: ListOffsetArray-length} - - {name: lencarry, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_ListArray_getitem_carry( - tostarts, tostops, fromstarts, fromstops, fromcarry, lenstarts, lencarry - ): - for i in range(lencarry): - if fromcarry[i] >= lenstarts: - raise ValueError("index out of range") - tostarts[i] = float(fromstarts[fromcarry[i]]) - tostops[i] = float(fromstops[fromcarry[i]]) - automatic-tests: true - manual-tests: [] - - - name: awkward_ListArray_getitem_jagged_apply - specializations: - - name: awkward_ListArray32_getitem_jagged_apply_64 - args: - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: slicestarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: slicestops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: sliceouterlen, type: "int64_t", dir: in, role: ListArray-length} - - {name: sliceindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: sliceinnerlen, type: "int64_t", dir: in, role: IndexedArray-length} - - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray2-starts} - - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray2-stops} - - {name: contentlen, type: "int64_t", dir: in, role: ListArray2-length} - - name: awkward_ListArray64_getitem_jagged_apply_64 - args: - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: slicestarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: slicestops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: sliceouterlen, type: "int64_t", dir: in, role: ListArray-length} - - {name: sliceindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: sliceinnerlen, type: "int64_t", dir: in, role: IndexedArray-length} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray2-starts} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray2-stops} - - {name: contentlen, type: "int64_t", dir: in, role: ListArray2-length} - - name: awkward_ListArrayU32_getitem_jagged_apply_64 - args: - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: slicestarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: slicestops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: sliceouterlen, type: "int64_t", dir: in, role: ListArray-length} - - {name: sliceindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: sliceinnerlen, type: "int64_t", dir: in, role: IndexedArray-length} - - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray2-starts} - - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray2-stops} - - {name: contentlen, type: "int64_t", dir: in, role: ListArray2-length} - description: null - definition: | - def awkward_ListArray_getitem_jagged_apply( - tooffsets, - tocarry, - slicestarts, - slicestops, - sliceouterlen, - sliceindex, - sliceinnerlen, - fromstarts, - fromstops, - contentlen, - ): - k = 0 - for i in range(sliceouterlen): - slicestart = slicestarts[i] - slicestop = slicestops[i] - tooffsets[i] = float(k) - if slicestart != slicestop: - if slicestop < slicestart: - raise ValueError("jagged slice's stops[i] < starts[i]") - if slicestop > sliceinnerlen: - raise ValueError("jagged slice's offsets extend beyond its content") - start = int(fromstarts[i]) - stop = int(fromstops[i]) - if stop < start: - raise ValueError("stops[i] < starts[i]") - if (start != stop) and (stop > contentlen): - raise ValueError("stops[i] > len(content)") - count = stop - start - for j in range(slicestart, slicestop): - index = int(sliceindex[j]) - if index < 0: - index += count - if not ((0 <= index) and (index < count)): - raise ValueError("index out of range") - tocarry[k] = start + index - k = k + 1 - tooffsets[i + 1] = float(k) - automatic-tests: true - manual-tests: [] - - - name: awkward_ListArray_getitem_jagged_carrylen - specializations: - - name: awkward_ListArray_getitem_jagged_carrylen_64 - args: - - {name: carrylen, type: "List[int64_t]", dir: out} - - {name: slicestarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: slicestops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: sliceouterlen, type: "int64_t", dir: in, role: default} + - {name: length, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_ListArray_getitem_jagged_carrylen( - carrylen, slicestarts, slicestops, sliceouterlen - ): - carrylen[0] = 0 - for i in range(sliceouterlen): - carrylen[0] = carrylen[0] + int(slicestops[i] - slicestarts[i]) + def awkward_ListArray_num(tonum, fromstarts, fromstops, length): + for i in range(length): + start = fromstarts[i] + stop = fromstops[i] + tonum[i] = float(stop - start) automatic-tests: true manual-tests: [] - - name: awkward_ListArray_getitem_jagged_descend + - name: awkward_ListArray_rpad_and_clip_length_axis1 specializations: - - name: awkward_ListArray32_getitem_jagged_descend_64 + - name: awkward_ListArray32_rpad_and_clip_length_axis1 args: - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: slicestarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: slicestops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: sliceouterlen, type: "int64_t", dir: in, role: default} - - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray2-starts} - - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray2-stops} - - name: awkward_ListArray64_getitem_jagged_descend_64 + - {name: tomin, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} + - {name: target, type: "int64_t", dir: in, role: default} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - name: awkward_ListArray64_rpad_and_clip_length_axis1 args: - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: slicestarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: slicestops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: sliceouterlen, type: "int64_t", dir: in, role: default} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray2-starts} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray2-stops} - - name: awkward_ListArrayU32_getitem_jagged_descend_64 + - {name: tomin, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: target, type: "int64_t", dir: in, role: default} + - {name: lenstarts, type: "int64_t", dir: in, role: default} + - name: awkward_ListArrayU32_rpad_and_clip_length_axis1 args: - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: slicestarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: slicestops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: sliceouterlen, type: "int64_t", dir: in, role: default} - - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray2-starts} - - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray2-stops} + - {name: tomin, type: "List[int64_t]", dir: out} + - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} + - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} + - {name: target, type: "int64_t", dir: in, role: default} + - {name: lenstarts, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_ListArray_getitem_jagged_descend( - tooffsets, slicestarts, slicestops, sliceouterlen, fromstarts, fromstops + def awkward_ListArray_rpad_and_clip_length_axis1( + tomin, fromstarts, fromstops, target, lenstarts ): - if sliceouterlen == 0: - tooffsets[0] = 0 - else: - tooffsets[0] = slicestarts[0] - for i in range(sliceouterlen): - slicecount = int(slicestops[i] - slicestarts[i]) - count = int(fromstops[i] - fromstarts[i]) - if slicecount != count: - raise ValueError( - "jagged slice inner length differs from array inner length" - ) - tooffsets[i + 1] = tooffsets[i] + float(count) + length = 0 + for i in range(lenstarts): + rangeval = fromstops[i] - fromstarts[i] + length += target if target > rangeval else rangeval + tomin[0] = length automatic-tests: true manual-tests: [] - - name: awkward_ListArray_getitem_jagged_expand + - name: awkward_ListArray_rpad_axis1 specializations: - - name: awkward_ListArray32_getitem_jagged_expand_64 + - name: awkward_ListArray32_rpad_axis1_64 args: - - {name: multistarts, type: "List[int64_t]", dir: out} - - {name: multistops, type: "List[int64_t]", dir: out} - - {name: singleoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: toindex, type: "List[int64_t]", dir: out} - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} - - {name: jaggedsize, type: "int64_t", dir: in, role: ListArray-at} + - {name: tostarts, type: "List[int32_t]", dir: out} + - {name: tostops, type: "List[int32_t]", dir: out} + - {name: target, type: "int64_t", dir: in, role: default} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_ListArray64_getitem_jagged_expand_64 + - name: awkward_ListArray64_rpad_axis1_64 args: - - {name: multistarts, type: "List[int64_t]", dir: out} - - {name: multistops, type: "List[int64_t]", dir: out} - - {name: singleoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: toindex, type: "List[int64_t]", dir: out} - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: jaggedsize, type: "int64_t", dir: in, role: ListArray-at} + - {name: tostarts, type: "List[int64_t]", dir: out} + - {name: tostops, type: "List[int64_t]", dir: out} + - {name: target, type: "int64_t", dir: in, role: default} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_ListArrayU32_getitem_jagged_expand_64 + - name: awkward_ListArrayU32_rpad_axis1_64 args: - - {name: multistarts, type: "List[int64_t]", dir: out} - - {name: multistops, type: "List[int64_t]", dir: out} - - {name: singleoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: toindex, type: "List[int64_t]", dir: out} - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} - - {name: jaggedsize, type: "int64_t", dir: in, role: ListArray-at} + - {name: tostarts, type: "List[uint32_t]", dir: out} + - {name: tostops, type: "List[uint32_t]", dir: out} + - {name: target, type: "int64_t", dir: in, role: default} - {name: length, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_ListArray_getitem_jagged_expand( - multistarts, - multistops, - singleoffsets, - tocarry, - fromstarts, - fromstops, - jaggedsize, - length, + def awkward_ListArray_rpad_axis1( + toindex, fromstarts, fromstops, tostarts, tostops, target, length ): + offset = 0 for i in range(length): - start = fromstarts[i] - stop = fromstops[i] - if stop < start: - raise ValueError("stops[i] < starts[i]") - if (stop - start) != jaggedsize: - raise ValueError("cannot fit jagged slice into nested list") - for j in range(jaggedsize): - multistarts[(i * jaggedsize) + j] = singleoffsets[j] - multistops[(i * jaggedsize) + j] = singleoffsets[j + 1] - tocarry[(i * jaggedsize) + j] = start + j + tostarts[i] = offset + rangeval = fromstops[i] - fromstarts[i] + for j in range(rangeval): + toindex[offset + j] = fromstarts[i] + j + for j in range(rangeval, target): + toindex[offset + j] = -1 + offset = tostarts[i] + target if target > rangeval else tostarts[i] + rangeval + tostops[i] = offset automatic-tests: true manual-tests: [] - - name: awkward_ListArray_getitem_jagged_numvalid + - name: awkward_ListArray_validity specializations: - - name: awkward_ListArray_getitem_jagged_numvalid_64 + - name: awkward_ListArray32_validity args: - - {name: numvalid, type: "List[int64_t]", dir: out} - - {name: slicestarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: slicestops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: starts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} + - {name: stops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} - {name: length, type: "int64_t", dir: in, role: default} - - {name: missing, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: missinglength, type: "int64_t", dir: in, role: IndexedArray-length} - description: null - definition: | - def awkward_ListArray_getitem_jagged_numvalid( - numvalid, slicestarts, slicestops, length, missing, missinglength - ): - numvalid[0] = 0 - for i in range(length): - slicestart = slicestarts[i] - slicestop = slicestops[i] - if slicestart != slicestop: - if slicestop < slicestart: - raise ValueError("jagged slice's stops[i] < starts[i]") - if slicestop > missinglength: - raise ValueError("jagged slice's offsets extend beyond its content") - for j in range(slicestart, slicestop): - numvalid[0] = numvalid[0] + 1 if missing[j] >= 0 else 0 - automatic-tests: false - manual-tests: [] - - - name: awkward_ListArray_getitem_jagged_shrink - specializations: - - name: awkward_ListArray_getitem_jagged_shrink_64 + - {name: lencontent, type: "int64_t", dir: in, role: default} + - name: awkward_ListArray64_validity args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: tosmalloffsets, type: "List[int64_t]", dir: out} - - {name: tolargeoffsets, type: "List[int64_t]", dir: out} - - {name: slicestarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: slicestops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} + - {name: starts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} + - {name: stops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - {name: length, type: "int64_t", dir: in, role: default} - - {name: missing, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: lencontent, type: "int64_t", dir: in, role: default} + - name: awkward_ListArrayU32_validity + args: + - {name: starts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} + - {name: stops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} + - {name: length, type: "int64_t", dir: in, role: default} + - {name: lencontent, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_ListArray_getitem_jagged_shrink( - tocarry, tosmalloffsets, tolargeoffsets, slicestarts, slicestops, length, missing - ): - k = 0 - if length == 0: - tosmalloffsets[0] = 0 - tolargeoffsets[0] = 0 - else: - tosmalloffsets[0] = slicestarts[0] - tolargeoffsets[0] = slicestarts[0] + def awkward_ListArray_validity(starts, stops, length, lencontent): for i in range(length): - slicestart = slicestarts[i] - slicestop = slicestops[i] - if slicestart != slicestop: - smallcount = 0 - for j in range(slicestart, slicestop): - if missing[j] >= 0: - tocarry[k] = j - k = k + 1 - smallcount = smallcount + 1 - tosmalloffsets[i + 1] = tosmalloffsets[i] + smallcount - else: - tosmalloffsets[i + 1] = tosmalloffsets[i] - tolargeoffsets[i + 1] = tolargeoffsets[i] + (slicestop - slicestart) + start = starts[i] + stop = stops[i] + if start != stop: + if start > stop: + raise ValueError("start[i] > stop[i]") + if start < 0: + raise ValueError("start[i] < 0") + if stop > lencontent: + raise ValueError("stop[i] > len(content)") automatic-tests: true manual-tests: [] - - name: awkward_ListArray_getitem_next_array + - name: awkward_ListOffsetArray_compact_offsets specializations: - - name: awkward_ListArray32_getitem_next_array_64 + - name: awkward_ListOffsetArray32_compact_offsets_64 args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: toadvanced, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} - - {name: fromarray, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - {name: lenarray, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: ListArray-length} - - name: awkward_ListArray64_getitem_next_array_64 + - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: fromoffsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: length, type: "int64_t", dir: in, role: default} + - name: awkward_ListOffsetArray64_compact_offsets_64 args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: toadvanced, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: fromarray, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - {name: lenarray, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: ListArray-length} - - name: awkward_ListArrayU32_getitem_next_array_64 + - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: length, type: "int64_t", dir: in, role: default} + - name: awkward_ListOffsetArrayU32_compact_offsets_64 args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: toadvanced, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} - - {name: fromarray, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - {name: lenarray, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: ListArray-length} + - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: fromoffsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: length, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_ListArray_getitem_next_array( - tocarry, - toadvanced, - fromstarts, - fromstops, - fromarray, - lenstarts, - lenarray, - lencontent, - ): - for i in range(lenstarts): - if fromstops[i] < fromstarts[i]: - raise ValueError("stops[i] < starts[i]") - if (fromstarts[i] != fromstops[i]) and (fromstops[i] > lencontent): - raise ValueError("stops[i] > len(content)") - length = fromstops[i] - fromstarts[i] - for j in range(lenarray): - regular_at = fromarray[j] - if regular_at < 0: - regular_at += length - if not ((0 <= regular_at) and (regular_at < length)): - raise ValueError("index out of range") - tocarry[(i * lenarray) + j] = fromstarts[i] + regular_at - toadvanced[(i * lenarray) + j] = j + def awkward_ListOffsetArray_compact_offsets(tooffsets, fromoffsets, length): + diff = int(fromoffsets[0]) + tooffsets[0] = 0 + for i in range(length): + tooffsets[i + 1] = fromoffsets[i + 1] - diff automatic-tests: true manual-tests: [] - - name: awkward_ListArray_getitem_next_array_advanced + - name: awkward_ListOffsetArray_flatten_offsets specializations: - - name: awkward_ListArray32_getitem_next_array_advanced_64 + - name: awkward_ListOffsetArray32_flatten_offsets_64 args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: toadvanced, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} - - {name: fromarray, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: fromadvanced, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray2-offsets} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - {name: lenarray, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: ListArray-length} - - name: awkward_ListArray64_getitem_next_array_advanced_64 + - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: outeroffsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: outeroffsetslen, type: "int64_t", dir: in, role: default} + - {name: inneroffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray2-offsets} + - {name: inneroffsetslen, type: "int64_t", dir: in, role: default} + - name: awkward_ListOffsetArray64_flatten_offsets_64 args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: toadvanced, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: fromarray, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: fromadvanced, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray2-offsets} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - {name: lenarray, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: ListArray-length} - - name: awkward_ListArrayU32_getitem_next_array_advanced_64 + - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: outeroffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: outeroffsetslen, type: "int64_t", dir: in, role: default} + - {name: inneroffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray2-offsets} + - {name: inneroffsetslen, type: "int64_t", dir: in, role: default} + - name: awkward_ListOffsetArrayU32_flatten_offsets_64 args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: toadvanced, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} - - {name: fromarray, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: fromadvanced, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray2-offsets} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - {name: lenarray, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: ListArray-length} + - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: outeroffsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: outeroffsetslen, type: "int64_t", dir: in, role: default} + - {name: inneroffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray2-offsets} + - {name: inneroffsetslen, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_ListArray_getitem_next_array_advanced( - tocarry, - toadvanced, - fromstarts, - fromstops, - fromarray, - fromadvanced, - lenstarts, - lenarray, - lencontent, + def awkward_ListOffsetArray_flatten_offsets( + tooffsets, outeroffsets, outeroffsetslen, inneroffsets, inneroffsetslen ): - for i in range(lenstarts): - if fromstops[i] < fromstarts[i]: - raise ValueError("stops[i] < starts[i]") - if (fromstarts[i] != fromstops[i]) and (fromstops[i] > lencontent): - raise ValueError("stops[i] > len(content)") - length = fromstops[i] - fromstarts[i] - regular_at = fromarray[fromadvanced[i]] - if regular_at < 0: - regular_at += length - if not ((0 <= regular_at) and (regular_at < length)): - raise ValueError("index out of range") - tocarry[i] = fromstarts[i] + regular_at - toadvanced[i] = i + for i in range(outeroffsetslen): + tooffsets[i] = inneroffsets[outeroffsets[i]] automatic-tests: true manual-tests: [] - - name: awkward_ListArray_getitem_next_at + - name: awkward_ListOffsetArray_local_preparenext_64 specializations: - - name: awkward_ListArray32_getitem_next_at_64 - args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - {name: at, type: "int64_t", dir: in, role: ListArray-at} - - name: awkward_ListArray64_getitem_next_at_64 - args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - {name: at, type: "int64_t", dir: in, role: ListArray-at} - - name: awkward_ListArrayU32_getitem_next_at_64 + - name: awkward_ListOffsetArray_local_preparenext_64 args: - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - {name: at, type: "int64_t", dir: in, role: ListArray-at} + - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: length, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_ListArray_getitem_next_at(tocarry, fromstarts, fromstops, lenstarts, at): - for i in range(lenstarts): - length = fromstops[i] - fromstarts[i] - regular_at = at - if regular_at < 0: - regular_at += length - if not ((0 <= regular_at) and (regular_at < length)): - raise ValueError("index out of range") - tocarry[i] = fromstarts[i] + regular_at - automatic-tests: true + Insert Python definition here + automatic-tests: false manual-tests: [] - - name: awkward_ListArray_getitem_next_range + - name: awkward_ListOffsetArray_reduce_local_nextparents_64 specializations: - - name: awkward_ListArray32_getitem_next_range_64 - args: - - {name: tooffsets, type: "List[int32_t]", dir: out} - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: default} - - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: default} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - {name: start, type: "int64_t", dir: in, role: default} - - {name: stop, type: "int64_t", dir: in, role: default} - - {name: step, type: "int64_t", dir: in, role: default} - - name: awkward_ListArray64_getitem_next_range_64 - args: - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: default} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: default} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - {name: start, type: "int64_t", dir: in, role: default} - - {name: stop, type: "int64_t", dir: in, role: default} - - {name: step, type: "int64_t", dir: in, role: default} - - name: awkward_ListArrayU32_getitem_next_range_64 + - name: awkward_ListOffsetArray_reduce_local_nextparents_64 args: - - {name: tooffsets, type: "List[uint32_t]", dir: out} - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: default} - - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: default} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - {name: start, type: "int64_t", dir: in, role: default} - - {name: stop, type: "int64_t", dir: in, role: default} - - {name: step, type: "int64_t", dir: in, role: default} + - {name: nextparents, type: "List[int64_t]", dir: out} + - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: reducer-offsets} + - {name: length, type: "int64_t", dir: in, role: reducer-length} description: null definition: | - def awkward_ListArray_getitem_next_range( - tooffsets, tocarry, fromstarts, fromstops, lenstarts, start, stop, step - ): - k = 0 - tooffsets[0] = 0 - if step > 0: - for i in range(lenstarts): - length = fromstops[i] - fromstarts[i] - regular_start = start - regular_stop = stop - awkward_regularize_rangeslice( - regular_start, - regular_stop, - step > 0, - start != kSliceNone, - stop != kSliceNone, - length, - ) - j = regular_start - while j < regular_stop: - tocarry[k] = fromstarts[i] + j - k = k + 1 - j += step - tooffsets[i + 1] = float(k) - else: - for i in range(lenstarts): - length = fromstops[i] - fromstarts[i] - regular_start = start - regular_stop = stop - awkward_regularize_rangeslice( - regular_start, - regular_stop, - step > 0, - start != kSliceNone, - stop != kSliceNone, - length, - ) - j = regular_start - while j > regular_stop: - tocarry[k] = fromstarts[i] + j - k = k + 1 - j += step - tooffsets[i + 1] = float(k) + def awkward_ListOffsetArray_reduce_local_nextparents_64(nextparents, offsets, length): + initialoffset = offsets[0] + for i in range(length): + j = offsets[i] - initialoffset + while j < (offsets[i + 1] - initialoffset): + nextparents[j] = i + j = j + 1 automatic-tests: false manual-tests: [] - - name: awkward_ListArray_getitem_next_range_carrylength + - name: awkward_ListOffsetArray_reduce_local_outoffsets_64 specializations: - - name: awkward_ListArray32_getitem_next_range_carrylength - args: - - {name: carrylength, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: default} - - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: default} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - {name: start, type: "int64_t", dir: in, role: default} - - {name: stop, type: "int64_t", dir: in, role: default} - - {name: step, type: "int64_t", dir: in, role: default} - - name: awkward_ListArray64_getitem_next_range_carrylength - args: - - {name: carrylength, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: default} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: default} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - {name: start, type: "int64_t", dir: in, role: default} - - {name: stop, type: "int64_t", dir: in, role: default} - - {name: step, type: "int64_t", dir: in, role: default} - - name: awkward_ListArrayU32_getitem_next_range_carrylength + - name: awkward_ListOffsetArray_reduce_local_outoffsets_64 args: - - {name: carrylength, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: default} - - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: default} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - {name: start, type: "int64_t", dir: in, role: default} - - {name: stop, type: "int64_t", dir: in, role: default} - - {name: step, type: "int64_t", dir: in, role: default} + - {name: outoffsets, type: "List[int64_t]", dir: out} + - {name: parents, type: "Const[List[int64_t]]", dir: in, role: reducer-parents} + - {name: lenparents, type: "int64_t", dir: in, role: reducer-lenparents} + - {name: outlength, type: "int64_t", dir: in, role: reducer-outlength} description: null definition: | - def awkward_ListArray_getitem_next_range_carrylength( - carrylength, fromstarts, fromstops, lenstarts, start, stop, step + def awkward_ListOffsetArray_reduce_local_outoffsets_64( + outoffsets, parents, lenparents, outlength ): - carrylength[0] = 0 - for i in range(lenstarts): - length = fromstops[i] - fromstarts[i] - regular_start = start - regular_stop = stop - awkward_regularize_rangeslice( - regular_start, - regular_stop, - step > 0, - start != kSliceNone, - stop != kSliceNone, - length, - ) - if step > 0: - j = regular_start - while j < regular_stop: - carrylength[0] = carrylength[0] + 1 - j += step - else: - j = regular_start - while j > regular_stop: - carrylength[0] = carrylength[0] + 1 - j += step - automatic-tests: false - manual-tests: [] + k = 0 + last = -1 + for i in range(lenparents): + while last < parents[i]: + outoffsets[k] = i + k = k + 1 + last = last + 1 - - name: awkward_ListArray_getitem_next_range_counts - specializations: - - name: awkward_ListArray32_getitem_next_range_counts_64 - args: - - {name: total, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - name: awkward_ListArray64_getitem_next_range_counts_64 - args: - - {name: total, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - name: awkward_ListArrayU32_getitem_next_range_counts_64 - args: - - {name: total, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_ListArray_getitem_next_range_counts(total, fromoffsets, lenstarts): - total[0] = 0 - for i in range(lenstarts): - total[0] = (total[0] + fromoffsets[i + 1]) - fromoffsets[i] + while k <= outlength: + outoffsets[k] = lenparents + k = k + 1 automatic-tests: true manual-tests: [] - - name: awkward_ListArray_getitem_next_range_spreadadvanced + - name: awkward_ListOffsetArray_reduce_nonlocal_findgaps_64 specializations: - - name: awkward_ListArray32_getitem_next_range_spreadadvanced_64 - args: - - {name: toadvanced, type: "List[int64_t]", dir: out} - - {name: fromadvanced, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: fromoffsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - name: awkward_ListArray64_getitem_next_range_spreadadvanced_64 - args: - - {name: toadvanced, type: "List[int64_t]", dir: out} - - {name: fromadvanced, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - name: awkward_ListArrayU32_getitem_next_range_spreadadvanced_64 + - name: awkward_ListOffsetArray_reduce_nonlocal_findgaps_64 args: - - {name: toadvanced, type: "List[int64_t]", dir: out} - - {name: fromadvanced, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: fromoffsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenstarts, type: "int64_t", dir: in, role: default} + - {name: gaps, type: "List[int64_t]", dir: out} + - {name: parents, type: "Const[List[int64_t]]", dir: in, role: reducer-parents} + - {name: lenparents, type: "int64_t", dir: in, role: reducer-lenparents} description: null definition: | - def awkward_ListArray_getitem_next_range_spreadadvanced( - toadvanced, fromadvanced, fromoffsets, lenstarts - ): - for i in range(lenstarts): - count = fromoffsets[i + 1] - fromoffsets[i] - for j in range(count): - toadvanced[fromoffsets[i] + j] = fromadvanced[i] - automatic-tests: false + def awkward_ListOffsetArray_reduce_nonlocal_findgaps_64(gaps, parents, lenparents): + k = 0 + last = -1 + for i in range(lenparents): + parent = parents[i] + if last < parent: + gaps[k] = parent - last + k = k + 1 + last = parent + automatic-tests: true manual-tests: [] - - name: awkward_ListArray_localindex + - name: awkward_ListOffsetArray_reduce_nonlocal_maxcount_offsetscopy_64 specializations: - - name: awkward_ListArray32_localindex_64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: offsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_ListArray64_localindex_64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_ListArrayU32_localindex_64 + - name: awkward_ListOffsetArray_reduce_nonlocal_maxcount_offsetscopy_64 args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: offsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: length, type: "int64_t", dir: in, role: default} + - {name: maxcount, type: "List[int64_t]", dir: out} + - {name: offsetscopy, type: "List[int64_t]", dir: out} + - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: reducer-offsets} + - {name: length, type: "int64_t", dir: in, role: reducer-length} description: null definition: | - def awkward_ListArray_localindex(toindex, offsets, length): + def awkward_ListOffsetArray_reduce_nonlocal_maxcount_offsetscopy_64( + maxcount, offsetscopy, offsets, length + ): + maxcount[0] = 0 + offsetscopy[0] = offsets[0] for i in range(length): - start = int(offsets[i]) - stop = int(offsets[i + 1]) - for j in range(start, stop): - toindex[j] = j - start + count = offsets[i + 1] - offsets[i] + if maxcount[0] < count: + maxcount[0] = count + offsetscopy[i + 1] = offsets[i + 1] automatic-tests: true manual-tests: [] - - name: awkward_ListArray_min_range + - name: awkward_ListOffsetArray_reduce_nonlocal_nextshifts_64 specializations: - - name: awkward_ListArray32_min_range - args: - - {name: tomin, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - name: awkward_ListArray64_min_range - args: - - {name: tomin, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - name: awkward_ListArrayU32_min_range + - name: awkward_ListOffsetArray_reduce_nonlocal_nextshifts_64 args: - - {name: tomin, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} - - {name: lenstarts, type: "int64_t", dir: in, role: default} + - {name: nummissing, type: "List[int64_t]", dir: out} + - {name: missing, type: "List[int64_t]", dir: out} + - {name: nextshifts, type: "List[int64_t]", dir: out} + - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: reducer-offsets} + - {name: length, type: "int64_t", dir: in, role: reducer-length} + - {name: starts, type: "Const[List[int64_t]]", dir: in, role: reducer-starts} + - {name: parents, type: "Const[List[int64_t]]", dir: in, role: reducer-parents} + - {name: maxcount, type: "int64_t", dir: in, role: reducer-maxcount} + - {name: nextlen, type: "int64_t", dir: in, role: reducer-nextlen} + - {name: nextcarry, type: "Const[List[int64_t]]", dir: in, role: reducer-nextcarry} description: null definition: | - def awkward_ListArray_min_range(tomin, fromstarts, fromstops, lenstarts): - shorter = fromstops[0] - fromstarts[0] - for i in range(1, lenstarts): - rangeval = fromstops[i] - fromstarts[i] - shorter = shorter if shorter < rangeval else rangeval - tomin[0] = shorter + def awkward_ListOffsetArray_reduce_nonlocal_nextshifts_64( + nummissing, + missing, + nextshifts, + offsets, + length, + starts, + parents, + maxcount, + nextlen, + nextcarry, + ): + for i in range(length): + start = offsets[i] + stop = offsets[i + 1] + count = stop - start + if starts[parents[i]] == i: + for k in range(maxcount): + nummissing[k] = 0 + for k in range(count, maxcount): + nummissing[k] = nummissing[k] + 1 + for j in range(count): + missing[start + j] = nummissing[j] + for j in range(nextlen): + nextshifts[j] = missing[nextcarry[j]] automatic-tests: true manual-tests: [] - - name: awkward_ListArray_num + - name: awkward_ListOffsetArray_reduce_nonlocal_nextstarts_64 specializations: - - name: awkward_ListArray32_num_64 - args: - - {name: tonum, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_ListArray64_num_64 - args: - - {name: tonum, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_ListArrayU32_num_64 + - name: awkward_ListOffsetArray_reduce_nonlocal_nextstarts_64 args: - - {name: tonum, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} - - {name: length, type: "int64_t", dir: in, role: default} + - {name: nextstarts, type: "List[int64_t]", dir: out} + - {name: nextparents, type: "Const[List[int64_t]]", dir: in, role: reducer-nextparents} + - {name: nextlen, type: "int64_t", dir: in, role: reducer-nextlen} description: null definition: | - def awkward_ListArray_num(tonum, fromstarts, fromstops, length): - for i in range(length): - start = fromstarts[i] - stop = fromstops[i] - tonum[i] = float(stop - start) + def awkward_ListOffsetArray_reduce_nonlocal_nextstarts_64( + nextstarts, nextparents, nextlen + ): + lastnextparent = -1 + for i in range(nextlen): + if nextparents[i] != lastnextparent: + nextstarts[nextparents[i]] = i + lastnextparent = nextparents[i] automatic-tests: true manual-tests: [] - - name: awkward_ListArray_rpad_and_clip_length_axis1 + - name: awkward_ListOffsetArray_reduce_nonlocal_outstartsstops_64 specializations: - - name: awkward_ListArray32_rpad_and_clip_length_axis1 - args: - - {name: tomin, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} - - {name: target, type: "int64_t", dir: in, role: default} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - name: awkward_ListArray64_rpad_and_clip_length_axis1 - args: - - {name: tomin, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: target, type: "int64_t", dir: in, role: default} - - {name: lenstarts, type: "int64_t", dir: in, role: default} - - name: awkward_ListArrayU32_rpad_and_clip_length_axis1 + - name: awkward_ListOffsetArray_reduce_nonlocal_outstartsstops_64 args: - - {name: tomin, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} - - {name: target, type: "int64_t", dir: in, role: default} - - {name: lenstarts, type: "int64_t", dir: in, role: default} + - {name: outstarts, type: "List[int64_t]", dir: out} + - {name: outstops, type: "List[int64_t]", dir: out} + - {name: distincts, type: "Const[List[int64_t]]", dir: in, role: reducer-distincts} + - {name: lendistincts, type: "int64_t", dir: in, role: reducer-lendistincts} + - {name: gaps, type: "Const[List[int64_t]]", dir: in, role: reducer-gaps} + - {name: outlength, type: "int64_t", dir: in, role: reducer-outlength} description: null definition: | - def awkward_ListArray_rpad_and_clip_length_axis1( - tomin, fromstarts, fromstops, target, lenstarts + def awkward_ListOffsetArray_reduce_nonlocal_outstartsstops_64( + outstarts, outstops, distincts, lendistincts, gaps, outlength ): - length = 0 - for i in range(lenstarts): - rangeval = fromstops[i] - fromstarts[i] - length += target if target > rangeval else rangeval - tomin[0] = length + maxcount = lendistincts // outlength + + j = 0 + k = 0 + maxdistinct = -2 + lasti = -1 + for i in range(lendistincts): + if maxdistinct < distincts[i]: + maxdistinct = distincts[i] + + extra = (i - lasti) // maxcount + lasti = i + + numgappy = gaps[j] + if numgappy < extra: + numgappy = extra + + for gappy in range(numgappy): + outstarts[k] = i + outstops[k] = i + k = k + 1 + j = j + 1 + + if distincts[i] != -1: + outstops[k - 1] = i + 1 + + while k < outlength: + outstarts[k] = lendistincts + 1 + outstops[k] = lendistincts + 1 + k = k + 1 automatic-tests: true manual-tests: [] - - name: awkward_ListArray_rpad_axis1 + - name: awkward_ListOffsetArray_reduce_nonlocal_preparenext_64 specializations: - - name: awkward_ListArray32_rpad_axis1_64 + - name: awkward_ListOffsetArray_reduce_nonlocal_preparenext_64 + args: + - {name: nextcarry, type: "List[int64_t]", dir: out} + - {name: nextparents, type: "List[int64_t]", dir: out} + - {name: nextlen, type: "int64_t", dir: in} + - {name: maxnextparents, type: "List[int64_t]", dir: out} + - {name: distincts, type: "List[int64_t]", dir: out} + - {name: distinctslen, type: "int64_t", dir: in} + - {name: offsetscopy, type: "List[int64_t]", dir: in} + - {name: offsets, type: "Const[List[int64_t]]", dir: in} + - {name: length, type: "int64_t", dir: in} + - {name: parents, type: "Const[List[int64_t]]", dir: in} + - {name: maxcount, type: "int64_t", dir: in} + description: null + definition: | + Insert Python definition here + automatic-tests: false + manual-tests: [] + + - name: awkward_ListOffsetArray_rpad_and_clip_axis1 + specializations: + - name: awkward_ListOffsetArray32_rpad_and_clip_axis1_64 args: - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} - - {name: tostarts, type: "List[int32_t]", dir: out} - - {name: tostops, type: "List[int32_t]", dir: out} - - {name: target, type: "int64_t", dir: in, role: default} + - {name: fromoffsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_ListArray64_rpad_axis1_64 + - {name: target, type: "int64_t", dir: in, role: default} + - name: awkward_ListOffsetArray64_rpad_and_clip_axis1_64 args: - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: tostarts, type: "List[int64_t]", dir: out} - - {name: tostops, type: "List[int64_t]", dir: out} - - {name: target, type: "int64_t", dir: in, role: default} + - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_ListArrayU32_rpad_axis1_64 + - {name: target, type: "int64_t", dir: in, role: default} + - name: awkward_ListOffsetArrayU32_rpad_and_clip_axis1_64 args: - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromstarts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} - - {name: fromstops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} - - {name: tostarts, type: "List[uint32_t]", dir: out} - - {name: tostops, type: "List[uint32_t]", dir: out} - - {name: target, type: "int64_t", dir: in, role: default} + - {name: fromoffsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} - {name: length, type: "int64_t", dir: in, role: default} + - {name: target, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_ListArray_rpad_axis1( - toindex, fromstarts, fromstops, tostarts, tostops, target, length - ): - offset = 0 + def awkward_ListOffsetArray_rpad_and_clip_axis1(toindex, fromoffsets, length, target): for i in range(length): - tostarts[i] = offset - rangeval = fromstops[i] - fromstarts[i] - for j in range(rangeval): - toindex[offset + j] = fromstarts[i] + j - for j in range(rangeval, target): - toindex[offset + j] = -1 - offset = tostarts[i] + target if target > rangeval else tostarts[i] + rangeval - tostops[i] = offset - automatic-tests: true + rangeval = float(fromoffsets[i + 1] - fromoffsets[i]) + shorter = target if target < rangeval else rangeval + for j in range(shorter): + toindex[(i * target) + j] = float(fromoffsets[i]) + j + for j in range(shorter, target): + toindex[(i * target) + j] = -1 + automatic-tests: false manual-tests: [] - - name: awkward_ListArray_validity + - name: awkward_ListOffsetArray_rpad_axis1 specializations: - - name: awkward_ListArray32_validity - args: - - {name: starts, type: "Const[List[int32_t]]", dir: in, role: ListArray-starts} - - {name: stops, type: "Const[List[int32_t]]", dir: in, role: ListArray-stops} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: default} - - name: awkward_ListArray64_validity + - name: awkward_ListOffsetArray32_rpad_axis1_64 args: - - {name: starts, type: "Const[List[int64_t]]", dir: in, role: ListArray-starts} - - {name: stops, type: "Const[List[int64_t]]", dir: in, role: ListArray-stops} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: default} - - name: awkward_ListArrayU32_validity + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: fromoffsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: fromlength, type: "int64_t", dir: in, role: default} + - {name: target, type: "int64_t", dir: in, role: default} + - name: awkward_ListOffsetArray64_rpad_axis1_64 args: - - {name: starts, type: "Const[List[uint32_t]]", dir: in, role: ListArray-starts} - - {name: stops, type: "Const[List[uint32_t]]", dir: in, role: ListArray-stops} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: lencontent, type: "int64_t", dir: in, role: default} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: fromlength, type: "int64_t", dir: in, role: default} + - {name: target, type: "int64_t", dir: in, role: default} + - name: awkward_ListOffsetArrayU32_rpad_axis1_64 + args: + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: fromoffsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: fromlength, type: "int64_t", dir: in, role: default} + - {name: target, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_ListArray_validity(starts, stops, length, lencontent): - for i in range(length): - start = starts[i] - stop = stops[i] - if start != stop: - if start > stop: - raise ValueError("start[i] > stop[i]") - if start < 0: - raise ValueError("start[i] < 0") - if stop > lencontent: - raise ValueError("stop[i] > len(content)") - automatic-tests: true + def awkward_ListOffsetArray_rpad_axis1(toindex, fromoffsets, fromlength, target): + count = 0 + for i in range(fromlength): + rangeval = float(fromoffsets[i + 1] - fromoffsets[i]) + for j in range(rangeval): + toindex[count] = float(fromoffsets[i]) + j + count = count + 1 + for j in range(rangeval, target): + toindex[count] = -1 + count = count + 1 + automatic-tests: false manual-tests: [] - - name: awkward_ListOffsetArray_compact_offsets + - name: awkward_ListOffsetArray_rpad_length_axis1 specializations: - - name: awkward_ListOffsetArray32_compact_offsets_64 + - name: awkward_ListOffsetArray32_rpad_length_axis1 args: - - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: tooffsets, type: "List[int32_t]", dir: out} - {name: fromoffsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_ListOffsetArray64_compact_offsets_64 + - {name: fromlength, type: "int64_t", dir: in, role: default} + - {name: target, type: "int64_t", dir: in, role: default} + - {name: tolength, type: "List[int64_t]", dir: out} + - name: awkward_ListOffsetArray64_rpad_length_axis1 args: - {name: tooffsets, type: "List[int64_t]", dir: out} - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_ListOffsetArrayU32_compact_offsets_64 + - {name: fromlength, type: "int64_t", dir: in, role: default} + - {name: target, type: "int64_t", dir: in, role: default} + - {name: tolength, type: "List[int64_t]", dir: out} + - name: awkward_ListOffsetArrayU32_rpad_length_axis1 args: - - {name: tooffsets, type: "List[int64_t]", dir: out} + - {name: tooffsets, type: "List[uint32_t]", dir: out} - {name: fromoffsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: length, type: "int64_t", dir: in, role: default} + - {name: fromlength, type: "int64_t", dir: in, role: default} + - {name: target, type: "int64_t", dir: in, role: default} + - {name: tolength, type: "List[int64_t]", dir: out} description: null definition: | - def awkward_ListOffsetArray_compact_offsets(tooffsets, fromoffsets, length): - diff = int(fromoffsets[0]) + def awkward_ListOffsetArray_rpad_length_axis1( + tooffsets, fromoffsets, fromlength, target, tolength + ): + length = 0 tooffsets[0] = 0 - for i in range(length): - tooffsets[i + 1] = fromoffsets[i + 1] - diff - automatic-tests: true + for i in range(fromlength): + rangeval = fromoffsets[i + 1] - fromoffsets[i] + longer = rangeval if target < rangeval else target + length = length + longer + tooffsets[i + 1] = tooffsets[i] + longer + tolength[0] = length + automatic-tests: false manual-tests: [] - - name: awkward_ListOffsetArray_flatten_offsets + - name: awkward_ListOffsetArray_toRegularArray specializations: - - name: awkward_ListOffsetArray32_flatten_offsets_64 + - name: awkward_ListOffsetArray32_toRegularArray args: - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: outeroffsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: outeroffsetslen, type: "int64_t", dir: in, role: default} - - {name: inneroffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray2-offsets} - - {name: inneroffsetslen, type: "int64_t", dir: in, role: default} - - name: awkward_ListOffsetArray64_flatten_offsets_64 + - {name: size, type: "List[int64_t]", dir: out} + - {name: fromoffsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: offsetslength, type: "int64_t", dir: in, role: default} + - name: awkward_ListOffsetArray64_toRegularArray args: - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: outeroffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: outeroffsetslen, type: "int64_t", dir: in, role: default} - - {name: inneroffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray2-offsets} - - {name: inneroffsetslen, type: "int64_t", dir: in, role: default} - - name: awkward_ListOffsetArrayU32_flatten_offsets_64 + - {name: size, type: "List[int64_t]", dir: out} + - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: offsetslength, type: "int64_t", dir: in, role: default} + - name: awkward_ListOffsetArrayU32_toRegularArray args: - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: outeroffsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: outeroffsetslen, type: "int64_t", dir: in, role: default} - - {name: inneroffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray2-offsets} - - {name: inneroffsetslen, type: "int64_t", dir: in, role: default} + - {name: size, type: "List[int64_t]", dir: out} + - {name: fromoffsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: offsetslength, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_ListOffsetArray_flatten_offsets( - tooffsets, outeroffsets, outeroffsetslen, inneroffsets, inneroffsetslen - ): - for i in range(outeroffsetslen): - tooffsets[i] = inneroffsets[outeroffsets[i]] + def awkward_ListOffsetArray_toRegularArray(size, fromoffsets, offsetslength): + size[0] = -1 + for i in range(offsetslength - 1): + count = int(fromoffsets[i + 1]) - int(fromoffsets[i]) + if count < 0: + raise ValueError("offsets must be monotonically increasing") + if size[0] == -1: + size[0] = count + else: + if size[0] != count: + raise ValueError( + "cannot convert to RegularArray because subarray lengths are not regular" + ) + if size[0] == -1: + size[0] = 0 automatic-tests: true manual-tests: [] - - name: awkward_ListOffsetArray_getitem_adjust_offsets + - name: awkward_MaskedArray_getitem_next_jagged_project specializations: - - name: awkward_ListOffsetArray_getitem_adjust_offsets_64 + - name: awkward_MaskedArray32_getitem_next_jagged_project args: - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: tononzero, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: index, type: "List[int32_t]", dir: in, role: IndexedArray-index} + - {name: starts_in, type: "List[int64_t]", dir: in, role: ListArray-starts} + - {name: stops_in, type: "List[int64_t]", dir: in, role: ListArray-stops} + - {name: starts_out, type: "List[int64_t]", dir: out} + - {name: stops_out, type: "List[int64_t]", dir: out} - {name: length, type: "int64_t", dir: in, role: default} - - {name: nonzero, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray2-offsets} - - {name: nonzerolength, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_ListOffsetArray_getitem_adjust_offsets( - tooffsets, tononzero, fromoffsets, length, nonzero, nonzerolength - ): - j = 0 - tooffsets[0] = fromoffsets[0] - for i in range(length): - slicestart = fromoffsets[i] - slicestop = fromoffsets[i + 1] - count = 0 - while (j < nonzerolength) and (nonzero[j] < slicestop): - tononzero[j] = nonzero[j] - slicestart - j = j + 1 - count = count + 1 - - tooffsets[i + 1] = tooffsets[i] + count - automatic-tests: true - manual-tests: [] - - - name: awkward_ListOffsetArray_getitem_adjust_offsets_index - specializations: - - name: awkward_ListOffsetArray_getitem_adjust_offsets_index_64 + - name: awkward_MaskedArray64_getitem_next_jagged_project args: - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: tononzero, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: index, type: "List[int64_t]", dir: in, role: IndexedArray-index} + - {name: starts_in, type: "List[int64_t]", dir: in, role: ListArray-starts} + - {name: stops_in, type: "List[int64_t]", dir: in, role: ListArray-stops} + - {name: starts_out, type: "List[int64_t]", dir: out} + - {name: stops_out, type: "List[int64_t]", dir: out} + - {name: length, type: "int64_t", dir: in, role: default} + - name: awkward_MaskedArrayU32_getitem_next_jagged_project + args: + - {name: index, type: "List[uint32_t]", dir: in, role: IndexedArray-index} + - {name: starts_in, type: "List[int64_t]", dir: in, role: ListArray-starts} + - {name: stops_in, type: "List[int64_t]", dir: in, role: ListArray-stops} + - {name: starts_out, type: "List[int64_t]", dir: out} + - {name: stops_out, type: "List[int64_t]", dir: out} - {name: length, type: "int64_t", dir: in, role: default} - - {name: index, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: indexlength, type: "int64_t", dir: in, role: default} - - {name: nonzero, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray2-offsets} - - {name: nonzerolength, type: "int64_t", dir: in, role: default} - - {name: originalmask, type: "Const[List[int8_t]]", dir: in, role: ByteMaskedArray-mask} - - {name: masklength, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_ListOffsetArray_getitem_adjust_offsets_index( - tooffsets, - tononzero, - fromoffsets, - length, - index, - indexlength, - nonzero, - nonzerolength, - originalmask, - masklength, + def awkward_MaskedArray_getitem_next_jagged_project( + index, starts_in, stops_in, starts_out, stops_out, length ): k = 0 - tooffsets[0] = fromoffsets[0] for i in range(length): - slicestart = fromoffsets[i] - slicestop = fromoffsets[i + 1] - numnull = 0 - for j in range(slicestart, slicestop): - numnull += 1 if originalmask[j] != 0 else 0 - nullcount = 0 - count = 0 - while (k < indexlength) and ( - ((index[k] < 0) and (nullcount < numnull)) - or ( - ((index[k] >= 0) and (index[k] < nonzerolength)) - and (nonzero[index[k]] < slicestop) - ) - ): - if index[k] < 0: - nullcount = nullcount + 1 - else: - j = index[k] - tononzero[j] = nonzero[j] - slicestart + if index[i] >= 0: + starts_out[k] = starts_in[i] + stops_out[k] = stops_in[i] k = k + 1 - count = count + 1 - - tooffsets[i + 1] = tooffsets[i] + count automatic-tests: true manual-tests: [] - - name: awkward_ListOffsetArray_local_preparenext_64 + - name: awkward_NumpyArray_fill specializations: - - name: awkward_ListOffsetArray_local_preparenext_64 + - name: awkward_NumpyArray_fill_toint8_fromint8 args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: toptr, type: "List[int8_t]", dir: out} + - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} + - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - description: null - definition: | - Insert Python definition here - automatic-tests: false - manual-tests: [] - - - name: awkward_ListOffsetArray_reduce_global_startstop_64 - specializations: - - name: awkward_ListOffsetArray_reduce_global_startstop_64 + - name: awkward_NumpyArray_fill_toint8_fromint16 args: - - {name: globalstart, type: "List[int64_t]", dir: out} - - {name: globalstop, type: "List[int64_t]", dir: out} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: reducer-offsets} - - {name: length, type: "int64_t", dir: in, role: reducer-length} - description: null - definition: | - def awkward_ListOffsetArray_reduce_global_startstop_64( - globalstart, globalstop, offsets, length - ): - globalstart[0] = offsets[0] - globalstop[0] = offsets[length] - automatic-tests: true - manual-tests: [] - - - name: awkward_ListOffsetArray_reduce_local_nextparents_64 - specializations: - - name: awkward_ListOffsetArray_reduce_local_nextparents_64 + - {name: toptr, type: "List[int8_t]", dir: out} + - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} + - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: NumpyArray-ptr} + - {name: length, type: "int64_t", dir: in, role: default} + - name: awkward_NumpyArray_fill_toint8_fromint32 args: - - {name: nextparents, type: "List[int64_t]", dir: out} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: reducer-offsets} - - {name: length, type: "int64_t", dir: in, role: reducer-length} - description: null - definition: | - def awkward_ListOffsetArray_reduce_local_nextparents_64(nextparents, offsets, length): - initialoffset = offsets[0] - for i in range(length): - j = offsets[i] - initialoffset - while j < (offsets[i + 1] - initialoffset): - nextparents[j] = i - j = j + 1 - automatic-tests: false - manual-tests: [] - - - name: awkward_ListOffsetArray_reduce_local_outoffsets_64 - specializations: - - name: awkward_ListOffsetArray_reduce_local_outoffsets_64 + - {name: toptr, type: "List[int8_t]", dir: out} + - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} + - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: NumpyArray-ptr} + - {name: length, type: "int64_t", dir: in, role: default} + - name: awkward_NumpyArray_fill_toint8_fromint64 args: - - {name: outoffsets, type: "List[int64_t]", dir: out} - - {name: parents, type: "Const[List[int64_t]]", dir: in, role: reducer-parents} - - {name: lenparents, type: "int64_t", dir: in, role: reducer-lenparents} - - {name: outlength, type: "int64_t", dir: in, role: reducer-outlength} - description: null - definition: | - def awkward_ListOffsetArray_reduce_local_outoffsets_64( - outoffsets, parents, lenparents, outlength - ): - k = 0 - last = -1 - for i in range(lenparents): - while last < parents[i]: - outoffsets[k] = i - k = k + 1 - last = last + 1 - - while k <= outlength: - outoffsets[k] = lenparents - k = k + 1 - automatic-tests: true - manual-tests: [] - - - name: awkward_ListOffsetArray_reduce_nonlocal_findgaps_64 - specializations: - - name: awkward_ListOffsetArray_reduce_nonlocal_findgaps_64 - args: - - {name: gaps, type: "List[int64_t]", dir: out} - - {name: parents, type: "Const[List[int64_t]]", dir: in, role: reducer-parents} - - {name: lenparents, type: "int64_t", dir: in, role: reducer-lenparents} - description: null - definition: | - def awkward_ListOffsetArray_reduce_nonlocal_findgaps_64(gaps, parents, lenparents): - k = 0 - last = -1 - for i in range(lenparents): - parent = parents[i] - if last < parent: - gaps[k] = parent - last - k = k + 1 - last = parent - automatic-tests: true - manual-tests: [] - - - name: awkward_ListOffsetArray_reduce_nonlocal_maxcount_offsetscopy_64 - specializations: - - name: awkward_ListOffsetArray_reduce_nonlocal_maxcount_offsetscopy_64 - args: - - {name: maxcount, type: "List[int64_t]", dir: out} - - {name: offsetscopy, type: "List[int64_t]", dir: out} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: reducer-offsets} - - {name: length, type: "int64_t", dir: in, role: reducer-length} - description: null - definition: | - def awkward_ListOffsetArray_reduce_nonlocal_maxcount_offsetscopy_64( - maxcount, offsetscopy, offsets, length - ): - maxcount[0] = 0 - offsetscopy[0] = offsets[0] - for i in range(length): - count = offsets[i + 1] - offsets[i] - if maxcount[0] < count: - maxcount[0] = count - offsetscopy[i + 1] = offsets[i + 1] - automatic-tests: true - manual-tests: [] - - - name: awkward_ListOffsetArray_reduce_nonlocal_nextshifts_64 - specializations: - - name: awkward_ListOffsetArray_reduce_nonlocal_nextshifts_64 - args: - - {name: nummissing, type: "List[int64_t]", dir: out} - - {name: missing, type: "List[int64_t]", dir: out} - - {name: nextshifts, type: "List[int64_t]", dir: out} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: reducer-offsets} - - {name: length, type: "int64_t", dir: in, role: reducer-length} - - {name: starts, type: "Const[List[int64_t]]", dir: in, role: reducer-starts} - - {name: parents, type: "Const[List[int64_t]]", dir: in, role: reducer-parents} - - {name: maxcount, type: "int64_t", dir: in, role: reducer-maxcount} - - {name: nextlen, type: "int64_t", dir: in, role: reducer-nextlen} - - {name: nextcarry, type: "Const[List[int64_t]]", dir: in, role: reducer-nextcarry} - description: null - definition: | - def awkward_ListOffsetArray_reduce_nonlocal_nextshifts_64( - nummissing, - missing, - nextshifts, - offsets, - length, - starts, - parents, - maxcount, - nextlen, - nextcarry, - ): - for i in range(length): - start = offsets[i] - stop = offsets[i + 1] - count = stop - start - if starts[parents[i]] == i: - for k in range(maxcount): - nummissing[k] = 0 - for k in range(count, maxcount): - nummissing[k] = nummissing[k] + 1 - for j in range(count): - missing[start + j] = nummissing[j] - for j in range(nextlen): - nextshifts[j] = missing[nextcarry[j]] - automatic-tests: true - manual-tests: [] - - - name: awkward_ListOffsetArray_reduce_nonlocal_nextstarts_64 - specializations: - - name: awkward_ListOffsetArray_reduce_nonlocal_nextstarts_64 - args: - - {name: nextstarts, type: "List[int64_t]", dir: out} - - {name: nextparents, type: "Const[List[int64_t]]", dir: in, role: reducer-nextparents} - - {name: nextlen, type: "int64_t", dir: in, role: reducer-nextlen} - description: null - definition: | - def awkward_ListOffsetArray_reduce_nonlocal_nextstarts_64( - nextstarts, nextparents, nextlen - ): - lastnextparent = -1 - for i in range(nextlen): - if nextparents[i] != lastnextparent: - nextstarts[nextparents[i]] = i - lastnextparent = nextparents[i] - automatic-tests: true - manual-tests: [] - - - name: awkward_ListOffsetArray_reduce_nonlocal_outstartsstops_64 - specializations: - - name: awkward_ListOffsetArray_reduce_nonlocal_outstartsstops_64 - args: - - {name: outstarts, type: "List[int64_t]", dir: out} - - {name: outstops, type: "List[int64_t]", dir: out} - - {name: distincts, type: "Const[List[int64_t]]", dir: in, role: reducer-distincts} - - {name: lendistincts, type: "int64_t", dir: in, role: reducer-lendistincts} - - {name: gaps, type: "Const[List[int64_t]]", dir: in, role: reducer-gaps} - - {name: outlength, type: "int64_t", dir: in, role: reducer-outlength} - description: null - definition: | - def awkward_ListOffsetArray_reduce_nonlocal_outstartsstops_64( - outstarts, outstops, distincts, lendistincts, gaps, outlength - ): - maxcount = lendistincts // outlength - - j = 0 - k = 0 - maxdistinct = -2 - lasti = -1 - for i in range(lendistincts): - if maxdistinct < distincts[i]: - maxdistinct = distincts[i] - - extra = (i - lasti) // maxcount - lasti = i - - numgappy = gaps[j] - if numgappy < extra: - numgappy = extra - - for gappy in range(numgappy): - outstarts[k] = i - outstops[k] = i - k = k + 1 - j = j + 1 - - if distincts[i] != -1: - outstops[k - 1] = i + 1 - - while k < outlength: - outstarts[k] = lendistincts + 1 - outstops[k] = lendistincts + 1 - k = k + 1 - automatic-tests: true - manual-tests: [] - - - name: awkward_ListOffsetArray_reduce_nonlocal_preparenext_64 - specializations: - - name: awkward_ListOffsetArray_reduce_nonlocal_preparenext_64 - args: - - {name: nextcarry, type: "List[int64_t]", dir: out} - - {name: nextparents, type: "List[int64_t]", dir: out} - - {name: nextlen, type: "int64_t", dir: in} - - {name: maxnextparents, type: "List[int64_t]", dir: out} - - {name: distincts, type: "List[int64_t]", dir: out} - - {name: distinctslen, type: "int64_t", dir: in} - - {name: offsetscopy, type: "List[int64_t]", dir: in} - - {name: offsets, type: "Const[List[int64_t]]", dir: in} - - {name: length, type: "int64_t", dir: in} - - {name: parents, type: "Const[List[int64_t]]", dir: in} - - {name: maxcount, type: "int64_t", dir: in} - description: null - definition: | - Insert Python definition here - automatic-tests: false - manual-tests: [] - - - name: awkward_ListOffsetArray_rpad_and_clip_axis1 - specializations: - - name: awkward_ListOffsetArray32_rpad_and_clip_axis1_64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: target, type: "int64_t", dir: in, role: default} - - name: awkward_ListOffsetArray64_rpad_and_clip_axis1_64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: target, type: "int64_t", dir: in, role: default} - - name: awkward_ListOffsetArrayU32_rpad_and_clip_axis1_64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: target, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_ListOffsetArray_rpad_and_clip_axis1(toindex, fromoffsets, length, target): - for i in range(length): - rangeval = float(fromoffsets[i + 1] - fromoffsets[i]) - shorter = target if target < rangeval else rangeval - for j in range(shorter): - toindex[(i * target) + j] = float(fromoffsets[i]) + j - for j in range(shorter, target): - toindex[(i * target) + j] = -1 - automatic-tests: false - manual-tests: [] - - - name: awkward_ListOffsetArray_rpad_axis1 - specializations: - - name: awkward_ListOffsetArray32_rpad_axis1_64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: target, type: "int64_t", dir: in, role: default} - - name: awkward_ListOffsetArray64_rpad_axis1_64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: target, type: "int64_t", dir: in, role: default} - - name: awkward_ListOffsetArrayU32_rpad_axis1_64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: target, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_ListOffsetArray_rpad_axis1(toindex, fromoffsets, fromlength, target): - count = 0 - for i in range(fromlength): - rangeval = float(fromoffsets[i + 1] - fromoffsets[i]) - for j in range(rangeval): - toindex[count] = float(fromoffsets[i]) + j - count = count + 1 - for j in range(rangeval, target): - toindex[count] = -1 - count = count + 1 - automatic-tests: false - manual-tests: [] - - - name: awkward_ListOffsetArray_rpad_length_axis1 - specializations: - - name: awkward_ListOffsetArray32_rpad_length_axis1 - args: - - {name: tooffsets, type: "List[int32_t]", dir: out} - - {name: fromoffsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: target, type: "int64_t", dir: in, role: default} - - {name: tolength, type: "List[int64_t]", dir: out} - - name: awkward_ListOffsetArray64_rpad_length_axis1 - args: - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: target, type: "int64_t", dir: in, role: default} - - {name: tolength, type: "List[int64_t]", dir: out} - - name: awkward_ListOffsetArrayU32_rpad_length_axis1 - args: - - {name: tooffsets, type: "List[uint32_t]", dir: out} - - {name: fromoffsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: fromlength, type: "int64_t", dir: in, role: default} - - {name: target, type: "int64_t", dir: in, role: default} - - {name: tolength, type: "List[int64_t]", dir: out} - description: null - definition: | - def awkward_ListOffsetArray_rpad_length_axis1( - tooffsets, fromoffsets, fromlength, target, tolength - ): - length = 0 - tooffsets[0] = 0 - for i in range(fromlength): - rangeval = fromoffsets[i + 1] - fromoffsets[i] - longer = rangeval if target < rangeval else target - length = length + longer - tooffsets[i + 1] = tooffsets[i] + longer - tolength[0] = length - automatic-tests: false - manual-tests: [] - - - name: awkward_ListOffsetArray_toRegularArray - specializations: - - name: awkward_ListOffsetArray32_toRegularArray - args: - - {name: size, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[int32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - name: awkward_ListOffsetArray64_toRegularArray - args: - - {name: size, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - name: awkward_ListOffsetArrayU32_toRegularArray - args: - - {name: size, type: "List[int64_t]", dir: out} - - {name: fromoffsets, type: "Const[List[uint32_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_ListOffsetArray_toRegularArray(size, fromoffsets, offsetslength): - size[0] = -1 - for i in range(offsetslength - 1): - count = int(fromoffsets[i + 1]) - int(fromoffsets[i]) - if count < 0: - raise ValueError("offsets must be monotonically increasing") - if size[0] == -1: - size[0] = count - else: - if size[0] != count: - raise ValueError( - "cannot convert to RegularArray because subarray lengths are not regular" - ) - if size[0] == -1: - size[0] = 0 - automatic-tests: true - manual-tests: [] - - - name: awkward_MaskedArray_getitem_next_jagged_project - specializations: - - name: awkward_MaskedArray32_getitem_next_jagged_project - args: - - {name: index, type: "List[int32_t]", dir: in, role: IndexedArray-index} - - {name: starts_in, type: "List[int64_t]", dir: in, role: ListArray-starts} - - {name: stops_in, type: "List[int64_t]", dir: in, role: ListArray-stops} - - {name: starts_out, type: "List[int64_t]", dir: out} - - {name: stops_out, type: "List[int64_t]", dir: out} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_MaskedArray64_getitem_next_jagged_project - args: - - {name: index, type: "List[int64_t]", dir: in, role: IndexedArray-index} - - {name: starts_in, type: "List[int64_t]", dir: in, role: ListArray-starts} - - {name: stops_in, type: "List[int64_t]", dir: in, role: ListArray-stops} - - {name: starts_out, type: "List[int64_t]", dir: out} - - {name: stops_out, type: "List[int64_t]", dir: out} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_MaskedArrayU32_getitem_next_jagged_project - args: - - {name: index, type: "List[uint32_t]", dir: in, role: IndexedArray-index} - - {name: starts_in, type: "List[int64_t]", dir: in, role: ListArray-starts} - - {name: stops_in, type: "List[int64_t]", dir: in, role: ListArray-stops} - - {name: starts_out, type: "List[int64_t]", dir: out} - - {name: stops_out, type: "List[int64_t]", dir: out} - - {name: length, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_MaskedArray_getitem_next_jagged_project( - index, starts_in, stops_in, starts_out, stops_out, length - ): - k = 0 - for i in range(length): - if index[i] >= 0: - starts_out[k] = starts_in[i] - stops_out[k] = stops_in[i] - k = k + 1 - automatic-tests: true - manual-tests: [] - - - name: awkward_NumpyArray_copy - specializations: - - name: awkward_NumpyArray_copy - args: - - {name: toptr, type: "List[uint8_t]", dir: out} - - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - - {name: len, type: "int64_t", dir: in, role: default} - description: null - definition: | - Insert Python definition here - automatic-tests: false - manual-tests: [] - - - name: awkward_NumpyArray_contiguous_copy - specializations: - - name: awkward_NumpyArray_contiguous_copy_64 - args: - - {name: toptr, type: "List[uint8_t]", dir: out} - - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - - {name: len, type: "int64_t", dir: in, role: default} - - {name: stride, type: "int64_t", dir: in, role: default} - - {name: pos, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - description: null - definition: | - Insert Python definition here - automatic-tests: false - manual-tests: [] - - - name: awkward_NumpyArray_contiguous_copy_from_many - specializations: - - name: awkward_NumpyArray_contiguous_copy_from_many_64 - args: - - {name: toptr, type: "List[uint8_t]", dir: out} - - {name: fromptrs, type: "Const[List[List[uint8_t]]]", dir: in, role: NumpyArray-ptr} - - {name: fromlens, type: "List[int64_t]", dir: in, role: default} - - {name: len, type: "int64_t", dir: in, role: default} - - {name: stride, type: "int64_t", dir: in, role: default} - - {name: pos, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - description: null - definition: | - Insert Python definition here - automatic-tests: false - manual-tests: [] - - - name: awkward_NumpyArray_contiguous_init - specializations: - - name: awkward_NumpyArray_contiguous_init_64 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: skip, type: "int64_t", dir: in, role: default} - - {name: stride, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_NumpyArray_contiguous_init(toptr, skip, stride): - for i in range(skip): - toptr[i] = i * stride - automatic-tests: true - manual-tests: [] - - - name: awkward_NumpyArray_contiguous_next - specializations: - - name: awkward_NumpyArray_contiguous_next_64 - args: - - {name: topos, type: "List[int64_t]", dir: out} - - {name: frompos, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: skip, type: "int64_t", dir: in, role: default} - - {name: stride, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_NumpyArray_contiguous_next(topos, frompos, length, skip, stride): - for i in range(length): - for j in range(skip): - topos[(i * skip) + j] = frompos[i] + (j * stride) - automatic-tests: true - manual-tests: [] - - - name: awkward_NumpyArray_fill - specializations: - - name: awkward_NumpyArray_fill_toint8_fromint8 - args: - - {name: toptr, type: "List[int8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint8_fromint16 - args: - - {name: toptr, type: "List[int8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint8_fromint32 - args: - - {name: toptr, type: "List[int8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint8_fromint64 - args: - - {name: toptr, type: "List[int8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint8_fromuint8 - args: - - {name: toptr, type: "List[int8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint8_fromuint16 - args: - - {name: toptr, type: "List[int8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint8_fromuint32 - args: - - {name: toptr, type: "List[int8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint8_fromuint64 - args: - - {name: toptr, type: "List[int8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint8_fromfloat32 - args: - - {name: toptr, type: "List[int8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint8_fromfloat64 - args: - - {name: toptr, type: "List[int8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint16_fromint8 - args: - - {name: toptr, type: "List[int16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint16_fromint16 - args: - - {name: toptr, type: "List[int16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint16_fromint32 - args: - - {name: toptr, type: "List[int16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint16_fromint64 - args: - - {name: toptr, type: "List[int16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint16_fromuint8 - args: - - {name: toptr, type: "List[int16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint16_fromuint16 - args: - - {name: toptr, type: "List[int16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint16_fromuint32 - args: - - {name: toptr, type: "List[int16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint16_fromuint64 - args: - - {name: toptr, type: "List[int16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint16_fromfloat32 - args: - - {name: toptr, type: "List[int16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint16_fromfloat64 - args: - - {name: toptr, type: "List[int16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint32_fromint8 - args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint32_fromint16 - args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint32_fromint32 - args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint32_fromint64 - args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint32_fromuint8 - args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint32_fromuint16 - args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint32_fromuint32 - args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint32_fromuint64 - args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint32_fromfloat32 - args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint32_fromfloat64 - args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint64_fromint8 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint64_fromint16 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint64_fromint32 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint64_fromint64 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint64_fromuint8 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint64_fromuint16 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint64_fromuint32 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint64_fromuint64 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint64_fromfloat32 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint64_fromfloat64 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint8_fromint8 - args: - - {name: toptr, type: "List[uint8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint8_fromint16 - args: - - {name: toptr, type: "List[uint8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint8_fromint32 - args: - - {name: toptr, type: "List[uint8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint8_fromint64 - args: - - {name: toptr, type: "List[uint8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint8_fromuint8 - args: - - {name: toptr, type: "List[uint8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint8_fromuint16 - args: - - {name: toptr, type: "List[uint8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint8_fromuint32 - args: - - {name: toptr, type: "List[uint8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint8_fromuint64 - args: - - {name: toptr, type: "List[uint8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint8_fromfloat32 - args: - - {name: toptr, type: "List[uint8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint8_fromfloat64 - args: - - {name: toptr, type: "List[uint8_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint16_fromint8 - args: - - {name: toptr, type: "List[uint16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint16_fromint16 - args: - - {name: toptr, type: "List[uint16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint16_fromint32 - args: - - {name: toptr, type: "List[uint16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint16_fromint64 - args: - - {name: toptr, type: "List[uint16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint16_fromuint8 - args: - - {name: toptr, type: "List[uint16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint16_fromuint16 - args: - - {name: toptr, type: "List[uint16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint16_fromuint32 - args: - - {name: toptr, type: "List[uint16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint16_fromuint64 - args: - - {name: toptr, type: "List[uint16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint16_fromfloat32 - args: - - {name: toptr, type: "List[uint16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint16_fromfloat64 - args: - - {name: toptr, type: "List[uint16_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint32_fromint8 - args: - - {name: toptr, type: "List[uint32_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint32_fromint16 - args: - - {name: toptr, type: "List[uint32_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint32_fromint32 - args: - - {name: toptr, type: "List[uint32_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint32_fromint64 - args: - - {name: toptr, type: "List[uint32_t]", dir: out} + - {name: toptr, type: "List[int8_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint32_fromuint8 + - name: awkward_NumpyArray_fill_toint8_fromuint8 args: - - {name: toptr, type: "List[uint32_t]", dir: out} + - {name: toptr, type: "List[int8_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint32_fromuint16 + - name: awkward_NumpyArray_fill_toint8_fromuint16 args: - - {name: toptr, type: "List[uint32_t]", dir: out} + - {name: toptr, type: "List[int8_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint32_fromuint32 + - name: awkward_NumpyArray_fill_toint8_fromuint32 args: - - {name: toptr, type: "List[uint32_t]", dir: out} + - {name: toptr, type: "List[int8_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint32_fromuint64 + - name: awkward_NumpyArray_fill_toint8_fromuint64 args: - - {name: toptr, type: "List[uint32_t]", dir: out} + - {name: toptr, type: "List[int8_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint32_fromfloat32 + - name: awkward_NumpyArray_fill_toint8_fromfloat32 args: - - {name: toptr, type: "List[uint32_t]", dir: out} + - {name: toptr, type: "List[int8_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint32_fromfloat64 + - name: awkward_NumpyArray_fill_toint8_fromfloat64 args: - - {name: toptr, type: "List[uint32_t]", dir: out} + - {name: toptr, type: "List[int8_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint64_fromint8 + - name: awkward_NumpyArray_fill_toint16_fromint8 args: - - {name: toptr, type: "List[uint64_t]", dir: out} + - {name: toptr, type: "List[int16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint64_fromint16 + - name: awkward_NumpyArray_fill_toint16_fromint16 args: - - {name: toptr, type: "List[uint64_t]", dir: out} + - {name: toptr, type: "List[int16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint64_fromint32 + - name: awkward_NumpyArray_fill_toint16_fromint32 args: - - {name: toptr, type: "List[uint64_t]", dir: out} + - {name: toptr, type: "List[int16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint64_fromint64 + - name: awkward_NumpyArray_fill_toint16_fromint64 args: - - {name: toptr, type: "List[uint64_t]", dir: out} + - {name: toptr, type: "List[int16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint64_fromuint8 + - name: awkward_NumpyArray_fill_toint16_fromuint8 args: - - {name: toptr, type: "List[uint64_t]", dir: out} + - {name: toptr, type: "List[int16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint64_fromuint16 + - name: awkward_NumpyArray_fill_toint16_fromuint16 args: - - {name: toptr, type: "List[uint64_t]", dir: out} + - {name: toptr, type: "List[int16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint64_fromuint32 + - name: awkward_NumpyArray_fill_toint16_fromuint32 args: - - {name: toptr, type: "List[uint64_t]", dir: out} + - {name: toptr, type: "List[int16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint64_fromuint64 + - name: awkward_NumpyArray_fill_toint16_fromuint64 args: - - {name: toptr, type: "List[uint64_t]", dir: out} + - {name: toptr, type: "List[int16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint64_fromfloat32 + - name: awkward_NumpyArray_fill_toint16_fromfloat32 args: - - {name: toptr, type: "List[uint64_t]", dir: out} + - {name: toptr, type: "List[int16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint64_fromfloat64 + - name: awkward_NumpyArray_fill_toint16_fromfloat64 args: - - {name: toptr, type: "List[uint64_t]", dir: out} + - {name: toptr, type: "List[int16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat32_fromint8 + - name: awkward_NumpyArray_fill_toint32_fromint8 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[int32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat32_fromint16 + - name: awkward_NumpyArray_fill_toint32_fromint16 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[int32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat32_fromint32 + - name: awkward_NumpyArray_fill_toint32_fromint32 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[int32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat32_fromint64 + - name: awkward_NumpyArray_fill_toint32_fromint64 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[int32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat32_fromuint8 + - name: awkward_NumpyArray_fill_toint32_fromuint8 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[int32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat32_fromuint16 + - name: awkward_NumpyArray_fill_toint32_fromuint16 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[int32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat32_fromuint32 + - name: awkward_NumpyArray_fill_toint32_fromuint32 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[int32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat32_fromuint64 + - name: awkward_NumpyArray_fill_toint32_fromuint64 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[int32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat32_fromfloat32 + - name: awkward_NumpyArray_fill_toint32_fromfloat32 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[int32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat32_fromfloat64 + - name: awkward_NumpyArray_fill_toint32_fromfloat64 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[int32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat64_fromint8 + - name: awkward_NumpyArray_fill_toint64_fromint8 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[int64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat64_fromint16 + - name: awkward_NumpyArray_fill_toint64_fromint16 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[int64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat64_fromint32 + - name: awkward_NumpyArray_fill_toint64_fromint32 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[int64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat64_fromint64 + - name: awkward_NumpyArray_fill_toint64_fromint64 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[int64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat64_fromuint8 + - name: awkward_NumpyArray_fill_toint64_fromuint8 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[int64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat64_fromuint16 + - name: awkward_NumpyArray_fill_toint64_fromuint16 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[int64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat64_fromuint32 + - name: awkward_NumpyArray_fill_toint64_fromuint32 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[int64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat64_fromuint64 + - name: awkward_NumpyArray_fill_toint64_fromuint64 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[int64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat64_fromfloat32 + - name: awkward_NumpyArray_fill_toint64_fromfloat32 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[int64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat64_fromfloat64 + - name: awkward_NumpyArray_fill_toint64_fromfloat64 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[int64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_NumpyArray_fill(toptr, tooffset, fromptr, length): - for i in range(length): - toptr[tooffset + i] = float(fromptr[i]) - automatic-tests: false - manual-tests: [] - - - name: awkward_NumpyArray_fill_tocomplex - specializations: - - name: awkward_NumpyArray_fill_tocomplex64_frombool - args: - - {name: toptr, type: "List[float]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex64_fromint8 + - name: awkward_NumpyArray_fill_touint8_fromint8 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[uint8_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex64_fromint16 + - name: awkward_NumpyArray_fill_touint8_fromint16 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[uint8_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex64_fromint32 + - name: awkward_NumpyArray_fill_touint8_fromint32 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[uint8_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex64_fromint64 + - name: awkward_NumpyArray_fill_touint8_fromint64 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[uint8_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex64_fromuint8 + - name: awkward_NumpyArray_fill_touint8_fromuint8 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[uint8_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex64_fromuint16 + - name: awkward_NumpyArray_fill_touint8_fromuint16 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[uint8_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex64_fromuint32 + - name: awkward_NumpyArray_fill_touint8_fromuint32 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[uint8_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex64_fromuint64 + - name: awkward_NumpyArray_fill_touint8_fromuint64 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[uint8_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex64_fromfloat32 + - name: awkward_NumpyArray_fill_touint8_fromfloat32 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[uint8_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex64_fromfloat64 + - name: awkward_NumpyArray_fill_touint8_fromfloat64 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[uint8_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex128_frombool - args: - - {name: toptr, type: "List[double]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex128_fromint8 + - name: awkward_NumpyArray_fill_touint16_fromint8 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[uint16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex128_fromint16 + - name: awkward_NumpyArray_fill_touint16_fromint16 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[uint16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex128_fromint32 + - name: awkward_NumpyArray_fill_touint16_fromint32 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[uint16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex128_fromint64 + - name: awkward_NumpyArray_fill_touint16_fromint64 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[uint16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex128_fromuint8 + - name: awkward_NumpyArray_fill_touint16_fromuint8 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[uint16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex128_fromuint16 + - name: awkward_NumpyArray_fill_touint16_fromuint16 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[uint16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex128_fromuint32 + - name: awkward_NumpyArray_fill_touint16_fromuint32 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[uint16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex128_fromuint64 + - name: awkward_NumpyArray_fill_touint16_fromuint64 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[uint16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex128_fromfloat32 - args: - - {name: toptr, type: "List[double]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tocomplex128_fromfloat64 - args: - - {name: toptr, type: "List[double]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - description: null - definition: | - automatic-tests: false - manual-tests: [] - - - name: awkward_NumpyArray_fill_fromcomplex - specializations: - - name: awkward_NumpyArray_fill_tobool_fromcomplex64 + - name: awkward_NumpyArray_fill_touint16_fromfloat32 args: - - {name: toptr, type: "List[bool]", dir: out} + - {name: toptr, type: "List[uint16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tobool_fromcomplex128 + - name: awkward_NumpyArray_fill_touint16_fromfloat64 args: - - {name: toptr, type: "List[bool]", dir: out} + - {name: toptr, type: "List[uint16_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint8_fromcomplex64 + - name: awkward_NumpyArray_fill_touint32_fromint8 args: - - {name: toptr, type: "List[int8_t]", dir: out} + - {name: toptr, type: "List[uint32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint8_fromcomplex128 + - name: awkward_NumpyArray_fill_touint32_fromint16 args: - - {name: toptr, type: "List[int8_t]", dir: out} + - {name: toptr, type: "List[uint32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint16_fromcomplex64 + - name: awkward_NumpyArray_fill_touint32_fromint32 args: - - {name: toptr, type: "List[int16_t]", dir: out} + - {name: toptr, type: "List[uint32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint16_fromcomplex128 + - name: awkward_NumpyArray_fill_touint32_fromint64 args: - - {name: toptr, type: "List[int16_t]", dir: out} + - {name: toptr, type: "List[uint32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint32_fromcomplex64 + - name: awkward_NumpyArray_fill_touint32_fromuint8 args: - - {name: toptr, type: "List[int32_t]", dir: out} + - {name: toptr, type: "List[uint32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint32_fromcomplex128 + - name: awkward_NumpyArray_fill_touint32_fromuint16 args: - - {name: toptr, type: "List[int32_t]", dir: out} + - {name: toptr, type: "List[uint32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint64_fromcomplex64 + - name: awkward_NumpyArray_fill_touint32_fromuint32 args: - - {name: toptr, type: "List[int64_t]", dir: out} + - {name: toptr, type: "List[uint32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint64_fromcomplex128 + - name: awkward_NumpyArray_fill_touint32_fromuint64 args: - - {name: toptr, type: "List[int64_t]", dir: out} + - {name: toptr, type: "List[uint32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint8_fromcomplex64 + - name: awkward_NumpyArray_fill_touint32_fromfloat32 args: - - {name: toptr, type: "List[uint8_t]", dir: out} + - {name: toptr, type: "List[uint32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint8_fromcomplex128 + - name: awkward_NumpyArray_fill_touint32_fromfloat64 args: - - {name: toptr, type: "List[uint8_t]", dir: out} + - {name: toptr, type: "List[uint32_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint16_fromcomplex64 + - name: awkward_NumpyArray_fill_touint64_fromint8 args: - - {name: toptr, type: "List[uint16_t]", dir: out} + - {name: toptr, type: "List[uint64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint16_fromcomplex128 + - name: awkward_NumpyArray_fill_touint64_fromint16 args: - - {name: toptr, type: "List[uint16_t]", dir: out} + - {name: toptr, type: "List[uint64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint32_fromcomplex64 + - name: awkward_NumpyArray_fill_touint64_fromint32 args: - - {name: toptr, type: "List[uint32_t]", dir: out} + - {name: toptr, type: "List[uint64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint32_fromcomplex128 + - name: awkward_NumpyArray_fill_touint64_fromint64 args: - - {name: toptr, type: "List[uint32_t]", dir: out} + - {name: toptr, type: "List[uint64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint64_fromcomplex64 + - name: awkward_NumpyArray_fill_touint64_fromuint8 args: - {name: toptr, type: "List[uint64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint64_fromcomplex128 + - name: awkward_NumpyArray_fill_touint64_fromuint16 args: - {name: toptr, type: "List[uint64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat32_fromcomplex64 + - name: awkward_NumpyArray_fill_touint64_fromuint32 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[uint64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat32_fromcomplex128 + - name: awkward_NumpyArray_fill_touint64_fromuint64 args: - - {name: toptr, type: "List[float]", dir: out} + - {name: toptr, type: "List[uint64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat64_fromcomplex64 + - name: awkward_NumpyArray_fill_touint64_fromfloat32 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[uint64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat64_fromcomplex128 - args: - - {name: toptr, type: "List[double]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_NumpyArray_fill_fromcomplex(toptr, tooffset, fromptr, length): - for i in range(length): - toptr[tooffset + i] = fromptr[i*2] - automatic-tests: false - manual-tests: [] - - - name: awkward_NumpyArray_fill_frombool - specializations: - - name: awkward_NumpyArray_fill_tobool_frombool + - name: awkward_NumpyArray_fill_touint64_fromfloat64 args: - - {name: toptr, type: "List[bool]", dir: out} + - {name: toptr, type: "List[uint64_t]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint8_frombool + - name: awkward_NumpyArray_fill_tofloat32_fromint8 args: - - {name: toptr, type: "List[int8_t]", dir: out} + - {name: toptr, type: "List[float]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint16_frombool + - name: awkward_NumpyArray_fill_tofloat32_fromint16 args: - - {name: toptr, type: "List[int16_t]", dir: out} + - {name: toptr, type: "List[float]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint32_frombool + - name: awkward_NumpyArray_fill_tofloat32_fromint32 args: - - {name: toptr, type: "List[int32_t]", dir: out} + - {name: toptr, type: "List[float]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_toint64_frombool + - name: awkward_NumpyArray_fill_tofloat32_fromint64 args: - - {name: toptr, type: "List[int64_t]", dir: out} + - {name: toptr, type: "List[float]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint8_frombool + - name: awkward_NumpyArray_fill_tofloat32_fromuint8 args: - - {name: toptr, type: "List[uint8_t]", dir: out} + - {name: toptr, type: "List[float]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint16_frombool + - name: awkward_NumpyArray_fill_tofloat32_fromuint16 args: - - {name: toptr, type: "List[uint16_t]", dir: out} + - {name: toptr, type: "List[float]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint32_frombool + - name: awkward_NumpyArray_fill_tofloat32_fromuint32 args: - - {name: toptr, type: "List[uint32_t]", dir: out} + - {name: toptr, type: "List[float]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_touint64_frombool + - name: awkward_NumpyArray_fill_tofloat32_fromuint64 args: - - {name: toptr, type: "List[uint64_t]", dir: out} + - {name: toptr, type: "List[float]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat32_frombool + - name: awkward_NumpyArray_fill_tofloat32_fromfloat32 args: - {name: toptr, type: "List[float]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tofloat64_frombool + - name: awkward_NumpyArray_fill_tofloat32_fromfloat64 args: - - {name: toptr, type: "List[double]", dir: out} + - {name: toptr, type: "List[float]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: NumpyArray-ptr} + - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_NumpyArray_fill_frombool(toptr, tooffset, fromptr, length): - for i in range(length): - toptr[tooffset + i] = float(1 if fromptr[i] else 0) - automatic-tests: true - manual-tests: [] - - - name: awkward_NumpyArray_fill_tobool - specializations: - - name: awkward_NumpyArray_fill_tobool_fromint8 + - name: awkward_NumpyArray_fill_tofloat64_fromint8 args: - - {name: toptr, type: "List[bool]", dir: out} + - {name: toptr, type: "List[double]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tobool_fromint16 + - name: awkward_NumpyArray_fill_tofloat64_fromint16 args: - - {name: toptr, type: "List[bool]", dir: out} + - {name: toptr, type: "List[double]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tobool_fromint32 + - name: awkward_NumpyArray_fill_tofloat64_fromint32 args: - - {name: toptr, type: "List[bool]", dir: out} + - {name: toptr, type: "List[double]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tobool_fromint64 + - name: awkward_NumpyArray_fill_tofloat64_fromint64 args: - - {name: toptr, type: "List[bool]", dir: out} + - {name: toptr, type: "List[double]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tobool_fromuint8 + - name: awkward_NumpyArray_fill_tofloat64_fromuint8 args: - - {name: toptr, type: "List[bool]", dir: out} + - {name: toptr, type: "List[double]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tobool_fromuint16 + - name: awkward_NumpyArray_fill_tofloat64_fromuint16 args: - - {name: toptr, type: "List[bool]", dir: out} + - {name: toptr, type: "List[double]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tobool_fromuint32 + - name: awkward_NumpyArray_fill_tofloat64_fromuint32 args: - - {name: toptr, type: "List[bool]", dir: out} + - {name: toptr, type: "List[double]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tobool_fromuint64 + - name: awkward_NumpyArray_fill_tofloat64_fromuint64 args: - - {name: toptr, type: "List[bool]", dir: out} + - {name: toptr, type: "List[double]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tobool_fromfloat32 + - name: awkward_NumpyArray_fill_tofloat64_fromfloat32 args: - - {name: toptr, type: "List[bool]", dir: out} + - {name: toptr, type: "List[double]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[float]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_NumpyArray_fill_tobool_fromfloat64 + - name: awkward_NumpyArray_fill_tofloat64_fromfloat64 args: - - {name: toptr, type: "List[bool]", dir: out} + - {name: toptr, type: "List[double]", dir: out} - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - {name: fromptr, type: "Const[List[double]]", dir: in, role: NumpyArray-ptr} - {name: length, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_NumpyArray_fill_tobool(toptr, tooffset, fromptr, length): - for i in range(length): - toptr[tooffset + i] = True if fromptr[i] > 0 else False - automatic-tests: true - manual-tests: [] - - - name: awkward_NumpyArray_fill_scaled - specializations: - - name: awkward_NumpyArray_fill_scaled_toint64_fromint64 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: tooffset, type: "int64_t", dir: in, role: IndexedArray-index-offset} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: scale, type: "double", dir: in, role: default} - description: null - definition: | - def awkward_NumpyArray_fill_scaled(toptr, tooffset, fromptr, length, scale): + def awkward_NumpyArray_fill(toptr, tooffset, fromptr, length): for i in range(length): - toptr[tooffset + i] = fromptr[i] * scale + toptr[tooffset + i] = float(fromptr[i]) automatic-tests: false manual-tests: [] @@ -4656,180 +3328,6 @@ kernels: automatic-tests: false manual-tests: [] - - name: awkward_NumpyArray_getitem_boolean_nonzero - specializations: - - name: awkward_NumpyArray_getitem_boolean_nonzero_64 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: ByteMaskedArray-mask} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: stride, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_NumpyArray_getitem_boolean_nonzero(toptr, fromptr, length, stride): - k = 0 - i = 0 - while i < length: - if fromptr[i] != 0: - toptr[k] = i - k = k + 1 - i += stride - automatic-tests: true - manual-tests: [] - - - name: awkward_NumpyArray_getitem_boolean_numtrue - specializations: - - name: awkward_NumpyArray_getitem_boolean_numtrue - args: - - {name: numtrue, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: ByteMaskedArray-mask} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: stride, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_NumpyArray_getitem_boolean_numtrue(numtrue, fromptr, length, stride): - numtrue[0] = 0 - i = 0 - while i < length: - numtrue[0] = numtrue[0] + (fromptr[i] != 0) - i += stride - automatic-tests: true - manual-tests: [] - - - name: awkward_NumpyArray_getitem_next_array - specializations: - - name: awkward_NumpyArray_getitem_next_array_64 - args: - - {name: nextcarryptr, type: "List[int64_t]", dir: out} - - {name: nextadvancedptr, type: "List[int64_t]", dir: out} - - {name: carryptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - - {name: flatheadptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray2-ptr} - - {name: lencarry, type: "int64_t", dir: in, role: default} - - {name: lenflathead, type: "int64_t", dir: in, role: default} - - {name: skip, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_NumpyArray_getitem_next_array( - nextcarryptr, nextadvancedptr, carryptr, flatheadptr, lencarry, lenflathead, skip - ): - for i in range(lencarry): - for j in range(lenflathead): - nextcarryptr[(i * lenflathead) + j] = (skip * carryptr[i]) + flatheadptr[j] - nextadvancedptr[(i * lenflathead) + j] = j - automatic-tests: true - manual-tests: [] - - - name: awkward_NumpyArray_getitem_next_array_advanced - specializations: - - name: awkward_NumpyArray_getitem_next_array_advanced_64 - args: - - {name: nextcarryptr, type: "List[int64_t]", dir: out} - - {name: carryptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - - {name: advancedptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray2-ptr} - - {name: flatheadptr, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lencarry, type: "int64_t", dir: in, role: default} - - {name: skip, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_NumpyArray_getitem_next_array_advanced( - nextcarryptr, carryptr, advancedptr, flatheadptr, lencarry, skip - ): - for i in range(lencarry): - nextcarryptr[i] = (skip * carryptr[i]) + flatheadptr[advancedptr[i]] - automatic-tests: false - manual-tests: [] - - - name: awkward_NumpyArray_getitem_next_at - specializations: - - name: awkward_NumpyArray_getitem_next_at_64 - args: - - {name: nextcarryptr, type: "List[int64_t]", dir: out} - - {name: carryptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - - {name: lencarry, type: "int64_t", dir: in, role: default} - - {name: skip, type: "int64_t", dir: in, role: default} - - {name: at, type: "int64_t", dir: in, role: ListArray-at} - description: null - definition: | - def awkward_NumpyArray_getitem_next_at(nextcarryptr, carryptr, lencarry, skip, at): - for i in range(lencarry): - nextcarryptr[i] = (skip * carryptr[i]) + at - automatic-tests: true - manual-tests: [] - - - name: awkward_NumpyArray_getitem_next_null - specializations: - - name: awkward_NumpyArray_getitem_next_null_64 - args: - - {name: toptr, type: "List[uint8_t]", dir: out} - - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: NumpyArray-ptr} - - {name: len, type: "int64_t", dir: in, role: default} - - {name: stride, type: "int64_t", dir: in, role: default} - - {name: pos, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - description: null - definition: | - Insert Python definition here - automatic-tests: false - manual-tests: [] - - - name: awkward_NumpyArray_getitem_next_range - specializations: - - name: awkward_NumpyArray_getitem_next_range_64 - args: - - {name: nextcarryptr, type: "List[int64_t]", dir: out} - - {name: carryptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - - {name: lencarry, type: "int64_t", dir: in, role: default} - - {name: lenhead, type: "int64_t", dir: in, role: default} - - {name: skip, type: "int64_t", dir: in, role: default} - - {name: start, type: "int64_t", dir: in, role: default} - - {name: step, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_NumpyArray_getitem_next_range( - nextcarryptr, carryptr, lencarry, lenhead, skip, start, step - ): - for i in range(lencarry): - for j in range(lenhead): - nextcarryptr[(i * lenhead) + j] = ((skip * carryptr[i]) + start) + ( - j * step - ) - automatic-tests: true - manual-tests: [] - - - name: awkward_NumpyArray_getitem_next_range_advanced - specializations: - - name: awkward_NumpyArray_getitem_next_range_advanced_64 - args: - - {name: nextcarryptr, type: "List[int64_t]", dir: out} - - {name: nextadvancedptr, type: "List[int64_t]", dir: out} - - {name: carryptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray-ptr} - - {name: advancedptr, type: "Const[List[int64_t]]", dir: in, role: NumpyArray2-ptr} - - {name: lencarry, type: "int64_t", dir: in, role: default} - - {name: lenhead, type: "int64_t", dir: in, role: default} - - {name: skip, type: "int64_t", dir: in, role: default} - - {name: start, type: "int64_t", dir: in, role: default} - - {name: step, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_NumpyArray_getitem_next_range_advanced( - nextcarryptr, - nextadvancedptr, - carryptr, - advancedptr, - lencarry, - lenhead, - skip, - start, - step, - ): - for i in range(lencarry): - for j in range(lenhead): - nextcarryptr[(i * lenhead) + j] = ((skip * carryptr[i]) + start) + ( - j * step - ) - nextadvancedptr[(i * lenhead) + j] = advancedptr[i] - automatic-tests: true - manual-tests: [] - - name: awkward_NumpyArray_reduce_adjust_starts_64 specializations: - name: awkward_NumpyArray_reduce_adjust_starts_64 @@ -4895,116 +3393,38 @@ kernels: - name: awkward_ListOffsetArray_argsort_strings specializations: - - name: awkward_ListOffsetArray_argsort_strings - args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromparents, type: "Const[List[int64_t]]", dir: in} - - {name: length, type: "int64_t", dir: in} - - {name: stringdata, type: "Const[List[uint8_t]]", dir: in} - - {name: stringstarts, type: "Const[List[int64_t]]", dir: in} - - {name: stringstops, type: "Const[List[int64_t]]", dir: in} - - {name: is_stable, type: "bool", dir: in} - - {name: is_ascending, type: "bool", dir: in} - - {name: is_local, type: "bool", dir: in} - description: null - definition: | - Insert Python definition here - automatic-tests: false - manual-tests: [] - - - name: awkward_NumpyArray_sort_asstrings_uint8 - specializations: - - name: awkward_NumpyArray_sort_asstrings_uint8 - args: - - {name: toptr, type: "List[uint8_t]", dir: out} - - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: IndexedArray-index} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: outoffsets, type: "List[int64_t]", dir: out} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - description: null - definition: | - Insert Python definition here - automatic-tests: true - manual-tests: [] - - - name: awkward_NumpyArray_unique_ranges - specializations: - - name: awkward_NumpyArray_unique_ranges_int8 - args: - - {name: toptr, type: "List[int8_t]", dir: out, role: IndexedArray-index} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: outoffsets, type: "List[int64_t]", dir: out} - - {name: tolength, type: "List[int64_t]", dir: out} - - name: awkward_NumpyArray_unique_ranges_int16 - args: - - {name: toptr, type: "List[int16_t]", dir: out, role: IndexedArray-index} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: outoffsets, type: "List[int64_t]", dir: out} - - {name: tolength, type: "List[int64_t]", dir: out} - - name: awkward_NumpyArray_unique_ranges_int32 - args: - - {name: toptr, type: "List[int32_t]", dir: out, role: IndexedArray-index} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: outoffsets, type: "List[int64_t]", dir: out} - - {name: tolength, type: "List[int64_t]", dir: out} - - name: awkward_NumpyArray_unique_ranges_int64 - args: - - {name: toptr, type: "List[int64_t]", dir: out, role: IndexedArray-index} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: outoffsets, type: "List[int64_t]", dir: out} - - {name: tolength, type: "List[int64_t]", dir: out} - - name: awkward_NumpyArray_unique_ranges_uint8 - args: - - {name: toptr, type: "List[uint8_t]", dir: out, role: IndexedArray-index} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: outoffsets, type: "List[int64_t]", dir: out} - - {name: tolength, type: "List[int64_t]", dir: out} - - name: awkward_NumpyArray_unique_ranges_uint16 - args: - - {name: toptr, type: "List[uint16_t]", dir: out, role: IndexedArray-index} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: outoffsets, type: "List[int64_t]", dir: out} - - {name: tolength, type: "List[int64_t]", dir: out} - - name: awkward_NumpyArray_unique_ranges_uint32 - args: - - {name: toptr, type: "List[uint32_t]", dir: out, role: IndexedArray-index} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: outoffsets, type: "List[int64_t]", dir: out} - - {name: tolength, type: "List[int64_t]", dir: out} - - name: awkward_NumpyArray_unique_ranges_uint64 - args: - - {name: toptr, type: "List[uint64_t]", dir: out, role: IndexedArray-index} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: outoffsets, type: "List[int64_t]", dir: out} - - {name: tolength, type: "List[int64_t]", dir: out} - - name: awkward_NumpyArray_unique_ranges_float32 - args: - - {name: toptr, type: "List[float]", dir: out, role: IndexedArray-index} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: outoffsets, type: "List[int64_t]", dir: out} - - {name: tolength, type: "List[int64_t]", dir: out} - - name: awkward_NumpyArray_unique_ranges_float64 + - name: awkward_ListOffsetArray_argsort_strings + args: + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromparents, type: "Const[List[int64_t]]", dir: in} + - {name: length, type: "int64_t", dir: in} + - {name: stringdata, type: "Const[List[uint8_t]]", dir: in} + - {name: stringstarts, type: "Const[List[int64_t]]", dir: in} + - {name: stringstops, type: "Const[List[int64_t]]", dir: in} + - {name: is_stable, type: "bool", dir: in} + - {name: is_ascending, type: "bool", dir: in} + - {name: is_local, type: "bool", dir: in} + description: null + definition: | + Insert Python definition here + automatic-tests: false + manual-tests: [] + + - name: awkward_NumpyArray_sort_asstrings_uint8 + specializations: + - name: awkward_NumpyArray_sort_asstrings_uint8 args: - - {name: toptr, type: "List[double]", dir: out, role: IndexedArray-index} + - {name: toptr, type: "List[uint8_t]", dir: out} + - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: IndexedArray-index} - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - {name: offsetslength, type: "int64_t", dir: in, role: default} - {name: outoffsets, type: "List[int64_t]", dir: out} - - {name: tolength, type: "List[int64_t]", dir: out} + - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} + - {name: stable, type: "bool", dir: in, role: ListArray-replacement} description: null definition: | Insert Python definition here - automatic-tests: false + automatic-tests: true manual-tests: [] - name: awkward_NumpyArray_unique_strings @@ -5192,1370 +3612,866 @@ kernels: definition: | def awkward_RegularArray_getitem_carry(tocarry, fromcarry, lencarry, size): for i in range(lencarry): - for j in range(size): - tocarry[(i * size) + j] = (fromcarry[i] * size) + j - automatic-tests: true - manual-tests: [] - - - name: awkward_RegularArray_getitem_jagged_expand - specializations: - - name: awkward_RegularArray_getitem_jagged_expand_64 - args: - - {name: multistarts, type: "List[int64_t]", dir: out} - - {name: multistops, type: "List[int64_t]", dir: out} - - {name: singleoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: regularsize, type: "int64_t", dir: in, role: RegularArray-size} - - {name: regularlength, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_RegularArray_getitem_jagged_expand( - multistarts, multistops, singleoffsets, regularsize, regularlength - ): - for i in range(regularlength): - for j in range(regularsize): - multistarts[(i * regularsize) + j] = singleoffsets[j] - multistops[(i * regularsize) + j] = singleoffsets[j + 1] - automatic-tests: true - manual-tests: [] - - - name: awkward_RegularArray_getitem_next_array - specializations: - - name: awkward_RegularArray_getitem_next_array_64 - args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: toadvanced, type: "List[int64_t]", dir: out} - - {name: fromarray, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: lenarray, type: "int64_t", dir: in, role: default} - - {name: size, type: "int64_t", dir: in, role: RegularArray-size} - description: null - definition: | - def awkward_RegularArray_getitem_next_array( - tocarry, toadvanced, fromarray, length, lenarray, size - ): - for i in range(length): - for j in range(lenarray): - tocarry[(i * lenarray) + j] = (i * size) + fromarray[j] - toadvanced[(i * lenarray) + j] = j - automatic-tests: true - manual-tests: [] - - - name: awkward_RegularArray_getitem_next_array_advanced - specializations: - - name: awkward_RegularArray_getitem_next_array_advanced_64 - args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: toadvanced, type: "List[int64_t]", dir: out} - - {name: fromadvanced, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: fromarray, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray2-offsets} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: lenarray, type: "int64_t", dir: in, role: default} - - {name: size, type: "int64_t", dir: in, role: RegularArray-size} - description: null - definition: | - def awkward_RegularArray_getitem_next_array_advanced( - tocarry, toadvanced, fromadvanced, fromarray, length, lenarray, size - ): - for i in range(length): - tocarry[i] = (i * size) + fromarray[fromadvanced[i]] - toadvanced[i] = i - automatic-tests: true - manual-tests: [] - - - name: awkward_RegularArray_getitem_next_array_regularize - specializations: - - name: awkward_RegularArray_getitem_next_array_regularize_64 - args: - - {name: toarray, type: "List[int64_t]", dir: out} - - {name: fromarray, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenarray, type: "int64_t", dir: in, role: default} - - {name: size, type: "int64_t", dir: in, role: RegularArray-size} - description: null - definition: | - def awkward_RegularArray_getitem_next_array_regularize( - toarray, fromarray, lenarray, size - ): - for j in range(lenarray): - toarray[j] = fromarray[j] - if toarray[j] < 0: - toarray[j] += size - if not ((0 <= toarray[j]) and (toarray[j] < size)): - raise ValueError("index out of range") - automatic-tests: true - manual-tests: [] - - - name: awkward_RegularArray_getitem_next_at - specializations: - - name: awkward_RegularArray_getitem_next_at_64 - args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: at, type: "int64_t", dir: in, role: ListArray-at} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: size, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_RegularArray_getitem_next_at(tocarry, at, length, size): - regular_at = at - if regular_at < 0: - regular_at += size - if not ((0 <= regular_at) and (regular_at < size)): - raise ValueError("index out of range") - for i in range(length): - tocarry[i] = (i * size) + regular_at - automatic-tests: true - manual-tests: [] - - - name: awkward_RegularArray_getitem_next_range - specializations: - - name: awkward_RegularArray_getitem_next_range_64 - args: - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: regular_start, type: "int64_t", dir: in, role: default} - - {name: step, type: "int64_t", dir: in, role: default} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: size, type: "int64_t", dir: in, role: default} - - {name: nextsize, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_RegularArray_getitem_next_range( - tocarry, regular_start, step, length, size, nextsize - ): - for i in range(length): - for j in range(nextsize): - tocarry[(i * nextsize) + j] = ((i * size) + regular_start) + (j * step) - automatic-tests: true - manual-tests: [] - - - name: awkward_RegularArray_getitem_next_range_spreadadvanced - specializations: - - name: awkward_RegularArray_getitem_next_range_spreadadvanced_64 - args: - - {name: toadvanced, type: "List[int64_t]", dir: out} - - {name: fromadvanced, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: nextsize, type: "int64_t", dir: in, role: RegularArray-size} - description: null - definition: | - def awkward_RegularArray_getitem_next_range_spreadadvanced( - toadvanced, fromadvanced, length, nextsize - ): - for i in range(length): - for j in range(nextsize): - toadvanced[(i * nextsize) + j] = fromadvanced[i] - automatic-tests: true - manual-tests: [] - - - name: awkward_RegularArray_localindex - specializations: - - name: awkward_RegularArray_localindex_64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: size, type: "int64_t", dir: in, role: RegularArray-size} - - {name: length, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_RegularArray_localindex(toindex, size, length): - for i in range(length): - for j in range(size): - toindex[(i * size) + j] = j - automatic-tests: true - manual-tests: [] - - - name: awkward_RegularArray_num - specializations: - - name: awkward_RegularArray_num_64 - args: - - {name: tonum, type: "List[int64_t]", dir: out} - - {name: size, type: "int64_t", dir: in, role: RegularArray-size} - - {name: length, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_RegularArray_num(tonum, size, length): - for i in range(length): - tonum[i] = size - automatic-tests: true - manual-tests: [] - - - name: awkward_RegularArray_rpad_and_clip_axis1 - specializations: - - name: awkward_RegularArray_rpad_and_clip_axis1_64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: target, type: "int64_t", dir: in, role: default} - - {name: size, type: "int64_t", dir: in, role: default} - - {name: length, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_RegularArray_rpad_and_clip_axis1(toindex, target, size, length): - shorter = target if target < size else size - for i in range(length): - for j in range(shorter): - toindex[(i * target) + j] = (i * size) + j - for j in range(shorter, target): - toindex[(i * target) + j] = -1 - automatic-tests: true - manual-tests: [] - - - name: awkward_UnionArray_fillindex - specializations: - - name: awkward_UnionArray_fillindex_to64_from32 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: toindexoffset, type: "int64_t", dir: in, role: default} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_UnionArray_fillindex_to64_from64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: toindexoffset, type: "int64_t", dir: in, role: default} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_UnionArray_fillindex_to64_fromU32 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: toindexoffset, type: "int64_t", dir: in, role: default} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_UnionArray_fillindex(toindex, toindexoffset, fromindex, length): - for i in range(length): - toindex[toindexoffset + i] = float(fromindex[i]) + for j in range(size): + tocarry[(i * size) + j] = (fromcarry[i] * size) + j automatic-tests: true manual-tests: [] - - name: awkward_UnionArray_fillindex_count + - name: awkward_RegularArray_getitem_jagged_expand specializations: - - name: awkward_UnionArray_fillindex_to64_count + - name: awkward_RegularArray_getitem_jagged_expand_64 args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: toindexoffset, type: "int64_t", dir: in, role: default} - - {name: length, type: "int64_t", dir: in, role: default} + - {name: multistarts, type: "List[int64_t]", dir: out} + - {name: multistops, type: "List[int64_t]", dir: out} + - {name: singleoffsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: regularsize, type: "int64_t", dir: in, role: RegularArray-size} + - {name: regularlength, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_UnionArray_fillindex_count(toindex, toindexoffset, length): - for i in range(length): - toindex[toindexoffset + i] = float(i) + def awkward_RegularArray_getitem_jagged_expand( + multistarts, multistops, singleoffsets, regularsize, regularlength + ): + for i in range(regularlength): + for j in range(regularsize): + multistarts[(i * regularsize) + j] = singleoffsets[j] + multistops[(i * regularsize) + j] = singleoffsets[j + 1] automatic-tests: true manual-tests: [] - - name: awkward_UnionArray_fillna + - name: awkward_RegularArray_getitem_next_array specializations: - - name: awkward_UnionArray_fillna_from32_to64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_UnionArray_fillna_from64_to64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_UnionArray_fillna_fromU32_to64 + - name: awkward_RegularArray_getitem_next_array_64 args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: toadvanced, type: "List[int64_t]", dir: out} + - {name: fromarray, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - {name: length, type: "int64_t", dir: in, role: default} + - {name: lenarray, type: "int64_t", dir: in, role: default} + - {name: size, type: "int64_t", dir: in, role: RegularArray-size} description: null definition: | - def awkward_UnionArray_fillna(toindex, fromindex, length): + def awkward_RegularArray_getitem_next_array( + tocarry, toadvanced, fromarray, length, lenarray, size + ): for i in range(length): - toindex[i] = fromindex[i] if fromindex[i] >= 0 else 0 + for j in range(lenarray): + tocarry[(i * lenarray) + j] = (i * size) + fromarray[j] + toadvanced[(i * lenarray) + j] = j automatic-tests: true manual-tests: [] - - name: awkward_UnionArray_filltags + - name: awkward_RegularArray_getitem_next_array_advanced specializations: - - name: awkward_UnionArray_filltags_to8_from8 + - name: awkward_RegularArray_getitem_next_array_advanced_64 args: - - {name: totags, type: "List[int8_t]", dir: out} - - {name: totagsoffset, type: "int64_t", dir: in, role: default} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: toadvanced, type: "List[int64_t]", dir: out} + - {name: fromadvanced, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: fromarray, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray2-offsets} - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} + - {name: lenarray, type: "int64_t", dir: in, role: default} + - {name: size, type: "int64_t", dir: in, role: RegularArray-size} description: null definition: | - def awkward_UnionArray_filltags(totags, totagsoffset, fromtags, length, base): + def awkward_RegularArray_getitem_next_array_advanced( + tocarry, toadvanced, fromadvanced, fromarray, length, lenarray, size + ): for i in range(length): - totags[totagsoffset + i] = float(fromtags[i] + base) + tocarry[i] = (i * size) + fromarray[fromadvanced[i]] + toadvanced[i] = i automatic-tests: true manual-tests: [] - - name: awkward_UnionArray_filltags_const + - name: awkward_RegularArray_getitem_next_array_regularize specializations: - - name: awkward_UnionArray_filltags_to8_const + - name: awkward_RegularArray_getitem_next_array_regularize_64 args: - - {name: totags, type: "List[int8_t]", dir: out} - - {name: totagsoffset, type: "int64_t", dir: in, role: default} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} + - {name: toarray, type: "List[int64_t]", dir: out} + - {name: fromarray, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: lenarray, type: "int64_t", dir: in, role: default} + - {name: size, type: "int64_t", dir: in, role: RegularArray-size} description: null definition: | - def awkward_UnionArray_filltags_const(totags, totagsoffset, length, base): - for i in range(length): - totags[totagsoffset + i] = float(base) + def awkward_RegularArray_getitem_next_array_regularize( + toarray, fromarray, lenarray, size + ): + for j in range(lenarray): + toarray[j] = fromarray[j] + if toarray[j] < 0: + toarray[j] += size + if not ((0 <= toarray[j]) and (toarray[j] < size)): + raise ValueError("index out of range") automatic-tests: true manual-tests: [] - - name: awkward_UnionArray_flatten_combine + - name: awkward_RegularArray_getitem_next_at specializations: - - name: awkward_UnionArray32_flatten_combine_64 - args: - - {name: totags, type: "List[int8_t]", dir: out} - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsetsraws, type: "List[List[int64_t]]", dir: in, role: ListOffsetArray-rawoffsets} - - name: awkward_UnionArray64_flatten_combine_64 - args: - - {name: totags, type: "List[int8_t]", dir: out} - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: UnionArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsetsraws, type: "List[List[int64_t]]", dir: in, role: ListOffsetArray-rawoffsets} - - name: awkward_UnionArrayU32_flatten_combine_64 + - name: awkward_RegularArray_getitem_next_at_64 args: - - {name: totags, type: "List[int8_t]", dir: out} - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: tooffsets, type: "List[int64_t]", dir: out} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: UnionArray-index} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: at, type: "int64_t", dir: in, role: ListArray-at} - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsetsraws, type: "List[List[int64_t]]", dir: in, role: ListOffsetArray-rawoffsets} + - {name: size, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_UnionArray_flatten_combine( - totags, toindex, tooffsets, fromtags, fromindex, length, offsetsraws - ): - tooffsets[0] = 0 - k = 0 + def awkward_RegularArray_getitem_next_at(tocarry, at, length, size): + regular_at = at + if regular_at < 0: + regular_at += size + if not ((0 <= regular_at) and (regular_at < size)): + raise ValueError("index out of range") for i in range(length): - tag = fromtags[i] - idx = fromindex[i] - start = offsetsraws[tag][idx] - stop = offsetsraws[tag][idx + 1] - tooffsets[i + 1] = tooffsets[i] + (stop - start) - for j in range(start, stop): - totags[k] = tag - toindex[k] = j - k = k + 1 - automatic-tests: false + tocarry[i] = (i * size) + regular_at + automatic-tests: true manual-tests: [] - - name: awkward_UnionArray_flatten_length + - name: awkward_RegularArray_getitem_next_range specializations: - - name: awkward_UnionArray32_flatten_length_64 - args: - - {name: total_length, type: "List[int64_t]", dir: out} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsetsraws, type: "List[List[int64_t]]", dir: in, role: ListOffsetArray-rawoffsets} - - name: awkward_UnionArray64_flatten_length_64 - args: - - {name: total_length, type: "List[int64_t]", dir: out} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsetsraws, type: "List[List[int64_t]]", dir: in, role: ListOffsetArray-rawoffsets} - - name: awkward_UnionArrayU32_flatten_length_64 + - name: awkward_RegularArray_getitem_next_range_64 args: - - {name: total_length, type: "List[int64_t]", dir: out} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: regular_start, type: "int64_t", dir: in, role: default} + - {name: step, type: "int64_t", dir: in, role: default} - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsetsraws, type: "List[List[int64_t]]", dir: in, role: ListOffsetArray-rawoffsets} + - {name: size, type: "int64_t", dir: in, role: default} + - {name: nextsize, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_UnionArray_flatten_length( - total_length, fromtags, fromindex, length, offsetsraws + def awkward_RegularArray_getitem_next_range( + tocarry, regular_start, step, length, size, nextsize ): - total_length[0] = 0 for i in range(length): - tag = fromtags[i] - idx = fromindex[i] - start = offsetsraws[tag][idx] - stop = offsetsraws[tag][idx + 1] - total_length[0] = total_length[0] + (stop - start) - automatic-tests: false + for j in range(nextsize): + tocarry[(i * nextsize) + j] = ((i * size) + regular_start) + (j * step) + automatic-tests: true manual-tests: [] - - name: awkward_UnionArray_nestedfill_tags_index + - name: awkward_RegularArray_getitem_next_range_spreadadvanced specializations: - - name: awkward_UnionArray8_32_nestedfill_tags_index_64 - args: - - {name: totags, type: "List[int8_t]", dir: out} - - {name: toindex, type: "List[int32_t]", dir: out} - - {name: tmpstarts, type: "List[int64_t]", dir: out} - - {name: tag, type: "int8_t", dir: in, role: default} - - {name: fromcounts, type: "Const[List[int64_t]]", dir: in, role: default} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_UnionArray8_64_nestedfill_tags_index_64 - args: - - {name: totags, type: "List[int8_t]", dir: out} - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: tmpstarts, type: "List[int64_t]", dir: out} - - {name: tag, type: "int8_t", dir: in, role: default} - - {name: fromcounts, type: "Const[List[int64_t]]", dir: in, role: default} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_UnionArray8_U32_nestedfill_tags_index_64 + - name: awkward_RegularArray_getitem_next_range_spreadadvanced_64 args: - - {name: totags, type: "List[int8_t]", dir: out} - - {name: toindex, type: "List[uint32_t]", dir: out} - - {name: tmpstarts, type: "List[int64_t]", dir: out} - - {name: tag, type: "int8_t", dir: in, role: default} - - {name: fromcounts, type: "Const[List[int64_t]]", dir: in, role: default} + - {name: toadvanced, type: "List[int64_t]", dir: out} + - {name: fromadvanced, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - {name: length, type: "int64_t", dir: in, role: default} + - {name: nextsize, type: "int64_t", dir: in, role: RegularArray-size} description: null definition: | - def awkward_UnionArray_nestedfill_tags_index( - totags, toindex, tmpstarts, tag, fromcounts, length + def awkward_RegularArray_getitem_next_range_spreadadvanced( + toadvanced, fromadvanced, length, nextsize ): - k = 0 for i in range(length): - start = tmpstarts[i] - stop = start + fromcounts[i] - for j in range(start, stop): - totags[j] = tag - toindex[j] = k - k += 1 - tmpstarts[i] = stop - automatic-tests: false + for j in range(nextsize): + toadvanced[(i * nextsize) + j] = fromadvanced[i] + automatic-tests: true manual-tests: [] - - name: awkward_UnionArray_project - specializations: - - name: awkward_UnionArray8_32_project_64 - args: - - {name: lenout, type: "List[int64_t]", dir: out} - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: which, type: "int64_t", dir: in, role: UnionArray-which} - - name: awkward_UnionArray8_64_project_64 - args: - - {name: lenout, type: "List[int64_t]", dir: out} - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: which, type: "int64_t", dir: in, role: UnionArray-which} - - name: awkward_UnionArray8_U32_project_64 + - name: awkward_RegularArray_localindex + specializations: + - name: awkward_RegularArray_localindex_64 args: - - {name: lenout, type: "List[int64_t]", dir: out} - - {name: tocarry, type: "List[int64_t]", dir: out} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: size, type: "int64_t", dir: in, role: RegularArray-size} - {name: length, type: "int64_t", dir: in, role: default} - - {name: which, type: "int64_t", dir: in, role: UnionArray-which} description: null definition: | - def awkward_UnionArray_project(lenout, tocarry, fromtags, fromindex, length, which): - lenout[0] = 0 + def awkward_RegularArray_localindex(toindex, size, length): for i in range(length): - if fromtags[i] == which: - tocarry[lenout[0]] = fromindex[i] - lenout[0] = lenout[0] + 1 + for j in range(size): + toindex[(i * size) + j] = j automatic-tests: true manual-tests: [] - - name: awkward_UnionArray_regular_index + - name: awkward_RegularArray_num specializations: - - name: awkward_UnionArray8_32_regular_index - args: - - {name: toindex, type: "List[int32_t]", dir: out} - - {name: current, type: "List[int32_t]", dir: out} - - {name: size, type: "int64_t", dir: in, role: default} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_UnionArray8_64_regular_index - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: current, type: "List[int64_t]", dir: out} - - {name: size, type: "int64_t", dir: in, role: default} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_UnionArray8_U32_regular_index + - name: awkward_RegularArray_num_64 args: - - {name: toindex, type: "List[uint32_t]", dir: out} - - {name: current, type: "List[uint32_t]", dir: out} - - {name: size, type: "int64_t", dir: in, role: default} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: tonum, type: "List[int64_t]", dir: out} + - {name: size, type: "int64_t", dir: in, role: RegularArray-size} - {name: length, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_UnionArray_regular_index(toindex, current, size, fromtags, length): - count = 0 - for k in range(size): - current[k] = 0 + def awkward_RegularArray_num(tonum, size, length): for i in range(length): - tag = fromtags[i] - toindex[i] = current[tag] - current[tag] = current[tag] + 1 + tonum[i] = size automatic-tests: true manual-tests: [] - - name: awkward_UnionArray_regular_index_getsize + - name: awkward_RegularArray_rpad_and_clip_axis1 specializations: - - name: awkward_UnionArray8_regular_index_getsize + - name: awkward_RegularArray_rpad_and_clip_axis1_64 args: - - {name: size, type: "List[int64_t]", dir: out} - - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: target, type: "int64_t", dir: in, role: default} + - {name: size, type: "int64_t", dir: in, role: default} - {name: length, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_UnionArray_regular_index_getsize(size, fromtags, length): - size[0] = 0 + def awkward_RegularArray_rpad_and_clip_axis1(toindex, target, size, length): + shorter = target if target < size else size for i in range(length): - tag = int(fromtags[i]) - if size[0] < tag: - size[0] = tag - size[0] = size[0] + 1 + for j in range(shorter): + toindex[(i * target) + j] = (i * size) + j + for j in range(shorter, target): + toindex[(i * target) + j] = -1 automatic-tests: true manual-tests: [] - - name: awkward_UnionArray_simplify + - name: awkward_UnionArray_fillindex specializations: - - name: awkward_UnionArray8_32_simplify8_32_to8_64 + - name: awkward_UnionArray_fillindex_to64_from32 args: - - {name: totags, type: "List[int8_t]", dir: out} - {name: toindex, type: "List[int64_t]", dir: out} - - {name: outertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: outerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: innertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray2-tags} - - {name: innerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray2-index} - - {name: towhich, type: "int64_t", dir: in, role: default} - - {name: innerwhich, type: "int64_t", dir: in, role: UnionArray1-which} - - {name: outerwhich, type: "int64_t", dir: in, role: UnionArray2-which} + - {name: toindexoffset, type: "int64_t", dir: in, role: default} + - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} - - name: awkward_UnionArray8_32_simplify8_64_to8_64 + - name: awkward_UnionArray_fillindex_to64_from64 args: - - {name: totags, type: "List[int8_t]", dir: out} - {name: toindex, type: "List[int64_t]", dir: out} - - {name: outertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: outerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: innertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray2-tags} - - {name: innerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray2-index} - - {name: towhich, type: "int64_t", dir: in, role: default} - - {name: innerwhich, type: "int64_t", dir: in, role: UnionArray1-which} - - {name: outerwhich, type: "int64_t", dir: in, role: UnionArray2-which} + - {name: toindexoffset, type: "int64_t", dir: in, role: default} + - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} - - name: awkward_UnionArray8_32_simplify8_U32_to8_64 + - name: awkward_UnionArray_fillindex_to64_fromU32 args: - - {name: totags, type: "List[int8_t]", dir: out} - {name: toindex, type: "List[int64_t]", dir: out} - - {name: outertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: outerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: innertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray2-tags} - - {name: innerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray2-index} - - {name: towhich, type: "int64_t", dir: in, role: default} - - {name: innerwhich, type: "int64_t", dir: in, role: UnionArray1-which} - - {name: outerwhich, type: "int64_t", dir: in, role: UnionArray2-which} + - {name: toindexoffset, type: "int64_t", dir: in, role: default} + - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} - - name: awkward_UnionArray8_64_simplify8_32_to8_64 + description: null + definition: | + def awkward_UnionArray_fillindex(toindex, toindexoffset, fromindex, length): + for i in range(length): + toindex[toindexoffset + i] = float(fromindex[i]) + automatic-tests: true + manual-tests: [] + + - name: awkward_UnionArray_fillindex_count + specializations: + - name: awkward_UnionArray_fillindex_to64_count args: - - {name: totags, type: "List[int8_t]", dir: out} - {name: toindex, type: "List[int64_t]", dir: out} - - {name: outertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: outerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: innertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray2-tags} - - {name: innerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray2-index} - - {name: towhich, type: "int64_t", dir: in, role: default} - - {name: innerwhich, type: "int64_t", dir: in, role: UnionArray1-which} - - {name: outerwhich, type: "int64_t", dir: in, role: UnionArray2-which} + - {name: toindexoffset, type: "int64_t", dir: in, role: default} - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} - - name: awkward_UnionArray8_64_simplify8_64_to8_64 + description: null + definition: | + def awkward_UnionArray_fillindex_count(toindex, toindexoffset, length): + for i in range(length): + toindex[toindexoffset + i] = float(i) + automatic-tests: true + manual-tests: [] + + - name: awkward_UnionArray_fillna + specializations: + - name: awkward_UnionArray_fillna_from32_to64 args: - - {name: totags, type: "List[int8_t]", dir: out} - {name: toindex, type: "List[int64_t]", dir: out} - - {name: outertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: outerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: innertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray2-tags} - - {name: innerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray2-index} - - {name: towhich, type: "int64_t", dir: in, role: default} - - {name: innerwhich, type: "int64_t", dir: in, role: UnionArray1-which} - - {name: outerwhich, type: "int64_t", dir: in, role: UnionArray2-which} + - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} - - name: awkward_UnionArray8_64_simplify8_U32_to8_64 + - name: awkward_UnionArray_fillna_from64_to64 args: - - {name: totags, type: "List[int8_t]", dir: out} - {name: toindex, type: "List[int64_t]", dir: out} - - {name: outertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: outerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: innertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray2-tags} - - {name: innerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray2-index} - - {name: towhich, type: "int64_t", dir: in, role: default} - - {name: innerwhich, type: "int64_t", dir: in, role: UnionArray1-which} - - {name: outerwhich, type: "int64_t", dir: in, role: UnionArray2-which} + - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} - - name: awkward_UnionArray8_U32_simplify8_32_to8_64 + - name: awkward_UnionArray_fillna_fromU32_to64 args: - - {name: totags, type: "List[int8_t]", dir: out} - {name: toindex, type: "List[int64_t]", dir: out} - - {name: outertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: outerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: innertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray2-tags} - - {name: innerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray2-index} - - {name: towhich, type: "int64_t", dir: in, role: default} - - {name: innerwhich, type: "int64_t", dir: in, role: UnionArray1-which} - - {name: outerwhich, type: "int64_t", dir: in, role: UnionArray2-which} + - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} - - name: awkward_UnionArray8_U32_simplify8_64_to8_64 + description: null + definition: | + def awkward_UnionArray_fillna(toindex, fromindex, length): + for i in range(length): + toindex[i] = fromindex[i] if fromindex[i] >= 0 else 0 + automatic-tests: true + manual-tests: [] + + - name: awkward_UnionArray_filltags + specializations: + - name: awkward_UnionArray_filltags_to8_from8 args: - {name: totags, type: "List[int8_t]", dir: out} - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: outertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: outerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: innertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray2-tags} - - {name: innerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray2-index} - - {name: towhich, type: "int64_t", dir: in, role: default} - - {name: innerwhich, type: "int64_t", dir: in, role: UnionArray1-which} - - {name: outerwhich, type: "int64_t", dir: in, role: UnionArray2-which} + - {name: totagsoffset, type: "int64_t", dir: in, role: default} + - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - {name: length, type: "int64_t", dir: in, role: default} - {name: base, type: "int64_t", dir: in, role: default} - - name: awkward_UnionArray8_U32_simplify8_U32_to8_64 + description: null + definition: | + def awkward_UnionArray_filltags(totags, totagsoffset, fromtags, length, base): + for i in range(length): + totags[totagsoffset + i] = float(fromtags[i] + base) + automatic-tests: true + manual-tests: [] + + - name: awkward_UnionArray_filltags_const + specializations: + - name: awkward_UnionArray_filltags_to8_const args: - {name: totags, type: "List[int8_t]", dir: out} - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: outertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: outerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: innertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray2-tags} - - {name: innerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray2-index} - - {name: towhich, type: "int64_t", dir: in, role: default} - - {name: innerwhich, type: "int64_t", dir: in, role: UnionArray1-which} - - {name: outerwhich, type: "int64_t", dir: in, role: UnionArray2-which} + - {name: totagsoffset, type: "int64_t", dir: in, role: default} - {name: length, type: "int64_t", dir: in, role: default} - {name: base, type: "int64_t", dir: in, role: default} description: null definition: | - def awkward_UnionArray_simplify( - totags, - toindex, - outertags, - outerindex, - innertags, - innerindex, - towhich, - innerwhich, - outerwhich, - length, - base, - ): + def awkward_UnionArray_filltags_const(totags, totagsoffset, length, base): for i in range(length): - if outertags[i] == outerwhich: - j = outerindex[i] - if innertags[j] == innerwhich: - totags[i] = float(towhich) - toindex[i] = float(innerindex[j] + base) + totags[totagsoffset + i] = float(base) automatic-tests: true manual-tests: [] - - name: awkward_UnionArray_simplify_one + - name: awkward_UnionArray_flatten_combine specializations: - - name: awkward_UnionArray8_32_simplify_one_to8_64 + - name: awkward_UnionArray32_flatten_combine_64 args: - {name: totags, type: "List[int8_t]", dir: out} - {name: toindex, type: "List[int64_t]", dir: out} + - {name: tooffsets, type: "List[int64_t]", dir: out} - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: towhich, type: "int64_t", dir: in, role: default} - - {name: fromwhich, type: "int64_t", dir: in, role: UnionArray-which} - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} - - name: awkward_UnionArray8_64_simplify_one_to8_64 + - {name: offsetsraws, type: "List[List[int64_t]]", dir: in, role: ListOffsetArray-rawoffsets} + - name: awkward_UnionArray64_flatten_combine_64 args: - {name: totags, type: "List[int8_t]", dir: out} - {name: toindex, type: "List[int64_t]", dir: out} + - {name: tooffsets, type: "List[int64_t]", dir: out} - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: towhich, type: "int64_t", dir: in, role: default} - - {name: fromwhich, type: "int64_t", dir: in, role: UnionArray-which} + - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: UnionArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} - - name: awkward_UnionArray8_U32_simplify_one_to8_64 + - {name: offsetsraws, type: "List[List[int64_t]]", dir: in, role: ListOffsetArray-rawoffsets} + - name: awkward_UnionArrayU32_flatten_combine_64 args: - {name: totags, type: "List[int8_t]", dir: out} - {name: toindex, type: "List[int64_t]", dir: out} + - {name: tooffsets, type: "List[int64_t]", dir: out} - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: towhich, type: "int64_t", dir: in, role: default} - - {name: fromwhich, type: "int64_t", dir: in, role: UnionArray-which} + - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: UnionArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: base, type: "int64_t", dir: in, role: default} + - {name: offsetsraws, type: "List[List[int64_t]]", dir: in, role: ListOffsetArray-rawoffsets} description: null definition: | - def awkward_UnionArray_simplify_one( - totags, toindex, fromtags, fromindex, towhich, fromwhich, length, base + def awkward_UnionArray_flatten_combine( + totags, toindex, tooffsets, fromtags, fromindex, length, offsetsraws ): + tooffsets[0] = 0 + k = 0 for i in range(length): - if fromtags[i] == fromwhich: - totags[i] = float(towhich) - toindex[i] = float(fromindex[i] + base) - automatic-tests: true + tag = fromtags[i] + idx = fromindex[i] + start = offsetsraws[tag][idx] + stop = offsetsraws[tag][idx + 1] + tooffsets[i + 1] = tooffsets[i] + (stop - start) + for j in range(start, stop): + totags[k] = tag + toindex[k] = j + k = k + 1 + automatic-tests: false manual-tests: [] - - name: awkward_UnionArray_validity + - name: awkward_UnionArray_flatten_length specializations: - - name: awkward_UnionArray8_32_validity + - name: awkward_UnionArray32_flatten_length_64 args: - - {name: tags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: index, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} + - {name: total_length, type: "List[int64_t]", dir: out} + - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: numcontents, type: "int64_t", dir: in, role: UnionArray-length} - - {name: lencontents, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - name: awkward_UnionArray8_64_validity + - {name: offsetsraws, type: "List[List[int64_t]]", dir: in, role: ListOffsetArray-rawoffsets} + - name: awkward_UnionArray64_flatten_length_64 args: - - {name: tags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: index, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: total_length, type: "List[int64_t]", dir: out} + - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: numcontents, type: "int64_t", dir: in, role: UnionArray-length} - - {name: lencontents, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - name: awkward_UnionArray8_U32_validity + - {name: offsetsraws, type: "List[List[int64_t]]", dir: in, role: ListOffsetArray-rawoffsets} + - name: awkward_UnionArrayU32_flatten_length_64 args: - - {name: tags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - - {name: index, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: total_length, type: "List[int64_t]", dir: out} + - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: numcontents, type: "int64_t", dir: in, role: UnionArray-length} - - {name: lencontents, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: offsetsraws, type: "List[List[int64_t]]", dir: in, role: ListOffsetArray-rawoffsets} description: null definition: | - def awkward_UnionArray_validity(tags, index, length, numcontents, lencontents): + def awkward_UnionArray_flatten_length( + total_length, fromtags, fromindex, length, offsetsraws + ): + total_length[0] = 0 for i in range(length): - tag = tags[i] - idx = index[i] - if tag < 0: - raise ValueError("tags[i] < 0") - if idx < 0: - raise ValueError("index[i] < 0") - if tag >= numcontents: - raise ValueError("tags[i] >= len(contents)") - lencontent = lencontents[tag] - if idx >= lencontent: - raise ValueError("index[i] >= len(content[tags[i]])") - automatic-tests: true + tag = fromtags[i] + idx = fromindex[i] + start = offsetsraws[tag][idx] + stop = offsetsraws[tag][idx + 1] + total_length[0] = total_length[0] + (stop - start) + automatic-tests: false manual-tests: [] - - name: awkward_argsort + - name: awkward_UnionArray_nestedfill_tags_index specializations: - - name: awkward_argsort_bool - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_argsort_int8 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_argsort_int16 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_argsort_int32 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_argsort_int64 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_argsort_uint8 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_argsort_uint16 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_argsort_uint32 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_argsort_uint64 + - name: awkward_UnionArray8_32_nestedfill_tags_index_64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: IndexedArray-index} + - {name: totags, type: "List[int8_t]", dir: out} + - {name: toindex, type: "List[int32_t]", dir: out} + - {name: tmpstarts, type: "List[int64_t]", dir: out} + - {name: tag, type: "int8_t", dir: in, role: default} + - {name: fromcounts, type: "Const[List[int64_t]]", dir: in, role: default} - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_argsort_float32 + - name: awkward_UnionArray8_64_nestedfill_tags_index_64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: IndexedArray-index} + - {name: totags, type: "List[int8_t]", dir: out} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: tmpstarts, type: "List[int64_t]", dir: out} + - {name: tag, type: "int8_t", dir: in, role: default} + - {name: fromcounts, type: "Const[List[int64_t]]", dir: in, role: default} - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_argsort_float64 + - name: awkward_UnionArray8_U32_nestedfill_tags_index_64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: IndexedArray-index} + - {name: totags, type: "List[int8_t]", dir: out} + - {name: toindex, type: "List[uint32_t]", dir: out} + - {name: tmpstarts, type: "List[int64_t]", dir: out} + - {name: tag, type: "int8_t", dir: in, role: default} + - {name: fromcounts, type: "Const[List[int64_t]]", dir: in, role: default} - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} description: null definition: | - Insert Python definition here + def awkward_UnionArray_nestedfill_tags_index( + totags, toindex, tmpstarts, tag, fromcounts, length + ): + k = 0 + for i in range(length): + start = tmpstarts[i] + stop = start + fromcounts[i] + for j in range(start, stop): + totags[j] = tag + toindex[j] = k + k += 1 + tmpstarts[i] = stop automatic-tests: false manual-tests: [] - - name: awkward_ListOffsetArray_argsort + - name: awkward_UnionArray_project specializations: - - name: awkward_ListOffsetArray_argsort_bool - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListOffsetArray_argsort_int8 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListOffsetArray_argsort_int16 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListOffsetArray_argsort_int32 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListOffsetArray_argsort_int64 + - name: awkward_UnionArray8_32_project_64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: lenout, type: "List[int64_t]", dir: out} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListOffsetArray_argsort_uint8 + - {name: which, type: "int64_t", dir: in, role: UnionArray-which} + - name: awkward_UnionArray8_64_project_64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: IndexedArray-index} + - {name: lenout, type: "List[int64_t]", dir: out} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListOffsetArray_argsort_uint16 + - {name: which, type: "int64_t", dir: in, role: UnionArray-which} + - name: awkward_UnionArray8_U32_project_64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: IndexedArray-index} + - {name: lenout, type: "List[int64_t]", dir: out} + - {name: tocarry, type: "List[int64_t]", dir: out} + - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListOffsetArray_argsort_uint32 + - {name: which, type: "int64_t", dir: in, role: UnionArray-which} + description: null + definition: | + def awkward_UnionArray_project(lenout, tocarry, fromtags, fromindex, length, which): + lenout[0] = 0 + for i in range(length): + if fromtags[i] == which: + tocarry[lenout[0]] = fromindex[i] + lenout[0] = lenout[0] + 1 + automatic-tests: true + manual-tests: [] + + - name: awkward_UnionArray_regular_index + specializations: + - name: awkward_UnionArray8_32_regular_index args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: toindex, type: "List[int32_t]", dir: out} + - {name: current, type: "List[int32_t]", dir: out} + - {name: size, type: "int64_t", dir: in, role: default} + - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListOffsetArray_argsort_uint64 + - name: awkward_UnionArray8_64_regular_index args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: IndexedArray-index} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: current, type: "List[int64_t]", dir: out} + - {name: size, type: "int64_t", dir: in, role: default} + - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListOffsetArray_argsort_float32 + - name: awkward_UnionArray8_U32_regular_index args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: IndexedArray-index} + - {name: toindex, type: "List[uint32_t]", dir: out} + - {name: current, type: "List[uint32_t]", dir: out} + - {name: size, type: "int64_t", dir: in, role: default} + - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListOffsetArray_argsort_float64 + description: null + definition: | + def awkward_UnionArray_regular_index(toindex, current, size, fromtags, length): + count = 0 + for k in range(size): + current[k] = 0 + for i in range(length): + tag = fromtags[i] + toindex[i] = current[tag] + current[tag] = current[tag] + 1 + automatic-tests: true + manual-tests: [] + + - name: awkward_UnionArray_regular_index_getsize + specializations: + - name: awkward_UnionArray8_regular_index_getsize args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: IndexedArray-index} + - {name: size, type: "List[int64_t]", dir: out} + - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} description: null definition: | - Insert Python definition here - automatic-tests: false + def awkward_UnionArray_regular_index_getsize(size, fromtags, length): + size[0] = 0 + for i in range(length): + tag = int(fromtags[i]) + if size[0] < tag: + size[0] = tag + size[0] = size[0] + 1 + automatic-tests: true manual-tests: [] - - name: awkward_ListArray_argsort + - name: awkward_UnionArray_simplify specializations: - - name: awkward_ListArray_argsort_bool + - name: awkward_UnionArray8_32_simplify8_32_to8_64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: IndexedArray-index} + - {name: totags, type: "List[int8_t]", dir: out} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: outertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: outerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} + - {name: innertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray2-tags} + - {name: innerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray2-index} + - {name: towhich, type: "int64_t", dir: in, role: default} + - {name: innerwhich, type: "int64_t", dir: in, role: UnionArray1-which} + - {name: outerwhich, type: "int64_t", dir: in, role: UnionArray2-which} - {name: length, type: "int64_t", dir: in, role: default} - - {name: starts, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: stops, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: startslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListArray_argsort_int8 + - {name: base, type: "int64_t", dir: in, role: default} + - name: awkward_UnionArray8_32_simplify8_64_to8_64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: IndexedArray-index} + - {name: totags, type: "List[int8_t]", dir: out} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: outertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: outerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} + - {name: innertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray2-tags} + - {name: innerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray2-index} + - {name: towhich, type: "int64_t", dir: in, role: default} + - {name: innerwhich, type: "int64_t", dir: in, role: UnionArray1-which} + - {name: outerwhich, type: "int64_t", dir: in, role: UnionArray2-which} - {name: length, type: "int64_t", dir: in, role: default} - - {name: starts, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: stops, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: startslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListArray_argsort_int16 + - {name: base, type: "int64_t", dir: in, role: default} + - name: awkward_UnionArray8_32_simplify8_U32_to8_64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: IndexedArray-index} + - {name: totags, type: "List[int8_t]", dir: out} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: outertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: outerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} + - {name: innertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray2-tags} + - {name: innerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray2-index} + - {name: towhich, type: "int64_t", dir: in, role: default} + - {name: innerwhich, type: "int64_t", dir: in, role: UnionArray1-which} + - {name: outerwhich, type: "int64_t", dir: in, role: UnionArray2-which} - {name: length, type: "int64_t", dir: in, role: default} - - {name: starts, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: stops, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: startslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListArray_argsort_int32 + - {name: base, type: "int64_t", dir: in, role: default} + - name: awkward_UnionArray8_64_simplify8_32_to8_64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} + - {name: totags, type: "List[int8_t]", dir: out} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: outertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: outerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: innertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray2-tags} + - {name: innerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray2-index} + - {name: towhich, type: "int64_t", dir: in, role: default} + - {name: innerwhich, type: "int64_t", dir: in, role: UnionArray1-which} + - {name: outerwhich, type: "int64_t", dir: in, role: UnionArray2-which} - {name: length, type: "int64_t", dir: in, role: default} - - {name: starts, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: stops, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: startslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListArray_argsort_int64 + - {name: base, type: "int64_t", dir: in, role: default} + - name: awkward_UnionArray8_64_simplify8_64_to8_64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: totags, type: "List[int8_t]", dir: out} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: outertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: outerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: innertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray2-tags} + - {name: innerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray2-index} + - {name: towhich, type: "int64_t", dir: in, role: default} + - {name: innerwhich, type: "int64_t", dir: in, role: UnionArray1-which} + - {name: outerwhich, type: "int64_t", dir: in, role: UnionArray2-which} - {name: length, type: "int64_t", dir: in, role: default} - - {name: starts, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: stops, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: startslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListArray_argsort_uint8 + - {name: base, type: "int64_t", dir: in, role: default} + - name: awkward_UnionArray8_64_simplify8_U32_to8_64 + args: + - {name: totags, type: "List[int8_t]", dir: out} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: outertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: outerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: innertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray2-tags} + - {name: innerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray2-index} + - {name: towhich, type: "int64_t", dir: in, role: default} + - {name: innerwhich, type: "int64_t", dir: in, role: UnionArray1-which} + - {name: outerwhich, type: "int64_t", dir: in, role: UnionArray2-which} + - {name: length, type: "int64_t", dir: in, role: default} + - {name: base, type: "int64_t", dir: in, role: default} + - name: awkward_UnionArray8_U32_simplify8_32_to8_64 + args: + - {name: totags, type: "List[int8_t]", dir: out} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: outertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: outerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: innertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray2-tags} + - {name: innerindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray2-index} + - {name: towhich, type: "int64_t", dir: in, role: default} + - {name: innerwhich, type: "int64_t", dir: in, role: UnionArray1-which} + - {name: outerwhich, type: "int64_t", dir: in, role: UnionArray2-which} + - {name: length, type: "int64_t", dir: in, role: default} + - {name: base, type: "int64_t", dir: in, role: default} + - name: awkward_UnionArray8_U32_simplify8_64_to8_64 + args: + - {name: totags, type: "List[int8_t]", dir: out} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: outertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: outerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: innertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray2-tags} + - {name: innerindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray2-index} + - {name: towhich, type: "int64_t", dir: in, role: default} + - {name: innerwhich, type: "int64_t", dir: in, role: UnionArray1-which} + - {name: outerwhich, type: "int64_t", dir: in, role: UnionArray2-which} + - {name: length, type: "int64_t", dir: in, role: default} + - {name: base, type: "int64_t", dir: in, role: default} + - name: awkward_UnionArray8_U32_simplify8_U32_to8_64 + args: + - {name: totags, type: "List[int8_t]", dir: out} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: outertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: outerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: innertags, type: "Const[List[int8_t]]", dir: in, role: UnionArray2-tags} + - {name: innerindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray2-index} + - {name: towhich, type: "int64_t", dir: in, role: default} + - {name: innerwhich, type: "int64_t", dir: in, role: UnionArray1-which} + - {name: outerwhich, type: "int64_t", dir: in, role: UnionArray2-which} + - {name: length, type: "int64_t", dir: in, role: default} + - {name: base, type: "int64_t", dir: in, role: default} + description: null + definition: | + def awkward_UnionArray_simplify( + totags, + toindex, + outertags, + outerindex, + innertags, + innerindex, + towhich, + innerwhich, + outerwhich, + length, + base, + ): + for i in range(length): + if outertags[i] == outerwhich: + j = outerindex[i] + if innertags[j] == innerwhich: + totags[i] = float(towhich) + toindex[i] = float(innerindex[j] + base) + automatic-tests: true + manual-tests: [] + + - name: awkward_UnionArray_simplify_one + specializations: + - name: awkward_UnionArray8_32_simplify_one_to8_64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: IndexedArray-index} + - {name: totags, type: "List[int8_t]", dir: out} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} + - {name: towhich, type: "int64_t", dir: in, role: default} + - {name: fromwhich, type: "int64_t", dir: in, role: UnionArray-which} - {name: length, type: "int64_t", dir: in, role: default} - - {name: starts, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: stops, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: startslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListArray_argsort_uint16 + - {name: base, type: "int64_t", dir: in, role: default} + - name: awkward_UnionArray8_64_simplify_one_to8_64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: IndexedArray-index} + - {name: totags, type: "List[int8_t]", dir: out} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} + - {name: towhich, type: "int64_t", dir: in, role: default} + - {name: fromwhich, type: "int64_t", dir: in, role: UnionArray-which} - {name: length, type: "int64_t", dir: in, role: default} - - {name: starts, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: stops, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: startslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListArray_argsort_uint32 + - {name: base, type: "int64_t", dir: in, role: default} + - name: awkward_UnionArray8_U32_simplify_one_to8_64 args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: totags, type: "List[int8_t]", dir: out} + - {name: toindex, type: "List[int64_t]", dir: out} + - {name: fromtags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} + - {name: towhich, type: "int64_t", dir: in, role: default} + - {name: fromwhich, type: "int64_t", dir: in, role: UnionArray-which} - {name: length, type: "int64_t", dir: in, role: default} - - {name: starts, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: stops, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: startslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListArray_argsort_uint64 + - {name: base, type: "int64_t", dir: in, role: default} + description: null + definition: | + def awkward_UnionArray_simplify_one( + totags, toindex, fromtags, fromindex, towhich, fromwhich, length, base + ): + for i in range(length): + if fromtags[i] == fromwhich: + totags[i] = float(towhich) + toindex[i] = float(fromindex[i] + base) + automatic-tests: true + manual-tests: [] + + - name: awkward_UnionArray_validity + specializations: + - name: awkward_UnionArray8_32_validity args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: IndexedArray-index} + - {name: tags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: index, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: starts, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: stops, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: startslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListArray_argsort_float32 + - {name: numcontents, type: "int64_t", dir: in, role: UnionArray-length} + - {name: lencontents, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - name: awkward_UnionArray8_64_validity args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: IndexedArray-index} + - {name: tags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: index, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: starts, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: stops, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: startslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - name: awkward_ListArray_argsort_float64 + - {name: numcontents, type: "int64_t", dir: in, role: UnionArray-length} + - {name: lencontents, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - name: awkward_UnionArray8_U32_validity args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: IndexedArray-index} + - {name: tags, type: "Const[List[int8_t]]", dir: in, role: UnionArray-tags} + - {name: index, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: starts, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: stops, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: startslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} + - {name: numcontents, type: "int64_t", dir: in, role: UnionArray-length} + - {name: lencontents, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} description: null definition: | - Insert Python definition here - automatic-tests: false + def awkward_UnionArray_validity(tags, index, length, numcontents, lencontents): + for i in range(length): + tag = tags[i] + idx = index[i] + if tag < 0: + raise ValueError("tags[i] < 0") + if idx < 0: + raise ValueError("index[i] < 0") + if tag >= numcontents: + raise ValueError("tags[i] >= len(contents)") + lencontent = lencontents[tag] + if idx >= lencontent: + raise ValueError("index[i] >= len(content[tags[i]])") + automatic-tests: true manual-tests: [] - - name: awkward_quick_argsort + - name: awkward_argsort specializations: - - name: awkward_quick_argsort_bool + - name: awkward_argsort_bool args: - {name: toptr, type: "List[int64_t]", dir: out} - {name: fromptr, type: "Const[List[bool]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: tmpbeg, type: "List[int64_t]", dir: in, role: IndexedArray-index} - - {name: tmpend, type: "List[int64_t]", dir: in, role: IndexedArray-index} - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - {name: offsetslength, type: "int64_t", dir: in, role: default} - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - {name: maxlevels, type: "int64_t", dir: in, role: default} - - name: awkward_quick_argsort_int8 + - name: awkward_argsort_int8 args: - {name: toptr, type: "List[int64_t]", dir: out} - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: tmpbeg, type: "List[int64_t]", dir: in, role: IndexedArray-index} - - {name: tmpend, type: "List[int64_t]", dir: in, role: IndexedArray-index} - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - {name: offsetslength, type: "int64_t", dir: in, role: default} - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - {name: maxlevels, type: "int64_t", dir: in, role: default} - - name: awkward_quick_argsort_int16 + - name: awkward_argsort_int16 args: - {name: toptr, type: "List[int64_t]", dir: out} - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: tmpbeg, type: "List[int64_t]", dir: in, role: IndexedArray-index} - - {name: tmpend, type: "List[int64_t]", dir: in, role: IndexedArray-index} - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - {name: offsetslength, type: "int64_t", dir: in, role: default} - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - {name: maxlevels, type: "int64_t", dir: in, role: default} - - name: awkward_quick_argsort_int32 + - name: awkward_argsort_int32 args: - {name: toptr, type: "List[int64_t]", dir: out} - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: tmpbeg, type: "List[int64_t]", dir: in, role: IndexedArray-index} - - {name: tmpend, type: "List[int64_t]", dir: in, role: IndexedArray-index} - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - {name: offsetslength, type: "int64_t", dir: in, role: default} - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - {name: maxlevels, type: "int64_t", dir: in, role: default} - - name: awkward_quick_argsort_int64 + - name: awkward_argsort_int64 args: - {name: toptr, type: "List[int64_t]", dir: out} - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: tmpbeg, type: "List[int64_t]", dir: in, role: IndexedArray-index} - - {name: tmpend, type: "List[int64_t]", dir: in, role: IndexedArray-index} - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - {name: offsetslength, type: "int64_t", dir: in, role: default} - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - {name: maxlevels, type: "int64_t", dir: in, role: default} - - name: awkward_quick_argsort_uint8 + - name: awkward_argsort_uint8 args: - {name: toptr, type: "List[int64_t]", dir: out} - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - {name: tmpbeg, type: "List[int64_t]", dir: in, role: IndexedArray-index} - - {name: tmpend, type: "List[int64_t]", dir: in, role: IndexedArray-index} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - {name: maxlevels, type: "int64_t", dir: in, role: default} - - name: awkward_quick_argsort_uint16 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: tmpbeg, type: "List[int64_t]", dir: in, role: IndexedArray-index} - - {name: tmpend, type: "List[int64_t]", dir: in, role: IndexedArray-index} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - {name: maxlevels, type: "int64_t", dir: in, role: default} - - name: awkward_quick_argsort_uint32 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: tmpbeg, type: "List[int64_t]", dir: in, role: IndexedArray-index} - - {name: tmpend, type: "List[int64_t]", dir: in, role: IndexedArray-index} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - {name: maxlevels, type: "int64_t", dir: in, role: default} - - name: awkward_quick_argsort_uint64 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: tmpbeg, type: "List[int64_t]", dir: in, role: IndexedArray-index} - - {name: tmpend, type: "List[int64_t]", dir: in, role: IndexedArray-index} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - {name: maxlevels, type: "int64_t", dir: in, role: default} - - name: awkward_quick_argsort_float32 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: tmpbeg, type: "List[int64_t]", dir: in, role: IndexedArray-index} - - {name: tmpend, type: "List[int64_t]", dir: in, role: IndexedArray-index} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - {name: maxlevels, type: "int64_t", dir: in, role: default} - - name: awkward_quick_argsort_float64 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: tmpbeg, type: "List[int64_t]", dir: in, role: IndexedArray-index} - - {name: tmpend, type: "List[int64_t]", dir: in, role: IndexedArray-index} - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - {name: offsetslength, type: "int64_t", dir: in, role: default} - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} - {name: stable, type: "bool", dir: in, role: ListArray-replacement} - - {name: maxlevels, type: "int64_t", dir: in, role: default} - description: null - definition: | - Insert Python definition here - automatic-tests: false - manual-tests: [] - - - name: awkward_carry_arange - specializations: - - name: awkward_carry_arange32 - args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_carry_arange64 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_carry_arangeU32 - args: - - {name: toptr, type: "List[uint32_t]", dir: out} - - {name: length, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_carry_arange(toptr, length): - for i in range(length): - toptr[i] = i - automatic-tests: true - manual-tests: [] - - - name: awkward_combinations - specializations: - - name: awkward_combinations_64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: n, type: "int64_t", dir: in, role: default} - - {name: replacement, type: "bool", dir: in, role: default} - - {name: singlelen, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_combinations(toindex, n, replacement, singlelen): - raise ValueError("FIXME: awkward_combinations") - automatic-tests: true - manual-tests: [] - - - name: awkward_content_reduce_zeroparents_64 - specializations: - - name: awkward_content_reduce_zeroparents_64 - args: - - {name: toparents, type: "List[int64_t]", dir: out} - - {name: length, type: "int64_t", dir: in, role: reducer-length} - description: null - definition: | - def awkward_content_reduce_zeroparents_64(toparents, length): - for i in range(length): - toparents[i] = 0 - automatic-tests: true - manual-tests: [] - - - name: awkward_index_carry - specializations: - - name: awkward_Index32_carry_64 - args: - - {name: toindex, type: "List[int32_t]", dir: out} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: carry, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenfromindex, type: "int64_t", dir: in, role: ListOffsetArray-length} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_Index64_carry_64 - args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: carry, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenfromindex, type: "int64_t", dir: in, role: ListOffsetArray-length} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_Index8_carry_64 - args: - - {name: toindex, type: "List[int8_t]", dir: out} - - {name: fromindex, type: "Const[List[int8_t]]", dir: in, role: IndexedArray-index} - - {name: carry, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenfromindex, type: "int64_t", dir: in, role: ListOffsetArray-length} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_IndexU32_carry_64 - args: - - {name: toindex, type: "List[uint32_t]", dir: out} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: carry, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenfromindex, type: "int64_t", dir: in, role: ListOffsetArray-length} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_IndexU8_carry_64 - args: - - {name: toindex, type: "List[uint8_t]", dir: out} - - {name: fromindex, type: "Const[List[uint8_t]]", dir: in, role: IndexedArray-index} - - {name: carry, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: lenfromindex, type: "int64_t", dir: in, role: ListOffsetArray-length} - - {name: length, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_index_carry(toindex, fromindex, carry, lenfromindex, length): - for i in range(length): - j = carry[i] - if j > lenfromindex: - raise ValueError("index out of range") - toindex[i] = fromindex[j] - automatic-tests: true - manual-tests: [] - - - name: awkward_index_carry_nocheck - specializations: - - name: awkward_Index32_carry_nocheck_64 + - name: awkward_argsort_uint16 args: - - {name: toindex, type: "List[int32_t]", dir: out} - - {name: fromindex, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: carry, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: toptr, type: "List[int64_t]", dir: out} + - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_Index64_carry_nocheck_64 + - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: offsetslength, type: "int64_t", dir: in, role: default} + - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} + - {name: stable, type: "bool", dir: in, role: ListArray-replacement} + - name: awkward_argsort_uint32 args: - - {name: toindex, type: "List[int64_t]", dir: out} - - {name: fromindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: carry, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: toptr, type: "List[int64_t]", dir: out} + - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_Index8_carry_nocheck_64 + - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: offsetslength, type: "int64_t", dir: in, role: default} + - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} + - {name: stable, type: "bool", dir: in, role: ListArray-replacement} + - name: awkward_argsort_uint64 args: - - {name: toindex, type: "List[int8_t]", dir: out} - - {name: fromindex, type: "Const[List[int8_t]]", dir: in, role: IndexedArray-index} - - {name: carry, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: toptr, type: "List[int64_t]", dir: out} + - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_IndexU32_carry_nocheck_64 + - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: offsetslength, type: "int64_t", dir: in, role: default} + - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} + - {name: stable, type: "bool", dir: in, role: ListArray-replacement} + - name: awkward_argsort_float32 args: - - {name: toindex, type: "List[uint32_t]", dir: out} - - {name: fromindex, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: carry, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: toptr, type: "List[int64_t]", dir: out} + - {name: fromptr, type: "Const[List[float]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_IndexU8_carry_nocheck_64 + - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: offsetslength, type: "int64_t", dir: in, role: default} + - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} + - {name: stable, type: "bool", dir: in, role: ListArray-replacement} + - name: awkward_argsort_float64 args: - - {name: toindex, type: "List[uint8_t]", dir: out} - - {name: fromindex, type: "Const[List[uint8_t]]", dir: in, role: IndexedArray-index} - - {name: carry, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: toptr, type: "List[int64_t]", dir: out} + - {name: fromptr, type: "Const[List[double]]", dir: in, role: IndexedArray-index} - {name: length, type: "int64_t", dir: in, role: default} + - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} + - {name: offsetslength, type: "int64_t", dir: in, role: default} + - {name: ascending, type: "bool", dir: in, role: ListArray-replacement} + - {name: stable, type: "bool", dir: in, role: ListArray-replacement} description: null definition: | - def awkward_index_carry_nocheck(toindex, fromindex, carry, length): - for i in range(length): - toindex[i] = fromindex[carry[i]] - automatic-tests: true + Insert Python definition here + automatic-tests: false manual-tests: [] - name: awkward_index_rpad_and_clip_axis0 @@ -6648,24 +4564,6 @@ kernels: automatic-tests: true manual-tests: [] - - name: awkward_new_Identities - specializations: - - name: awkward_new_Identities32 - args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: length, type: "int64_t", dir: in, role: default} - - name: awkward_new_Identities64 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: length, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_new_Identities(toptr, length): - for i in range(length): - toptr[i] = i - automatic-tests: true - manual-tests: [] - - name: awkward_reduce_argmax specializations: - name: awkward_reduce_argmax_int8_64 @@ -6771,27 +4669,6 @@ kernels: automatic-tests: false manual-tests: [] - - name: awkward_reduce_argmax_bool_64 - specializations: - - name: awkward_reduce_argmax_bool_64 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: reducer-fromptr} - - {name: parents, type: "Const[List[int64_t]]", dir: in, role: reducer-parents} - - {name: lenparents, type: "int64_t", dir: in, role: reducer-lenparents} - - {name: outlength, type: "int64_t", dir: in, role: reducer-outlength} - description: null - definition: | - def awkward_reduce_argmax_bool_64(toptr, fromptr, parents, lenparents, outlength): - for k in range(outlength): - toptr[k] = -1 - for i in range(lenparents): - parent = parents[i] - if (toptr[parent] == -1) or ((fromptr[i] != 0) > (fromptr[toptr[parent]] != 0)): - toptr[parent] = i - automatic-tests: true - manual-tests: [] - - name: awkward_reduce_argmin specializations: - name: awkward_reduce_argmin_int8_64 @@ -6876,27 +4753,6 @@ kernels: automatic-tests: true manual-tests: [] - - name: awkward_reduce_argmin_bool_64 - specializations: - - name: awkward_reduce_argmin_bool_64 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: reducer-fromptr} - - {name: parents, type: "Const[List[int64_t]]", dir: in, role: reducer-parents} - - {name: lenparents, type: "int64_t", dir: in, role: reducer-lenparents} - - {name: outlength, type: "int64_t", dir: in, role: reducer-outlength} - description: null - definition: | - def awkward_reduce_argmin_bool_64(toptr, fromptr, parents, lenparents, outlength): - for k in range(outlength): - toptr[k] = -1 - for i in range(lenparents): - parent = parents[i] - if (toptr[parent] == -1) or ((fromptr[i] != 0) < (fromptr[toptr[parent]] != 0)): - toptr[parent] = i - automatic-tests: true - manual-tests: [] - - name: awkward_reduce_argmin_complex specializations: - name: awkward_reduce_argmin_complex64_64 @@ -7533,44 +5389,6 @@ kernels: automatic-tests: false manual-tests: [] - - name: awkward_reduce_prod_int32_bool_64 - specializations: - - name: awkward_reduce_prod_int32_bool_64 - args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: reducer-fromptr} - - {name: parents, type: "Const[List[int64_t]]", dir: in, role: reducer-parents} - - {name: lenparents, type: "int64_t", dir: in, role: reducer-lenparents} - - {name: outlength, type: "int64_t", dir: in, role: reducer-outlength} - description: null - definition: | - def awkward_reduce_prod_int32_bool_64(toptr, fromptr, parents, lenparents, outlength): - for i in range(outlength): - toptr[i] = 1 - for i in range(lenparents): - toptr[parents[i]] *= fromptr[i] != 0 - automatic-tests: true - manual-tests: [] - - - name: awkward_reduce_prod_int64_bool_64 - specializations: - - name: awkward_reduce_prod_int64_bool_64 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: reducer-fromptr} - - {name: parents, type: "Const[List[int64_t]]", dir: in, role: reducer-parents} - - {name: lenparents, type: "int64_t", dir: in, role: reducer-lenparents} - - {name: outlength, type: "int64_t", dir: in, role: reducer-outlength} - description: null - definition: | - def awkward_reduce_prod_int64_bool_64(toptr, fromptr, parents, lenparents, outlength): - for i in range(outlength): - toptr[i] = 1 - for i in range(lenparents): - toptr[parents[i]] *= fromptr[i] != 0 - automatic-tests: true - manual-tests: [] - - name: awkward_reduce_sum specializations: - name: awkward_reduce_sum_int32_int8_64 @@ -7864,75 +5682,6 @@ kernels: automatic-tests: true manual-tests: [] - - name: awkward_regularize_arrayslice - specializations: - - name: awkward_regularize_arrayslice_64 - args: - - {name: flatheadptr, type: "List[int64_t]", dir: in, role: NumpyArray-ptr} - - {name: lenflathead, type: "int64_t", dir: in, role: default} - - {name: length, type: "int64_t", dir: in, role: NumpyArray-length} - description: null - definition: | - def awkward_regularize_arrayslice(flatheadptr, lenflathead, length): - for i in range(lenflathead): - original = flatheadptr[i] - if flatheadptr[i] < 0: - flatheadptr[i] += length - if (flatheadptr[i] < 0) or (flatheadptr[i] >= length): - raise ValueError("index out of range") - automatic-tests: true - manual-tests: [] - - - name: awkward_slicearray_ravel - specializations: - - name: awkward_slicearray_ravel_64 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: default} - - {name: ndim, type: "int64_t", dir: in, role: default} - - {name: shape, type: "Const[List[int64_t]]", dir: in, role: default} - - {name: strides, type: "Const[List[int64_t]]", dir: in, role: default} - description: null - definition: | - def awkward_slicearray_ravel(toptr, fromptr, ndim, shape, strides): - if ndim == 1: - for i in range(shape[0]): - toptr[i] = fromptr[i * strides[0]] - else: - for i in range(shape[0]): - err = awkward_slicearray_ravel( - toptr[i * shape[1]], - fromptr[i * strides[0]], - ndim - 1, - shape[1], - strides[1], - ) - if err.str != nullptr: - return err - automatic-tests: false - manual-tests: [] - - - name: awkward_slicemissing_check_same - specializations: - - name: awkward_slicemissing_check_same - args: - - {name: same, type: "List[bool]", dir: out} - - {name: bytemask, type: "Const[List[int8_t]]", dir: in, role: ByteMaskedArray-mask} - - {name: missingindex, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_slicemissing_check_same(same, bytemask, missingindex, length): - same[0] = True - for i in range(length): - left = bytemask[i] != 0 - right = missingindex[i] < 0 - if left != right: - same[0] = False - return - automatic-tests: true - manual-tests: [] - - name: awkward_quick_sort specializations: - name: awkward_quick_sort_bool @@ -8169,102 +5918,6 @@ kernels: automatic-tests: false manual-tests: [] - - name: awkward_sort_ascending - specializations: - - name: awkward_sort_ascending_bool - args: - - {name: toptr, type: "List[bool]", dir: out} - - {name: fromptr, type: "Const[List[bool]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: parentslength, type: "int64_t", dir: in, role: default} - - name: awkward_sort_ascending_int8 - args: - - {name: toptr, type: "List[int8_t]", dir: out} - - {name: fromptr, type: "Const[List[int8_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: parentslength, type: "int64_t", dir: in, role: default} - - name: awkward_sort_ascending_int16 - args: - - {name: toptr, type: "List[int16_t]", dir: out} - - {name: fromptr, type: "Const[List[int16_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: parentslength, type: "int64_t", dir: in, role: default} - - name: awkward_sort_ascending_int32 - args: - - {name: toptr, type: "List[int32_t]", dir: out} - - {name: fromptr, type: "Const[List[int32_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: parentslength, type: "int64_t", dir: in, role: default} - - name: awkward_sort_ascending_int64 - args: - - {name: toptr, type: "List[int64_t]", dir: out} - - {name: fromptr, type: "Const[List[int64_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: parentslength, type: "int64_t", dir: in, role: default} - - name: awkward_sort_ascending_uint8 - args: - - {name: toptr, type: "List[uint8_t]", dir: out} - - {name: fromptr, type: "Const[List[uint8_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: parentslength, type: "int64_t", dir: in, role: default} - - name: awkward_sort_ascending_uint16 - args: - - {name: toptr, type: "List[uint16_t]", dir: out} - - {name: fromptr, type: "Const[List[uint16_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: parentslength, type: "int64_t", dir: in, role: default} - - name: awkward_sort_ascending_uint32 - args: - - {name: toptr, type: "List[uint32_t]", dir: out} - - {name: fromptr, type: "Const[List[uint32_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: parentslength, type: "int64_t", dir: in, role: default} - - name: awkward_sort_ascending_uint64 - args: - - {name: toptr, type: "List[uint64_t]", dir: out} - - {name: fromptr, type: "Const[List[uint64_t]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: parentslength, type: "int64_t", dir: in, role: default} - - name: awkward_sort_ascending_float32 - args: - - {name: toptr, type: "List[float]", dir: out} - - {name: fromptr, type: "Const[List[float]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: parentslength, type: "int64_t", dir: in, role: default} - - name: awkward_sort_ascending_float64 - args: - - {name: toptr, type: "List[double]", dir: out} - - {name: fromptr, type: "Const[List[double]]", dir: in, role: IndexedArray-index} - - {name: length, type: "int64_t", dir: in, role: default} - - {name: offsets, type: "Const[List[int64_t]]", dir: in, role: ListOffsetArray-offsets} - - {name: offsetslength, type: "int64_t", dir: in, role: default} - - {name: parentslength, type: "int64_t", dir: in, role: default} - description: null - definition: | - Insert Python definition here - automatic-tests: false - manual-tests: [] - - name: awkward_unique specializations: - name: awkward_unique_bool @@ -8549,61 +6202,3 @@ kernels: Insert Python definition here automatic-tests: false manual-tests: [] - - - name: awkward_one_mask - specializations: - - name: awkward_one_mask8 - args: - - {name: tomask, type: "List[int8_t]", dir: out} - - {name: length, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_one_mask(tomask, length): - for i in range(length): - tomask[i] = 1 - automatic-tests: true - manual-tests: [] - - - name: awkward_zero_mask - specializations: - - name: awkward_zero_mask8 - args: - - {name: tomask, type: "List[int8_t]", dir: out} - - {name: length, type: "int64_t", dir: in, role: default} - description: null - definition: | - def awkward_zero_mask(tomask, length): - for i in range(length): - tomask[i] = 0 - automatic-tests: true - manual-tests: [] - - -# These are the names of the reducer roles with a minimal indicator of type. - -# If samples.json were samples.yml, we'd be able to include this information in a comment. - -# { -# "reducer-distincts": [], -# "reducer-distinctslen": 0, -# "reducer-fromptr": [], -# "reducer-gaps": [], -# "reducer-identity": 0, -# "reducer-index": [], -# "reducer-lendistincts": 0, -# "reducer-length": 0, -# "reducer-lenparents": 0, -# "reducer-mask": [], -# "reducer-maxcount": 0, -# "reducer-nextlen": 0, -# "reducer-nextparents": [], -# "reducer-offsets": [], -# "reducer-offsetscopy": [], -# "reducer-outindexlength": 0, -# "reducer-outlength": 0, -# "reducer-parents": [], -# "reducer-starts": [], -# "reducer-startslength": 0, -# "reducer-shifts": [], -# "reducer-validwhen": false -# } diff --git a/kernel-test-data.yml b/kernel-test-data.yml index d0170b78e4..0665cd46c1 100644 --- a/kernel-test-data.yml +++ b/kernel-test-data.yml @@ -177,252 +177,6 @@ tests: num: 3 unit-tests: -- name: awkward_Identities_getitem_carry - tests: - - error: false - inputs: - carryptr: [0, 0, 0, 0] - identitiesptr: [0, 1] - lencarry: 4 - length: 2 - width: 1 - outputs: - newidentitiesptr: [0, 0, 0, 0] - - error: false - inputs: - carryptr: [0, 1, 1, 1] - identitiesptr: [0, 1] - lencarry: 4 - length: 2 - width: 1 - outputs: - newidentitiesptr: [0, 1, 1, 1] - - error: false - inputs: - carryptr: [0, 1, 2, 6, 8] - identitiesptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - lencarry: 5 - length: 10 - width: 1 - outputs: - newidentitiesptr: [0, 1, 2, 6, 8] - - error: false - inputs: - carryptr: [1, 0, 0, 1] - identitiesptr: [0, 1] - lencarry: 4 - length: 2 - width: 1 - outputs: - newidentitiesptr: [1, 0, 0, 1] - - error: false - inputs: - carryptr: [1] - identitiesptr: [0, 1, 2, 3] - lencarry: 1 - length: 4 - width: 1 - outputs: - newidentitiesptr: [1] - - error: false - inputs: - carryptr: [0] - identitiesptr: [1] - lencarry: 1 - length: 1 - width: 1 - outputs: - newidentitiesptr: [1] - - error: false - inputs: - carryptr: [1, 1, 1, 1] - identitiesptr: [0, 1] - lencarry: 4 - length: 2 - width: 1 - outputs: - newidentitiesptr: [1, 1, 1, 1] - - error: false - inputs: - carryptr: [0, 1, 5, 7] - identitiesptr: [1, 2, 3, 4, 5, 6, 7, 8, 9] - lencarry: 4 - length: 9 - width: 1 - outputs: - newidentitiesptr: [1, 2, 6, 8] - - error: false - inputs: - carryptr: [2, 2, 2, 2] - identitiesptr: [0, 1, 2, 3, 4] - lencarry: 4 - length: 5 - width: 1 - outputs: - newidentitiesptr: [2, 2, 2, 2] - - error: false - inputs: - carryptr: [3] - identitiesptr: [0, 1, 2, 3] - lencarry: 1 - length: 4 - width: 1 - outputs: - newidentitiesptr: [3] - - error: false - inputs: - carryptr: [2] - identitiesptr: [1, 2, 3] - lencarry: 1 - length: 3 - width: 1 - outputs: - newidentitiesptr: [3] - - error: false - inputs: - carryptr: [2] - identitiesptr: [1, 2, 3, 4] - lencarry: 1 - length: 4 - width: 1 - outputs: - newidentitiesptr: [3] - - error: false - inputs: - carryptr: [2, 2] - identitiesptr: [1, 2, 3, 4] - lencarry: 2 - length: 4 - width: 1 - outputs: - newidentitiesptr: [3, 3] - - error: false - inputs: - carryptr: [7, 3, 3, 5] - identitiesptr: [1, 2, 3, 4, 5, 6, 7, 8, 9] - lencarry: 4 - length: 9 - width: 1 - outputs: - newidentitiesptr: [8, 4, 4, 6] - - error: false - inputs: - carryptr: [7, 3, 3, 6] - identitiesptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - lencarry: 4 - length: 10 - width: 1 - outputs: - newidentitiesptr: [7, 3, 3, 6] - - error: false - inputs: - carryptr: [2] - identitiesptr: [0, 1, 2, 3] - lencarry: 1 - length: 4 - width: 1 - outputs: - newidentitiesptr: [2] - - error: false - inputs: - carryptr: [2] - identitiesptr: [0, 1, 2, 3, 4] - lencarry: 1 - length: 5 - width: 1 - outputs: - newidentitiesptr: [2] - - error: false - inputs: - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - identitiesptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - lencarry: 10 - length: 10 - width: 1 - outputs: - newidentitiesptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - - error: false - inputs: - carryptr: [1] - identitiesptr: [0, 1] - lencarry: 1 - length: 2 - width: 1 - outputs: - newidentitiesptr: [1] - - error: false - inputs: - carryptr: [1, 0, 1, 1, 1, 0] - identitiesptr: [0, 1] - lencarry: 6 - length: 2 - width: 1 - outputs: - newidentitiesptr: [1, 0, 1, 1, 1, 0] - - error: false - inputs: - carryptr: [2] - identitiesptr: [0, 1, 2] - lencarry: 1 - length: 3 - width: 1 - outputs: - newidentitiesptr: [2] - - error: false - inputs: - carryptr: [1] - identitiesptr: [0, 1, 2, 3, 4] - lencarry: 1 - length: 5 - width: 1 - outputs: - newidentitiesptr: [1] -- name: awkward_content_reduce_zeroparents_64 - tests: - - error: false - inputs: {length: 0} - outputs: - toparents: [123] - - error: false - inputs: {length: 10} - outputs: - toparents: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - - error: false - inputs: {length: 9} - outputs: - toparents: [0, 0, 0, 0, 0, 0, 0, 0, 0] - - error: false - inputs: {length: 8} - outputs: - toparents: [0, 0, 0, 0, 0, 0, 0, 0] - - error: false - inputs: {length: 7} - outputs: - toparents: [0, 0, 0, 0, 0, 0, 0] - - error: false - inputs: {length: 6} - outputs: - toparents: [0, 0, 0, 0, 0, 0] - - error: false - inputs: {length: 5} - outputs: - toparents: [0, 0, 0, 0, 0] - - error: false - inputs: {length: 4} - outputs: - toparents: [0, 0, 0, 0] - - error: false - inputs: {length: 3} - outputs: - toparents: [0, 0, 0] - - error: false - inputs: {length: 2} - outputs: - toparents: [0, 0] - - error: false - inputs: {length: 1} - outputs: - toparents: [0] - name: awkward_missing_repeat tests: - error: false @@ -869,73 +623,6 @@ unit-tests: validwhen: false outputs: tobytemask: [0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0] -- name: awkward_ByteMaskedArray_getitem_carry - tests: - - error: false - inputs: - fromcarry: [0, 1, 2, 3, 4, 15, 16, 17, 18, 19, 5, 6, 7, 8, 9, 20, 21, 22, 23, - 24, 10, 11, 12, 13, 14, 25, 26, 27, 28, 29] - frommask: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0] - lencarry: 30 - lenmask: 30 - outputs: - tomask: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0] - - error: false - inputs: - fromcarry: [4] - frommask: [0, 0, 1, 1, 0] - lencarry: 1 - lenmask: 5 - outputs: - tomask: [0] - - error: false - inputs: - fromcarry: [0, 5, 10, 15, 20, 25, 1, 6, 11, 16, 21, 26, 2, 7, 12, 17, 22, 27, - 3, 8, 13, 18, 23, 28, 4, 9, 14, 19, 24, 29] - frommask: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0] - lencarry: 30 - lenmask: 30 - outputs: - tomask: [0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, - 0, 0, 0, 1, 1, 0, 0] - - error: false - inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - frommask: [0, 1, 0, 0, 1, 0] - lencarry: 6 - lenmask: 6 - outputs: - tomask: [0, 0, 1, 1, 0, 0] - - error: false - inputs: - fromcarry: [3, 2, 1, 1, 0, 5, 7, 7, 9, 10] - frommask: [0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0] - lencarry: 10 - lenmask: 13 - outputs: - tomask: [0, 1, 0, 0, 0, 1, 0, 0, 0, 1] - - error: false - inputs: - fromcarry: [0, 5, 10, 15, 20, 25, 1, 6, 11, 16, 21, 26, 2, 7, 12, 17, 22, 27, - 3, 8, 13, 18, 23, 28, 4, 9, 14, 19, 24, 29] - frommask: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0] - lencarry: 30 - lenmask: 30 - outputs: - tomask: [0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, - 0, 0, 1, 0, 0, 1, 0] - - error: false - inputs: - fromcarry: [2, 3, 4] - frommask: [0, 0, 1, 1, 0] - lencarry: 3 - lenmask: 5 - outputs: - tomask: [1, 1, 0] - name: awkward_ByteMaskedArray_getitem_nextcarry tests: - error: false @@ -1094,82 +781,6 @@ unit-tests: validwhen: true outputs: numnull: [5] -- name: awkward_carry_arange - tests: - - error: false - inputs: {length: 1} - outputs: - toptr: [0] - - error: false - inputs: {length: 2} - outputs: - toptr: [0, 1] - - error: false - inputs: {length: 3} - outputs: - toptr: [0, 1, 2] - - error: false - inputs: {length: 4} - outputs: - toptr: [0, 1, 2, 3] - - error: false - inputs: {length: 5} - outputs: - toptr: [0, 1, 2, 3, 4] - - error: false - inputs: {length: 6} - outputs: - toptr: [0, 1, 2, 3, 4, 5] - - error: false - inputs: {length: 7} - outputs: - toptr: [0, 1, 2, 3, 4, 5, 6] - - error: false - inputs: {length: 8} - outputs: - toptr: [0, 1, 2, 3, 4, 5, 6, 7] - - error: false - inputs: {length: 9} - outputs: - toptr: [0, 1, 2, 3, 4, 5, 6, 7, 8] - - error: false - inputs: {length: 10} - outputs: - toptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - - error: false - inputs: {length: 11} - outputs: - toptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] - - error: false - inputs: {length: 12} - outputs: - toptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] - - error: false - inputs: {length: 14} - outputs: - toptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] - - error: false - inputs: {length: 15} - outputs: - toptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] - - error: false - inputs: {length: 18} - outputs: - toptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17] - - error: false - inputs: {length: 20} - outputs: - toptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] - - error: false - inputs: {length: 24} - outputs: - toptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23] - - error: false - inputs: {length: 25} - outputs: - toptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24] - name: awkward_ByteMaskedArray_toIndexedOptionArray tests: - error: false @@ -1195,437 +806,64 @@ unit-tests: lenindex: 2 outputs: tocarry: [0, 1] -- name: awkward_IndexedArray_getitem_carry +- name: awkward_IndexedArray_getitem_nextcarry tests: - error: false inputs: - fromcarry: [0, 1, 2, 5, 6, 7, 8] - fromindex: [0, 1, 1, 2, 3, 1, 4, 5, 6] - lencarry: 7 - lenindex: 9 + fromindex: [0, 0, 0, 0, 0, 0, 0] + lencontent: 1 + lenindex: 7 outputs: - toindex: [0, 1, 1, 1, 4, 5, 6] + tocarry: [0, 0, 0, 0, 0, 0, 0] - error: false inputs: - fromcarry: [0, 1, 2, 5, 6, 7, 8] - fromindex: [0, 1, 1, 2, 3, 4, 5, 6, 7] - lencarry: 7 - lenindex: 9 + fromindex: [0, 0, 0, 0, 0, 0] + lencontent: 1 + lenindex: 6 outputs: - toindex: [0, 1, 1, 4, 5, 6, 7] + tocarry: [0, 0, 0, 0, 0, 0] - error: false inputs: - fromcarry: [0, 2, 3, 4, 5, 7, 8] - fromindex: [0, 1, 1, 2, 3, 4, 1, 5, 6] - lencarry: 7 - lenindex: 9 + fromindex: [0, 0, 0, 0, 0] + lencontent: 1 + lenindex: 5 outputs: - toindex: [0, 1, 2, 3, 4, 5, 6] + tocarry: [0, 0, 0, 0, 0] - error: false inputs: - fromcarry: [0, 3, 6, 9, 12, 1, 4, 7, 10, 13, 2, 5, 8, 11, 14] - fromindex: [0, 1, 2, 1, 1, 1, 3, 4, 1, 5, 1, 1, 6, 7, 8] - lencarry: 15 - lenindex: 15 + fromindex: [0, 0, 0] + lencontent: 1 + lenindex: 3 outputs: - toindex: [0, 1, 3, 5, 6, 1, 1, 4, 1, 7, 2, 1, 1, 1, 8] + tocarry: [0, 0, 0] - error: false inputs: - fromcarry: [0, 5, 10, 15, 20, 1, 6, 11, 16, 21, 2, 7, 12, 17, 22, 3, 8, 13, - 18, 23, 4, 9, 14, 19, 24] - fromindex: [0, 1, 2, 1, 1, 1, 1, 1, 1, 1, 3, 4, 1, 1, 1, 5, 1, 1, 1, 1, 6, 7, - 8, 1, 1] - lencarry: 25 - lenindex: 25 + fromindex: [0, 0] + lencontent: 1 + lenindex: 2 outputs: - toindex: [0, 1, 3, 5, 6, 1, 1, 4, 1, 7, 2, 1, 1, 1, 8, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1] + tocarry: [0, 0] - error: false inputs: - fromcarry: [0, 5, 10, 15, 16, 1, 6, 11, 2, 7, 12, 3, 8, 13, 4, 9, 14] - fromindex: [0, 1, 2, 9, 10, 3, 11, 12, 13, 14, 4, 5, 6, 15, 16, 7, 8] - lencarry: 17 - lenindex: 17 + fromindex: [0, 0, 0, 1, 1, 1, 2, 2, 2] + lencontent: 3 + lenindex: 9 outputs: - toindex: [0, 3, 4, 7, 8, 1, 11, 5, 2, 12, 6, 9, 13, 15, 10, 14, 16] + tocarry: [0, 0, 0, 1, 1, 1, 2, 2, 2] - error: false inputs: - fromcarry: [0, 5, 10, 15, 16, 1, 6, 11, 2, 7, 12, 3, 8, 13, 4, 9, 14] - fromindex: [0, 1, 2, 1, 1, 3, 1, 1, 1, 1, 4, 5, 6, 1, 1, 7, 8] - lencarry: 17 - lenindex: 17 + fromindex: [0, 0, 0, 2, 3, 3, 4] + lencontent: 5 + lenindex: 7 outputs: - toindex: [0, 3, 4, 7, 8, 1, 1, 5, 2, 1, 6, 1, 1, 1, 1, 1, 1] + tocarry: [0, 0, 0, 2, 3, 3, 4] - error: false inputs: - fromcarry: [0, 5, 10, 15, 20, 1, 6, 11, 16, 21, 2, 7, 12, 17, 22, 3, 8, 13, - 18, 23, 4, 9, 14, 19, 24] - fromindex: [0, 1, 2, 3, 1, 4, 5, 6, 1, 1, 7, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1] - lencarry: 25 - lenindex: 25 + fromindex: [0, 1] + lencontent: 2 + lenindex: 2 outputs: - toindex: [0, 4, 7, 1, 1, 1, 5, 8, 1, 1, 2, 6, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, - 1, 1, 1] - - error: false - inputs: - fromcarry: [0, 5, 10, 15, 20, 1, 6, 11, 16, 21, 2, 7, 12, 17, 22, 3, 8, 13, - 18, 23, 4, 9, 14, 19, 24] - fromindex: [0, 1, 2, 3, 9, 4, 5, 6, 10, 11, 7, 8, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24] - lencarry: 25 - lenindex: 25 - outputs: - toindex: [0, 4, 7, 15, 20, 1, 5, 8, 16, 21, 2, 6, 12, 17, 22, 3, 10, 13, 18, - 23, 9, 11, 14, 19, 24] - - error: false - inputs: - fromcarry: [0, 5, 10, 1, 6, 11, 2, 7, 12, 3, 8, 13, 4, 9, 14] - fromindex: [0, 1, 2, 3, 1, 4, 5, 6, 1, 1, 7, 8, 1, 1, 1] - lencarry: 15 - lenindex: 15 - outputs: - toindex: [0, 4, 7, 1, 5, 8, 2, 6, 1, 3, 1, 1, 1, 1, 1] - - error: false - inputs: - fromcarry: [1, 2, 3, 4, 7, 8] - fromindex: [0, 1, 1, 1, 2, 3, 4, 5, 1] - lencarry: 6 - lenindex: 9 - outputs: - toindex: [1, 1, 1, 2, 5, 1] - - error: false - inputs: - fromcarry: [1, 2, 3, 6] - fromindex: [0, 1, 1, 1, 2, 3, 4] - lencarry: 4 - lenindex: 7 - outputs: - toindex: [1, 1, 1, 4] - - error: false - inputs: - fromcarry: [3, 3, 3] - fromindex: [4, 0, 3, 1, 3] - lencarry: 3 - lenindex: 5 - outputs: - toindex: [1, 1, 1] - - error: false - inputs: - fromcarry: [0, 5, 8, 11, 14, 1, 6, 9, 12, 15, 2, 7, 10, 13, 16, 3, 4] - fromindex: [1, 1, 0, 1, 2, 1, 1, 1, 3, 1, 4, 5, 1, 1, 6, 7, 8] - lencarry: 17 - lenindex: 17 - outputs: - toindex: [1, 1, 3, 5, 6, 1, 1, 1, 1, 7, 0, 1, 4, 1, 8, 1, 2] - - error: false - inputs: - fromcarry: [4] - fromindex: [2, 2, 0, 3, 1] - lencarry: 1 - lenindex: 5 - outputs: - toindex: [1] - - error: false - inputs: - fromcarry: [4, 1] - fromindex: [2, 2, 0, 3, 1] - lencarry: 2 - lenindex: 5 - outputs: - toindex: [1, 2] - - error: false - inputs: - fromcarry: [3, 4] - fromindex: [4, 0, 3, 1, 3] - lencarry: 2 - lenindex: 5 - outputs: - toindex: [1, 3] - - error: false - inputs: - fromcarry: [3] - fromindex: [4, 0, 3, 1, 3] - lencarry: 1 - lenindex: 5 - outputs: - toindex: [1] - - error: false - inputs: - fromcarry: [0, 5, 10, 15, 20, 25, 1, 6, 11, 16, 21, 26, 2, 7, 12, 17, 22, 27, - 3, 8, 13, 18, 23, 28, 4, 9, 14, 19, 24, 29] - fromindex: [15, 16, 17, 18, 19, 1, 1, 1, 1, 1, 10, 11, 12, 13, 14, 5, 6, 7, - 8, 9, 1, 1, 1, 1, 1, 0, 1, 2, 3, 4] - lencarry: 30 - lenindex: 30 - outputs: - toindex: [15, 1, 10, 5, 1, 0, 16, 1, 11, 6, 1, 1, 17, 1, 12, 7, 1, 2, 18, 1, - 13, 8, 1, 3, 19, 1, 14, 9, 1, 4] - - error: false - inputs: - fromcarry: [0, 5, 6, 11, 16, 17, 1, 7, 12, 18, 2, 8, 13, 19, 3, 9, 14, 20, 4, - 10, 15, 21] - fromindex: [15, 16, 17, 18, 19, 1, 10, 11, 12, 13, 14, 5, 6, 7, 8, 9, 1, 0, - 1, 2, 3, 4] - lencarry: 22 - lenindex: 22 - outputs: - toindex: [15, 1, 10, 5, 1, 0, 16, 11, 6, 1, 17, 12, 7, 2, 18, 13, 8, 3, 19, - 14, 9, 4] - - error: false - inputs: - fromcarry: [0, 1, 2, 3, 4, 11, 12, 13, 14, 15, 5, 16, 6, 7, 8, 9, 10, 17, 18, - 19, 20, 21] - fromindex: [15, 16, 17, 18, 19, 1, 10, 11, 12, 13, 14, 5, 6, 7, 8, 9, 1, 0, - 1, 2, 3, 4] - lencarry: 22 - lenindex: 22 - outputs: - toindex: [15, 16, 17, 18, 19, 5, 6, 7, 8, 9, 1, 1, 10, 11, 12, 13, 14, 0, 1, - 2, 3, 4] - - error: false - inputs: - fromcarry: [0, 1, 2, 3, 4, 15, 16, 17, 18, 19, 5, 6, 7, 8, 9, 20, 21, 22, 23, - 24, 10, 11, 12, 13, 14, 25, 26, 27, 28, 29] - fromindex: [15, 16, 17, 18, 19, 1, 1, 1, 1, 1, 10, 11, 12, 13, 14, 5, 6, 7, - 8, 9, 1, 1, 1, 1, 1, 0, 1, 2, 3, 4] - lencarry: 30 - lenindex: 30 - outputs: - toindex: [15, 16, 17, 18, 19, 5, 6, 7, 8, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, - 11, 12, 13, 14, 0, 1, 2, 3, 4] - - error: false - inputs: - fromcarry: [0, 5, 10, 15, 20, 25, 1, 6, 11, 16, 21, 26, 2, 7, 12, 17, 22, 27, - 3, 8, 13, 18, 23, 28, 4, 9, 14, 19, 24, 29] - fromindex: [15, 16, 17, 18, 19, 5, 6, 7, 8, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 10, 11, 12, 13, 14, 0, 1, 2, 3, 4] - lencarry: 30 - lenindex: 30 - outputs: - toindex: [15, 5, 1, 1, 10, 0, 16, 6, 1, 1, 11, 1, 17, 7, 1, 1, 12, 2, 18, 8, - 1, 1, 13, 3, 19, 9, 1, 1, 14, 4] - - error: false - inputs: - fromcarry: [0, 5, 10, 11, 12, 17, 1, 6, 13, 18, 2, 7, 14, 19, 3, 8, 15, 20, - 4, 9, 16, 21] - fromindex: [15, 16, 17, 18, 19, 5, 6, 7, 8, 9, 1, 1, 10, 11, 12, 13, 14, 0, - 1, 2, 3, 4] - lencarry: 22 - lenindex: 22 - outputs: - toindex: [15, 5, 1, 1, 10, 0, 16, 6, 11, 1, 17, 7, 12, 2, 18, 8, 13, 3, 19, - 9, 14, 4] - - error: false - inputs: - fromcarry: [3, 2, 1, 0] - fromindex: [0, 1, 1, 2] - lencarry: 4 - lenindex: 4 - outputs: - toindex: [2, 1, 1, 0] - - error: false - inputs: - fromcarry: [3, 2, 1] - fromindex: [0, 1, 1, 2] - lencarry: 3 - lenindex: 4 - outputs: - toindex: [2, 1, 1] - - error: false - inputs: - fromcarry: [3, 2, 1, 1, 0, 5, 7, 7, 9, 10] - fromindex: [0, 1, 1, 2, 3, 1, 4, 5, 6, 7, 1, 8, 9] - lencarry: 10 - lenindex: 13 - outputs: - toindex: [2, 1, 1, 1, 0, 1, 5, 5, 7, 1] - - error: false - inputs: - fromcarry: [3, 2, 2, 1, 5, 6] - fromindex: [0, 1, 1, 2, 3, 1, 4, 5] - lencarry: 6 - lenindex: 8 - outputs: - toindex: [2, 1, 1, 1, 1, 4] - - error: false - inputs: - fromcarry: [1, 2] - fromindex: [1, 2, 3] - lencarry: 2 - lenindex: 3 - outputs: - toindex: [2, 3] - - error: false - inputs: - fromcarry: [1, 2, 3] - fromindex: [1, 2, 3, 4] - lencarry: 3 - lenindex: 4 - outputs: - toindex: [2, 3, 4] - - error: false - inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - fromindex: [3, 1, 2, 1, 1, 0] - lencarry: 6 - lenindex: 6 - outputs: - toindex: [3, 1, 1, 1, 2, 0] - - error: false - inputs: - fromcarry: [4, 3, 2] - fromindex: [0, 1, 2, 1, 3, 1, 1, 4] - lencarry: 3 - lenindex: 8 - outputs: - toindex: [3, 1, 2] - - error: false - inputs: - fromcarry: [4, 3, 2, 1] - fromindex: [0, 1, 2, 1, 3, 1, 1, 4] - lencarry: 4 - lenindex: 8 - outputs: - toindex: [3, 1, 2, 1] - - error: false - inputs: - fromcarry: [4, 3, 2, 0] - fromindex: [0, 1, 1, 2, 3] - lencarry: 4 - lenindex: 5 - outputs: - toindex: [3, 2, 1, 0] - - error: false - inputs: - fromcarry: [4, 5] - fromindex: [0, 1, 1, 2, 3, 4] - lencarry: 2 - lenindex: 6 - outputs: - toindex: [3, 4] - - error: false - inputs: - fromcarry: [2, 3] - fromindex: [1, 2, 3, 4] - lencarry: 2 - lenindex: 4 - outputs: - toindex: [3, 4] - - error: false - inputs: - fromcarry: [5, 6, 7, 8] - fromindex: [0, 1, 1, 1, 2, 3, 4, 5, 1] - lencarry: 4 - lenindex: 9 - outputs: - toindex: [3, 4, 5, 1] - - error: false - inputs: - fromcarry: [4, 5, 7, 8, 9, 10, 11] - fromindex: [0, 1, 1, 2, 3, 4, 5, 6, 1, 7, 8, 9] - lencarry: 7 - lenindex: 12 - outputs: - toindex: [3, 4, 6, 1, 7, 8, 9] - - error: false - inputs: - fromcarry: [4] - fromindex: [2, 2, 0, 3, 4] - lencarry: 1 - lenindex: 5 - outputs: - toindex: [4] - - error: false - inputs: - fromcarry: [4, 1] - fromindex: [2, 2, 0, 3, 4] - lencarry: 2 - lenindex: 5 - outputs: - toindex: [4, 2] - - error: false - inputs: - fromcarry: [6, 7, 8, 9, 5, 3, 4, 0, 1, 2] - fromindex: [0, 1, 1, 1, 2, 3, 4, 5, 6, 7] - lencarry: 10 - lenindex: 10 - outputs: - toindex: [4, 5, 6, 7, 3, 1, 2, 0, 1, 1] - - error: false - inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - fromindex: [5, 4, 3, 2, 1, 0] - lencarry: 6 - lenindex: 6 - outputs: - toindex: [5, 2, 4, 1, 3, 0] - - error: false - inputs: - fromcarry: [6, 7, 8, 9, 10, 11] - fromindex: [0, 1, 1, 2, 3, 4, 5, 6, 1, 7, 8, 9] - lencarry: 6 - lenindex: 12 - outputs: - toindex: [5, 6, 1, 7, 8, 9] -- name: awkward_IndexedArray_getitem_nextcarry - tests: - - error: false - inputs: - fromindex: [0, 0, 0, 0, 0, 0, 0] - lencontent: 1 - lenindex: 7 - outputs: - tocarry: [0, 0, 0, 0, 0, 0, 0] - - error: false - inputs: - fromindex: [0, 0, 0, 0, 0, 0] - lencontent: 1 - lenindex: 6 - outputs: - tocarry: [0, 0, 0, 0, 0, 0] - - error: false - inputs: - fromindex: [0, 0, 0, 0, 0] - lencontent: 1 - lenindex: 5 - outputs: - tocarry: [0, 0, 0, 0, 0] - - error: false - inputs: - fromindex: [0, 0, 0] - lencontent: 1 - lenindex: 3 - outputs: - tocarry: [0, 0, 0] - - error: false - inputs: - fromindex: [0, 0] - lencontent: 1 - lenindex: 2 - outputs: - tocarry: [0, 0] - - error: false - inputs: - fromindex: [0, 0, 0, 1, 1, 1, 2, 2, 2] - lencontent: 3 - lenindex: 9 - outputs: - tocarry: [0, 0, 0, 1, 1, 1, 2, 2, 2] - - error: false - inputs: - fromindex: [0, 0, 0, 2, 3, 3, 4] - lencontent: 5 - lenindex: 7 - outputs: - tocarry: [0, 0, 0, 2, 3, 3, 4] - - error: false - inputs: - fromindex: [0, 1] - lencontent: 2 - lenindex: 2 - outputs: - tocarry: [0, 1] + tocarry: [0, 1] - error: false inputs: fromindex: [0, 1, 2] @@ -1777,20 +1015,6 @@ unit-tests: outputs: tocarry: [3, 2, 1, 0] toindex: [0, 1, 2, 3] -- name: awkward_IndexedArray_mask - tests: - - error: false - inputs: - fromindex: [3, 2, 1, 0] - length: 4 - outputs: - tomask: [0, 0, 0, 0] - - error: false - inputs: - fromindex: [0, 1] - length: 2 - outputs: - tomask: [0, 0] - name: awkward_IndexedArray_numnull tests: - error: false @@ -3316,16015 +2540,9090 @@ unit-tests: outputs: tooffsets: [0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, 112, 119, 126, 133, 140, 147, 154, 161, 168, 175, 182, 189, 196, 203, 210] -- name: awkward_ListArray_getitem_carry +- name: awkward_RegularArray_localindex tests: - error: false - inputs: - fromcarry: [1, 3, 4] - fromstarts: [0, 0, 0, 0, 0] - fromstops: [0, 0, 0, 0, 0] - lencarry: 3 - lenstarts: 5 + inputs: {length: 2, size: 3} outputs: - tostarts: [0, 0, 0] - tostops: [0, 0, 0] + toindex: [0, 1, 2, 0, 1, 2] - error: false - inputs: - fromcarry: [3] - fromstarts: [0, 0, 0, 0, 0] - fromstops: [0, 0, 0, 0, 0] - lencarry: 1 - lenstarts: 5 + inputs: {length: 6, size: 5} outputs: - tostarts: [0] - tostops: [0] - - error: false - inputs: - fromcarry: [0, 0, 0, 2, 3, 3, 4] - fromstarts: [0, 0, 0, 0, 0] - fromstops: [3, 3, 3, 3, 3] - lencarry: 7 - lenstarts: 5 - outputs: - tostarts: [0, 0, 0, 0, 0, 0, 0] - tostops: [3, 3, 3, 3, 3, 3, 3] + toindex: [0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, + 2, 3, 4, 0, 1, 2, 3, 4] +- name: awkward_RegularArray_num + tests: - error: false - inputs: - fromcarry: [0, 0, 0, 0, 0, 0, 0] - fromstarts: [0] - fromstops: [3] - lencarry: 7 - lenstarts: 1 + inputs: {length: 15, size: 2} outputs: - tostarts: [0, 0, 0, 0, 0, 0, 0] - tostops: [3, 3, 3, 3, 3, 3, 3] + tonum: [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] - error: false - inputs: - fromcarry: [0, 0, 0, 0, 0, 0] - fromstarts: [0] - fromstops: [3] - lencarry: 6 - lenstarts: 1 + inputs: {length: 21, size: 2} outputs: - tostarts: [0, 0, 0, 0, 0, 0] - tostops: [3, 3, 3, 3, 3, 3] + tonum: [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] - error: false - inputs: - fromcarry: [0, 0, 1, 1, 2, 2, 3, 3, 4, 4] - fromstarts: [0, 0, 0, 4, 4] - fromstops: [2, 2, 2, 5, 5] - lencarry: 10 - lenstarts: 5 + inputs: {length: 2, size: 3} outputs: - tostarts: [0, 0, 0, 0, 0, 0, 4, 4, 4, 4] - tostops: [2, 2, 2, 2, 2, 2, 5, 5, 5, 5] + tonum: [3, 3] - error: false - inputs: - fromcarry: [0, 1, 3, 4, 5] - fromstarts: [0, 0, 0, 0, 0, 0, 0] - fromstops: [3, 3, 3, 3, 3, 3, 3] - lencarry: 5 - lenstarts: 7 + inputs: {length: 7, size: 3} outputs: - tostarts: [0, 0, 0, 0, 0] - tostops: [3, 3, 3, 3, 3] + tonum: [3, 3, 3, 3, 3, 3, 3] - error: false - inputs: - fromcarry: [0, 1, 3, 4, 5] - fromstarts: [0, 0, 0, 0, 0, 0] - fromstops: [3, 3, 3, 3, 3, 3] - lencarry: 5 - lenstarts: 6 + inputs: {length: 5, size: 3} outputs: - tostarts: [0, 0, 0, 0, 0] - tostops: [3, 3, 3, 3, 3] + tonum: [3, 3, 3, 3, 3] - error: false - inputs: - fromcarry: [0, 0, 0, 0, 0] - fromstarts: [0] - fromstops: [3] - lencarry: 5 - lenstarts: 1 + inputs: {length: 3, size: 5} outputs: - tostarts: [0, 0, 0, 0, 0] - tostops: [3, 3, 3, 3, 3] + tonum: [5, 5, 5] - error: false - inputs: - fromcarry: [0, 0, 0, 0] - fromstarts: [0, 3] - fromstops: [3, 6] - lencarry: 4 - lenstarts: 2 + inputs: {length: 6, size: 5} outputs: - tostarts: [0, 0, 0, 0] - tostops: [3, 3, 3, 3] + tonum: [5, 5, 5, 5, 5, 5] - error: false - inputs: - fromcarry: [0, 0, 0, 2, 2] - fromstarts: [0, 2, 3] - fromstops: [2, 3, 5] - lencarry: 5 - lenstarts: 3 + inputs: {length: 30, size: 7} outputs: - tostarts: [0, 0, 0, 3, 3] - tostops: [2, 2, 2, 5, 5] + tonum: [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7] +- name: awkward_RegularArray_rpad_and_clip_axis1 + tests: - error: false - inputs: - fromcarry: [0, 0, 0] - fromstarts: [0] - fromstops: [3] - lencarry: 3 - lenstarts: 1 + inputs: {length: 3, size: 2, target: 2} outputs: - tostarts: [0, 0, 0] - tostops: [3, 3, 3] + toindex: [0, 1, 2, 3, 4, 5] - error: false - inputs: - fromcarry: [0, 0, 0, 2, 2, 3, 3, 3, 5, 5] - fromstarts: [0, 2, 3, 5, 7, 8] - fromstops: [2, 3, 5, 7, 8, 10] - lencarry: 10 - lenstarts: 6 + inputs: {length: 2, size: 3, target: 3} outputs: - tostarts: [0, 0, 0, 3, 3, 5, 5, 5, 8, 8] - tostops: [2, 2, 2, 5, 5, 7, 7, 7, 10, 10] + toindex: [0, 1, 2, 3, 4, 5] - error: false - inputs: - fromcarry: [0, 0, 0, 2, 2] - fromstarts: [0, 2, 4] - fromstops: [2, 4, 5] - lencarry: 5 - lenstarts: 3 + inputs: {length: 3, size: 3, target: 3} outputs: - tostarts: [0, 0, 0, 4, 4] - tostops: [2, 2, 2, 5, 5] + toindex: [0, 1, 2, 3, 4, 5, 6, 7, 8] - error: false - inputs: - fromcarry: [0, 0, 0, 2, 3, 3, 4] - fromstarts: [0, 5, 8, 11, 14] - fromstops: [5, 8, 11, 14, 19] - lencarry: 7 - lenstarts: 5 + inputs: {length: 3, size: 3, target: 2} outputs: - tostarts: [0, 0, 0, 8, 11, 11, 14] - tostops: [5, 5, 5, 11, 14, 14, 19] + toindex: [0, 1, 3, 4, 6, 7] - error: false - inputs: - fromcarry: [0, 0, 1, 1, 1, 0] - fromstarts: [0, 2, 3, 3] - fromstops: [2, 3, 3, 5] - lencarry: 6 - lenstarts: 4 + inputs: {length: 6, size: 5, target: 2} outputs: - tostarts: [0, 0, 2, 2, 2, 0] - tostops: [2, 2, 3, 3, 3, 2] + toindex: [0, 1, 5, 6, 10, 11, 15, 16, 20, 21, 25, 26] - error: false - inputs: - fromcarry: [0, 0, 1, 5] - fromstarts: [0, 3, 3, 5, 6, 10, 10] - fromstops: [3, 3, 5, 6, 10, 10, 13] - lencarry: 4 - lenstarts: 7 + inputs: {length: 3, size: 2, target: 1} outputs: - tostarts: [0, 0, 3, 10] - tostops: [3, 3, 3, 10] + toindex: [0, 2, 4] - error: false - inputs: - fromcarry: [0, 0] - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - lencarry: 2 - lenstarts: 3 + inputs: {length: 3, size: 3, target: 1} outputs: - tostarts: [0, 0] - tostops: [3, 3] + toindex: [0, 3, 6] +- name: awkward_RegularArray_compact_offsets + tests: - error: false - inputs: - fromcarry: [0, 0, 1, 3] - fromstarts: [0, 4, 4, 7, 8] - fromstops: [4, 4, 7, 8, 13] - lencarry: 4 - lenstarts: 5 + inputs: {length: 1, size: 1} outputs: - tostarts: [0, 0, 4, 7] - tostops: [4, 4, 4, 8] + tooffsets: [0, 1] - error: false - inputs: - fromcarry: [1] - fromstarts: [0, 0, 1] - fromstops: [0, 1, 1] - lencarry: 1 - lenstarts: 3 + inputs: {length: 2, size: 1} outputs: - tostarts: [0] - tostops: [1] + tooffsets: [0, 1, 2] - error: false - inputs: - fromcarry: [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 4, 4, 4, 4] - fromstarts: [0, 1, 2, 3, 4] - fromstops: [1, 2, 3, 4, 5] - lencarry: 16 - lenstarts: 5 + inputs: {length: 3, size: 1} outputs: - tostarts: [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 4, 4, 4, 4] - tostops: [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 5, 5, 5, 5] + tooffsets: [0, 1, 2, 3] - error: false - inputs: - fromcarry: [0, 2, 3, 5] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 4 - lenstarts: 6 + inputs: {length: 6, size: 1} outputs: - tostarts: [0, 10, 15, 25] - tostops: [5, 15, 20, 30] + tooffsets: [0, 1, 2, 3, 4, 5, 6] - error: false - inputs: - fromcarry: [0, 2, 4] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 3 - lenstarts: 6 + inputs: {length: 3, size: 2} outputs: - tostarts: [0, 10, 20] - tostops: [5, 15, 25] + tooffsets: [0, 2, 4, 6] - error: false - inputs: - fromcarry: [0, 2, 4, 1, 3, 5] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 6 - lenstarts: 6 + inputs: {length: 1, size: 3} outputs: - tostarts: [0, 10, 20, 5, 15, 25] - tostops: [5, 15, 25, 10, 20, 30] + tooffsets: [0, 3] - error: false - inputs: - fromcarry: [0, 2] - fromstarts: [0, 1, 1, 1, 1] - fromstops: [1, 1, 1, 1, 4] - lencarry: 2 - lenstarts: 5 + inputs: {length: 2, size: 3} outputs: - tostarts: [0, 1] - tostops: [1, 1] + tooffsets: [0, 3, 6] - error: false - inputs: - fromcarry: [0, 3] - fromstarts: [0, 1, 1, 1, 1] - fromstops: [1, 1, 1, 1, 4] - lencarry: 2 - lenstarts: 5 + inputs: {length: 1, size: 4} outputs: - tostarts: [0, 1] - tostops: [1, 1] + tooffsets: [0, 4] - error: false - inputs: - fromcarry: [0, 2, 4] - fromstarts: [0, 1, 1, 1, 1] - fromstops: [1, 1, 1, 1, 4] - lencarry: 3 - lenstarts: 5 + inputs: {length: 6, size: 5} outputs: - tostarts: [0, 1, 1] - tostops: [1, 1, 4] + tooffsets: [0, 5, 10, 15, 20, 25, 30] - error: false - inputs: - fromcarry: [1, 2] - fromstarts: [0, 0, 1] - fromstops: [0, 1, 2] - lencarry: 2 - lenstarts: 3 + inputs: {length: 4, size: 5} outputs: - tostarts: [0, 1] - tostops: [1, 2] + tooffsets: [0, 5, 10, 15, 20] - error: false - inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - fromstarts: [0, 5, 6, 11, 16, 17] - fromstops: [5, 6, 11, 16, 17, 22] - lencarry: 6 - lenstarts: 6 + inputs: {length: 1, size: 5} outputs: - tostarts: [0, 11, 5, 16, 6, 17] - tostops: [5, 16, 6, 17, 11, 22] + tooffsets: [0, 5] - error: false - inputs: - fromcarry: [1, 2, 4, 7, 8] - fromstarts: [0, 0, 1, 2, 2, 3, 3, 3, 4, 5] - fromstops: [0, 1, 2, 2, 3, 3, 3, 4, 5, 5] - lencarry: 5 - lenstarts: 10 + inputs: {length: 30, size: 7} outputs: - tostarts: [0, 1, 2, 3, 4] - tostops: [1, 2, 3, 4, 5] + tooffsets: [0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, 112, + 119, 126, 133, 140, 147, 154, 161, 168, 175, 182, 189, 196, 203, 210] +- name: awkward_RegularArray_getitem_carry + tests: - error: false inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - fromstarts: [0, 3, 8, 13, 18, 23] - fromstops: [3, 8, 13, 18, 23, 28] - lencarry: 6 - lenstarts: 6 + fromcarry: [0, 0] + lencarry: 2 + size: 1 outputs: - tostarts: [0, 13, 3, 18, 8, 23] - tostops: [3, 18, 8, 23, 13, 28] + tocarry: [0, 0] - error: false inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - fromstarts: [0, 4, 8, 13, 18, 23] - fromstops: [4, 8, 13, 18, 23, 28] + fromcarry: [0, 0, 0, 1, 1, 1] lencarry: 6 - lenstarts: 6 + size: 1 outputs: - tostarts: [0, 13, 4, 18, 8, 23] - tostops: [4, 18, 8, 23, 13, 28] + tocarry: [0, 0, 0, 1, 1, 1] - error: false inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - fromstarts: [0, 4, 9, 14, 19, 24] - fromstops: [4, 9, 14, 19, 24, 29] - lencarry: 6 - lenstarts: 6 + fromcarry: [0, 0, 0, 2, 2] + lencarry: 5 + size: 1 outputs: - tostarts: [0, 14, 4, 19, 9, 24] - tostops: [4, 19, 9, 24, 14, 29] + tocarry: [0, 0, 0, 2, 2] - error: false inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - fromstarts: [0, 5, 10, 14, 19, 24] - fromstops: [5, 10, 14, 19, 24, 28] - lencarry: 6 - lenstarts: 6 + fromcarry: [0, 0, 1, 1, 2, 2, 3, 3, 4, 4] + lencarry: 10 + size: 1 outputs: - tostarts: [0, 14, 5, 19, 10, 24] - tostops: [5, 19, 10, 24, 14, 28] + tocarry: [0, 0, 1, 1, 2, 2, 3, 3, 4, 4] - error: false inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - fromstarts: [0, 5, 9, 14, 19, 23] - fromstops: [5, 9, 14, 19, 23, 28] - lencarry: 6 - lenstarts: 6 + fromcarry: [0, 1, 0, 1, 0, 1, 3, 4, 3, 4] + lencarry: 10 + size: 1 outputs: - tostarts: [0, 14, 5, 19, 9, 23] - tostops: [5, 19, 9, 23, 14, 28] + tocarry: [0, 1, 0, 1, 0, 1, 3, 4, 3, 4] - error: false inputs: - fromcarry: [0, 1, 4, 5] - fromstarts: [0, 15, 5, 20, 10, 25] - fromstops: [5, 20, 10, 25, 15, 30] + fromcarry: [0, 0, 1, 1] lencarry: 4 - lenstarts: 6 + size: 2 outputs: - tostarts: [0, 15, 10, 25] - tostops: [5, 20, 15, 30] + tocarry: [0, 1, 0, 1, 2, 3, 2, 3] - error: false inputs: - fromcarry: [0, 3, 3, 3] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] + fromcarry: [0, 0, 0, 0] lencarry: 4 - lenstarts: 6 + size: 3 outputs: - tostarts: [0, 15, 15, 15] - tostops: [5, 20, 20, 20] + tocarry: [0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2] - error: false inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - fromstarts: [0, 5, 10, 15, 20, 24] - fromstops: [5, 10, 15, 20, 24, 28] - lencarry: 6 - lenstarts: 6 + fromcarry: [0, 1, 1, 2] + lencarry: 4 + size: 2 outputs: - tostarts: [0, 15, 5, 20, 10, 24] - tostops: [5, 20, 10, 24, 15, 28] + tocarry: [0, 1, 2, 3, 2, 3, 4, 5] - error: false inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 28] - lencarry: 6 - lenstarts: 6 + fromcarry: [0, 0] + lencarry: 2 + size: 5 outputs: - tostarts: [0, 15, 5, 20, 10, 25] - tostops: [5, 20, 10, 25, 15, 28] + tocarry: [0, 1, 2, 3, 4, 0, 1, 2, 3, 4] - error: false inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 29] + fromcarry: [0, 0, 0, 1, 1, 1] lencarry: 6 - lenstarts: 6 + size: 5 outputs: - tostarts: [0, 15, 5, 20, 10, 25] - tostops: [5, 20, 10, 25, 15, 29] + tocarry: [0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 6, + 7, 8, 9, 5, 6, 7, 8, 9] - error: false inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 6 - lenstarts: 6 + fromcarry: [0, 2, 3, 5] + lencarry: 4 + size: 5 outputs: - tostarts: [0, 15, 5, 20, 10, 25] - tostops: [5, 20, 10, 25, 15, 30] + tocarry: [0, 1, 2, 3, 4, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 25, 26, 27, + 28, 29] - error: false inputs: - fromcarry: [0, 5, 2, 6, 1, 3, 4] - fromstarts: [0, 3, 6, 11, 14, 17, 20] - fromstops: [3, 6, 11, 14, 17, 20, 25] - lencarry: 7 - lenstarts: 7 + fromcarry: [0, 2, 4] + lencarry: 3 + size: 5 outputs: - tostarts: [0, 17, 6, 20, 3, 11, 14] - tostops: [3, 20, 11, 25, 6, 14, 17] + tocarry: [0, 1, 2, 3, 4, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24] - error: false inputs: - fromcarry: [1, 2] - fromstarts: [0, 0, 2] - fromstops: [0, 2, 5] - lencarry: 2 - lenstarts: 3 + fromcarry: [0, 3, 6, 9] + lencarry: 4 + size: 5 outputs: - tostarts: [0, 2] - tostops: [2, 5] + tocarry: [0, 1, 2, 3, 4, 15, 16, 17, 18, 19, 30, 31, 32, 33, 34, 45, 46, 47, + 48, 49] - error: false inputs: - fromcarry: [0, 1, 3, 4, 5, 8] - fromstarts: [0, 2, 3, 4, 5, 6, 7, 8, 9] - fromstops: [2, 3, 4, 5, 6, 7, 8, 9, 11] + fromcarry: [0, 3, 1, 4, 2, 5] lencarry: 6 - lenstarts: 9 - outputs: - tostarts: [0, 2, 4, 5, 6, 9] - tostops: [2, 3, 5, 6, 7, 11] - - error: false - inputs: - fromcarry: [0, 1, 0, 1, 2, 2, 2, 0, 1] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 9] - lencarry: 9 - lenstarts: 5 + size: 5 outputs: - tostarts: [0, 3, 0, 3, 3, 3, 3, 0, 3] - tostops: [3, 3, 3, 3, 5, 5, 5, 3, 3] + tocarry: [0, 1, 2, 3, 4, 15, 16, 17, 18, 19, 5, 6, 7, 8, 9, 20, 21, 22, 23, + 24, 10, 11, 12, 13, 14, 25, 26, 27, 28, 29] - error: false inputs: - fromcarry: [0, 1, 0, 1, 2, 3, 2, 3] - fromstarts: [0, 3, 3, 5, 6, 10] - fromstops: [3, 3, 5, 6, 10, 10] - lencarry: 8 - lenstarts: 6 + fromcarry: [0, 4, 8, 10] + lencarry: 4 + size: 5 outputs: - tostarts: [0, 3, 0, 3, 3, 5, 3, 5] - tostops: [3, 3, 3, 3, 5, 6, 5, 6] + tocarry: [0, 1, 2, 3, 4, 20, 21, 22, 23, 24, 40, 41, 42, 43, 44, 50, 51, 52, + 53, 54] - error: false inputs: - fromcarry: [0, 1, 4, 6, 7] - fromstarts: [0, 3, 6, 6, 10, 14, 14, 18, 21] - fromstops: [3, 6, 6, 10, 14, 14, 18, 21, 21] - lencarry: 5 - lenstarts: 9 + fromcarry: [0, 1, 1, 1] + lencarry: 4 + size: 3 outputs: - tostarts: [0, 3, 10, 14, 18] - tostops: [3, 6, 14, 18, 21] + tocarry: [0, 1, 2, 3, 4, 5, 3, 4, 5, 3, 4, 5] - error: false inputs: - fromcarry: [0, 1, 4, 6, 7] - fromstarts: [0, 3, 6, 6, 10, 14, 14, 18] - fromstops: [3, 6, 6, 10, 14, 14, 18, 21] - lencarry: 5 - lenstarts: 8 + fromcarry: [0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2] + lencarry: 12 + size: 5 outputs: - tostarts: [0, 3, 10, 14, 18] - tostops: [3, 6, 14, 18, 21] + tocarry: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] - error: false inputs: - fromcarry: [0, 1, 3, 4, 5] - fromstarts: [0, 3, 6, 11, 14, 17, 20] - fromstops: [3, 6, 11, 14, 17, 20, 25] - lencarry: 5 - lenstarts: 7 + fromcarry: [0, 1, 2, 3, 4, 5, 3, 4, 5, 3, 4, 5] + lencarry: 12 + size: 5 outputs: - tostarts: [0, 3, 11, 14, 17] - tostops: [3, 6, 14, 17, 20] + tocarry: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29] - error: false inputs: - fromcarry: [0, 1, 3, 4, 5] - fromstarts: [0, 3, 6, 11, 14, 17] - fromstops: [3, 6, 11, 14, 17, 20] - lencarry: 5 - lenstarts: 6 + fromcarry: [2, 0, 0, 1] + lencarry: 4 + size: 5 outputs: - tostarts: [0, 3, 11, 14, 17] - tostops: [3, 6, 14, 17, 20] + tocarry: [10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - error: false inputs: - fromcarry: [0, 1, 4, 6, 7] - fromstarts: [0, 3, 6, 6, 11, 15, 15, 19, 22] - fromstops: [3, 6, 6, 11, 15, 15, 19, 22, 22] - lencarry: 5 - lenstarts: 9 + fromcarry: [2, 2, 2, 2] + lencarry: 4 + size: 5 outputs: - tostarts: [0, 3, 11, 15, 19] - tostops: [3, 6, 15, 19, 22] + tocarry: [10, 11, 12, 13, 14, 10, 11, 12, 13, 14, 10, 11, 12, 13, 14, 10, 11, + 12, 13, 14] - error: false inputs: - fromcarry: [0, 1, 4, 6, 7] - fromstarts: [0, 3, 6, 6, 11, 15, 15, 19] - fromstops: [3, 6, 6, 11, 15, 15, 19, 22] - lencarry: 5 - lenstarts: 8 + fromcarry: [2] + lencarry: 1 + size: 5 outputs: - tostarts: [0, 3, 11, 15, 19] - tostops: [3, 6, 15, 19, 22] + tocarry: [10, 11, 12, 13, 14] - error: false inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - fromstarts: [0, 2, 3, 3, 5, 6] - fromstops: [2, 3, 3, 5, 6, 6] - lencarry: 6 - lenstarts: 6 + fromcarry: [2, 5, 8, 11] + lencarry: 4 + size: 5 outputs: - tostarts: [0, 3, 2, 5, 3, 6] - tostops: [2, 5, 3, 6, 3, 6] + tocarry: [10, 11, 12, 13, 14, 25, 26, 27, 28, 29, 40, 41, 42, 43, 44, 55, 56, + 57, 58, 59] - error: false inputs: - fromcarry: [0, 2, 1, 0] - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - lencarry: 4 - lenstarts: 3 + fromcarry: [1] + lencarry: 1 + size: 1 outputs: - tostarts: [0, 3, 3, 0] - tostops: [3, 5, 3, 3] + tocarry: [1] - error: false inputs: - fromcarry: [0, 1, 2, 5, 6] - fromstarts: [0, 3, 3, 5, 6, 10, 10] - fromstops: [3, 3, 5, 6, 10, 10, 13] - lencarry: 5 - lenstarts: 7 + fromcarry: [3, 4, 5, 0, 1, 2, 0, 1, 2, 3, 4, 5] + lencarry: 12 + size: 5 outputs: - tostarts: [0, 3, 3, 10, 10] - tostops: [3, 3, 5, 10, 13] + tocarry: [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 0, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29] - error: false inputs: - fromcarry: [0, 1, 1, 1] - fromstarts: [0, 3] - fromstops: [3, 6] - lencarry: 4 - lenstarts: 2 + fromcarry: [3, 4, 5, 3, 4, 5, 3, 4, 5, 3, 4, 5] + lencarry: 12 + size: 5 outputs: - tostarts: [0, 3, 3, 3] - tostops: [3, 6, 6, 6] + tocarry: [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29] - error: false inputs: - fromcarry: [0, 2] - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - lencarry: 2 - lenstarts: 3 + fromcarry: [3, 4, 5] + lencarry: 3 + size: 5 outputs: - tostarts: [0, 3] - tostops: [3, 5] + tocarry: [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] - error: false inputs: - fromcarry: [0, 3, 4, 7] - fromstarts: [0, 3, 0, 3, 3, 5, 3, 5] - fromstops: [3, 3, 3, 3, 5, 6, 5, 6] + fromcarry: [4, 4, 4, 4] lencarry: 4 - lenstarts: 8 + size: 5 outputs: - tostarts: [0, 3, 3, 5] - tostops: [3, 3, 5, 6] + tocarry: [20, 21, 22, 23, 24, 20, 21, 22, 23, 24, 20, 21, 22, 23, 24, 20, 21, + 22, 23, 24] - error: false inputs: - fromcarry: [0, 1, 2, 3, 2, 3, 4, 5] - fromstarts: [0, 3, 3, 5, 6, 10] - fromstops: [3, 3, 5, 6, 10, 10] - lencarry: 8 - lenstarts: 6 + fromcarry: [4] + lencarry: 1 + size: 5 outputs: - tostarts: [0, 3, 3, 5, 3, 5, 6, 10] - tostops: [3, 3, 5, 6, 5, 6, 10, 10] + tocarry: [20, 21, 22, 23, 24] - error: false inputs: - fromcarry: [0, 2, 3, 5, 7] - fromstarts: [0, 2, 3, 3, 5, 5, 6, 8] - fromstops: [2, 3, 3, 5, 5, 6, 8, 9] - lencarry: 5 - lenstarts: 8 + fromcarry: [2] + lencarry: 1 + size: 1 outputs: - tostarts: [0, 3, 3, 5, 8] - tostops: [2, 3, 5, 6, 9] + tocarry: [2] - error: false inputs: - fromcarry: [0, 2] - fromstarts: [0, 3, 3] - fromstops: [3, 3, 7] + fromcarry: [1, 0] lencarry: 2 - lenstarts: 3 + size: 2 outputs: - tostarts: [0, 3] - tostops: [3, 7] + tocarry: [2, 3, 0, 1] - error: false inputs: - fromcarry: [0, 1, 4] - fromstarts: [0, 3, 3, 4, 5] - fromstops: [3, 3, 4, 5, 7] - lencarry: 3 - lenstarts: 5 + fromcarry: [1] + lencarry: 1 + size: 2 outputs: - tostarts: [0, 3, 5] - tostops: [3, 3, 7] + tocarry: [2, 3] - error: false inputs: - fromcarry: [0, 1, 3] - fromstarts: [0, 3, 3, 5] - fromstops: [3, 3, 5, 9] - lencarry: 3 - lenstarts: 4 + fromcarry: [1, 1, 0, 0] + lencarry: 4 + size: 2 outputs: - tostarts: [0, 3, 5] - tostops: [3, 3, 9] + tocarry: [2, 3, 2, 3, 0, 1, 0, 1] - error: false inputs: - fromcarry: [0, 1, 3, 4, 6, 7] - fromstarts: [0, 3, 6, 6, 11, 15, 15, 19, 22] - fromstops: [3, 6, 6, 11, 15, 15, 19, 22, 22] - lencarry: 6 - lenstarts: 9 + fromcarry: [1, 2] + lencarry: 2 + size: 2 outputs: - tostarts: [0, 3, 6, 11, 15, 19] - tostops: [3, 6, 11, 15, 19, 22] + tocarry: [2, 3, 4, 5] - error: false inputs: - fromcarry: [0, 1, 3, 4, 6, 7] - fromstarts: [0, 3, 6, 6, 11, 15, 15, 19] - fromstops: [3, 6, 6, 11, 15, 15, 19, 22] - lencarry: 6 - lenstarts: 8 + fromcarry: [1, 0, 0, 1] + lencarry: 4 + size: 3 outputs: - tostarts: [0, 3, 6, 11, 15, 19] - tostops: [3, 6, 11, 15, 19, 22] + tocarry: [3, 4, 5, 0, 1, 2, 0, 1, 2, 3, 4, 5] - error: false inputs: - fromcarry: [0, 1, 2, 4, 3] - fromstarts: [0, 3, 6, 11, 15] - fromstops: [3, 6, 11, 15, 19] - lencarry: 5 - lenstarts: 5 + fromcarry: [1] + lencarry: 1 + size: 3 outputs: - tostarts: [0, 3, 6, 15, 11] - tostops: [3, 6, 11, 19, 15] + tocarry: [3, 4, 5] - error: false inputs: - fromcarry: [0, 1, 4] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 10] - lencarry: 3 - lenstarts: 5 + fromcarry: [1, 1, 1, 1] + lencarry: 4 + size: 3 outputs: - tostarts: [0, 3, 6] - tostops: [3, 3, 10] + tocarry: [3, 4, 5, 3, 4, 5, 3, 4, 5, 3, 4, 5] - error: false inputs: - fromcarry: [1, 3, 4, 6, 7] - fromstarts: [0, 0, 3, 3, 8, 12, 12, 16] - fromstops: [0, 3, 3, 8, 12, 12, 16, 19] - lencarry: 5 - lenstarts: 8 + fromcarry: [2] + lencarry: 1 + size: 2 outputs: - tostarts: [0, 3, 8, 12, 16] - tostops: [3, 8, 12, 16, 19] + tocarry: [4, 5] - error: false inputs: - fromcarry: [1, 3, 4, 6, 7] - fromstarts: [0, 0, 3, 3, 8, 12, 12, 16, 19] - fromstops: [0, 3, 3, 8, 12, 12, 16, 19, 19] - lencarry: 5 - lenstarts: 9 + fromcarry: [1, 2] + lencarry: 2 + size: 4 outputs: - tostarts: [0, 3, 8, 12, 16] - tostops: [3, 8, 12, 16, 19] + tocarry: [4, 5, 6, 7, 8, 9, 10, 11] - error: false inputs: - fromcarry: [0, 1, 3, 4, 6, 7] - fromstarts: [0, 3, 6, 8, 13, 17, 17, 21, 24] - fromstops: [3, 6, 8, 13, 17, 17, 21, 24, 24] - lencarry: 6 - lenstarts: 9 + fromcarry: [1, 2] + lencarry: 2 + size: 5 outputs: - tostarts: [0, 3, 8, 13, 17, 21] - tostops: [3, 6, 13, 17, 21, 24] + tocarry: [5, 6, 7, 8, 9, 10, 11, 12, 13, 14] - error: false inputs: - fromcarry: [0, 1, 3, 4, 6, 7] - fromstarts: [0, 3, 6, 8, 13, 17, 17, 21] - fromstops: [3, 6, 8, 13, 17, 17, 21, 24] - lencarry: 6 - lenstarts: 8 + fromcarry: [1, 2, 3, 4, 5] + lencarry: 5 + size: 5 outputs: - tostarts: [0, 3, 8, 13, 17, 21] - tostops: [3, 6, 13, 17, 21, 24] + tocarry: [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29] - error: false inputs: - fromcarry: [0, 2, 3, 5, 7] - fromstarts: [0, 3, 4, 4, 6, 6, 7, 9] - fromstops: [3, 4, 4, 6, 6, 7, 9, 11] - lencarry: 5 - lenstarts: 8 + fromcarry: [1] + lencarry: 1 + size: 5 outputs: - tostarts: [0, 4, 4, 6, 9] - tostops: [3, 4, 6, 7, 11] + tocarry: [5, 6, 7, 8, 9] - error: false inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - fromstarts: [0, 5, 10, 45, 50, 55] - fromstops: [5, 10, 15, 50, 55, 60] - lencarry: 6 - lenstarts: 6 + fromcarry: [1, 3, 6, 10] + lencarry: 4 + size: 5 outputs: - tostarts: [0, 45, 5, 50, 10, 55] - tostops: [5, 50, 10, 55, 15, 60] + tocarry: [5, 6, 7, 8, 9, 15, 16, 17, 18, 19, 30, 31, 32, 33, 34, 50, 51, 52, + 53, 54] - error: false inputs: - fromcarry: [0, 2, 4, 1, 3, 5] - fromstarts: [0, 3, 4, 6, 6, 7] - fromstops: [3, 4, 6, 6, 7, 9] - lencarry: 6 - lenstarts: 6 + fromcarry: [1, 4, 0, 5] + lencarry: 4 + size: 5 outputs: - tostarts: [0, 4, 6, 3, 6, 7] - tostops: [3, 6, 7, 4, 6, 9] + tocarry: [5, 6, 7, 8, 9, 20, 21, 22, 23, 24, 0, 1, 2, 3, 4, 25, 26, 27, 28, + 29] - error: false inputs: - fromcarry: [0, 2, 3, 1, 4] - fromstarts: [0, 3, 4, 6, 7] - fromstops: [3, 4, 6, 7, 9] - lencarry: 5 - lenstarts: 5 + fromcarry: [2, 1, 1, 2] + lencarry: 4 + size: 4 outputs: - tostarts: [0, 4, 6, 3, 7] - tostops: [3, 6, 7, 4, 9] + tocarry: [8, 9, 10, 11, 4, 5, 6, 7, 4, 5, 6, 7, 8, 9, 10, 11] +- name: awkward_RegularArray_getitem_jagged_expand + tests: - error: false inputs: - fromcarry: [0, 1, 2, 4, 3] - fromstarts: [0, 4, 7, 10, 15] - fromstops: [4, 7, 10, 15, 19] - lencarry: 5 - lenstarts: 5 + regularlength: 1 + regularsize: 4 + singleoffsets: [0, 0, 0, 0, 0] outputs: - tostarts: [0, 4, 7, 15, 10] - tostops: [4, 7, 10, 19, 15] + multistarts: [0, 0, 0, 0] + multistops: [0, 0, 0, 0] - error: false inputs: - fromcarry: [0, 1, 2, 1] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 4 - lenstarts: 6 + regularlength: 1 + regularsize: 3 + singleoffsets: [0, 0, 0, 0] outputs: - tostarts: [0, 5, 10, 5] - tostops: [5, 10, 15, 10] + multistarts: [0, 0, 0] + multistops: [0, 0, 0] - error: false inputs: - fromcarry: [0, 3, 1, 3, 2] - fromstarts: [0, 3, 3, 5] - fromstops: [3, 3, 5, 5] - lencarry: 5 - lenstarts: 4 + regularlength: 1 + regularsize: 4 + singleoffsets: [0, 0, 1, 1, 1] outputs: - tostarts: [0, 5, 3, 5, 3] - tostops: [3, 5, 3, 5, 5] + multistarts: [0, 0, 1, 1] + multistops: [0, 1, 1, 1] - error: false inputs: - fromcarry: [0, 3, 1, 3, 2] - fromstarts: [0, 3, 3, 5] - fromstops: [3, 3, 5, 8] - lencarry: 5 - lenstarts: 4 + regularlength: 1 + regularsize: 3 + singleoffsets: [0, 1, 1, 3] outputs: - tostarts: [0, 5, 3, 5, 3] - tostops: [3, 8, 3, 8, 5] + multistarts: [0, 1, 1] + multistops: [1, 1, 3] - error: false inputs: - fromcarry: [0, 3] - fromstarts: [0, 3, 3, 5] - fromstops: [3, 3, 5, 9] - lencarry: 2 - lenstarts: 4 + regularlength: 1 + regularsize: 5 + singleoffsets: [0, 1, 1, 3, 3, 5] outputs: - tostarts: [0, 5] - tostops: [3, 9] + multistarts: [0, 1, 1, 3, 3] + multistops: [1, 1, 3, 3, 5] - error: false inputs: - fromcarry: [0, 2, 3] - fromstarts: [0, 3, 5, 6] - fromstops: [3, 5, 6, 10] - lencarry: 3 - lenstarts: 4 + regularlength: 1 + regularsize: 5 + singleoffsets: [0, 2, 2, 2, 2, 6] outputs: - tostarts: [0, 5, 6] - tostops: [3, 6, 10] + multistarts: [0, 2, 2, 2, 2] + multistops: [2, 2, 2, 2, 6] - error: false inputs: - fromcarry: [0, 2, 4] - fromstarts: [0, 3, 6, 11, 15] - fromstops: [3, 6, 11, 15, 19] - lencarry: 3 - lenstarts: 5 + regularlength: 1 + regularsize: 3 + singleoffsets: [0, 2, 2, 3] outputs: - tostarts: [0, 6, 15] - tostops: [3, 11, 19] + multistarts: [0, 2, 2] + multistops: [2, 2, 3] - error: false inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - fromstarts: [0, 2, 4, 6, 8, 10] - fromstops: [2, 4, 6, 8, 10, 12] - lencarry: 6 - lenstarts: 6 + regularlength: 1 + regularsize: 3 + singleoffsets: [0, 2, 2, 4] outputs: - tostarts: [0, 6, 2, 8, 4, 10] - tostops: [2, 8, 4, 10, 6, 12] + multistarts: [0, 2, 2] + multistops: [2, 2, 4] - error: false inputs: - fromcarry: [0, 4, 1, 5, 2, 3] - fromstarts: [0, 3, 3, 5, 6, 8] - fromstops: [3, 3, 5, 6, 8, 9] - lencarry: 6 - lenstarts: 6 + regularlength: 1 + regularsize: 2 + singleoffsets: [0, 2, 4] outputs: - tostarts: [0, 6, 3, 8, 3, 5] - tostops: [3, 8, 3, 9, 5, 6] + multistarts: [0, 2] + multistops: [2, 4] - error: false inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - fromstarts: [0, 3, 5, 6, 8, 9] - fromstops: [3, 5, 6, 8, 9, 10] - lencarry: 6 - lenstarts: 6 + regularlength: 1 + regularsize: 7 + singleoffsets: [0, 2, 2, 4, 4, 5, 5, 8] outputs: - tostarts: [0, 6, 3, 8, 5, 9] - tostops: [3, 8, 5, 9, 6, 10] + multistarts: [0, 2, 2, 4, 4, 5, 5] + multistops: [2, 2, 4, 4, 5, 5, 8] - error: false inputs: - fromcarry: [2, 3, 4, 5, 6] - fromstarts: [0, 0, 0, 8, 11, 11, 14] - fromstops: [5, 5, 5, 11, 14, 14, 19] - lencarry: 5 - lenstarts: 7 + regularlength: 1 + regularsize: 5 + singleoffsets: [0, 2, 2, 4, 5, 6] outputs: - tostarts: [0, 8, 11, 11, 14] - tostops: [5, 11, 14, 14, 19] + multistarts: [0, 2, 2, 4, 5] + multistops: [2, 2, 4, 5, 6] - error: false inputs: - fromcarry: [2, 0, 0, 1] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 4 - lenstarts: 6 + regularlength: 1 + regularsize: 5 + singleoffsets: [0, 2, 2, 4, 5, 8] outputs: - tostarts: [10, 0, 0, 5] - tostops: [15, 5, 5, 10] + multistarts: [0, 2, 2, 4, 5] + multistops: [2, 2, 4, 5, 8] - error: false inputs: - fromcarry: [2, 2, 2, 2] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 4 - lenstarts: 6 + regularlength: 1 + regularsize: 5 + singleoffsets: [0, 2, 2, 4, 5, 9] outputs: - tostarts: [10, 10, 10, 10] - tostops: [15, 15, 15, 15] + multistarts: [0, 2, 2, 4, 5] + multistops: [2, 2, 4, 5, 9] - error: false inputs: - fromcarry: [1] - fromstarts: [6, 10] - fromstops: [10, 10] - lencarry: 1 - lenstarts: 2 + regularlength: 1 + regularsize: 3 + singleoffsets: [0, 2, 3, 4] outputs: - tostarts: [10] - tostops: [10] + multistarts: [0, 2, 3] + multistops: [2, 3, 4] - error: false inputs: - fromcarry: [3, 0] - fromstarts: [0, 1, 1, 1, 1] - fromstops: [1, 1, 1, 1, 4] - lencarry: 2 - lenstarts: 5 + regularlength: 1 + regularsize: 4 + singleoffsets: [0, 2, 3, 3, 5] outputs: - tostarts: [1, 0] - tostops: [1, 1] + multistarts: [0, 2, 3, 3] + multistops: [2, 3, 3, 5] - error: false inputs: - fromcarry: [2] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 1 - lenstarts: 6 + regularlength: 1 + regularsize: 4 + singleoffsets: [0, 2, 3, 4, 7] outputs: - tostarts: [10] - tostops: [15] + multistarts: [0, 2, 3, 4] + multistops: [2, 3, 4, 7] - error: false inputs: - fromcarry: [2, 5, 5, 5] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 4 - lenstarts: 6 + regularlength: 1 + regularsize: 3 + singleoffsets: [0, 2, 5, 7] outputs: - tostarts: [10, 25, 25, 25] - tostops: [15, 30, 30, 30] + multistarts: [0, 2, 5] + multistops: [2, 5, 7] - error: false inputs: - fromcarry: [1, 0] - fromstarts: [0, 1] - fromstops: [2, 3] - lencarry: 2 - lenstarts: 2 + regularlength: 1 + regularsize: 3 + singleoffsets: [0, 2, 6, 8] outputs: - tostarts: [1, 0] - tostops: [3, 2] + multistarts: [0, 2, 6] + multistops: [2, 6, 8] - error: false inputs: - fromcarry: [2, 1, 0, 5, 4, 3] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 6 - lenstarts: 6 + regularlength: 2 + regularsize: 2 + singleoffsets: [0, 3, 4] outputs: - tostarts: [10, 5, 0, 25, 20, 15] - tostops: [15, 10, 5, 30, 25, 20] + multistarts: [0, 3, 0, 3] + multistops: [3, 4, 3, 4] - error: false inputs: - fromcarry: [1] - fromstarts: [0, 1, 1, 1, 1] - fromstops: [1, 1, 1, 1, 4] - lencarry: 1 - lenstarts: 5 + regularlength: 1 + regularsize: 3 + singleoffsets: [0, 3, 3, 4] outputs: - tostarts: [1] - tostops: [1] + multistarts: [0, 3, 3] + multistops: [3, 3, 4] - error: false inputs: - fromcarry: [2] - fromstarts: [0, 1, 1, 1, 1] - fromstops: [1, 1, 1, 1, 4] - lencarry: 1 - lenstarts: 5 + regularlength: 1 + regularsize: 3 + singleoffsets: [0, 3, 3, 5] outputs: - tostarts: [1] - tostops: [1] + multistarts: [0, 3, 3] + multistops: [3, 3, 5] - error: false inputs: - fromcarry: [4, 2, 0] - fromstarts: [0, 1, 1, 1, 1] - fromstops: [1, 1, 1, 1, 4] - lencarry: 3 - lenstarts: 5 + regularlength: 1 + regularsize: 5 + singleoffsets: [0, 3, 3, 3, 4, 7] outputs: - tostarts: [1, 1, 0] - tostops: [4, 1, 1] + multistarts: [0, 3, 3, 3, 4] + multistops: [3, 3, 3, 4, 7] - error: false inputs: - fromcarry: [3, 2, 1, 0] - fromstarts: [0, 1, 1, 1, 1] - fromstops: [1, 1, 1, 1, 4] - lencarry: 4 - lenstarts: 5 + regularlength: 1 + regularsize: 2 + singleoffsets: [0, 3, 4] outputs: - tostarts: [1, 1, 1, 0] - tostops: [1, 1, 1, 1] + multistarts: [0, 3] + multistops: [3, 4] - error: false inputs: - fromcarry: [1, 3] - fromstarts: [0, 1, 1, 1, 1] - fromstops: [1, 1, 1, 1, 4] - lencarry: 2 - lenstarts: 5 + regularlength: 1 + regularsize: 4 + singleoffsets: [0, 3, 3, 4, 5] outputs: - tostarts: [1, 1] - tostops: [1, 1] + multistarts: [0, 3, 3, 4] + multistops: [3, 3, 4, 5] - error: false inputs: - fromcarry: [3, 1] - fromstarts: [0, 1, 1, 1, 1] - fromstops: [1, 1, 1, 1, 4] - lencarry: 2 - lenstarts: 5 + regularlength: 1 + regularsize: 5 + singleoffsets: [0, 3, 3, 4, 5, 8] outputs: - tostarts: [1, 1] - tostops: [1, 1] + multistarts: [0, 3, 3, 4, 5] + multistops: [3, 3, 4, 5, 8] - error: false inputs: - fromcarry: [4, 3, 2, 1, 0] - fromstarts: [0, 1, 1, 1, 1] - fromstops: [1, 1, 1, 1, 4] - lencarry: 5 - lenstarts: 5 + regularlength: 1 + regularsize: 5 + singleoffsets: [0, 3, 3, 5, 6, 9] outputs: - tostarts: [1, 1, 1, 1, 0] - tostops: [4, 1, 1, 1, 1] + multistarts: [0, 3, 3, 5, 6] + multistops: [3, 3, 5, 6, 9] - error: false inputs: - fromcarry: [4, 3, 2, 1] - fromstarts: [0, 1, 1, 1, 1] - fromstops: [1, 1, 1, 1, 4] - lencarry: 4 - lenstarts: 5 + regularlength: 1 + regularsize: 2 + singleoffsets: [0, 3, 6] outputs: - tostarts: [1, 1, 1, 1] - tostops: [4, 1, 1, 1] + multistarts: [0, 3] + multistops: [3, 6] - error: false inputs: - fromcarry: [1, 4] - fromstarts: [0, 1, 1, 1, 1] - fromstops: [1, 1, 1, 1, 4] - lencarry: 2 - lenstarts: 5 + regularlength: 1 + regularsize: 3 + singleoffsets: [0, 4, 6, 6] outputs: - tostarts: [1, 1] - tostops: [1, 4] + multistarts: [0, 4, 6] + multistops: [4, 6, 6] - error: false inputs: - fromcarry: [4, 1] - fromstarts: [0, 1, 1, 1, 1] - fromstops: [1, 1, 1, 1, 4] - lencarry: 2 - lenstarts: 5 + regularlength: 1 + regularsize: 5 + singleoffsets: [0, 5, 5, 6, 8, 10] outputs: - tostarts: [1, 1] - tostops: [4, 1] + multistarts: [0, 5, 5, 6, 8] + multistops: [5, 5, 6, 8, 10] +- name: awkward_RegularArray_getitem_next_array + tests: - error: false inputs: - fromcarry: [4, 4] - fromstarts: [0, 1, 1, 1, 1] - fromstops: [1, 1, 1, 1, 4] - lencarry: 2 - lenstarts: 5 + fromarray: [0, 0, 0, 0] + lenarray: 4 + length: 1 + size: 2 outputs: - tostarts: [1, 1] - tostops: [4, 4] + toadvanced: [0, 1, 2, 3] + tocarry: [0, 0, 0, 0] - error: false inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - fromstarts: [1, 6, 11, 16, 21, 26] - fromstops: [6, 11, 16, 21, 26, 31] - lencarry: 6 - lenstarts: 6 - outputs: - tostarts: [1, 16, 6, 21, 11, 26] - tostops: [6, 21, 11, 26, 16, 31] - - error: false - inputs: - fromcarry: [3] - fromstarts: [0, 1, 1, 1] - fromstops: [1, 1, 1, 2] - lencarry: 1 - lenstarts: 4 + fromarray: [0, 0] + lenarray: 2 + length: 1 + size: 3 outputs: - tostarts: [1] - tostops: [2] + toadvanced: [0, 1] + tocarry: [0, 0] - error: false inputs: - fromcarry: [2] - fromstarts: [0, 0, 1, 3, 6] - fromstops: [0, 1, 3, 6, 10] - lencarry: 1 - lenstarts: 5 + fromarray: [0] + lenarray: 1 + length: 1 + size: 5 outputs: - tostarts: [1] - tostops: [3] + toadvanced: [0] + tocarry: [0] - error: false inputs: - fromcarry: [1] - fromstarts: [0, 1] - fromstops: [2, 3] - lencarry: 1 - lenstarts: 2 + fromarray: [0, 0, 1, 1, 1, 0] + lenarray: 6 + length: 1 + size: 4 outputs: - tostarts: [1] - tostops: [3] + toadvanced: [0, 1, 2, 3, 4, 5] + tocarry: [0, 0, 1, 1, 1, 0] - error: false inputs: - fromcarry: [4] - fromstarts: [0, 1, 1, 1, 1] - fromstops: [1, 1, 1, 1, 4] - lencarry: 1 - lenstarts: 5 + fromarray: [0, 1] + lenarray: 2 + length: 1 + size: 3 outputs: - tostarts: [1] - tostops: [4] + toadvanced: [0, 1] + tocarry: [0, 1] - error: false inputs: - fromcarry: [3, 0, 0, 3] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 4 - lenstarts: 6 + fromarray: [0, 1] + lenarray: 2 + length: 1 + size: 5 outputs: - tostarts: [15, 0, 0, 15] - tostops: [20, 5, 5, 20] + toadvanced: [0, 1] + tocarry: [0, 1] - error: false inputs: - fromcarry: [3, 2, 1, 0] - fromstarts: [0, 5, 10, 15] - fromstops: [5, 10, 15, 20] - lencarry: 4 - lenstarts: 4 + fromarray: [0, 1] + lenarray: 2 + length: 1 + size: 6 outputs: - tostarts: [15, 10, 5, 0] - tostops: [20, 15, 10, 5] + toadvanced: [0, 1] + tocarry: [0, 1] - error: false inputs: - fromcarry: [4, 3, 0, 2, 1] - fromstarts: [0, 3, 6, 11, 15] - fromstops: [3, 6, 11, 15, 19] - lencarry: 5 - lenstarts: 5 + fromarray: [0, 1, 1, 1] + lenarray: 4 + length: 1 + size: 2 outputs: - tostarts: [15, 11, 0, 6, 3] - tostops: [19, 15, 3, 11, 6] + toadvanced: [0, 1, 2, 3] + tocarry: [0, 1, 1, 1] - error: false inputs: - fromcarry: [3, 3, 3, 3] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 4 - lenstarts: 6 + fromarray: [0, 1, 2] + lenarray: 3 + length: 1 + size: 3 outputs: - tostarts: [15, 15, 15, 15] - tostops: [20, 20, 20, 20] + toadvanced: [0, 1, 2] + tocarry: [0, 1, 2] - error: false inputs: - fromcarry: [3] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 1 - lenstarts: 6 + fromarray: [0, 1, 2] + lenarray: 3 + length: 1 + size: 5 outputs: - tostarts: [15] - tostops: [20] + toadvanced: [0, 1, 2] + tocarry: [0, 1, 2] - error: false inputs: - fromcarry: [3, 4] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 2 - lenstarts: 6 + fromarray: [0, 1, 2, 3] + lenarray: 4 + length: 1 + size: 5 outputs: - tostarts: [15, 20] - tostops: [20, 25] + toadvanced: [0, 1, 2, 3] + tocarry: [0, 1, 2, 3] - error: false inputs: - fromcarry: [3, 4, 5, 4] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 4 - lenstarts: 6 + fromarray: [0, 1] + lenarray: 2 + length: 4 + size: 2 outputs: - tostarts: [15, 20, 25, 20] - tostops: [20, 25, 30, 25] + toadvanced: [0, 1, 0, 1, 0, 1, 0, 1] + tocarry: [0, 1, 2, 3, 4, 5, 6, 7] - error: false inputs: - fromcarry: [3, 1, 2, 0] - fromstarts: [0, 5, 10, 15] - fromstops: [5, 10, 15, 20] - lencarry: 4 - lenstarts: 4 + fromarray: [0, 1, 2, 4] + lenarray: 4 + length: 1 + size: 5 outputs: - tostarts: [15, 5, 10, 0] - tostops: [20, 10, 15, 5] + toadvanced: [0, 1, 2, 3] + tocarry: [0, 1, 2, 4] - error: false inputs: - fromcarry: [3, 1, 2, 4] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 4 - lenstarts: 6 + fromarray: [0, 1, 3] + lenarray: 3 + length: 1 + size: 5 outputs: - tostarts: [15, 5, 10, 20] - tostops: [20, 10, 15, 25] + toadvanced: [0, 1, 2] + tocarry: [0, 1, 3] - error: false inputs: - fromcarry: [4, 3, 3, 4] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 4 - lenstarts: 6 + fromarray: [0, 1, 3, 4] + lenarray: 4 + length: 1 + size: 5 outputs: - tostarts: [20, 15, 15, 20] - tostops: [25, 20, 20, 25] + toadvanced: [0, 1, 2, 3] + tocarry: [0, 1, 3, 4] - error: false inputs: - fromcarry: [4, 4, 4, 4] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 4 - lenstarts: 6 + fromarray: [0, 1, 3, 4, 5] + lenarray: 5 + length: 1 + size: 6 outputs: - tostarts: [20, 20, 20, 20] - tostops: [25, 25, 25, 25] + toadvanced: [0, 1, 2, 3, 4] + tocarry: [0, 1, 3, 4, 5] - error: false inputs: - fromcarry: [4] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 1 - lenstarts: 6 + fromarray: [0, 1, 3, 4, 5] + lenarray: 5 + length: 1 + size: 7 outputs: - tostarts: [20] - tostops: [25] + toadvanced: [0, 1, 2, 3, 4] + tocarry: [0, 1, 3, 4, 5] - error: false inputs: - fromcarry: [4, 5] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 2 - lenstarts: 6 + fromarray: [0, 1, 3, 4, 6, 7] + lenarray: 6 + length: 1 + size: 8 outputs: - tostarts: [20, 25] - tostops: [25, 30] + toadvanced: [0, 1, 2, 3, 4, 5] + tocarry: [0, 1, 3, 4, 6, 7] - error: false inputs: - fromcarry: [1, 2, 3] - fromstarts: [0, 2, 2, 3] - fromstops: [2, 2, 3, 5] - lencarry: 3 - lenstarts: 4 + fromarray: [0, 1, 3, 4, 6, 7] + lenarray: 6 + length: 1 + size: 9 outputs: - tostarts: [2, 2, 3] - tostops: [2, 3, 5] + toadvanced: [0, 1, 2, 3, 4, 5] + tocarry: [0, 1, 3, 4, 6, 7] - error: false inputs: - fromcarry: [1] - fromstarts: [0, 2, 3, 3] - fromstops: [2, 3, 3, 5] - lencarry: 1 - lenstarts: 4 + fromarray: [0, 1, 4] + lenarray: 3 + length: 1 + size: 5 outputs: - tostarts: [2] - tostops: [3] + toadvanced: [0, 1, 2] + tocarry: [0, 1, 4] - error: false inputs: - fromcarry: [1, 2] - fromstarts: [0, 2, 3, 3] - fromstops: [2, 3, 3, 5] - lencarry: 2 - lenstarts: 4 + fromarray: [0, 1, 4, 6, 7] + lenarray: 5 + length: 1 + size: 8 outputs: - tostarts: [2, 3] - tostops: [3, 3] + toadvanced: [0, 1, 2, 3, 4] + tocarry: [0, 1, 4, 6, 7] - error: false inputs: - fromcarry: [1] - fromstarts: [0, 2] - fromstops: [2, 4] - lencarry: 1 - lenstarts: 2 + fromarray: [0, 1, 4, 6, 7] + lenarray: 5 + length: 1 + size: 9 outputs: - tostarts: [2] - tostops: [4] + toadvanced: [0, 1, 2, 3, 4] + tocarry: [0, 1, 4, 6, 7] - error: false inputs: - fromcarry: [2, 4, 5] - fromstarts: [0, 1, 2, 3, 4, 5] - fromstops: [1, 2, 3, 4, 5, 6] - lencarry: 3 - lenstarts: 6 + fromarray: [0, 2] + lenarray: 2 + length: 1 + size: 3 outputs: - tostarts: [2, 4, 5] - tostops: [3, 5, 6] + toadvanced: [0, 1] + tocarry: [0, 2] - error: false inputs: - fromcarry: [2] - fromstarts: [0, 0, 2] - fromstops: [0, 2, 5] - lencarry: 1 - lenstarts: 3 + fromarray: [0, 2] + lenarray: 2 + length: 1 + size: 5 outputs: - tostarts: [2] - tostops: [5] + toadvanced: [0, 1] + tocarry: [0, 2] - error: false inputs: - fromcarry: [5, 0, 4, 4, 5, 0] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 6 - lenstarts: 6 + fromarray: [0, 2, 1, 0] + lenarray: 4 + length: 1 + size: 3 outputs: - tostarts: [25, 0, 20, 20, 25, 0] - tostops: [30, 5, 25, 25, 30, 5] + toadvanced: [0, 1, 2, 3] + tocarry: [0, 2, 1, 0] - error: false inputs: - fromcarry: [5, 2, 2, 5] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 4 - lenstarts: 6 + fromarray: [0, 2, 3] + lenarray: 3 + length: 1 + size: 5 outputs: - tostarts: [25, 10, 10, 25] - tostops: [30, 15, 15, 30] + toadvanced: [0, 1, 2] + tocarry: [0, 2, 3] - error: false inputs: - fromcarry: [5, 2, 4, 1, 3, 0] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 6 - lenstarts: 6 + fromarray: [0, 2, 3, 4] + lenarray: 4 + length: 1 + size: 5 outputs: - tostarts: [25, 10, 20, 5, 15, 0] - tostops: [30, 15, 25, 10, 20, 5] + toadvanced: [0, 1, 2, 3] + tocarry: [0, 2, 3, 4] - error: false inputs: - fromcarry: [5, 4, 3, 2, 1, 0] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 6 - lenstarts: 6 + fromarray: [0, 2, 4] + lenarray: 3 + length: 1 + size: 5 outputs: - tostarts: [25, 20, 15, 10, 5, 0] - tostops: [30, 25, 20, 15, 10, 5] + toadvanced: [0, 1, 2] + tocarry: [0, 2, 4] - error: false inputs: - fromcarry: [5] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 1 - lenstarts: 6 + fromarray: [0, 3] + lenarray: 2 + length: 1 + size: 5 outputs: - tostarts: [25] - tostops: [30] + toadvanced: [0, 1] + tocarry: [0, 3] - error: false inputs: - fromcarry: [2, 0, 0, 2] - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - lencarry: 4 - lenstarts: 3 + fromarray: [0, 3, 4] + lenarray: 3 + length: 1 + size: 5 outputs: - tostarts: [3, 0, 0, 3] - tostops: [5, 3, 3, 5] + toadvanced: [0, 1, 2] + tocarry: [0, 3, 4] - error: false inputs: - fromcarry: [1, 0, 0, 1] - fromstarts: [0, 3] - fromstops: [3, 6] - lencarry: 4 - lenstarts: 2 + fromarray: [0, 3] + lenarray: 2 + length: 2 + size: 4 outputs: - tostarts: [3, 0, 0, 3] - tostops: [6, 3, 3, 6] + toadvanced: [0, 1, 0, 1] + tocarry: [0, 3, 4, 7] - error: false inputs: - fromcarry: [2, 0, 0, 1, 4] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 9] - lencarry: 5 - lenstarts: 5 + fromarray: [0, 3] + lenarray: 2 + length: 3 + size: 4 outputs: - tostarts: [3, 0, 0, 3, 6] - tostops: [5, 3, 3, 3, 9] + toadvanced: [0, 1, 0, 1, 0, 1] + tocarry: [0, 3, 4, 7, 8, 11] - error: false inputs: - fromcarry: [2, 0, 0, 4] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 9] - lencarry: 4 - lenstarts: 5 + fromarray: [0, 4] + lenarray: 2 + length: 1 + size: 5 outputs: - tostarts: [3, 0, 0, 6] - tostops: [5, 3, 3, 9] + toadvanced: [0, 1] + tocarry: [0, 4] - error: false inputs: - fromcarry: [1, 0] - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - lencarry: 2 - lenstarts: 3 + fromarray: [1, 0, 0, 1] + lenarray: 4 + length: 1 + size: 2 outputs: - tostarts: [3, 0] - tostops: [3, 3] + toadvanced: [0, 1, 2, 3] + tocarry: [1, 0, 0, 1] - error: false inputs: - fromcarry: [1, 0, 1, 1, 1, 0] - fromstarts: [0, 3] - fromstops: [3, 6] - lencarry: 6 - lenstarts: 2 + fromarray: [1, 0] + lenarray: 2 + length: 1 + size: 2 outputs: - tostarts: [3, 0, 3, 3, 3, 0] - tostops: [6, 3, 6, 6, 6, 3] + toadvanced: [0, 1] + tocarry: [1, 0] - error: false inputs: - fromcarry: [1, 0, 1, 3, 2, 3, 5, 4, 5, 7, 6, 7] - fromstarts: [0, 3, 3, 5, 3, 5, 6, 10] - fromstops: [3, 3, 5, 6, 5, 6, 10, 10] - lencarry: 12 - lenstarts: 8 + fromarray: [1, 0, 1, 1, 1, 0] + lenarray: 6 + length: 1 + size: 2 outputs: - tostarts: [3, 0, 3, 5, 3, 5, 5, 3, 5, 10, 6, 10] - tostops: [3, 3, 3, 6, 5, 6, 6, 5, 6, 10, 10, 10] + toadvanced: [0, 1, 2, 3, 4, 5] + tocarry: [1, 0, 1, 1, 1, 0] - error: false inputs: - fromcarry: [2, 0] - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - lencarry: 2 - lenstarts: 3 + fromarray: [1] + lenarray: 1 + length: 1 + size: 2 outputs: - tostarts: [3, 0] - tostops: [5, 3] + toadvanced: [0] + tocarry: [1] - error: false inputs: - fromcarry: [1, 0, 3, 2, 5, 4, 7, 6] - fromstarts: [0, 3, 3, 5, 3, 5, 6, 10] - fromstops: [3, 3, 5, 6, 5, 6, 10, 10] - lencarry: 8 - lenstarts: 8 + fromarray: [1] + lenarray: 1 + length: 1 + size: 5 outputs: - tostarts: [3, 0, 5, 3, 5, 3, 10, 6] - tostops: [3, 3, 6, 5, 6, 5, 10, 10] + toadvanced: [0] + tocarry: [1] - error: false inputs: - fromcarry: [2] - fromstarts: [0, 2, 3, 3] - fromstops: [2, 3, 3, 5] - lencarry: 1 - lenstarts: 4 + fromarray: [1, 0, 1] + lenarray: 3 + length: 4 + size: 2 outputs: - tostarts: [3] - tostops: [3] + toadvanced: [0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2] + tocarry: [1, 0, 1, 3, 2, 3, 5, 4, 5, 7, 6, 7] - error: false inputs: - fromcarry: [1] - fromstarts: [0, 3] - fromstops: [3, 3] - lencarry: 1 - lenstarts: 2 + fromarray: [1, 0] + lenarray: 2 + length: 4 + size: 2 outputs: - tostarts: [3] - tostops: [3] + toadvanced: [0, 1, 0, 1, 0, 1, 0, 1] + tocarry: [1, 0, 3, 2, 5, 4, 7, 6] - error: false inputs: - fromcarry: [1] - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - lencarry: 1 - lenstarts: 3 + fromarray: [1, 1, 1, 1] + lenarray: 4 + length: 1 + size: 2 outputs: - tostarts: [3] - tostops: [3] + toadvanced: [0, 1, 2, 3] + tocarry: [1, 1, 1, 1] - error: false inputs: - fromcarry: [1] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 9] - lencarry: 1 - lenstarts: 5 + fromarray: [1, 2] + lenarray: 2 + length: 1 + size: 3 outputs: - tostarts: [3] - tostops: [3] + toadvanced: [0, 1] + tocarry: [1, 2] - error: false inputs: - fromcarry: [2, 1, 0] - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - lencarry: 3 - lenstarts: 3 + fromarray: [1, 2] + lenarray: 2 + length: 1 + size: 5 outputs: - tostarts: [3, 3, 0] - tostops: [5, 3, 3] + toadvanced: [0, 1] + tocarry: [1, 2] - error: false inputs: - fromcarry: [2, 1, 0, 3, 3, 4] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 10] - lencarry: 6 - lenstarts: 5 + fromarray: [1, 2, 3] + lenarray: 3 + length: 1 + size: 5 outputs: - tostarts: [3, 3, 0, 5, 5, 6] - tostops: [5, 3, 3, 6, 6, 10] + toadvanced: [0, 1, 2] + tocarry: [1, 2, 3] - error: false inputs: - fromcarry: [2, 2, 1, 0, 3] - fromstarts: [0, 3, 3, 4] - fromstops: [3, 3, 4, 6] - lencarry: 5 - lenstarts: 4 + fromarray: [1, 2, 3, 4] + lenarray: 4 + length: 1 + size: 5 outputs: - tostarts: [3, 3, 3, 0, 4] - tostops: [4, 4, 3, 3, 6] + toadvanced: [0, 1, 2, 3] + tocarry: [1, 2, 3, 4] - error: false inputs: - fromcarry: [2, 2, 1, 0] - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - lencarry: 4 - lenstarts: 3 + fromarray: [1, 2, 4] + lenarray: 3 + length: 1 + size: 5 outputs: - tostarts: [3, 3, 3, 0] - tostops: [5, 5, 3, 3] + toadvanced: [0, 1, 2] + tocarry: [1, 2, 4] - error: false inputs: - fromcarry: [1, 2, 2, 6] - fromstarts: [0, 3, 3, 5, 6, 10, 10] - fromstops: [3, 3, 5, 6, 10, 10, 13] - lencarry: 4 - lenstarts: 7 + fromarray: [1, 3] + lenarray: 2 + length: 1 + size: 5 outputs: - tostarts: [3, 3, 3, 10] - tostops: [3, 5, 5, 13] + toadvanced: [0, 1] + tocarry: [1, 3] - error: false inputs: - fromcarry: [2, 2, 2, 2] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 10] - lencarry: 4 - lenstarts: 5 + fromarray: [1, 3, 4] + lenarray: 3 + length: 1 + size: 5 outputs: - tostarts: [3, 3, 3, 3] - tostops: [5, 5, 5, 5] + toadvanced: [0, 1, 2] + tocarry: [1, 3, 4] - error: false inputs: - fromcarry: [1, 1, 1, 1] - fromstarts: [0, 3] - fromstops: [3, 6] - lencarry: 4 - lenstarts: 2 + fromarray: [1, 3, 4, 6, 7] + lenarray: 5 + length: 1 + size: 8 outputs: - tostarts: [3, 3, 3, 3] - tostops: [6, 6, 6, 6] + toadvanced: [0, 1, 2, 3, 4] + tocarry: [1, 3, 4, 6, 7] - error: false inputs: - fromcarry: [1, 2] - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - lencarry: 2 - lenstarts: 3 + fromarray: [1, 3, 4, 6, 7] + lenarray: 5 + length: 1 + size: 9 outputs: - tostarts: [3, 3] - tostops: [3, 5] + toadvanced: [0, 1, 2, 3, 4] + tocarry: [1, 3, 4, 6, 7] - error: false inputs: - fromcarry: [2, 1] - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - lencarry: 2 - lenstarts: 3 + fromarray: [1, 4] + lenarray: 2 + length: 1 + size: 5 outputs: - tostarts: [3, 3] - tostops: [5, 3] + toadvanced: [0, 1] + tocarry: [1, 4] - error: false inputs: - fromcarry: [1, 2, 3] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 9] - lencarry: 3 - lenstarts: 5 + fromarray: [1, 4, 0, 5] + lenarray: 4 + length: 1 + size: 6 outputs: - tostarts: [3, 3, 5] - tostops: [3, 5, 6] + toadvanced: [0, 1, 2, 3] + tocarry: [1, 4, 0, 5] - error: false inputs: - fromcarry: [1, 2, 5] - fromstarts: [0, 3, 3, 5, 6, 6] - fromstops: [3, 3, 5, 6, 6, 10] - lencarry: 3 - lenstarts: 6 + fromarray: [2, 0, 0, 1] + lenarray: 4 + length: 1 + size: 6 outputs: - tostarts: [3, 3, 6] - tostops: [3, 5, 10] + toadvanced: [0, 1, 2, 3] + tocarry: [2, 0, 0, 1] - error: false inputs: - fromcarry: [2] - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - lencarry: 1 - lenstarts: 3 + fromarray: [2, 0] + lenarray: 2 + length: 1 + size: 3 outputs: - tostarts: [3] - tostops: [5] + toadvanced: [0, 1] + tocarry: [2, 0] - error: false inputs: - fromcarry: [2] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 10] - lencarry: 1 - lenstarts: 5 + fromarray: [2, 0, 0, 1, 4] + lenarray: 5 + length: 1 + size: 5 outputs: - tostarts: [3] - tostops: [5] + toadvanced: [0, 1, 2, 3, 4] + tocarry: [2, 0, 0, 1, 4] - error: false inputs: - fromcarry: [2] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 9] - lencarry: 1 - lenstarts: 5 + fromarray: [2, 0, 0, 2] + lenarray: 4 + length: 1 + size: 3 outputs: - tostarts: [3] - tostops: [5] + toadvanced: [0, 1, 2, 3] + tocarry: [2, 0, 0, 2] - error: false inputs: - fromcarry: [2, 3, 0, 1] - fromstarts: [0, 3, 3, 5, 6, 10] - fromstops: [3, 3, 5, 6, 10, 10] - lencarry: 4 - lenstarts: 6 + fromarray: [2, 0, 0, 4] + lenarray: 4 + length: 1 + size: 5 outputs: - tostarts: [3, 5, 0, 3] - tostops: [5, 6, 3, 3] + toadvanced: [0, 1, 2, 3] + tocarry: [2, 0, 0, 4] - error: false inputs: - fromcarry: [2] - fromstarts: [2, 3, 3] - fromstops: [3, 3, 5] - lencarry: 1 - lenstarts: 3 + fromarray: [2] + lenarray: 1 + length: 1 + size: 3 outputs: - tostarts: [3] - tostops: [5] + toadvanced: [0] + tocarry: [2] - error: false inputs: - fromcarry: [2, 3, 2, 3, 0, 1, 0, 1] - fromstarts: [0, 3, 3, 5, 6, 10] - fromstops: [3, 3, 5, 6, 10, 10] - lencarry: 8 - lenstarts: 6 + fromarray: [2] + lenarray: 1 + length: 1 + size: 5 outputs: - tostarts: [3, 5, 3, 5, 0, 3, 0, 3] - tostops: [5, 6, 5, 6, 3, 3, 3, 3] + toadvanced: [0] + tocarry: [2] - error: false inputs: - fromcarry: [2, 3] - fromstarts: [0, 3, 3, 5, 6, 10] - fromstops: [3, 3, 5, 6, 10, 10] - lencarry: 2 - lenstarts: 6 + fromarray: [2, 1, 1, 2] + lenarray: 4 + length: 1 + size: 3 outputs: - tostarts: [3, 5] - tostops: [5, 6] + toadvanced: [0, 1, 2, 3] + tocarry: [2, 1, 1, 2] - error: false inputs: - fromcarry: [2, 3, 4, 5] - fromstarts: [0, 3, 3, 5, 6, 10] - fromstops: [3, 3, 5, 6, 10, 10] - lencarry: 4 - lenstarts: 6 + fromarray: [2, 1, 1, 3] + lenarray: 4 + length: 2 + size: 4 outputs: - tostarts: [3, 5, 6, 10] - tostops: [5, 6, 10, 10] + toadvanced: [0, 1, 2, 3, 0, 1, 2, 3] + tocarry: [2, 1, 1, 3, 6, 5, 5, 7] - error: false inputs: - fromcarry: [2, 3, 4] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 10] - lencarry: 3 - lenstarts: 5 + fromarray: [2, 1, 1, 3] + lenarray: 4 + length: 3 + size: 4 outputs: - tostarts: [3, 5, 6] - tostops: [5, 6, 10] + toadvanced: [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3] + tocarry: [2, 1, 1, 3, 6, 5, 5, 7, 10, 9, 9, 11] - error: false inputs: - fromcarry: [2, 3, 4] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 9] - lencarry: 3 - lenstarts: 5 + fromarray: [2, 2] + lenarray: 2 + length: 1 + size: 4 outputs: - tostarts: [3, 5, 6] - tostops: [5, 6, 9] + toadvanced: [0, 1] + tocarry: [2, 2] - error: false inputs: - fromcarry: [1, 2, 0, 3, 4] - fromstarts: [0, 3, 6, 11, 15] - fromstops: [3, 6, 11, 15, 19] - lencarry: 5 - lenstarts: 5 + fromarray: [2, 2, 2, 2] + lenarray: 4 + length: 1 + size: 5 outputs: - tostarts: [3, 6, 0, 11, 15] - tostops: [6, 11, 3, 15, 19] + toadvanced: [0, 1, 2, 3] + tocarry: [2, 2, 2, 2] - error: false inputs: - fromcarry: [1] - fromstarts: [0, 3] - fromstops: [3, 6] - lencarry: 1 - lenstarts: 2 + fromarray: [2, 2, 2, 2] + lenarray: 4 + length: 1 + size: 6 outputs: - tostarts: [3] - tostops: [6] + toadvanced: [0, 1, 2, 3] + tocarry: [2, 2, 2, 2] - error: false inputs: - fromcarry: [1, 3, 4, 6, 7] - fromstarts: [0, 3, 6, 6, 11, 15, 15, 19, 22] - fromstops: [3, 6, 6, 11, 15, 15, 19, 22, 22] - lencarry: 5 - lenstarts: 9 + fromarray: [2, 3] + lenarray: 2 + length: 1 + size: 5 outputs: - tostarts: [3, 6, 11, 15, 19] - tostops: [6, 11, 15, 19, 22] + toadvanced: [0, 1] + tocarry: [2, 3] - error: false inputs: - fromcarry: [1, 3, 4, 6, 7] - fromstarts: [0, 3, 6, 6, 11, 15, 15, 19] - fromstops: [3, 6, 6, 11, 15, 15, 19, 22] - lencarry: 5 - lenstarts: 8 + fromarray: [2, 3] + lenarray: 2 + length: 1 + size: 6 outputs: - tostarts: [3, 6, 11, 15, 19] - tostops: [6, 11, 15, 19, 22] + toadvanced: [0, 1] + tocarry: [2, 3] - error: false inputs: - fromcarry: [1, 2, 4] - fromstarts: [0, 3, 6, 9, 11, 13] - fromstops: [3, 6, 9, 11, 13, 14] - lencarry: 3 - lenstarts: 6 + fromarray: [2, 3, 4] + lenarray: 3 + length: 1 + size: 5 outputs: - tostarts: [3, 6, 11] - tostops: [6, 9, 13] + toadvanced: [0, 1, 2] + tocarry: [2, 3, 4] - error: false inputs: - fromcarry: [0, 1, 3, 4, 2, 5] - fromstarts: [3, 6, 11, 17, 20, 25] - fromstops: [6, 9, 13, 20, 23, 27] - lencarry: 6 - lenstarts: 6 + fromarray: [2, 3, 4, 5, 6] + lenarray: 5 + length: 1 + size: 7 outputs: - tostarts: [3, 6, 17, 20, 11, 25] - tostops: [6, 9, 20, 23, 13, 27] + toadvanced: [0, 1, 2, 3, 4] + tocarry: [2, 3, 4, 5, 6] - error: false inputs: - fromcarry: [1, 4] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 9] - lencarry: 2 - lenstarts: 5 + fromarray: [2, 4] + lenarray: 2 + length: 1 + size: 5 outputs: - tostarts: [3, 6] - tostops: [3, 9] + toadvanced: [0, 1] + tocarry: [2, 4] - error: false inputs: - fromcarry: [1, 4] - fromstarts: [0, 3, 5, 6, 6] - fromstops: [3, 5, 6, 6, 10] - lencarry: 2 - lenstarts: 5 + fromarray: [3] + lenarray: 1 + length: 1 + size: 5 outputs: - tostarts: [3, 6] - tostops: [5, 10] + toadvanced: [0] + tocarry: [3] - error: false inputs: - fromcarry: [1, 2] - fromstarts: [0, 4, 4] - fromstops: [4, 4, 6] - lencarry: 2 - lenstarts: 3 + fromarray: [3, 1, 1, 7] + lenarray: 4 + length: 1 + size: 10 outputs: - tostarts: [4, 4] - tostops: [4, 6] + toadvanced: [0, 1, 2, 3] + tocarry: [3, 1, 1, 7] - error: false inputs: - fromcarry: [1, 2, 2, 4] - fromstarts: [0, 4, 4, 7, 8] - fromstops: [4, 4, 7, 8, 13] - lencarry: 4 - lenstarts: 5 + fromarray: [3, 2, 1, 0] + lenarray: 4 + length: 1 + size: 4 outputs: - tostarts: [4, 4, 4, 8] - tostops: [4, 7, 7, 13] + toadvanced: [0, 1, 2, 3] + tocarry: [3, 2, 1, 0] - error: false inputs: - fromcarry: [1, 2, 5] - fromstarts: [0, 4, 4, 6, 7, 7] - fromstops: [4, 4, 6, 7, 7, 12] - lencarry: 3 - lenstarts: 6 + fromarray: [3, 2, 1] + lenarray: 3 + length: 1 + size: 4 outputs: - tostarts: [4, 4, 7] - tostops: [4, 6, 12] + toadvanced: [0, 1, 2] + tocarry: [3, 2, 1] - error: false inputs: - fromcarry: [1, 2] - fromstarts: [0, 4, 8] - fromstops: [4, 8, 12] - lencarry: 2 - lenstarts: 3 + fromarray: [3, 3, 3] + lenarray: 3 + length: 1 + size: 5 outputs: - tostarts: [4, 8] - tostops: [8, 12] + toadvanced: [0, 1, 2] + tocarry: [3, 3, 3] - error: false inputs: - fromcarry: [1, 0, 0, 1] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 4 - lenstarts: 6 + fromarray: [3, 4] + lenarray: 2 + length: 1 + size: 5 outputs: - tostarts: [5, 0, 0, 5] - tostops: [10, 5, 5, 10] + toadvanced: [0, 1] + tocarry: [3, 4] - error: false inputs: - fromcarry: [1] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 1 - lenstarts: 6 + fromarray: [3, 6, 8, 6] + lenarray: 4 + length: 1 + size: 10 outputs: - tostarts: [5] - tostops: [10] + toadvanced: [0, 1, 2, 3] + tocarry: [3, 6, 8, 6] - error: false inputs: - fromcarry: [1, 2] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 2 - lenstarts: 6 + fromarray: [4] + lenarray: 1 + length: 1 + size: 5 outputs: - tostarts: [5, 10] - tostops: [10, 15] + toadvanced: [0] + tocarry: [4] - error: false inputs: - fromcarry: [1, 2, 3, 4, 5] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 5 - lenstarts: 6 + fromarray: [4, 3, 2] + lenarray: 3 + length: 1 + size: 8 outputs: - tostarts: [5, 10, 15, 20, 25] - tostops: [10, 15, 20, 25, 30] + toadvanced: [0, 1, 2] + tocarry: [4, 3, 2] - error: false inputs: - fromcarry: [1, 3, 3, 4] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 4 - lenstarts: 6 + fromarray: [4, 3, 2, 1] + lenarray: 4 + length: 1 + size: 8 outputs: - tostarts: [5, 15, 15, 20] - tostops: [10, 20, 20, 25] + toadvanced: [0, 1, 2, 3] + tocarry: [4, 3, 2, 1] - error: false inputs: - fromcarry: [1, 4, 0, 5] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - lencarry: 4 - lenstarts: 6 + fromarray: [4, 4] + lenarray: 2 + length: 1 + size: 5 outputs: - tostarts: [5, 20, 0, 25] - tostops: [10, 25, 5, 30] + toadvanced: [0, 1] + tocarry: [4, 4] - error: false inputs: - fromcarry: [1, 2, 5, 6] - fromstarts: [3, 5, 3, 5, 0, 3, 0, 3] - fromstops: [5, 6, 5, 6, 3, 3, 3, 3] - lencarry: 4 - lenstarts: 8 + fromarray: [4, 4, 4, 4] + lenarray: 4 + length: 1 + size: 6 outputs: - tostarts: [5, 3, 3, 0] - tostops: [6, 5, 3, 3] + toadvanced: [0, 1, 2, 3] + tocarry: [4, 4, 4, 4] - error: false inputs: - fromcarry: [3, 3, 0, 1, 2, 4, 5] - fromstarts: [0, 3, 3, 5, 6, 6] - fromstops: [3, 3, 5, 6, 6, 10] - lencarry: 7 - lenstarts: 6 + fromarray: [4, 5] + lenarray: 2 + length: 1 + size: 6 outputs: - tostarts: [5, 5, 0, 3, 3, 6, 6] - tostops: [6, 6, 3, 3, 5, 6, 10] + toadvanced: [0, 1] + tocarry: [4, 5] - error: false inputs: - fromcarry: [1, 2, 3] - fromstarts: [0, 5, 5, 6] - fromstops: [5, 5, 6, 9] - lencarry: 3 - lenstarts: 4 + fromarray: [7, 3, 0, 2, 3, 7] + lenarray: 6 + length: 1 + size: 8 outputs: - tostarts: [5, 5, 6] - tostops: [5, 6, 9] + toadvanced: [0, 1, 2, 3, 4, 5] + tocarry: [7, 3, 0, 2, 3, 7] - error: false inputs: - fromcarry: [2, 2] - fromstarts: [3, 3, 5, 6] - fromstops: [3, 5, 6, 10] - lencarry: 2 - lenstarts: 4 + fromarray: [7, 3, 2, 0, 2, 3, 7] + lenarray: 7 + length: 1 + size: 8 outputs: - tostarts: [5, 5] - tostops: [6, 6] + toadvanced: [0, 1, 2, 3, 4, 5, 6] + tocarry: [7, 3, 2, 0, 2, 3, 7] - error: false inputs: - fromcarry: [3] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 9] - lencarry: 1 - lenstarts: 5 + fromarray: [7, 3, 2, 0, 3, 7] + lenarray: 6 + length: 1 + size: 8 outputs: - tostarts: [5] - tostops: [6] + toadvanced: [0, 1, 2, 3, 4, 5] + tocarry: [7, 3, 2, 0, 3, 7] +- name: awkward_RegularArray_getitem_next_array_advanced + tests: - error: false inputs: - fromcarry: [2] - fromstarts: [3, 3, 5, 6] - fromstops: [3, 5, 6, 10] - lencarry: 1 - lenstarts: 4 + fromadvanced: [0, 1, 2, 3] + fromarray: [0, 1, 0, 1] + lenarray: 4 + length: 4 + size: 2 outputs: - tostarts: [5] - tostops: [6] + toadvanced: [0, 1, 2, 3] + tocarry: [0, 3, 4, 7] - error: false inputs: - fromcarry: [1] - fromstarts: [3, 5] - fromstops: [5, 6] - lencarry: 1 - lenstarts: 2 + fromadvanced: [0, 1, 2, 3] + fromarray: [0, 0, 0, 0] + lenarray: 4 + length: 4 + size: 3 outputs: - tostarts: [5] - tostops: [6] + toadvanced: [0, 1, 2, 3] + tocarry: [0, 3, 6, 9] - error: false inputs: - fromcarry: [2, 3, 4] - fromstarts: [0, 3, 5, 6, 6] - fromstops: [3, 5, 6, 6, 10] - lencarry: 3 - lenstarts: 5 + fromadvanced: [0, 1, 2, 3] + fromarray: [0, 1, 2, 1] + lenarray: 4 + length: 4 + size: 3 outputs: - tostarts: [5, 6, 6] - tostops: [6, 6, 10] + toadvanced: [0, 1, 2, 3] + tocarry: [0, 4, 8, 10] - error: false inputs: - fromcarry: [2, 0, 0, 2] - fromstarts: [0, 3, 6] - fromstops: [3, 6, 9] - lencarry: 4 - lenstarts: 3 + fromadvanced: [0, 1, 2, 3] + fromarray: [0, 0, 0, 0] + lenarray: 4 + length: 4 + size: 5 outputs: - tostarts: [6, 0, 0, 6] - tostops: [9, 3, 3, 9] + toadvanced: [0, 1, 2, 3] + tocarry: [0, 5, 10, 15] - error: false inputs: - fromcarry: [4] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 10] - lencarry: 1 - lenstarts: 5 + fromadvanced: [0, 1, 2, 3] + fromarray: [0, 1, 4, 1] + lenarray: 4 + length: 4 + size: 5 outputs: - tostarts: [6] - tostops: [10] + toadvanced: [0, 1, 2, 3] + tocarry: [0, 6, 14, 16] - error: false inputs: - fromcarry: [4, 5] - fromstarts: [0, 3, 3, 5, 6, 10] - fromstops: [3, 3, 5, 6, 10, 10] - lencarry: 2 - lenstarts: 6 + fromadvanced: [0, 1, 2, 3] + fromarray: [1, 0, 1, 0] + lenarray: 4 + length: 4 + size: 2 outputs: - tostarts: [6, 10] - tostops: [10, 10] + toadvanced: [0, 1, 2, 3] + tocarry: [1, 2, 5, 6] - error: false inputs: - fromcarry: [2] - fromstarts: [3, 5, 6] - fromstops: [5, 6, 10] - lencarry: 1 - lenstarts: 3 + fromadvanced: [0, 1, 2, 3] + fromarray: [1, 0, 0, 1] + lenarray: 4 + length: 4 + size: 3 outputs: - tostarts: [6] - tostops: [10] + toadvanced: [0, 1, 2, 3] + tocarry: [1, 3, 6, 10] - error: false inputs: - fromcarry: [2, 3, 4, 5, 6] - fromstarts: [0, 3, 6, 11, 14, 17, 20] - fromstops: [3, 6, 11, 14, 17, 20, 25] - lencarry: 5 - lenstarts: 7 + fromadvanced: [0, 1, 2, 3] + fromarray: [1, 0, 0, 1] + lenarray: 4 + length: 4 + size: 5 outputs: - tostarts: [6, 11, 14, 17, 20] - tostops: [11, 14, 17, 20, 25] + toadvanced: [0, 1, 2, 3] + tocarry: [1, 5, 10, 16] - error: false inputs: - fromcarry: [3, 2, 0] - fromstarts: [0, 3, 5, 6] - fromstops: [3, 5, 6, 10] - lencarry: 3 - lenstarts: 4 + fromadvanced: [0, 1, 2, 3] + fromarray: [1, 3, 0, 4] + lenarray: 4 + length: 4 + size: 5 outputs: - tostarts: [6, 5, 0] - tostops: [10, 6, 3] + toadvanced: [0, 1, 2, 3] + tocarry: [1, 8, 10, 19] - error: false inputs: - fromcarry: [7, 3, 0, 2, 3, 7] - fromstarts: [0, 3, 3, 5, 6, 6, 6, 6] - fromstops: [3, 3, 5, 6, 6, 6, 6, 9] - lencarry: 6 - lenstarts: 8 + fromadvanced: [0, 1, 2, 3] + fromarray: [2, 0, 0, 1] + lenarray: 4 + length: 4 + size: 5 outputs: - tostarts: [6, 5, 0, 3, 5, 6] - tostops: [9, 6, 3, 5, 6, 9] + toadvanced: [0, 1, 2, 3] + tocarry: [2, 5, 10, 16] - error: false inputs: - fromcarry: [3, 2, 1, 0] - fromstarts: [0, 3, 5, 6] - fromstops: [3, 5, 6, 10] - lencarry: 4 - lenstarts: 4 + fromadvanced: [0, 1, 2, 3] + fromarray: [2, 2, 2, 2] + lenarray: 4 + length: 4 + size: 3 outputs: - tostarts: [6, 5, 3, 0] - tostops: [10, 6, 5, 3] + toadvanced: [0, 1, 2, 3] + tocarry: [2, 5, 8, 11] - error: false inputs: - fromcarry: [7, 3, 2, 0, 2, 3, 7] - fromstarts: [0, 3, 3, 5, 6, 6, 6, 6] - fromstops: [3, 3, 5, 6, 6, 6, 6, 9] - lencarry: 7 - lenstarts: 8 + fromadvanced: [0, 1, 2, 3] + fromarray: [2, 2, 2, 2] + lenarray: 4 + length: 4 + size: 5 outputs: - tostarts: [6, 5, 3, 0, 3, 5, 6] - tostops: [9, 6, 5, 3, 5, 6, 9] + toadvanced: [0, 1, 2, 3] + tocarry: [2, 7, 12, 17] - error: false inputs: - fromcarry: [7, 3, 2, 0, 3, 7] - fromstarts: [0, 3, 3, 5, 6, 6, 6, 6] - fromstops: [3, 3, 5, 6, 6, 6, 6, 9] - lencarry: 6 - lenstarts: 8 + fromadvanced: [0, 1, 2, 3] + fromarray: [3, 3, 3, 3] + lenarray: 4 + length: 4 + size: 5 outputs: - tostarts: [6, 5, 3, 0, 5, 6] - tostops: [9, 6, 5, 3, 6, 9] + toadvanced: [0, 1, 2, 3] + tocarry: [3, 8, 13, 18] - error: false inputs: - fromcarry: [4, 3, 2, 1, 0] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 10] - lencarry: 5 - lenstarts: 5 + fromadvanced: [0, 1, 2, 3] + fromarray: [4, 4, 4, 4] + lenarray: 4 + length: 4 + size: 5 outputs: - tostarts: [6, 5, 3, 3, 0] - tostops: [10, 6, 5, 3, 3] + toadvanced: [0, 1, 2, 3] + tocarry: [4, 9, 14, 19] +- name: awkward_RegularArray_getitem_next_array_regularize + tests: - error: false inputs: - fromcarry: [4, 3, 2, 1, 0] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 9] - lencarry: 5 - lenstarts: 5 + fromarray: [0, 0, 0, 0] + lenarray: 4 + size: 2 outputs: - tostarts: [6, 5, 3, 3, 0] - tostops: [9, 6, 5, 3, 3] + toarray: [0, 0, 0, 0] - error: false inputs: - fromcarry: [4, 3, 4, 0] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 9] - lencarry: 4 - lenstarts: 5 + fromarray: [0, 0, 0, 0] + lenarray: 4 + size: 3 outputs: - tostarts: [6, 5, 6, 0] - tostops: [9, 6, 9, 3] + toarray: [0, 0, 0, 0] - error: false inputs: - fromcarry: [3, 4, 5] - fromstarts: [0, 4, 4, 6, 7, 7] - fromstops: [4, 4, 6, 7, 7, 12] - lencarry: 3 - lenstarts: 6 + fromarray: [0, 0, 0, 0] + lenarray: 4 + size: 5 outputs: - tostarts: [6, 7, 7] - tostops: [7, 7, 12] + toarray: [0, 0, 0, 0] - error: false inputs: - fromcarry: [4] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 9] - lencarry: 1 - lenstarts: 5 + fromarray: [0, 0] + lenarray: 2 + size: 3 outputs: - tostarts: [6] - tostops: [9] + toarray: [0, 0] - error: false inputs: - fromcarry: [1] - fromstarts: [3, 6] - fromstops: [3, 9] - lencarry: 1 - lenstarts: 2 + fromarray: [0] + lenarray: 1 + size: 5 outputs: - tostarts: [6] - tostops: [9] + toarray: [0] - error: false inputs: - fromcarry: [2, 3] - fromstarts: [0, 4, 6, 9] - fromstops: [4, 6, 9, 14] - lencarry: 2 - lenstarts: 4 + fromarray: [0, 1, 0, 1] + lenarray: 4 + size: 2 outputs: - tostarts: [6, 9] - tostops: [9, 14] -- name: awkward_RegularArray_localindex - tests: + toarray: [0, 1, 0, 1] - error: false - inputs: {length: 2, size: 3} + inputs: + fromarray: [0, 1] + lenarray: 2 + size: 2 outputs: - toindex: [0, 1, 2, 0, 1, 2] + toarray: [0, 1] - error: false - inputs: {length: 6, size: 5} + inputs: + fromarray: [0, 1] + lenarray: 2 + size: 3 outputs: - toindex: [0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, - 2, 3, 4, 0, 1, 2, 3, 4] -- name: awkward_RegularArray_num - tests: - - error: false - inputs: {length: 15, size: 2} - outputs: - tonum: [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] + toarray: [0, 1] - error: false - inputs: {length: 21, size: 2} + inputs: + fromarray: [0, 1] + lenarray: 2 + size: 5 outputs: - tonum: [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] + toarray: [0, 1] - error: false - inputs: {length: 2, size: 3} + inputs: + fromarray: [0, 1] + lenarray: 2 + size: 6 outputs: - tonum: [3, 3] + toarray: [0, 1] - error: false - inputs: {length: 7, size: 3} + inputs: + fromarray: [0, 1, 1, 1] + lenarray: 4 + size: 2 outputs: - tonum: [3, 3, 3, 3, 3, 3, 3] + toarray: [0, 1, 1, 1] - error: false - inputs: {length: 5, size: 3} + inputs: + fromarray: [0, 1, 2] + lenarray: 3 + size: 3 outputs: - tonum: [3, 3, 3, 3, 3] + toarray: [0, 1, 2] - error: false - inputs: {length: 3, size: 5} + inputs: + fromarray: [0, 1, 2] + lenarray: 3 + size: 5 outputs: - tonum: [5, 5, 5] + toarray: [0, 1, 2] - error: false - inputs: {length: 6, size: 5} + inputs: + fromarray: [0, 1, 1, 1] + lenarray: 4 + size: 3 outputs: - tonum: [5, 5, 5, 5, 5, 5] + toarray: [0, 1, 1, 1] - error: false - inputs: {length: 30, size: 7} + inputs: + fromarray: [0, 1, 2, 3] + lenarray: 4 + size: 5 outputs: - tonum: [7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7] -- name: awkward_RegularArray_rpad_and_clip_axis1 - tests: + toarray: [0, 1, 2, 3] - error: false - inputs: {length: 3, size: 2, target: 2} + inputs: + fromarray: [0, 1, 2, 4] + lenarray: 4 + size: 5 outputs: - toindex: [0, 1, 2, 3, 4, 5] + toarray: [0, 1, 2, 4] - error: false - inputs: {length: 2, size: 3, target: 3} + inputs: + fromarray: [0, 1, 3] + lenarray: 3 + size: 5 outputs: - toindex: [0, 1, 2, 3, 4, 5] + toarray: [0, 1, 3] - error: false - inputs: {length: 3, size: 3, target: 3} + inputs: + fromarray: [0, 1, 3, 4] + lenarray: 4 + size: 5 outputs: - toindex: [0, 1, 2, 3, 4, 5, 6, 7, 8] + toarray: [0, 1, 3, 4] - error: false - inputs: {length: 3, size: 3, target: 2} + inputs: + fromarray: [0, 1, 3, 4, 5] + lenarray: 5 + size: 6 outputs: - toindex: [0, 1, 3, 4, 6, 7] + toarray: [0, 1, 3, 4, 5] - error: false - inputs: {length: 6, size: 5, target: 2} + inputs: + fromarray: [0, 1, 3, 4, 5] + lenarray: 5 + size: 7 outputs: - toindex: [0, 1, 5, 6, 10, 11, 15, 16, 20, 21, 25, 26] + toarray: [0, 1, 3, 4, 5] - error: false - inputs: {length: 3, size: 2, target: 1} + inputs: + fromarray: [0, 1, 3, 4, 6, 7] + lenarray: 6 + size: 8 outputs: - toindex: [0, 2, 4] + toarray: [0, 1, 3, 4, 6, 7] - error: false - inputs: {length: 3, size: 3, target: 1} + inputs: + fromarray: [0, 1, 3, 4, 6, 7] + lenarray: 6 + size: 9 outputs: - toindex: [0, 3, 6] -- name: awkward_regularize_arrayslice - tests: + toarray: [0, 1, 3, 4, 6, 7] - error: false inputs: - flatheadptr: [0, 0, 0, 0] - lenflathead: 4 - length: 7 - outputs: {} + fromarray: [0, 1, 4] + lenarray: 3 + size: 5 + outputs: + toarray: [0, 1, 4] - error: false inputs: - flatheadptr: [0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6] - lenflathead: 18 - length: 7 - outputs: {} + fromarray: [0, 1, 4, 6, 7] + lenarray: 5 + size: 8 + outputs: + toarray: [0, 1, 4, 6, 7] - error: false inputs: - flatheadptr: [0, 1, 0, 1] - lenflathead: 4 - length: 2 - outputs: {} + fromarray: [0, 1, 4, 6, 7] + lenarray: 5 + size: 9 + outputs: + toarray: [0, 1, 4, 6, 7] - error: false inputs: - flatheadptr: [0, 1, 1, 0] - lenflathead: 4 - length: 2 - outputs: {} + fromarray: [0, 2] + lenarray: 2 + size: 3 + outputs: + toarray: [0, 2] - error: false inputs: - flatheadptr: [0, 1, 2, 3] - lenflathead: 4 - length: 5 - outputs: {} + fromarray: [0, 2] + lenarray: 2 + size: 5 + outputs: + toarray: [0, 2] - error: false inputs: - flatheadptr: [0, 1, 2, 3, 4] - lenflathead: 5 - length: 5 - outputs: {} + fromarray: [0, 2, 1, 0] + lenarray: 4 + size: 3 + outputs: + toarray: [0, 2, 1, 0] - error: false inputs: - flatheadptr: [0, 1, 2] - lenflathead: 3 - length: 5 - outputs: {} + fromarray: [0, 2, 3] + lenarray: 3 + size: 5 + outputs: + toarray: [0, 2, 3] - error: false inputs: - flatheadptr: [0, 1, 2, 4] - lenflathead: 4 - length: 5 - outputs: {} + fromarray: [0, 2, 3, 4] + lenarray: 4 + size: 5 + outputs: + toarray: [0, 2, 3, 4] - error: false inputs: - flatheadptr: [0, 1] - lenflathead: 2 - length: 5 - outputs: {} + fromarray: [0, 2, 4] + lenarray: 3 + size: 5 + outputs: + toarray: [0, 2, 4] - error: false inputs: - flatheadptr: [0, 1, 2, 6, 8] - lenflathead: 5 - length: 10 - outputs: {} + fromarray: [0, 3] + lenarray: 2 + size: 4 + outputs: + toarray: [0, 3] - error: false inputs: - flatheadptr: [0, 1, 3] - lenflathead: 3 - length: 5 - outputs: {} + fromarray: [0, 3] + lenarray: 2 + size: 5 + outputs: + toarray: [0, 3] - error: false inputs: - flatheadptr: [0, 1, 3, 4] - lenflathead: 4 - length: 5 - outputs: {} + fromarray: [0, 3, 4] + lenarray: 3 + size: 5 + outputs: + toarray: [0, 3, 4] - error: false inputs: - flatheadptr: [0, 1, 4] - lenflathead: 3 - length: 5 - outputs: {} + fromarray: [0, 4] + lenarray: 2 + size: 5 + outputs: + toarray: [0, 4] - error: false inputs: - flatheadptr: [0] - lenflathead: 1 - length: 5 - outputs: {} + fromarray: [1, 0, 0, 1] + lenarray: 4 + size: 2 + outputs: + toarray: [1, 0, 0, 1] - error: false inputs: - flatheadptr: [0, 1, 5, 7] - lenflathead: 4 - length: 9 - outputs: {} + fromarray: [1, 0, 0, 1] + lenarray: 4 + size: 3 + outputs: + toarray: [1, 0, 0, 1] - error: false inputs: - flatheadptr: [0, 1, 6, 1] - lenflathead: 4 - length: 7 - outputs: {} + fromarray: [1, 0, 0, 1] + lenarray: 4 + size: 5 + outputs: + toarray: [1, 0, 0, 1] - error: false inputs: - flatheadptr: [0, 2] - lenflathead: 2 - length: 5 - outputs: {} + fromarray: [1, 0, 1, 0] + lenarray: 4 + size: 2 + outputs: + toarray: [1, 0, 1, 0] - error: false inputs: - flatheadptr: [0, 2, 3] - lenflathead: 3 - length: 5 - outputs: {} + fromarray: [1, 0] + lenarray: 2 + size: 2 + outputs: + toarray: [1, 0] - error: false inputs: - flatheadptr: [0, 2, 3, 4] - lenflathead: 4 - length: 5 - outputs: {} + fromarray: [1, 0, 1] + lenarray: 3 + size: 2 + outputs: + toarray: [1, 0, 1] - error: false inputs: - flatheadptr: [0, 2, 4, 1, 3, 0, 2, 4, 1, 3, 0, 2, 4, 1, 3, 0, 2, 4] - lenflathead: 18 - length: 5 - outputs: {} + fromarray: [1, 0, 1, 1, 1, 0] + lenarray: 6 + size: 2 + outputs: + toarray: [1, 0, 1, 1, 1, 0] - error: false inputs: - flatheadptr: [0, 2, 4] - lenflathead: 3 - length: 5 - outputs: {} + fromarray: [1, 1, 1, 1] + lenarray: 4 + size: 2 + outputs: + toarray: [1, 1, 1, 1] - error: false inputs: - flatheadptr: [0, 3] - lenflathead: 2 - length: 5 - outputs: {} + fromarray: [1] + lenarray: 1 + size: 2 + outputs: + toarray: [1] - error: false inputs: - flatheadptr: [0, 3, 4] - lenflathead: 3 - length: 5 - outputs: {} + fromarray: [1] + lenarray: 1 + size: 5 + outputs: + toarray: [1] - error: false inputs: - flatheadptr: [0, 4] - lenflathead: 2 - length: 5 - outputs: {} + fromarray: [1, 2] + lenarray: 2 + size: 3 + outputs: + toarray: [1, 2] - error: false inputs: - flatheadptr: [1, 0, 0, 1] - lenflathead: 4 - length: 7 - outputs: {} + fromarray: [1, 2] + lenarray: 2 + size: 5 + outputs: + toarray: [1, 2] - error: false inputs: - flatheadptr: [1, 1, 0] - lenflathead: 3 - length: 2 - outputs: {} + fromarray: [1, 2, 3] + lenarray: 3 + size: 5 + outputs: + toarray: [1, 2, 3] - error: false inputs: - flatheadptr: [1] - lenflathead: 1 - length: 5 - outputs: {} + fromarray: [1, 2, 3, 4] + lenarray: 4 + size: 5 + outputs: + toarray: [1, 2, 3, 4] - error: false inputs: - flatheadptr: [1, 2] - lenflathead: 2 - length: 5 - outputs: {} + fromarray: [1, 2, 4] + lenarray: 3 + size: 5 + outputs: + toarray: [1, 2, 4] - error: false inputs: - flatheadptr: [1, 2, 3] - lenflathead: 3 - length: 5 - outputs: {} + fromarray: [1, 3] + lenarray: 2 + size: 5 + outputs: + toarray: [1, 3] - error: false inputs: - flatheadptr: [1, 2, 3, 4] - lenflathead: 4 - length: 5 - outputs: {} + fromarray: [1, 3, 4] + lenarray: 3 + size: 5 + outputs: + toarray: [1, 3, 4] - error: false inputs: - flatheadptr: [1, 2, 4] - lenflathead: 3 - length: 5 - outputs: {} + fromarray: [1, 3, 4, 6, 7] + lenarray: 5 + size: 8 + outputs: + toarray: [1, 3, 4, 6, 7] - error: false inputs: - flatheadptr: [1, 3] - lenflathead: 2 - length: 5 - outputs: {} + fromarray: [1, 3, 4, 6, 7] + lenarray: 5 + size: 9 + outputs: + toarray: [1, 3, 4, 6, 7] - error: false inputs: - flatheadptr: [1, 3, 4] - lenflathead: 3 - length: 5 - outputs: {} + fromarray: [1, 4] + lenarray: 2 + size: 5 + outputs: + toarray: [1, 4] - error: false inputs: - flatheadptr: [1, 3, 4, 5] - lenflathead: 4 - length: 8 - outputs: {} + fromarray: [2, 0, 0, 1] + lenarray: 4 + size: 5 + outputs: + toarray: [2, 0, 0, 1] - error: false inputs: - flatheadptr: [1, 4] - lenflathead: 2 - length: 5 - outputs: {} + fromarray: [2, 0, 0, 1] + lenarray: 4 + size: 6 + outputs: + toarray: [2, 0, 0, 1] - error: false inputs: - flatheadptr: [1, 5, 0, 6] - lenflathead: 4 - length: 7 - outputs: {} + fromarray: [2, 0] + lenarray: 2 + size: 3 + outputs: + toarray: [2, 0] - error: false inputs: - flatheadptr: [2, 0, 0, 1] - lenflathead: 4 - length: 5 - outputs: {} + fromarray: [2] + lenarray: 1 + size: 3 + outputs: + toarray: [2] - error: false inputs: - flatheadptr: [2, 0, 0, 1] - lenflathead: 4 - length: 7 - outputs: {} + fromarray: [2] + lenarray: 1 + size: 5 + outputs: + toarray: [2] - error: false inputs: - flatheadptr: [2] - lenflathead: 1 - length: 5 - outputs: {} + fromarray: [2, 2, 2, 2] + lenarray: 4 + size: 5 + outputs: + toarray: [2, 2, 2, 2] - error: false inputs: - flatheadptr: [2, 2, 0, 1, 1, 3] - lenflathead: 6 - length: 5 - outputs: {} + fromarray: [2, 2, 2, 2] + lenarray: 4 + size: 6 + outputs: + toarray: [2, 2, 2, 2] - error: false inputs: - flatheadptr: [2, 2, 0, 1] - lenflathead: 4 - length: 5 - outputs: {} + fromarray: [2, 2] + lenarray: 2 + size: 4 + outputs: + toarray: [2, 2] - error: false inputs: - flatheadptr: [2, 2, 2, 2] - lenflathead: 4 - length: 7 - outputs: {} + fromarray: [2, 3] + lenarray: 2 + size: 5 + outputs: + toarray: [2, 3] - error: false inputs: - flatheadptr: [2, 3] - lenflathead: 2 - length: 5 - outputs: {} + fromarray: [2, 3] + lenarray: 2 + size: 6 + outputs: + toarray: [2, 3] - error: false inputs: - flatheadptr: [2, 3, 4] - lenflathead: 3 - length: 5 - outputs: {} + fromarray: [2, 3, 4] + lenarray: 3 + size: 5 + outputs: + toarray: [2, 3, 4] - error: false inputs: - flatheadptr: [2, 3, 5, 6] - lenflathead: 4 - length: 7 - outputs: {} + fromarray: [2, 3, 4, 5, 6] + lenarray: 5 + size: 7 + outputs: + toarray: [2, 3, 4, 5, 6] - error: false inputs: - flatheadptr: [2, 4] - lenflathead: 2 - length: 5 - outputs: {} + fromarray: [2, 4] + lenarray: 2 + size: 5 + outputs: + toarray: [2, 4] - error: false inputs: - flatheadptr: [2, 4, 3, 3] - lenflathead: 4 - length: 5 - outputs: {} + fromarray: [3, 1, 1, 7] + lenarray: 4 + size: 10 + outputs: + toarray: [3, 1, 1, 7] - error: false inputs: - flatheadptr: [3] - lenflathead: 1 - length: 5 - outputs: {} + fromarray: [3, 2, 1, 0] + lenarray: 4 + size: 4 + outputs: + toarray: [3, 2, 1, 0] - error: false inputs: - flatheadptr: [3, 4] - lenflathead: 2 - length: 5 - outputs: {} + fromarray: [3, 2, 1] + lenarray: 3 + size: 4 + outputs: + toarray: [3, 2, 1] - error: false inputs: - flatheadptr: [3, 4, 5, 7, 9] - lenflathead: 5 - length: 10 - outputs: {} + fromarray: [3] + lenarray: 1 + size: 5 + outputs: + toarray: [3] - error: false inputs: - flatheadptr: [4, 1, 1, 3, 0, 4] - lenflathead: 6 - length: 7 - outputs: {} + fromarray: [3, 3, 3] + lenarray: 3 + size: 5 + outputs: + toarray: [3, 3, 3] - error: false inputs: - flatheadptr: [4, 1, 1, 3] - lenflathead: 4 - length: 7 - outputs: {} + fromarray: [3, 4] + lenarray: 2 + size: 5 + outputs: + toarray: [3, 4] - error: false inputs: - flatheadptr: [4] - lenflathead: 1 - length: 5 - outputs: {} + fromarray: [4, 3, 2, 1] + lenarray: 4 + size: 8 + outputs: + toarray: [4, 3, 2, 1] - error: false inputs: - flatheadptr: [5, 2, 2, 3, 9, 0, 1] - lenflathead: 7 - length: 10 - outputs: {} + fromarray: [4, 3, 2] + lenarray: 3 + size: 8 + outputs: + toarray: [4, 3, 2] - error: false inputs: - flatheadptr: [5, 5, 5, 5] - lenflathead: 4 - length: 7 - outputs: {} + fromarray: [4] + lenarray: 1 + size: 5 + outputs: + toarray: [4] - error: false inputs: - flatheadptr: [5, 7, 9] - lenflathead: 3 - length: 10 - outputs: {} + fromarray: [4, 4] + lenarray: 2 + size: 5 + outputs: + toarray: [4, 4] - error: false inputs: - flatheadptr: [6, 6, 6, 6] - lenflathead: 4 - length: 7 - outputs: {} + fromarray: [4, 5] + lenarray: 2 + size: 6 + outputs: + toarray: [4, 5] +- name: awkward_RegularArray_getitem_next_at + tests: - error: false - inputs: - flatheadptr: [7, 3, 3, 5] - lenflathead: 4 - length: 10 - outputs: {} + inputs: {at: 0, length: 1, size: 1} + outputs: + tocarry: [0] - error: false - inputs: - flatheadptr: [7, 3, 3, 5] - lenflathead: 4 - length: 9 - outputs: {} + inputs: {at: 0, length: 1, size: 2} + outputs: + tocarry: [0] - error: false - inputs: - flatheadptr: [7, 3, 3, 6] - lenflathead: 4 - length: 10 - outputs: {} -- name: awkward_RegularArray_compact_offsets - tests: + inputs: {at: 0, length: 1, size: 3} + outputs: + tocarry: [0] - error: false - inputs: {length: 1, size: 1} + inputs: {at: 0, length: 1, size: 5} outputs: - tooffsets: [0, 1] + tocarry: [0] - error: false - inputs: {length: 2, size: 1} + inputs: {at: 0, length: 1, size: 6} outputs: - tooffsets: [0, 1, 2] + tocarry: [0] - error: false - inputs: {length: 3, size: 1} + inputs: {at: 0, length: 2, size: 5} outputs: - tooffsets: [0, 1, 2, 3] + tocarry: [0, 5] - error: false - inputs: {length: 6, size: 1} + inputs: {at: 1, length: 1, size: 2} outputs: - tooffsets: [0, 1, 2, 3, 4, 5, 6] + tocarry: [1] - error: false - inputs: {length: 3, size: 2} + inputs: {at: 1, length: 1, size: 3} outputs: - tooffsets: [0, 2, 4, 6] + tocarry: [1] - error: false - inputs: {length: 1, size: 3} + inputs: {at: 1, length: 1, size: 4} outputs: - tooffsets: [0, 3] + tocarry: [1] - error: false - inputs: {length: 2, size: 3} + inputs: {at: 1, length: 1, size: 5} outputs: - tooffsets: [0, 3, 6] + tocarry: [1] - error: false - inputs: {length: 1, size: 4} + inputs: {at: 1, length: 1, size: 6} outputs: - tooffsets: [0, 4] + tocarry: [1] - error: false - inputs: {length: 6, size: 5} + inputs: {at: 1, length: 2, size: 5} outputs: - tooffsets: [0, 5, 10, 15, 20, 25, 30] + tocarry: [1, 6] - error: false - inputs: {length: 4, size: 5} + inputs: {at: 2, length: 1, size: 3} outputs: - tooffsets: [0, 5, 10, 15, 20] + tocarry: [2] - error: false - inputs: {length: 1, size: 5} + inputs: {at: 2, length: 1, size: 4} outputs: - tooffsets: [0, 5] + tocarry: [2] - error: false - inputs: {length: 30, size: 7} + inputs: {at: 2, length: 1, size: 5} outputs: - tooffsets: [0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, 112, - 119, 126, 133, 140, 147, 154, 161, 168, 175, 182, 189, 196, 203, 210] -- name: awkward_RegularArray_getitem_carry - tests: + tocarry: [2] - error: false - inputs: - fromcarry: [0, 0] - lencarry: 2 - size: 1 + inputs: {at: 2, length: 1, size: 6} outputs: - tocarry: [0, 0] + tocarry: [2] - error: false - inputs: - fromcarry: [0, 0, 0, 1, 1, 1] - lencarry: 6 - size: 1 + inputs: {at: 2, length: 5, size: 5} outputs: - tocarry: [0, 0, 0, 1, 1, 1] + tocarry: [2, 7, 12, 17, 22] - error: false - inputs: - fromcarry: [0, 0, 0, 2, 2] - lencarry: 5 - size: 1 + inputs: {at: 3, length: 1, size: 4} outputs: - tocarry: [0, 0, 0, 2, 2] + tocarry: [3] - error: false - inputs: - fromcarry: [0, 0, 1, 1, 2, 2, 3, 3, 4, 4] - lencarry: 10 - size: 1 + inputs: {at: 3, length: 1, size: 5} outputs: - tocarry: [0, 0, 1, 1, 2, 2, 3, 3, 4, 4] + tocarry: [3] - error: false - inputs: - fromcarry: [0, 1, 0, 1, 0, 1, 3, 4, 3, 4] - lencarry: 10 - size: 1 + inputs: {at: 4, length: 1, size: 5} outputs: - tocarry: [0, 1, 0, 1, 0, 1, 3, 4, 3, 4] + tocarry: [4] - error: false - inputs: - fromcarry: [0, 0, 1, 1] - lencarry: 4 - size: 2 + inputs: {at: 4, length: 1, size: 6} outputs: - tocarry: [0, 1, 0, 1, 2, 3, 2, 3] + tocarry: [4] +- name: awkward_RegularArray_getitem_next_range + tests: - error: false - inputs: - fromcarry: [0, 0, 0, 0] - lencarry: 4 - size: 3 + inputs: {length: 1, nextsize: 1, regular_start: 0, size: 1, step: 1} outputs: - tocarry: [0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2] + tocarry: [0] - error: false - inputs: - fromcarry: [0, 1, 1, 2] - lencarry: 4 - size: 2 + inputs: {length: 1, nextsize: 1, regular_start: 0, size: 2, step: 1} outputs: - tocarry: [0, 1, 2, 3, 2, 3, 4, 5] + tocarry: [0] - error: false - inputs: - fromcarry: [0, 0] - lencarry: 2 - size: 5 + inputs: {length: 1, nextsize: 1, regular_start: 0, size: 5, step: 1} outputs: - tocarry: [0, 1, 2, 3, 4, 0, 1, 2, 3, 4] + tocarry: [0] - error: false - inputs: - fromcarry: [0, 0, 0, 1, 1, 1] - lencarry: 6 - size: 5 + inputs: {length: 1, nextsize: 1, regular_start: 0, size: 3, step: 3} outputs: - tocarry: [0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 6, - 7, 8, 9, 5, 6, 7, 8, 9] + tocarry: [0] - error: false - inputs: - fromcarry: [0, 2, 3, 5] - lencarry: 4 - size: 5 + inputs: {length: 1, nextsize: 1, regular_start: 0, size: 5, step: 3} outputs: - tocarry: [0, 1, 2, 3, 4, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 25, 26, 27, - 28, 29] + tocarry: [0] - error: false - inputs: - fromcarry: [0, 2, 4] - lencarry: 3 - size: 5 + inputs: {length: 1, nextsize: 2, regular_start: 0, size: 2, step: 1} outputs: - tocarry: [0, 1, 2, 3, 4, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24] + tocarry: [0, 1] - error: false - inputs: - fromcarry: [0, 3, 6, 9] - lencarry: 4 - size: 5 + inputs: {length: 1, nextsize: 2, regular_start: 0, size: 3, step: 1} outputs: - tocarry: [0, 1, 2, 3, 4, 15, 16, 17, 18, 19, 30, 31, 32, 33, 34, 45, 46, 47, - 48, 49] + tocarry: [0, 1] - error: false - inputs: - fromcarry: [0, 3, 1, 4, 2, 5] - lencarry: 6 - size: 5 + inputs: {length: 1, nextsize: 3, regular_start: 0, size: 3, step: 1} outputs: - tocarry: [0, 1, 2, 3, 4, 15, 16, 17, 18, 19, 5, 6, 7, 8, 9, 20, 21, 22, 23, - 24, 10, 11, 12, 13, 14, 25, 26, 27, 28, 29] + tocarry: [0, 1, 2] - error: false - inputs: - fromcarry: [0, 4, 8, 10] - lencarry: 4 - size: 5 + inputs: {length: 1, nextsize: 4, regular_start: 0, size: 4, step: 1} outputs: - tocarry: [0, 1, 2, 3, 4, 20, 21, 22, 23, 24, 40, 41, 42, 43, 44, 50, 51, 52, - 53, 54] + tocarry: [0, 1, 2, 3] - error: false - inputs: - fromcarry: [0, 1, 1, 1] - lencarry: 4 - size: 3 + inputs: {length: 1, nextsize: 4, regular_start: 0, size: 5, step: 1} outputs: - tocarry: [0, 1, 2, 3, 4, 5, 3, 4, 5, 3, 4, 5] + tocarry: [0, 1, 2, 3] - error: false - inputs: - fromcarry: [0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2] - lencarry: 12 - size: 5 + inputs: {length: 2, nextsize: 2, regular_start: 0, size: 2, step: 1} outputs: - tocarry: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] + tocarry: [0, 1, 2, 3] - error: false - inputs: - fromcarry: [0, 1, 2, 3, 4, 5, 3, 4, 5, 3, 4, 5] - lencarry: 12 - size: 5 + inputs: {length: 1, nextsize: 5, regular_start: 0, size: 5, step: 1} outputs: - tocarry: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29] + tocarry: [0, 1, 2, 3, 4] - error: false - inputs: - fromcarry: [2, 0, 0, 1] - lencarry: 4 - size: 5 + inputs: {length: 1, nextsize: 5, regular_start: 0, size: 6, step: 1} outputs: - tocarry: [10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + tocarry: [0, 1, 2, 3, 4] - error: false - inputs: - fromcarry: [2, 2, 2, 2] - lencarry: 4 - size: 5 + inputs: {length: 1, nextsize: 6, regular_start: 0, size: 6, step: 1} outputs: - tocarry: [10, 11, 12, 13, 14, 10, 11, 12, 13, 14, 10, 11, 12, 13, 14, 10, 11, - 12, 13, 14] + tocarry: [0, 1, 2, 3, 4, 5] - error: false - inputs: - fromcarry: [2] - lencarry: 1 - size: 5 + inputs: {length: 1, nextsize: 8, regular_start: 0, size: 8, step: 1} outputs: - tocarry: [10, 11, 12, 13, 14] + tocarry: [0, 1, 2, 3, 4, 5, 6, 7] - error: false - inputs: - fromcarry: [2, 5, 8, 11] - lencarry: 4 - size: 5 + inputs: {length: 1, nextsize: 10, regular_start: 0, size: 10, step: 1} outputs: - tocarry: [10, 11, 12, 13, 14, 25, 26, 27, 28, 29, 40, 41, 42, 43, 44, 55, 56, - 57, 58, 59] + tocarry: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - error: false - inputs: - fromcarry: [1] - lencarry: 1 - size: 1 + inputs: {length: 3, nextsize: 5, regular_start: 0, size: 5, step: 1} outputs: - tocarry: [1] + tocarry: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] - error: false - inputs: - fromcarry: [3, 4, 5, 0, 1, 2, 0, 1, 2, 3, 4, 5] - lencarry: 12 - size: 5 + inputs: {length: 5, nextsize: 5, regular_start: 0, size: 5, step: 1} outputs: - tocarry: [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 0, 1, - 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29] + tocarry: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24] - error: false - inputs: - fromcarry: [3, 4, 5, 3, 4, 5, 3, 4, 5, 3, 4, 5] - lencarry: 12 - size: 5 + inputs: {length: 2, nextsize: 4, regular_start: 0, size: 5, step: 1} outputs: - tocarry: [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29] + tocarry: [0, 1, 2, 3, 5, 6, 7, 8] - error: false - inputs: - fromcarry: [3, 4, 5] - lencarry: 3 - size: 5 + inputs: {length: 3, nextsize: 4, regular_start: 0, size: 5, step: 1} outputs: - tocarry: [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] + tocarry: [0, 1, 2, 3, 5, 6, 7, 8, 10, 11, 12, 13] - error: false - inputs: - fromcarry: [4, 4, 4, 4] - lencarry: 4 - size: 5 + inputs: {length: 5, nextsize: 4, regular_start: 0, size: 5, step: 1} outputs: - tocarry: [20, 21, 22, 23, 24, 20, 21, 22, 23, 24, 20, 21, 22, 23, 24, 20, 21, - 22, 23, 24] + tocarry: [0, 1, 2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 18, 20, 21, 22, + 23] - error: false - inputs: - fromcarry: [4] - lencarry: 1 - size: 5 + inputs: {length: 6, nextsize: 4, regular_start: 0, size: 5, step: 1} outputs: - tocarry: [20, 21, 22, 23, 24] + tocarry: [0, 1, 2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 18, 20, 21, 22, + 23, 25, 26, 27, 28] - error: false - inputs: - fromcarry: [2] - lencarry: 1 - size: 1 + inputs: {length: 1, nextsize: 2, regular_start: 0, size: 3, step: 2} outputs: - tocarry: [2] + tocarry: [0, 2] - error: false - inputs: - fromcarry: [1, 0] - lencarry: 2 - size: 2 + inputs: {length: 1, nextsize: 2, regular_start: 0, size: 5, step: 2} outputs: - tocarry: [2, 3, 0, 1] + tocarry: [0, 2] - error: false - inputs: - fromcarry: [1] - lencarry: 1 - size: 2 + inputs: {length: 1, nextsize: 3, regular_start: 0, size: 5, step: 2} outputs: - tocarry: [2, 3] + tocarry: [0, 2, 4] - error: false - inputs: - fromcarry: [1, 1, 0, 0] - lencarry: 4 - size: 2 + inputs: {length: 1, nextsize: 3, regular_start: 0, size: 6, step: 2} outputs: - tocarry: [2, 3, 2, 3, 0, 1, 0, 1] + tocarry: [0, 2, 4] - error: false - inputs: - fromcarry: [1, 2] - lencarry: 2 - size: 2 + inputs: {length: 5, nextsize: 3, regular_start: 0, size: 5, step: 2} outputs: - tocarry: [2, 3, 4, 5] + tocarry: [0, 2, 4, 5, 7, 9, 10, 12, 14, 15, 17, 19, 20, 22, 24] - error: false - inputs: - fromcarry: [1, 0, 0, 1] - lencarry: 4 - size: 3 + inputs: {length: 6, nextsize: 3, regular_start: 0, size: 5, step: 2} outputs: - tocarry: [3, 4, 5, 0, 1, 2, 0, 1, 2, 3, 4, 5] + tocarry: [0, 2, 4, 5, 7, 9, 10, 12, 14, 15, 17, 19, 20, 22, 24, 25, 27, 29] - error: false - inputs: - fromcarry: [1] - lencarry: 1 - size: 3 + inputs: {length: 1, nextsize: 4, regular_start: 0, size: 8, step: 2} outputs: - tocarry: [3, 4, 5] + tocarry: [0, 2, 4, 6] - error: false - inputs: - fromcarry: [1, 1, 1, 1] - lencarry: 4 - size: 3 + inputs: {length: 1, nextsize: 2, regular_start: 0, size: 5, step: 3} outputs: - tocarry: [3, 4, 5, 3, 4, 5, 3, 4, 5, 3, 4, 5] + tocarry: [0, 3] - error: false - inputs: - fromcarry: [2] - lencarry: 1 - size: 2 + inputs: {length: 1, nextsize: 1, regular_start: 1, size: 2, step: 1} outputs: - tocarry: [4, 5] + tocarry: [1] - error: false - inputs: - fromcarry: [1, 2] - lencarry: 2 - size: 4 + inputs: {length: 1, nextsize: 1, regular_start: 1, size: 3, step: 2} outputs: - tocarry: [4, 5, 6, 7, 8, 9, 10, 11] + tocarry: [1] - error: false - inputs: - fromcarry: [1, 2] - lencarry: 2 - size: 5 + inputs: {length: 1, nextsize: 1, regular_start: 1, size: 3, step: 3} outputs: - tocarry: [5, 6, 7, 8, 9, 10, 11, 12, 13, 14] + tocarry: [1] - error: false - inputs: - fromcarry: [1, 2, 3, 4, 5] - lencarry: 5 - size: 5 + inputs: {length: 1, nextsize: 1, regular_start: 1, size: 5, step: 3} outputs: - tocarry: [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29] + tocarry: [1] - error: false - inputs: - fromcarry: [1] - lencarry: 1 - size: 5 + inputs: {length: 1, nextsize: 2, regular_start: 1, size: 3, step: 1} outputs: - tocarry: [5, 6, 7, 8, 9] + tocarry: [1, 2] - error: false - inputs: - fromcarry: [1, 3, 6, 10] - lencarry: 4 - size: 5 + inputs: {length: 1, nextsize: 2, regular_start: 1, size: 4, step: 1} outputs: - tocarry: [5, 6, 7, 8, 9, 15, 16, 17, 18, 19, 30, 31, 32, 33, 34, 50, 51, 52, - 53, 54] + tocarry: [1, 2] - error: false - inputs: - fromcarry: [1, 4, 0, 5] - lencarry: 4 - size: 5 + inputs: {length: 1, nextsize: 3, regular_start: 1, size: 5, step: 1} outputs: - tocarry: [5, 6, 7, 8, 9, 20, 21, 22, 23, 24, 0, 1, 2, 3, 4, 25, 26, 27, 28, - 29] + tocarry: [1, 2, 3] - error: false - inputs: - fromcarry: [2, 1, 1, 2] - lencarry: 4 - size: 4 + inputs: {length: 1, nextsize: 4, regular_start: 1, size: 5, step: 1} outputs: - tocarry: [8, 9, 10, 11, 4, 5, 6, 7, 4, 5, 6, 7, 8, 9, 10, 11] -- name: awkward_RegularArray_getitem_jagged_expand - tests: + tocarry: [1, 2, 3, 4] - error: false - inputs: - regularlength: 1 - regularsize: 4 - singleoffsets: [0, 0, 0, 0, 0] + inputs: {length: 1, nextsize: 5, regular_start: 1, size: 6, step: 1} outputs: - multistarts: [0, 0, 0, 0] - multistops: [0, 0, 0, 0] + tocarry: [1, 2, 3, 4, 5] - error: false - inputs: - regularlength: 1 - regularsize: 3 - singleoffsets: [0, 0, 0, 0] + inputs: {length: 3, nextsize: 4, regular_start: 1, size: 5, step: 1} outputs: - multistarts: [0, 0, 0] - multistops: [0, 0, 0] + tocarry: [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14] - error: false - inputs: - regularlength: 1 - regularsize: 4 - singleoffsets: [0, 0, 1, 1, 1] + inputs: {length: 5, nextsize: 4, regular_start: 1, size: 5, step: 1} outputs: - multistarts: [0, 0, 1, 1] - multistops: [0, 1, 1, 1] + tocarry: [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, + 24] - error: false - inputs: - regularlength: 1 - regularsize: 3 - singleoffsets: [0, 1, 1, 3] + inputs: {length: 6, nextsize: 4, regular_start: 1, size: 5, step: 1} outputs: - multistarts: [0, 1, 1] - multistops: [1, 1, 3] + tocarry: [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, + 24, 26, 27, 28, 29] - error: false - inputs: - regularlength: 1 - regularsize: 5 - singleoffsets: [0, 1, 1, 3, 3, 5] + inputs: {length: 2, nextsize: 4, regular_start: 1, size: 5, step: 1} outputs: - multistarts: [0, 1, 1, 3, 3] - multistops: [1, 1, 3, 3, 5] + tocarry: [1, 2, 3, 4, 6, 7, 8, 9] - error: false - inputs: - regularlength: 1 - regularsize: 5 - singleoffsets: [0, 2, 2, 2, 2, 6] + inputs: {length: 1, nextsize: 2, regular_start: 1, size: 5, step: 2} outputs: - multistarts: [0, 2, 2, 2, 2] - multistops: [2, 2, 2, 2, 6] + tocarry: [1, 3] - error: false - inputs: - regularlength: 1 - regularsize: 3 - singleoffsets: [0, 2, 2, 3] + inputs: {length: 1, nextsize: 2, regular_start: 1, size: 5, step: 3} outputs: - multistarts: [0, 2, 2] - multistops: [2, 2, 3] + tocarry: [1, 4] - error: false - inputs: - regularlength: 1 - regularsize: 3 - singleoffsets: [0, 2, 2, 4] + inputs: {length: 1, nextsize: 1, regular_start: 2, size: 3, step: 1} outputs: - multistarts: [0, 2, 2] - multistops: [2, 2, 4] + tocarry: [2] - error: false - inputs: - regularlength: 1 - regularsize: 2 - singleoffsets: [0, 2, 4] + inputs: {length: 1, nextsize: 1, regular_start: 2, size: 3, step: 2} outputs: - multistarts: [0, 2] - multistops: [2, 4] + tocarry: [2] - error: false - inputs: - regularlength: 1 - regularsize: 7 - singleoffsets: [0, 2, 2, 4, 4, 5, 5, 8] + inputs: {length: 1, nextsize: 1, regular_start: 2, size: 3, step: 3} outputs: - multistarts: [0, 2, 2, 4, 4, 5, 5] - multistops: [2, 2, 4, 4, 5, 5, 8] + tocarry: [2] - error: false - inputs: - regularlength: 1 - regularsize: 5 - singleoffsets: [0, 2, 2, 4, 5, 6] + inputs: {length: 1, nextsize: 1, regular_start: 2, size: 5, step: 3} outputs: - multistarts: [0, 2, 2, 4, 5] - multistops: [2, 2, 4, 5, 6] + tocarry: [2] - error: false - inputs: - regularlength: 1 - regularsize: 5 - singleoffsets: [0, 2, 2, 4, 5, 8] + inputs: {length: 1, nextsize: 3, regular_start: 2, size: 5, step: 1} outputs: - multistarts: [0, 2, 2, 4, 5] - multistops: [2, 2, 4, 5, 8] + tocarry: [2, 3, 4] - error: false - inputs: - regularlength: 1 - regularsize: 5 - singleoffsets: [0, 2, 2, 4, 5, 9] + inputs: {length: 1, nextsize: 2, regular_start: 3, size: 5, step: 1} outputs: - multistarts: [0, 2, 2, 4, 5] - multistops: [2, 2, 4, 5, 9] - - error: false + tocarry: [3, 4] +- name: awkward_RegularArray_getitem_next_range_spreadadvanced + tests: + - error: false inputs: - regularlength: 1 - regularsize: 3 - singleoffsets: [0, 2, 3, 4] + fromadvanced: [0] + length: 1 + nextsize: 2 outputs: - multistarts: [0, 2, 3] - multistops: [2, 3, 4] + toadvanced: [0, 0] - error: false inputs: - regularlength: 1 - regularsize: 4 - singleoffsets: [0, 2, 3, 3, 5] + fromadvanced: [0, 1] + length: 2 + nextsize: 2 outputs: - multistarts: [0, 2, 3, 3] - multistops: [2, 3, 3, 5] + toadvanced: [0, 0, 1, 1] +- name: awkward_RegularArray_broadcast_tooffsets + tests: - error: false inputs: - regularlength: 1 - regularsize: 4 - singleoffsets: [0, 2, 3, 4, 7] - outputs: - multistarts: [0, 2, 3, 4] - multistops: [2, 3, 4, 7] + fromoffsets: [0, 2, 4, 6] + offsetslength: 4 + size: 2 + outputs: {} - error: false inputs: - regularlength: 1 - regularsize: 3 - singleoffsets: [0, 2, 5, 7] - outputs: - multistarts: [0, 2, 5] - multistops: [2, 5, 7] + fromoffsets: [0, 3] + offsetslength: 2 + size: 3 + outputs: {} - error: false inputs: - regularlength: 1 - regularsize: 3 - singleoffsets: [0, 2, 6, 8] - outputs: - multistarts: [0, 2, 6] - multistops: [2, 6, 8] + fromoffsets: [0, 3, 6] + offsetslength: 3 + size: 3 + outputs: {} - error: false inputs: - regularlength: 2 - regularsize: 2 - singleoffsets: [0, 3, 4] - outputs: - multistarts: [0, 3, 0, 3] - multistops: [3, 4, 3, 4] + fromoffsets: [0, 4] + offsetslength: 2 + size: 4 + outputs: {} - error: false inputs: - regularlength: 1 - regularsize: 3 - singleoffsets: [0, 3, 3, 4] - outputs: - multistarts: [0, 3, 3] - multistops: [3, 3, 4] + fromoffsets: [0, 5, 10, 15, 20, 25, 30] + offsetslength: 7 + size: 5 + outputs: {} - error: false inputs: - regularlength: 1 - regularsize: 3 - singleoffsets: [0, 3, 3, 5] - outputs: - multistarts: [0, 3, 3] - multistops: [3, 3, 5] + fromoffsets: [0, 5, 10, 15, 20] + offsetslength: 5 + size: 5 + outputs: {} - error: false inputs: - regularlength: 1 - regularsize: 5 - singleoffsets: [0, 3, 3, 3, 4, 7] + fromoffsets: [0, 5] + offsetslength: 2 + size: 5 + outputs: {} + - error: false + inputs: + fromoffsets: [0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, + 112, 119, 126, 133, 140, 147, 154, 161, 168, 175, 182, 189, 196, 203, 210] + offsetslength: 31 + size: 7 + outputs: {} +- name: awkward_RegularArray_broadcast_tooffsets_size1 + tests: + - error: false + inputs: + fromoffsets: [0, 5, 10] + offsetslength: 3 outputs: - multistarts: [0, 3, 3, 3, 4] - multistops: [3, 3, 3, 4, 7] + tocarry: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1] - error: false inputs: - regularlength: 1 - regularsize: 2 - singleoffsets: [0, 3, 4] + fromoffsets: [0, 5, 10, 15, 20, 25, 30] + offsetslength: 7 outputs: - multistarts: [0, 3] - multistops: [3, 4] + tocarry: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, + 4, 4, 4, 5, 5, 5, 5, 5] - error: false inputs: - regularlength: 1 - regularsize: 4 - singleoffsets: [0, 3, 3, 4, 5] + fromoffsets: [0, 4] + offsetslength: 2 outputs: - multistarts: [0, 3, 3, 4] - multistops: [3, 3, 4, 5] + tocarry: [0, 0, 0, 0] - error: false inputs: - regularlength: 1 - regularsize: 5 - singleoffsets: [0, 3, 3, 4, 5, 8] + fromoffsets: [0, 4, 7, 7, 9, 9, 11] + offsetslength: 7 outputs: - multistarts: [0, 3, 3, 4, 5] - multistops: [3, 3, 4, 5, 8] + tocarry: [0, 0, 0, 0, 1, 1, 1, 3, 3, 5, 5] - error: false inputs: - regularlength: 1 - regularsize: 5 - singleoffsets: [0, 3, 3, 5, 6, 9] + fromoffsets: [0, 3, 3] + offsetslength: 3 outputs: - multistarts: [0, 3, 3, 5, 6] - multistops: [3, 3, 5, 6, 9] + tocarry: [0, 0, 0] - error: false inputs: - regularlength: 1 - regularsize: 2 - singleoffsets: [0, 3, 6] + fromoffsets: [0, 3, 6] + offsetslength: 3 outputs: - multistarts: [0, 3] - multistops: [3, 6] + tocarry: [0, 0, 0, 1, 1, 1] - error: false inputs: - regularlength: 1 - regularsize: 3 - singleoffsets: [0, 4, 6, 6] + fromoffsets: [0, 3, 3, 5] + offsetslength: 4 outputs: - multistarts: [0, 4, 6] - multistops: [4, 6, 6] + tocarry: [0, 0, 0, 2, 2] - error: false inputs: - regularlength: 1 - regularsize: 5 - singleoffsets: [0, 5, 5, 6, 8, 10] + fromoffsets: [0, 3, 3, 5, 8, 8, 10] + offsetslength: 7 outputs: - multistarts: [0, 5, 5, 6, 8] - multistops: [5, 5, 6, 8, 10] -- name: awkward_RegularArray_getitem_next_array - tests: + tocarry: [0, 0, 0, 2, 2, 3, 3, 3, 5, 5] - error: false inputs: - fromarray: [0, 0, 0, 0] - lenarray: 4 - length: 1 - size: 2 + fromoffsets: [0, 3, 3, 5, 6, 10] + offsetslength: 6 outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [0, 0, 0, 0] + tocarry: [0, 0, 0, 2, 2, 3, 4, 4, 4, 4] - error: false inputs: - fromarray: [0, 0] - lenarray: 2 - length: 1 - size: 3 + fromoffsets: [0, 2, 3] + offsetslength: 3 outputs: - toadvanced: [0, 1] - tocarry: [0, 0] + tocarry: [0, 0, 1] - error: false inputs: - fromarray: [0] - lenarray: 1 - length: 1 - size: 5 + fromoffsets: [0, 2, 4, 6, 8, 10] + offsetslength: 6 outputs: - toadvanced: [0] - tocarry: [0] + tocarry: [0, 0, 1, 1, 2, 2, 3, 3, 4, 4] - error: false inputs: - fromarray: [0, 0, 1, 1, 1, 0] - lenarray: 6 - length: 1 - size: 4 + fromoffsets: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20] + offsetslength: 11 outputs: - toadvanced: [0, 1, 2, 3, 4, 5] - tocarry: [0, 0, 1, 1, 1, 0] + tocarry: [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9] - error: false inputs: - fromarray: [0, 1] - lenarray: 2 - length: 1 - size: 3 + fromoffsets: [0, 2, 4, 6, 8, 10, 12, 13, 14, 15, 16] + offsetslength: 11 outputs: - toadvanced: [0, 1] - tocarry: [0, 1] + tocarry: [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9] - error: false inputs: - fromarray: [0, 1] - lenarray: 2 - length: 1 - size: 5 + fromoffsets: [0, 1] + offsetslength: 2 outputs: - toadvanced: [0, 1] - tocarry: [0, 1] + tocarry: [0] - error: false inputs: - fromarray: [0, 1] - lenarray: 2 - length: 1 - size: 6 + fromoffsets: [0, 1, 2] + offsetslength: 3 outputs: - toadvanced: [0, 1] tocarry: [0, 1] - error: false inputs: - fromarray: [0, 1, 1, 1] - lenarray: 4 - length: 1 - size: 2 + fromoffsets: [0, 1, 5] + offsetslength: 3 outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [0, 1, 1, 1] + tocarry: [0, 1, 1, 1, 1] - error: false inputs: - fromarray: [0, 1, 2] - lenarray: 3 - length: 1 - size: 3 + fromoffsets: [0, 1, 2, 3] + offsetslength: 4 outputs: - toadvanced: [0, 1, 2] tocarry: [0, 1, 2] - error: false inputs: - fromarray: [0, 1, 2] - lenarray: 3 - length: 1 - size: 5 + fromoffsets: [0, 1, 2, 3, 4, 5, 6] + offsetslength: 7 outputs: - toadvanced: [0, 1, 2] - tocarry: [0, 1, 2] + tocarry: [0, 1, 2, 3, 4, 5] +- name: awkward_ListOffsetArray_compact_offsets + tests: - error: false inputs: - fromarray: [0, 1, 2, 3] - lenarray: 4 - length: 1 - size: 5 + fromoffsets: [3, 3, 4, 6] + length: 3 outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [0, 1, 2, 3] + tooffsets: [0, 0, 1, 3] - error: false inputs: - fromarray: [0, 1] - lenarray: 2 - length: 4 - size: 2 + fromoffsets: [3, 3, 5] + length: 2 outputs: - toadvanced: [0, 1, 0, 1, 0, 1, 0, 1] - tocarry: [0, 1, 2, 3, 4, 5, 6, 7] + tooffsets: [0, 0, 2] - error: false inputs: - fromarray: [0, 1, 2, 4] - lenarray: 4 - length: 1 - size: 5 + fromoffsets: [5, 6, 10] + length: 2 outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [0, 1, 2, 4] + tooffsets: [0, 1, 5] - error: false inputs: - fromarray: [0, 1, 3] - lenarray: 3 - length: 1 - size: 5 + fromoffsets: [3, 5, 5, 5, 5, 9] + length: 5 outputs: - toadvanced: [0, 1, 2] - tocarry: [0, 1, 3] + tooffsets: [0, 2, 2, 2, 2, 6] - error: false inputs: - fromarray: [0, 1, 3, 4] - lenarray: 4 - length: 1 - size: 5 + fromoffsets: [3, 5, 6] + length: 2 outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [0, 1, 3, 4] + tooffsets: [0, 2, 3] - error: false inputs: - fromarray: [0, 1, 3, 4, 5] - lenarray: 5 - length: 1 - size: 6 + fromoffsets: [1, 4, 4, 6] + length: 3 outputs: - toadvanced: [0, 1, 2, 3, 4] - tocarry: [0, 1, 3, 4, 5] + tooffsets: [0, 3, 3, 5] - error: false inputs: - fromarray: [0, 1, 3, 4, 5] - lenarray: 5 - length: 1 - size: 7 + fromoffsets: [1, 4, 7] + length: 2 outputs: - toadvanced: [0, 1, 2, 3, 4] - tocarry: [0, 1, 3, 4, 5] + tooffsets: [0, 3, 6] - error: false inputs: - fromarray: [0, 1, 3, 4, 6, 7] - lenarray: 6 - length: 1 - size: 8 + fromoffsets: [11, 14, 17, 20] + length: 3 outputs: - toadvanced: [0, 1, 2, 3, 4, 5] - tocarry: [0, 1, 3, 4, 6, 7] + tooffsets: [0, 3, 6, 9] - error: false inputs: - fromarray: [0, 1, 3, 4, 6, 7] - lenarray: 6 + fromoffsets: [20, 25] length: 1 - size: 9 outputs: - toadvanced: [0, 1, 2, 3, 4, 5] - tocarry: [0, 1, 3, 4, 6, 7] + tooffsets: [0, 5] +- name: awkward_ListOffsetArray_flatten_offsets + tests: - error: false inputs: - fromarray: [0, 1, 4] - lenarray: 3 - length: 1 - size: 5 + inneroffsets: [0] + inneroffsetslen: 1 + outeroffsets: [0, 0, 0, 0, 0] + outeroffsetslen: 5 outputs: - toadvanced: [0, 1, 2] - tocarry: [0, 1, 4] + tooffsets: [0, 0, 0, 0, 0] - error: false inputs: - fromarray: [0, 1, 4, 6, 7] - lenarray: 5 - length: 1 - size: 8 + inneroffsets: [0, 1, 2, 3] + inneroffsetslen: 4 + outeroffsets: [0, 0, 0, 1, 3] + outeroffsetslen: 5 outputs: - toadvanced: [0, 1, 2, 3, 4] - tocarry: [0, 1, 4, 6, 7] + tooffsets: [0, 0, 0, 1, 3] - error: false inputs: - fromarray: [0, 1, 4, 6, 7] - lenarray: 5 - length: 1 - size: 9 + inneroffsets: [0, 1, 2, 3, 4, 5, 6] + inneroffsetslen: 7 + outeroffsets: [0, 0, 1, 3, 6] + outeroffsetslen: 5 outputs: - toadvanced: [0, 1, 2, 3, 4] - tocarry: [0, 1, 4, 6, 7] + tooffsets: [0, 0, 1, 3, 6] - error: false inputs: - fromarray: [0, 2] - lenarray: 2 - length: 1 - size: 3 + inneroffsets: [0, 1, 1, 5] + inneroffsetslen: 4 + outeroffsets: [0, 0, 1, 3] + outeroffsetslen: 4 outputs: - toadvanced: [0, 1] - tocarry: [0, 2] + tooffsets: [0, 0, 1, 5] - error: false inputs: - fromarray: [0, 2] - lenarray: 2 - length: 1 - size: 5 + inneroffsets: [0, 1, 1, 6, 6] + inneroffsetslen: 5 + outeroffsets: [0, 0, 1, 4] + outeroffsetslen: 4 outputs: - toadvanced: [0, 1] - tocarry: [0, 2] + tooffsets: [0, 0, 1, 6] - error: false inputs: - fromarray: [0, 2, 1, 0] - lenarray: 4 - length: 1 - size: 3 + inneroffsets: [0, 4, 8, 12, 14, 16] + inneroffsetslen: 6 + outeroffsets: [0, 3, 3, 5] + outeroffsetslen: 4 outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [0, 2, 1, 0] + tooffsets: [0, 12, 12, 16] - error: false inputs: - fromarray: [0, 2, 3] - lenarray: 3 - length: 1 - size: 5 + inneroffsets: [0, 1, 2, 5, 5, 7, 7, 11] + inneroffsetslen: 8 + outeroffsets: [0, 1, 2, 2, 5, 7] + outeroffsetslen: 6 outputs: - toadvanced: [0, 1, 2] - tocarry: [0, 2, 3] + tooffsets: [0, 1, 2, 2, 7, 11] - error: false inputs: - fromarray: [0, 2, 3, 4] - lenarray: 4 - length: 1 - size: 5 + inneroffsets: [0, 1, 2, 3, 4, 5, 6] + inneroffsetslen: 7 + outeroffsets: [0, 1, 3, 6] + outeroffsetslen: 4 outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [0, 2, 3, 4] + tooffsets: [0, 1, 3, 6] - error: false inputs: - fromarray: [0, 2, 4] - lenarray: 3 - length: 1 - size: 5 + inneroffsets: [0, 5, 10, 15, 20, 25, 30] + inneroffsetslen: 7 + outeroffsets: [0, 3, 6] + outeroffsetslen: 3 outputs: - toadvanced: [0, 1, 2] - tocarry: [0, 2, 4] + tooffsets: [0, 15, 30] - error: false inputs: - fromarray: [0, 3] - lenarray: 2 - length: 1 - size: 5 + inneroffsets: [0, 2, 6] + inneroffsetslen: 3 + outeroffsets: [0, 1, 1, 1, 2] + outeroffsetslen: 5 outputs: - toadvanced: [0, 1] - tocarry: [0, 3] + tooffsets: [0, 2, 2, 2, 6] - error: false inputs: - fromarray: [0, 3, 4] - lenarray: 3 - length: 1 - size: 5 + inneroffsets: [0, 0, 2, 6] + inneroffsetslen: 4 + outeroffsets: [0, 2, 2, 2, 3] + outeroffsetslen: 5 outputs: - toadvanced: [0, 1, 2] - tocarry: [0, 3, 4] + tooffsets: [0, 2, 2, 2, 6] - error: false inputs: - fromarray: [0, 3] - lenarray: 2 - length: 2 - size: 4 + inneroffsets: [0, 0, 0, 2, 6] + inneroffsetslen: 5 + outeroffsets: [0, 3, 3, 3, 4] + outeroffsetslen: 5 outputs: - toadvanced: [0, 1, 0, 1] - tocarry: [0, 3, 4, 7] + tooffsets: [0, 2, 2, 2, 6] - error: false inputs: - fromarray: [0, 3] - lenarray: 2 - length: 3 - size: 4 + inneroffsets: [0, 0, 0, 0, 2, 7, 7] + inneroffsetslen: 7 + outeroffsets: [0, 4, 4, 4, 6] + outeroffsetslen: 5 outputs: - toadvanced: [0, 1, 0, 1, 0, 1] - tocarry: [0, 3, 4, 7, 8, 11] + tooffsets: [0, 2, 2, 2, 7] - error: false inputs: - fromarray: [0, 4] - lenarray: 2 - length: 1 - size: 5 + inneroffsets: [0, 3, 5, 6, 6] + inneroffsetslen: 5 + outeroffsets: [0, 1, 2, 3, 4] + outeroffsetslen: 5 outputs: - toadvanced: [0, 1] - tocarry: [0, 4] + tooffsets: [0, 3, 5, 6, 6] - error: false inputs: - fromarray: [1, 0, 0, 1] - lenarray: 4 - length: 1 - size: 2 + inneroffsets: [0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, + 112, 119, 126, 133, 140, 147, 154, 161, 168, 175, 182, 189, 196, 203, 210] + inneroffsetslen: 31 + outeroffsets: [0, 5, 10, 15, 20, 25, 30] + outeroffsetslen: 7 outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [1, 0, 0, 1] + tooffsets: [0, 35, 70, 105, 140, 175, 210] - error: false inputs: - fromarray: [1, 0] - lenarray: 2 - length: 1 - size: 2 + inneroffsets: [0, 2, 4, 6, 8, 10, 12, 13, 14, 15, 16] + inneroffsetslen: 11 + outeroffsets: [0, 2, 4, 6, 8, 10] + outeroffsetslen: 6 outputs: - toadvanced: [0, 1] - tocarry: [1, 0] + tooffsets: [0, 4, 8, 12, 14, 16] - error: false inputs: - fromarray: [1, 0, 1, 1, 1, 0] - lenarray: 6 - length: 1 - size: 2 + inneroffsets: [0, 3, 5, 6, 6, 10] + inneroffsetslen: 6 + outeroffsets: [0, 2, 2, 3, 5] + outeroffsetslen: 5 outputs: - toadvanced: [0, 1, 2, 3, 4, 5] - tocarry: [1, 0, 1, 1, 1, 0] + tooffsets: [0, 5, 5, 6, 10] - error: false inputs: - fromarray: [1] - lenarray: 1 - length: 1 - size: 2 + inneroffsets: [0, 3, 3, 5, 6, 6, 10] + inneroffsetslen: 7 + outeroffsets: [0, 3, 3, 4, 6] + outeroffsetslen: 5 outputs: - toadvanced: [0] - tocarry: [1] + tooffsets: [0, 5, 5, 6, 10] - error: false inputs: - fromarray: [1] - lenarray: 1 - length: 1 - size: 5 + inneroffsets: [0, 3, 3, 3, 5, 6, 6, 10] + inneroffsetslen: 8 + outeroffsets: [0, 4, 4, 5, 7] + outeroffsetslen: 5 outputs: - toadvanced: [0] - tocarry: [1] + tooffsets: [0, 5, 5, 6, 10] - error: false inputs: - fromarray: [1, 0, 1] - lenarray: 3 - length: 4 - size: 2 + inneroffsets: [0, 3, 3, 5, 5, 8] + inneroffsetslen: 6 + outeroffsets: [0, 3, 3, 5] + outeroffsetslen: 4 outputs: - toadvanced: [0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2] - tocarry: [1, 0, 1, 3, 2, 3, 5, 4, 5, 7, 6, 7] + tooffsets: [0, 5, 5, 8] - error: false inputs: - fromarray: [1, 0] - lenarray: 2 - length: 4 - size: 2 + inneroffsets: [0, 3, 6, 9, 12, 14, 16] + inneroffsetslen: 7 + outeroffsets: [0, 2, 4, 5, 6, 6, 6] + outeroffsetslen: 7 outputs: - toadvanced: [0, 1, 0, 1, 0, 1, 0, 1] - tocarry: [1, 0, 3, 2, 5, 4, 7, 6] + tooffsets: [0, 6, 12, 14, 16, 16, 16] - error: false inputs: - fromarray: [1, 1, 1, 1] - lenarray: 4 - length: 1 - size: 2 + inneroffsets: [0, 2, 4, 6, 8, 10] + inneroffsetslen: 6 + outeroffsets: [0, 3, 3, 5] + outeroffsetslen: 4 outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [1, 1, 1, 1] + tooffsets: [0, 6, 6, 10] - error: false inputs: - fromarray: [1, 2] - lenarray: 2 - length: 1 - size: 3 + inneroffsets: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20] + inneroffsetslen: 11 + outeroffsets: [0, 3, 3, 5, 8, 8, 10] + outeroffsetslen: 7 outputs: - toadvanced: [0, 1] - tocarry: [1, 2] + tooffsets: [0, 6, 6, 10, 16, 16, 20] - error: false inputs: - fromarray: [1, 2] - lenarray: 2 - length: 1 - size: 5 + inneroffsets: [0, 4, 4, 4, 4, 6, 7, 7, 12, 12] + inneroffsetslen: 10 + outeroffsets: [0, 5, 5, 6, 9] + outeroffsetslen: 5 outputs: - toadvanced: [0, 1] - tocarry: [1, 2] + tooffsets: [0, 6, 6, 7, 12] - error: false inputs: - fromarray: [1, 2, 3] - lenarray: 3 - length: 1 - size: 5 + inneroffsets: [0, 3, 6, 9, 11, 13, 14] + inneroffsetslen: 7 + outeroffsets: [0, 3, 5, 6] + outeroffsetslen: 4 outputs: - toadvanced: [0, 1, 2] - tocarry: [1, 2, 3] + tooffsets: [0, 9, 13, 14] - error: false inputs: - fromarray: [1, 2, 3, 4] - lenarray: 4 - length: 1 - size: 5 + inneroffsets: [0, 3, 5, 6, 6] + inneroffsetslen: 5 + outeroffsets: [1, 2, 3, 4] + outeroffsetslen: 4 outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [1, 2, 3, 4] + tooffsets: [3, 5, 6, 6] - error: false inputs: - fromarray: [1, 2, 4] - lenarray: 3 - length: 1 - size: 5 + inneroffsets: [0, 3, 3, 5, 6, 6, 10] + inneroffsetslen: 7 + outeroffsets: [3, 3, 4, 6] + outeroffsetslen: 4 outputs: - toadvanced: [0, 1, 2] - tocarry: [1, 2, 4] + tooffsets: [5, 5, 6, 10] - error: false inputs: - fromarray: [1, 3] - lenarray: 2 - length: 1 - size: 5 + inneroffsets: [0, 3, 3, 3, 5, 6, 6, 10] + inneroffsetslen: 8 + outeroffsets: [4, 4, 5, 7] + outeroffsetslen: 4 outputs: - toadvanced: [0, 1] - tocarry: [1, 3] + tooffsets: [5, 5, 6, 10] +- name: awkward_ListOffsetArray_toRegularArray + tests: - error: false inputs: - fromarray: [1, 3, 4] - lenarray: 3 - length: 1 - size: 5 + fromoffsets: [0, 1, 2, 3] + offsetslength: 4 outputs: - toadvanced: [0, 1, 2] - tocarry: [1, 3, 4] + size: [1] - error: false inputs: - fromarray: [1, 3, 4, 6, 7] - lenarray: 5 - length: 1 - size: 8 + fromoffsets: [0, 2, 4] + offsetslength: 3 outputs: - toadvanced: [0, 1, 2, 3, 4] - tocarry: [1, 3, 4, 6, 7] + size: [2] - error: false inputs: - fromarray: [1, 3, 4, 6, 7] - lenarray: 5 - length: 1 - size: 9 + fromoffsets: [0, 2, 4, 6] + offsetslength: 4 outputs: - toadvanced: [0, 1, 2, 3, 4] - tocarry: [1, 3, 4, 6, 7] + size: [2] - error: false inputs: - fromarray: [1, 4] - lenarray: 2 - length: 1 - size: 5 + fromoffsets: [0, 4] + offsetslength: 2 outputs: - toadvanced: [0, 1] - tocarry: [1, 4] + size: [4] - error: false inputs: - fromarray: [1, 4, 0, 5] - lenarray: 4 - length: 1 - size: 6 + fromoffsets: [0, 5, 10] + offsetslength: 3 outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [1, 4, 0, 5] + size: [5] +- name: awkward_MaskedArray_getitem_next_jagged_project + tests: - error: false inputs: - fromarray: [2, 0, 0, 1] - lenarray: 4 - length: 1 - size: 6 + index: [0, 1, 2, 3] + length: 4 + starts_in: [0, 2, 3, 3] + stops_in: [2, 3, 3, 3] outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [2, 0, 0, 1] + starts_out: [0, 2, 3, 3] + stops_out: [2, 3, 3, 3] - error: false inputs: - fromarray: [2, 0] - lenarray: 2 - length: 1 - size: 3 + index: [0, 1, 2, 3] + length: 4 + starts_in: [0, 2, 3, 3] + stops_in: [2, 3, 3, 5] outputs: - toadvanced: [0, 1] - tocarry: [2, 0] + starts_out: [0, 2, 3, 3] + stops_out: [2, 3, 3, 5] - error: false inputs: - fromarray: [2, 0, 0, 1, 4] - lenarray: 5 - length: 1 - size: 5 + index: [0, 1, 2, 3] + length: 4 + starts_in: [0, 2, 3, 3] + stops_in: [2, 3, 3, 6] outputs: - toadvanced: [0, 1, 2, 3, 4] - tocarry: [2, 0, 0, 1, 4] + starts_out: [0, 2, 3, 3] + stops_out: [2, 3, 3, 6] - error: false inputs: - fromarray: [2, 0, 0, 2] - lenarray: 4 - length: 1 - size: 3 + index: [0, 1, 2, 3] + length: 4 + starts_in: [0, 2, 3, 4] + stops_in: [2, 3, 4, 7] outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [2, 0, 0, 2] + starts_out: [0, 2, 3, 4] + stops_out: [2, 3, 4, 7] +- name: awkward_ListOffsetArray_reduce_nonlocal_maxcount_offsetscopy_64 + tests: - error: false inputs: - fromarray: [2, 0, 0, 4] - lenarray: 4 - length: 1 - size: 5 + length: 3 + offsets: [0, 2, 3, 5] outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [2, 0, 0, 4] + maxcount: [2] + offsetscopy: [0, 2, 3, 5] - error: false inputs: - fromarray: [2] - lenarray: 1 - length: 1 - size: 3 + length: 3 + offsets: [0, 2, 4, 6] outputs: - toadvanced: [0] - tocarry: [2] + maxcount: [2] + offsetscopy: [0, 2, 4, 6] - error: false inputs: - fromarray: [2] - lenarray: 1 - length: 1 - size: 5 - outputs: - toadvanced: [0] - tocarry: [2] - - error: false - inputs: - fromarray: [2, 1, 1, 2] - lenarray: 4 - length: 1 - size: 3 + length: 3 + offsets: [0, 3, 3, 5] outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [2, 1, 1, 2] + maxcount: [3] + offsetscopy: [0, 3, 3, 5] - error: false inputs: - fromarray: [2, 1, 1, 3] - lenarray: 4 - length: 2 - size: 4 + length: 6 + offsets: [0, 3, 3, 5, 6, 8, 9] outputs: - toadvanced: [0, 1, 2, 3, 0, 1, 2, 3] - tocarry: [2, 1, 1, 3, 6, 5, 5, 7] + maxcount: [3] + offsetscopy: [0, 3, 3, 5, 6, 8, 9] - error: false inputs: - fromarray: [2, 1, 1, 3] - lenarray: 4 - length: 3 - size: 4 + length: 5 + offsets: [0, 3, 3, 5, 6, 9] outputs: - toadvanced: [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3] - tocarry: [2, 1, 1, 3, 6, 5, 5, 7, 10, 9, 9, 11] + maxcount: [3] + offsetscopy: [0, 3, 3, 5, 6, 9] - error: false inputs: - fromarray: [2, 2] - lenarray: 2 - length: 1 - size: 4 + length: 6 + offsets: [0, 3, 5, 5, 6, 8, 9] outputs: - toadvanced: [0, 1] - tocarry: [2, 2] + maxcount: [3] + offsetscopy: [0, 3, 5, 5, 6, 8, 9] - error: false inputs: - fromarray: [2, 2, 2, 2] - lenarray: 4 - length: 1 - size: 5 + length: 6 + offsets: [0, 3, 5, 6, 7, 7, 9] outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [2, 2, 2, 2] + maxcount: [3] + offsetscopy: [0, 3, 5, 6, 7, 7, 9] - error: false inputs: - fromarray: [2, 2, 2, 2] - lenarray: 4 - length: 1 - size: 6 + length: 5 + offsets: [0, 3, 5, 6, 7, 9] outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [2, 2, 2, 2] + maxcount: [3] + offsetscopy: [0, 3, 5, 6, 7, 9] - error: false inputs: - fromarray: [2, 3] - lenarray: 2 - length: 1 - size: 5 + length: 6 + offsets: [0, 3, 5, 7, 8, 9, 10] outputs: - toadvanced: [0, 1] - tocarry: [2, 3] + maxcount: [3] + offsetscopy: [0, 3, 5, 7, 8, 9, 10] - error: false inputs: - fromarray: [2, 3] - lenarray: 2 - length: 1 - size: 6 + length: 2 + offsets: [0, 3, 6] outputs: - toadvanced: [0, 1] - tocarry: [2, 3] + maxcount: [3] + offsetscopy: [0, 3, 6] - error: false inputs: - fromarray: [2, 3, 4] - lenarray: 3 - length: 1 - size: 5 + length: 5 + offsets: [0, 3, 6, 9, 12, 15] outputs: - toadvanced: [0, 1, 2] - tocarry: [2, 3, 4] + maxcount: [3] + offsetscopy: [0, 3, 6, 9, 12, 15] - error: false inputs: - fromarray: [2, 3, 4, 5, 6] - lenarray: 5 - length: 1 - size: 7 + length: 9 + offsets: [0, 0, 1, 3, 6, 10, 13, 15, 16, 16] outputs: - toadvanced: [0, 1, 2, 3, 4] - tocarry: [2, 3, 4, 5, 6] + maxcount: [4] + offsetscopy: [0, 0, 1, 3, 6, 10, 13, 15, 16, 16] - error: false inputs: - fromarray: [2, 4] - lenarray: 2 - length: 1 - size: 5 + length: 3 + offsets: [0, 3, 3, 7] outputs: - toadvanced: [0, 1] - tocarry: [2, 4] + maxcount: [4] + offsetscopy: [0, 3, 3, 7] - error: false inputs: - fromarray: [3] - lenarray: 1 - length: 1 - size: 5 + length: 3 + offsets: [0, 3, 6, 10] outputs: - toadvanced: [0] - tocarry: [3] + maxcount: [4] + offsetscopy: [0, 3, 6, 10] - error: false inputs: - fromarray: [3, 1, 1, 7] - lenarray: 4 - length: 1 - size: 10 + length: 3 + offsets: [0, 4, 4, 6] outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [3, 1, 1, 7] + maxcount: [4] + offsetscopy: [0, 4, 4, 6] - error: false inputs: - fromarray: [3, 2, 1, 0] - lenarray: 4 - length: 1 - size: 4 + length: 2 + offsets: [0, 4, 6] outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [3, 2, 1, 0] + maxcount: [4] + offsetscopy: [0, 4, 6] - error: false inputs: - fromarray: [3, 2, 1] - lenarray: 3 - length: 1 - size: 4 + length: 3 + offsets: [0, 4, 8, 12] outputs: - toadvanced: [0, 1, 2] - tocarry: [3, 2, 1] + maxcount: [4] + offsetscopy: [0, 4, 8, 12] - error: false inputs: - fromarray: [3, 3, 3] - lenarray: 3 - length: 1 - size: 5 + length: 6 + offsets: [0, 3, 8, 13, 18, 23, 28] outputs: - toadvanced: [0, 1, 2] - tocarry: [3, 3, 3] + maxcount: [5] + offsetscopy: [0, 3, 8, 13, 18, 23, 28] - error: false inputs: - fromarray: [3, 4] - lenarray: 2 - length: 1 - size: 5 + length: 6 + offsets: [0, 4, 9, 13, 18, 23, 28] outputs: - toadvanced: [0, 1] - tocarry: [3, 4] + maxcount: [5] + offsetscopy: [0, 4, 9, 13, 18, 23, 28] - error: false inputs: - fromarray: [3, 6, 8, 6] - lenarray: 4 - length: 1 - size: 10 + length: 6 + offsets: [0, 4, 9, 14, 19, 24, 29] outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [3, 6, 8, 6] + maxcount: [5] + offsetscopy: [0, 4, 9, 14, 19, 24, 29] - error: false inputs: - fromarray: [4] - lenarray: 1 - length: 1 - size: 5 + length: 6 + offsets: [0, 5, 10, 11, 12, 17, 22] outputs: - toadvanced: [0] - tocarry: [4] + maxcount: [5] + offsetscopy: [0, 5, 10, 11, 12, 17, 22] - error: false inputs: - fromarray: [4, 3, 2] - lenarray: 3 - length: 1 - size: 8 + length: 6 + offsets: [0, 5, 10, 14, 18, 23, 28] outputs: - toadvanced: [0, 1, 2] - tocarry: [4, 3, 2] + maxcount: [5] + offsetscopy: [0, 5, 10, 14, 18, 23, 28] - error: false inputs: - fromarray: [4, 3, 2, 1] - lenarray: 4 - length: 1 - size: 8 + length: 3 + offsets: [0, 5, 10, 15] outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [4, 3, 2, 1] + maxcount: [5] + offsetscopy: [0, 5, 10, 15] - error: false inputs: - fromarray: [4, 4] - lenarray: 2 - length: 1 - size: 5 + length: 6 + offsets: [0, 5, 10, 15, 19, 24, 28] outputs: - toadvanced: [0, 1] - tocarry: [4, 4] + maxcount: [5] + offsetscopy: [0, 5, 10, 15, 19, 24, 28] - error: false inputs: - fromarray: [4, 4, 4, 4] - lenarray: 4 - length: 1 - size: 6 + length: 4 + offsets: [0, 5, 10, 15, 20] outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [4, 4, 4, 4] + maxcount: [5] + offsetscopy: [0, 5, 10, 15, 20] - error: false inputs: - fromarray: [4, 5] - lenarray: 2 - length: 1 - size: 6 + length: 6 + offsets: [0, 5, 10, 15, 20, 24, 28] outputs: - toadvanced: [0, 1] - tocarry: [4, 5] + maxcount: [5] + offsetscopy: [0, 5, 10, 15, 20, 24, 28] - error: false inputs: - fromarray: [7, 3, 0, 2, 3, 7] - lenarray: 6 - length: 1 - size: 8 + length: 5 + offsets: [0, 5, 10, 15, 20, 25] outputs: - toadvanced: [0, 1, 2, 3, 4, 5] - tocarry: [7, 3, 0, 2, 3, 7] + maxcount: [5] + offsetscopy: [0, 5, 10, 15, 20, 25] - error: false inputs: - fromarray: [7, 3, 2, 0, 2, 3, 7] - lenarray: 7 - length: 1 - size: 8 + length: 6 + offsets: [0, 5, 10, 15, 20, 25, 28] outputs: - toadvanced: [0, 1, 2, 3, 4, 5, 6] - tocarry: [7, 3, 2, 0, 2, 3, 7] + maxcount: [5] + offsetscopy: [0, 5, 10, 15, 20, 25, 28] - error: false inputs: - fromarray: [7, 3, 2, 0, 3, 7] - lenarray: 6 - length: 1 - size: 8 + length: 6 + offsets: [0, 5, 10, 15, 20, 25, 29] outputs: - toadvanced: [0, 1, 2, 3, 4, 5] - tocarry: [7, 3, 2, 0, 3, 7] -- name: awkward_RegularArray_getitem_next_array_advanced - tests: + maxcount: [5] + offsetscopy: [0, 5, 10, 15, 20, 25, 29] - error: false inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [0, 1, 0, 1] - lenarray: 4 - length: 4 - size: 2 + length: 6 + offsets: [0, 5, 10, 15, 20, 25, 30] outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [0, 3, 4, 7] + maxcount: [5] + offsetscopy: [0, 5, 10, 15, 20, 25, 30] - error: false inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [0, 0, 0, 0] - lenarray: 4 - length: 4 - size: 3 + length: 6 + offsets: [0, 5, 6, 11, 16, 17, 22] outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [0, 3, 6, 9] + maxcount: [5] + offsetscopy: [0, 5, 6, 11, 16, 17, 22] - error: false inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [0, 1, 2, 1] - lenarray: 4 - length: 4 - size: 3 + length: 5 + offsets: [0, 5, 8, 11, 14, 17] outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [0, 4, 8, 10] + maxcount: [5] + offsetscopy: [0, 5, 8, 11, 14, 17] - error: false inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [0, 0, 0, 0] - lenarray: 4 - length: 4 - size: 5 + length: 3 + offsets: [0, 5, 9, 12] outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [0, 5, 10, 15] + maxcount: [5] + offsetscopy: [0, 5, 9, 12] +- name: awkward_ByteMaskedArray_overlay_mask + tests: - error: false inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [0, 1, 4, 1] - lenarray: 4 - length: 4 - size: 5 + length: 2 + mymask: [0, 0] + theirmask: [0, 0] + validwhen: false outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [0, 6, 14, 16] + tomask: [0, 0] +- name: awkward_IndexedArray_flatten_none2empty + tests: - error: false inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [1, 0, 1, 0] - lenarray: 4 - length: 4 - size: 2 + offsets: [0, 1, 1, 6] + offsetslength: 4 + outindex: [0, 1, 2, 1] + outindexlength: 4 outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [1, 2, 5, 6] + outoffsets: [0, 1, 1, 6, 6] - error: false inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [1, 0, 0, 1] - lenarray: 4 - length: 4 - size: 3 + offsets: [0, 3, 3, 5] + offsetslength: 4 + outindex: [0, 1, 1, 1, 2] + outindexlength: 5 outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [1, 3, 6, 10] + outoffsets: [0, 3, 3, 3, 3, 5] - error: false inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [1, 0, 0, 1] - lenarray: 4 - length: 4 - size: 5 + offsets: [0, 3, 3, 4, 7] + offsetslength: 5 + outindex: [0, 1, 2, 1, 3] + outindexlength: 5 outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [1, 5, 10, 16] + outoffsets: [0, 3, 3, 4, 4, 7] - error: false inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [1, 3, 0, 4] - lenarray: 4 - length: 4 - size: 5 + offsets: [0, 3, 3, 5, 6, 6, 10] + offsetslength: 7 + outindex: [0, 1, 2, 3, 4, 1, 5] + outindexlength: 7 outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [1, 8, 10, 19] + outoffsets: [0, 3, 3, 5, 6, 6, 6, 10] - error: false inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [2, 0, 0, 1] - lenarray: 4 - length: 4 - size: 5 + offsets: [0, 4, 4, 6] + offsetslength: 4 + outindex: [0, 1, 1, 1, 2, 1] + outindexlength: 6 outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [2, 5, 10, 16] + outoffsets: [0, 4, 4, 4, 4, 6, 6] - error: false inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [2, 2, 2, 2] - lenarray: 4 - length: 4 - size: 3 + offsets: [0, 4, 4, 6, 7, 7, 12] + offsetslength: 7 + outindex: [0, 1, 1, 1, 2, 3, 4, 5, 1] + outindexlength: 9 outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [2, 5, 8, 11] + outoffsets: [0, 4, 4, 4, 4, 6, 7, 7, 12, 12] - error: false inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [2, 2, 2, 2] - lenarray: 4 - length: 4 - size: 5 + offsets: [0, 5, 5, 6, 9] + offsetslength: 5 + outindex: [0, 1, 1, 2, 1, 3] + outindexlength: 6 outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [2, 7, 12, 17] + outoffsets: [0, 5, 5, 5, 6, 6, 9] +- name: awkward_IndexedArray_reduce_next_64 + tests: - error: false inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [3, 3, 3, 3] - lenarray: 4 - length: 4 - size: 5 + index: [0, 1] + length: 2 + parents: [0, 0] outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [3, 8, 13, 18] + nextcarry: [0, 1] + nextparents: [0, 0] + outindex: [0, 1] - error: false inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [4, 4, 4, 4] - lenarray: 4 - length: 4 - size: 5 + index: [0, 1, 2, 3, 4, 5, 6] + length: 7 + parents: [0, 0, 2, 2, 3, 4, 4] outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [4, 9, 14, 19] -- name: awkward_RegularArray_getitem_next_array_regularize - tests: + nextcarry: [0, 1, 2, 3, 4, 5, 6] + nextparents: [0, 0, 2, 2, 3, 4, 4] + outindex: [0, 1, 2, 3, 4, 5, 6] - error: false inputs: - fromarray: [0, 0, 0, 0] - lenarray: 4 - size: 2 + index: [1, 2] + length: 2 + parents: [0, 0] outputs: - toarray: [0, 0, 0, 0] + nextcarry: [1, 2] + nextparents: [0, 0] + outindex: [0, 1] - error: false inputs: - fromarray: [0, 0, 0, 0] - lenarray: 4 - size: 3 + index: [1, 2, 3] + length: 3 + parents: [0, 0, 0] outputs: - toarray: [0, 0, 0, 0] + nextcarry: [1, 2, 3] + nextparents: [0, 0, 0] + outindex: [0, 1, 2] - error: false inputs: - fromarray: [0, 0, 0, 0] - lenarray: 4 - size: 5 + index: [1, 2, 3, 4] + length: 4 + parents: [0, 0, 0, 0] outputs: - toarray: [0, 0, 0, 0] + nextcarry: [1, 2, 3, 4] + nextparents: [0, 0, 0, 0] + outindex: [0, 1, 2, 3] - error: false inputs: - fromarray: [0, 0] - lenarray: 2 - size: 3 + index: [2, 3] + length: 2 + parents: [0, 0] outputs: - toarray: [0, 0] + nextcarry: [2, 3] + nextparents: [0, 0] + outindex: [0, 1] - error: false inputs: - fromarray: [0] - lenarray: 1 - size: 5 + index: [2, 3, 4] + length: 3 + parents: [0, 0, 0] outputs: - toarray: [0] + nextcarry: [2, 3, 4] + nextparents: [0, 0, 0] + outindex: [0, 1, 2] - error: false inputs: - fromarray: [0, 1, 0, 1] - lenarray: 4 - size: 2 + index: [3, 4] + length: 2 + parents: [0, 0] outputs: - toarray: [0, 1, 0, 1] + nextcarry: [3, 4] + nextparents: [0, 0] + outindex: [0, 1] - error: false inputs: - fromarray: [0, 1] - lenarray: 2 - size: 2 + index: [4, 3, 2, 1, 0] + length: 5 + parents: [0, 0, 0, 0, 0] outputs: - toarray: [0, 1] + nextcarry: [4, 3, 2, 1, 0] + nextparents: [0, 0, 0, 0, 0] + outindex: [0, 1, 2, 3, 4] - error: false inputs: - fromarray: [0, 1] - lenarray: 2 - size: 3 + index: [5, 2, 4, 1, 3, 0] + length: 6 + parents: [0, 0, 1, 1, 2, 2] outputs: - toarray: [0, 1] + nextcarry: [5, 2, 4, 1, 3, 0] + nextparents: [0, 0, 1, 1, 2, 2] + outindex: [0, 1, 2, 3, 4, 5] - error: false inputs: - fromarray: [0, 1] - lenarray: 2 - size: 5 + index: [5, 4, 3, 2, 1, 0] + length: 6 + parents: [0, 0, 0, 1, 1, 1] outputs: - toarray: [0, 1] + nextcarry: [5, 4, 3, 2, 1, 0] + nextparents: [0, 0, 0, 1, 1, 1] + outindex: [0, 1, 2, 3, 4, 5] +- name: awkward_IndexedArray_simplify + tests: - error: false inputs: - fromarray: [0, 1] - lenarray: 2 - size: 6 + innerindex: [0, 1] + innerlength: 2 + outerindex: [0, 1] + outerlength: 2 outputs: - toarray: [0, 1] + toindex: [0, 1] - error: false inputs: - fromarray: [0, 1, 1, 1] - lenarray: 4 - size: 2 + innerindex: [0, 1, 1, 1, 2] + innerlength: 5 + outerindex: [0, 1, 2] + outerlength: 3 outputs: - toarray: [0, 1, 1, 1] + toindex: [0, 1, 1] - error: false inputs: - fromarray: [0, 1, 2] - lenarray: 3 - size: 3 + innerindex: [0, 1, 1, 1, 4] + innerlength: 5 + outerindex: [0, 1, 2] + outerlength: 3 outputs: - toarray: [0, 1, 2] + toindex: [0, 1, 1] - error: false inputs: - fromarray: [0, 1, 2] - lenarray: 3 - size: 5 + innerindex: [0, 1, 2] + innerlength: 3 + outerindex: [0, 1, 1, 1, 1, 2] + outerlength: 6 outputs: - toarray: [0, 1, 2] + toindex: [0, 1, 1, 1, 1, 2] - error: false inputs: - fromarray: [0, 1, 1, 1] - lenarray: 4 - size: 3 + innerindex: [0, 1, 2, 1, 1] + innerlength: 5 + outerindex: [0, 1, 1, 1, 2] + outerlength: 5 outputs: - toarray: [0, 1, 1, 1] + toindex: [0, 1, 1, 1, 2] - error: false inputs: - fromarray: [0, 1, 2, 3] - lenarray: 4 - size: 5 + innerindex: [0, 1, 1, 1, 2] + innerlength: 5 + outerindex: [0, 1, 2, 3, 4, 1, 1] + outerlength: 7 outputs: - toarray: [0, 1, 2, 3] + toindex: [0, 1, 1, 1, 2, 1, 1] - error: false inputs: - fromarray: [0, 1, 2, 4] - lenarray: 4 - size: 5 + innerindex: [0, 1, 1, 1, 4] + innerlength: 5 + outerindex: [0, 1, 2, 3, 4, 1, 1] + outerlength: 7 outputs: - toarray: [0, 1, 2, 4] + toindex: [0, 1, 1, 1, 4, 1, 1] - error: false inputs: - fromarray: [0, 1, 3] - lenarray: 3 - size: 5 + innerindex: [0, 1, 2, 1] + innerlength: 4 + outerindex: [0, 1, 1, 2] + outerlength: 4 outputs: - toarray: [0, 1, 3] + toindex: [0, 1, 1, 2] - error: false inputs: - fromarray: [0, 1, 3, 4] - lenarray: 4 - size: 5 + innerindex: [0, 1, 1, 2] + innerlength: 4 + outerindex: [0, 1, 1, 3] + outerlength: 4 outputs: - toarray: [0, 1, 3, 4] + toindex: [0, 1, 1, 2] - error: false inputs: - fromarray: [0, 1, 3, 4, 5] - lenarray: 5 - size: 6 + innerindex: [0, 1, 1, 2] + innerlength: 4 + outerindex: [0, 1, 2, 3] + outerlength: 4 outputs: - toarray: [0, 1, 3, 4, 5] + toindex: [0, 1, 1, 2] - error: false inputs: - fromarray: [0, 1, 3, 4, 5] - lenarray: 5 - size: 7 + innerindex: [0, 1, 2, 3] + innerlength: 4 + outerindex: [0, 1, 1, 2, 3] + outerlength: 5 outputs: - toarray: [0, 1, 3, 4, 5] + toindex: [0, 1, 1, 2, 3] - error: false inputs: - fromarray: [0, 1, 3, 4, 6, 7] - lenarray: 6 - size: 8 + innerindex: [0, 1, 2, 3] + innerlength: 4 + outerindex: [0, 1, 1, 3] + outerlength: 4 outputs: - toarray: [0, 1, 3, 4, 6, 7] + toindex: [0, 1, 1, 3] - error: false inputs: - fromarray: [0, 1, 3, 4, 6, 7] - lenarray: 6 - size: 9 + innerindex: [0, 1, 2] + innerlength: 3 + outerindex: [0, 1, 2] + outerlength: 3 outputs: - toarray: [0, 1, 3, 4, 6, 7] + toindex: [0, 1, 2] - error: false inputs: - fromarray: [0, 1, 4] - lenarray: 3 - size: 5 + innerindex: [0, 1, 2, 3] + innerlength: 4 + outerindex: [0, 1, 2, 1, 3] + outerlength: 5 outputs: - toarray: [0, 1, 4] + toindex: [0, 1, 2, 1, 3] - error: false inputs: - fromarray: [0, 1, 4, 6, 7] - lenarray: 5 - size: 8 + innerindex: [0, 1, 2, 1, 4] + innerlength: 5 + outerindex: [0, 1, 2, 3, 4] + outerlength: 5 outputs: - toarray: [0, 1, 4, 6, 7] + toindex: [0, 1, 2, 1, 4] - error: false inputs: - fromarray: [0, 1, 4, 6, 7] - lenarray: 5 - size: 9 + innerindex: [0, 1, 2, 3, 4, 5, 6, 7, 1, 1] + innerlength: 10 + outerindex: [0, 1, 2, 3, 4, 1, 1, 1, 5, 6, 1, 1, 7, 8, 9, 1] + outerlength: 16 outputs: - toarray: [0, 1, 4, 6, 7] + toindex: [0, 1, 2, 3, 4, 1, 1, 1, 5, 6, 1, 1, 7, 1, 1, 1] - error: false inputs: - fromarray: [0, 2] - lenarray: 2 - size: 3 + innerindex: [0, 1, 1, 2, 1, 1, 3, 4] + innerlength: 8 + outerindex: [2, 2, 1, 6, 5] + outerlength: 5 outputs: - toarray: [0, 2] + toindex: [1, 1, 1, 3, 1] - error: false inputs: - fromarray: [0, 2] - lenarray: 2 - size: 5 + innerindex: [13, 9, 13, 4, 8, 3, 15, 1, 16, 2, 8] + innerlength: 11 + outerindex: [0, 3, 6] + outerlength: 3 outputs: - toarray: [0, 2] + toindex: [13, 4, 15] - error: false inputs: - fromarray: [0, 2, 1, 0] - lenarray: 4 - size: 3 + innerindex: [13, 9, 13, 4, 8, 3, 15, 1, 16, 2, 8] + innerlength: 11 + outerindex: [0, 1, 2, 3, 4, 5, 6, 7, 8] + outerlength: 9 outputs: - toarray: [0, 2, 1, 0] + toindex: [13, 9, 13, 4, 8, 3, 15, 1, 16] - error: false inputs: - fromarray: [0, 2, 3] - lenarray: 3 - size: 5 + innerindex: [13, 9, 13, 4, 8, 3, 15, 1, 16, 2, 8] + innerlength: 11 + outerindex: [0, 1, 3, 4, 6, 7] + outerlength: 6 outputs: - toarray: [0, 2, 3] + toindex: [13, 9, 4, 8, 15, 1] - error: false inputs: - fromarray: [0, 2, 3, 4] - lenarray: 4 - size: 5 + innerindex: [2, 1, 1, 0] + innerlength: 4 + outerindex: [0, 1, 2, 1, 3] + outerlength: 5 outputs: - toarray: [0, 2, 3, 4] + toindex: [2, 1, 1, 1, 0] - error: false inputs: - fromarray: [0, 2, 4] - lenarray: 3 - size: 5 + innerindex: [3, 1, 1, 7] + innerlength: 4 + outerindex: [0, 1, 1, 2, 3] + outerlength: 5 outputs: - toarray: [0, 2, 4] + toindex: [3, 1, 1, 1, 7] - error: false inputs: - fromarray: [0, 3] - lenarray: 2 - size: 4 + innerindex: [3, 1, 2, 1] + innerlength: 4 + outerindex: [0, 1, 2, 1, 3] + outerlength: 5 outputs: - toarray: [0, 3] + toindex: [3, 1, 2, 1, 1] - error: false inputs: - fromarray: [0, 3] - lenarray: 2 - size: 5 + innerindex: [4, 3, 2, 1, 0] + innerlength: 5 + outerindex: [0] + outerlength: 1 outputs: - toarray: [0, 3] + toindex: [4] - error: false inputs: - fromarray: [0, 3, 4] - lenarray: 3 - size: 5 + innerindex: [4, 3, 2, 1, 0] + innerlength: 5 + outerindex: [0, 1] + outerlength: 2 outputs: - toarray: [0, 3, 4] + toindex: [4, 3] - error: false inputs: - fromarray: [0, 4] - lenarray: 2 - size: 5 + innerindex: [4, 5, 6, 7, 3, 1, 2, 0, 1, 1] + innerlength: 10 + outerindex: [0, 4, 5, 7] + outerlength: 4 outputs: - toarray: [0, 4] + toindex: [4, 3, 1, 0] - error: false inputs: - fromarray: [1, 0, 0, 1] - lenarray: 4 - size: 2 + innerindex: [4, 3, 2, 1, 0] + innerlength: 5 + outerindex: [0, 1, 2] + outerlength: 3 outputs: - toarray: [1, 0, 0, 1] + toindex: [4, 3, 2] - error: false inputs: - fromarray: [1, 0, 0, 1] - lenarray: 4 - size: 3 + innerindex: [4, 3, 2, 1, 0] + innerlength: 5 + outerindex: [0, 1, 2, 3, 4] + outerlength: 5 outputs: - toarray: [1, 0, 0, 1] + toindex: [4, 3, 2, 1, 0] - error: false inputs: - fromarray: [1, 0, 0, 1] - lenarray: 4 - size: 5 + innerindex: [4, 3, 2, 1, 0] + innerlength: 5 + outerindex: [0, 1, 2, 3] + outerlength: 4 outputs: - toarray: [1, 0, 0, 1] + toindex: [4, 3, 2, 1] - error: false inputs: - fromarray: [1, 0, 1, 0] - lenarray: 4 - size: 2 + innerindex: [0, 1, 1, 1, 2, 3, 4, 5, 6, 7] + innerlength: 10 + outerindex: [6, 7, 8, 9, 5, 1, 1, 1, 3, 4, 1, 1, 0, 1, 2, 1] + outerlength: 16 outputs: - toarray: [1, 0, 1, 0] + toindex: [4, 5, 6, 7, 3, 1, 1, 1, 1, 2, 1, 1, 0, 1, 1, 1] - error: false inputs: - fromarray: [1, 0] - lenarray: 2 - size: 2 + innerindex: [0, 1, 1, 1, 2, 3, 4, 5, 6, 7] + innerlength: 10 + outerindex: [6, 7, 8, 9, 5, 1, 1, 3, 4, 1, 0, 1, 2] + outerlength: 13 outputs: - toarray: [1, 0] + toindex: [4, 5, 6, 7, 3, 1, 1, 1, 2, 1, 0, 1, 1] - error: false inputs: - fromarray: [1, 0, 1] - lenarray: 3 - size: 2 + innerindex: [0, 1, 1, 1, 2, 3, 4, 5, 6, 7] + innerlength: 10 + outerindex: [6, 7, 8, 9, 5, 3, 4, 0, 1, 2] + outerlength: 10 outputs: - toarray: [1, 0, 1] + toindex: [4, 5, 6, 7, 3, 1, 2, 0, 1, 1] - error: false inputs: - fromarray: [1, 0, 1, 1, 1, 0] - lenarray: 6 - size: 2 + innerindex: [6, 5, 1, 3, 1, 1, 0] + innerlength: 7 + outerindex: [0, 2, 4, 6] + outerlength: 4 outputs: - toarray: [1, 0, 1, 1, 1, 0] + toindex: [6, 1, 1, 0] - error: false inputs: - fromarray: [1, 1, 1, 1] - lenarray: 4 - size: 2 + innerindex: [6, 5, 4, 3, 2, 1, 0] + innerlength: 7 + outerindex: [0, 2, 4, 6] + outerlength: 4 outputs: - toarray: [1, 1, 1, 1] + toindex: [6, 4, 2, 0] +- name: awkward_IndexedArray_validity + tests: - error: false inputs: - fromarray: [1] - lenarray: 1 - size: 2 - outputs: - toarray: [1] + index: [0, 1, 1, 1, 1, 2] + isoption: true + lencontent: 3 + length: 6 + outputs: {} - error: false inputs: - fromarray: [1] - lenarray: 1 - size: 5 - outputs: - toarray: [1] + index: [0, 1, 1, 1, 1] + isoption: true + lencontent: 2 + length: 5 + outputs: {} - error: false inputs: - fromarray: [1, 2] - lenarray: 2 - size: 3 - outputs: - toarray: [1, 2] + index: [0, 1, 1, 1, 2, 3, 4] + isoption: true + lencontent: 5 + length: 7 + outputs: {} - error: false inputs: - fromarray: [1, 2] - lenarray: 2 - size: 5 - outputs: - toarray: [1, 2] + index: [0, 1, 1, 1, 2, 3] + isoption: true + lencontent: 4 + length: 6 + outputs: {} - error: false inputs: - fromarray: [1, 2, 3] - lenarray: 3 - size: 5 - outputs: - toarray: [1, 2, 3] + index: [0, 1, 1, 1, 2] + isoption: true + lencontent: 3 + length: 5 + outputs: {} - error: false inputs: - fromarray: [1, 2, 3, 4] - lenarray: 4 - size: 5 - outputs: - toarray: [1, 2, 3, 4] + index: [0, 1, 1, 1] + isoption: true + lencontent: 2 + length: 4 + outputs: {} - error: false inputs: - fromarray: [1, 2, 4] - lenarray: 3 - size: 5 - outputs: - toarray: [1, 2, 4] + index: [0, 1, 1, 2, 1, 3] + isoption: true + lencontent: 4 + length: 6 + outputs: {} - error: false inputs: - fromarray: [1, 3] - lenarray: 2 - size: 5 - outputs: - toarray: [1, 3] + index: [0, 1, 1, 2, 1] + isoption: true + lencontent: 3 + length: 5 + outputs: {} - error: false inputs: - fromarray: [1, 3, 4] - lenarray: 3 - size: 5 - outputs: - toarray: [1, 3, 4] + index: [0, 1, 1, 2, 3, 1, 4, 5, 6] + isoption: true + lencontent: 7 + length: 9 + outputs: {} - error: false inputs: - fromarray: [1, 3, 4, 6, 7] - lenarray: 5 - size: 8 - outputs: - toarray: [1, 3, 4, 6, 7] + index: [0, 1, 1, 2, 3, 4, 1, 5] + isoption: true + lencontent: 6 + length: 8 + outputs: {} - error: false inputs: - fromarray: [1, 3, 4, 6, 7] - lenarray: 5 - size: 9 - outputs: - toarray: [1, 3, 4, 6, 7] + index: [0, 1, 1, 2, 3, 4, 5, 6, 7] + isoption: true + lencontent: 8 + length: 9 + outputs: {} - error: false inputs: - fromarray: [1, 4] - lenarray: 2 - size: 5 - outputs: - toarray: [1, 4] + index: [0, 1, 1, 2, 3, 4, 5] + isoption: true + lencontent: 6 + length: 7 + outputs: {} - error: false inputs: - fromarray: [2, 0, 0, 1] - lenarray: 4 - size: 5 - outputs: - toarray: [2, 0, 0, 1] + index: [0, 1, 1, 2, 3] + isoption: true + lencontent: 4 + length: 5 + outputs: {} - error: false inputs: - fromarray: [2, 0, 0, 1] - lenarray: 4 - size: 6 - outputs: - toarray: [2, 0, 0, 1] + index: [0, 1, 1, 2] + isoption: true + lencontent: 3 + length: 4 + outputs: {} - error: false inputs: - fromarray: [2, 0] - lenarray: 2 - size: 3 - outputs: - toarray: [2, 0] + index: [0, 1, 1] + isoption: true + lencontent: 2 + length: 3 + outputs: {} - error: false inputs: - fromarray: [2] - lenarray: 1 - size: 3 - outputs: - toarray: [2] + index: [0, 1, 2, 1, 1] + isoption: true + lencontent: 3 + length: 5 + outputs: {} - error: false inputs: - fromarray: [2] - lenarray: 1 - size: 5 - outputs: - toarray: [2] + index: [0, 1, 2, 1, 3, 1, 4] + isoption: true + lencontent: 5 + length: 7 + outputs: {} - error: false inputs: - fromarray: [2, 2, 2, 2] - lenarray: 4 - size: 5 - outputs: - toarray: [2, 2, 2, 2] + index: [0, 1, 2, 1, 3] + isoption: true + lencontent: 4 + length: 5 + outputs: {} - error: false inputs: - fromarray: [2, 2, 2, 2] - lenarray: 4 - size: 6 - outputs: - toarray: [2, 2, 2, 2] + index: [0, 1, 2, 1] + isoption: true + lencontent: 3 + length: 4 + outputs: {} - error: false inputs: - fromarray: [2, 2] - lenarray: 2 - size: 4 - outputs: - toarray: [2, 2] + index: [0, 1, 2, 3, 1, 4, 5, 6, 7, 8, 1, 9] + isoption: true + lencontent: 10 + length: 12 + outputs: {} - error: false inputs: - fromarray: [2, 3] - lenarray: 2 - size: 5 - outputs: - toarray: [2, 3] + index: [0, 1, 2, 3, 1, 4, 5, 6] + isoption: true + lencontent: 7 + length: 8 + outputs: {} - error: false inputs: - fromarray: [2, 3] - lenarray: 2 - size: 6 - outputs: - toarray: [2, 3] + index: [0, 1, 2, 3, 1, 4] + isoption: true + lencontent: 5 + length: 6 + outputs: {} - error: false inputs: - fromarray: [2, 3, 4] - lenarray: 3 - size: 5 - outputs: - toarray: [2, 3, 4] + index: [0, 1, 2, 3, 1] + isoption: true + lencontent: 4 + length: 5 + outputs: {} - error: false inputs: - fromarray: [2, 3, 4, 5, 6] - lenarray: 5 - size: 7 - outputs: - toarray: [2, 3, 4, 5, 6] + index: [1, 0, 1, 1, 1] + isoption: true + lencontent: 2 + length: 5 + outputs: {} - error: false inputs: - fromarray: [2, 4] - lenarray: 2 - size: 5 - outputs: - toarray: [2, 4] + index: [1, 0, 1, 1, 2] + isoption: true + lencontent: 3 + length: 5 + outputs: {} - error: false inputs: - fromarray: [3, 1, 1, 7] - lenarray: 4 - size: 10 - outputs: - toarray: [3, 1, 1, 7] + index: [1, 0, 1, 2, 1, 3] + isoption: true + lencontent: 4 + length: 6 + outputs: {} - error: false inputs: - fromarray: [3, 2, 1, 0] - lenarray: 4 - size: 4 - outputs: - toarray: [3, 2, 1, 0] + index: [1, 0, 1, 2, 1] + isoption: true + lencontent: 3 + length: 5 + outputs: {} - error: false inputs: - fromarray: [3, 2, 1] - lenarray: 3 - size: 4 - outputs: - toarray: [3, 2, 1] + index: [1, 0, 1, 2, 3] + isoption: true + lencontent: 4 + length: 5 + outputs: {} - error: false inputs: - fromarray: [3] - lenarray: 1 - size: 5 - outputs: - toarray: [3] + index: [1, 0, 1, 2] + isoption: true + lencontent: 3 + length: 4 + outputs: {} - error: false inputs: - fromarray: [3, 3, 3] - lenarray: 3 - size: 5 - outputs: - toarray: [3, 3, 3] + index: [1, 1, 0, 1, 1] + isoption: true + lencontent: 2 + length: 5 + outputs: {} - error: false inputs: - fromarray: [3, 4] - lenarray: 2 - size: 5 - outputs: - toarray: [3, 4] + index: [1, 1, 0, 1, 2] + isoption: true + lencontent: 3 + length: 5 + outputs: {} - error: false inputs: - fromarray: [4, 3, 2, 1] - lenarray: 4 - size: 8 - outputs: - toarray: [4, 3, 2, 1] + index: [1, 1, 1, 0, 1] + isoption: true + lencontent: 2 + length: 5 + outputs: {} - error: false inputs: - fromarray: [4, 3, 2] - lenarray: 3 - size: 8 - outputs: - toarray: [4, 3, 2] + index: [1, 4, 4, 1, 0] + isoption: true + lencontent: 10 + length: 5 + outputs: {} - error: false inputs: - fromarray: [4] - lenarray: 1 - size: 5 - outputs: - toarray: [4] + index: [2, 1, 4, 0, 8] + isoption: true + lencontent: 10 + length: 5 + outputs: {} - error: false inputs: - fromarray: [4, 4] - lenarray: 2 - size: 5 - outputs: - toarray: [4, 4] + index: [2, 2, 0, 1, 4] + isoption: true + lencontent: 5 + length: 5 + outputs: {} - error: false inputs: - fromarray: [4, 5] - lenarray: 2 - size: 6 - outputs: - toarray: [4, 5] -- name: awkward_RegularArray_getitem_next_at + index: [2, 4, 4, 0, 8] + isoption: false + lencontent: 10 + length: 5 + outputs: {} + - error: false + inputs: + index: [6, 4, 4, 8, 0] + isoption: false + lencontent: 10 + length: 5 + outputs: {} + - error: false + inputs: + index: [6, 5, 4, 3, 2, 1, 0] + isoption: false + lencontent: 7 + length: 7 + outputs: {} +- name: awkward_IndexedOptionArray_rpad_and_clip_mask_axis1 tests: - error: false - inputs: {at: 0, length: 1, size: 1} + inputs: + frommask: [0, 0, 0, 0] + length: 4 outputs: - tocarry: [0] + toindex: [0, 1, 2, 3] +- name: awkward_index_rpad_and_clip_axis1 + tests: - error: false - inputs: {at: 0, length: 1, size: 2} + inputs: {length: 4, target: 1} outputs: - tocarry: [0] + tostarts: [0, 1, 2, 3] + tostops: [1, 2, 3, 4] - error: false - inputs: {at: 0, length: 1, size: 3} + inputs: {length: 5, target: 1} outputs: - tocarry: [0] + tostarts: [0, 1, 2, 3, 4] + tostops: [1, 2, 3, 4, 5] - error: false - inputs: {at: 0, length: 1, size: 5} + inputs: {length: 6, target: 1} outputs: - tocarry: [0] + tostarts: [0, 1, 2, 3, 4, 5] + tostops: [1, 2, 3, 4, 5, 6] - error: false - inputs: {at: 0, length: 1, size: 6} + inputs: {length: 3, target: 2} outputs: - tocarry: [0] + tostarts: [0, 2, 4] + tostops: [2, 4, 6] - error: false - inputs: {at: 0, length: 2, size: 5} + inputs: {length: 7, target: 2} outputs: - tocarry: [0, 5] + tostarts: [0, 2, 4, 6, 8, 10, 12] + tostops: [2, 4, 6, 8, 10, 12, 14] - error: false - inputs: {at: 1, length: 1, size: 2} + inputs: {length: 6, target: 2} outputs: - tocarry: [1] + tostarts: [0, 2, 4, 6, 8, 10] + tostops: [2, 4, 6, 8, 10, 12] - error: false - inputs: {at: 1, length: 1, size: 3} + inputs: {length: 5, target: 2} outputs: - tocarry: [1] + tostarts: [0, 2, 4, 6, 8] + tostops: [2, 4, 6, 8, 10] - error: false - inputs: {at: 1, length: 1, size: 4} + inputs: {length: 6, target: 3} outputs: - tocarry: [1] + tostarts: [0, 3, 6, 9, 12, 15] + tostops: [3, 6, 9, 12, 15, 18] - error: false - inputs: {at: 1, length: 1, size: 5} + inputs: {length: 5, target: 3} outputs: - tocarry: [1] + tostarts: [0, 3, 6, 9, 12] + tostops: [3, 6, 9, 12, 15] - error: false - inputs: {at: 1, length: 1, size: 6} + inputs: {length: 6, target: 4} outputs: - tocarry: [1] + tostarts: [0, 4, 8, 12, 16, 20] + tostops: [4, 8, 12, 16, 20, 24] - error: false - inputs: {at: 1, length: 2, size: 5} + inputs: {length: 5, target: 4} outputs: - tocarry: [1, 6] + tostarts: [0, 4, 8, 12, 16] + tostops: [4, 8, 12, 16, 20] - error: false - inputs: {at: 2, length: 1, size: 3} + inputs: {length: 6, target: 5} outputs: - tocarry: [2] + tostarts: [0, 5, 10, 15, 20, 25] + tostops: [5, 10, 15, 20, 25, 30] - error: false - inputs: {at: 2, length: 1, size: 4} + inputs: {length: 5, target: 5} outputs: - tocarry: [2] + tostarts: [0, 5, 10, 15, 20] + tostops: [5, 10, 15, 20, 25] +- name: awkward_ListArray_combinations_length + tests: - error: false - inputs: {at: 2, length: 1, size: 5} + inputs: + length: 5 + n: 3 + replacement: false + starts: [0, 4, 4, 7, 8] + stops: [4, 4, 7, 8, 13] outputs: - tocarry: [2] + tooffsets: [0, 4, 4, 5, 5, 15] + totallen: [15] - error: false - inputs: {at: 2, length: 1, size: 6} + inputs: + length: 5 + n: 2 + replacement: false + starts: [0, 4, 4, 7, 8] + stops: [4, 4, 7, 8, 13] outputs: - tocarry: [2] + tooffsets: [0, 6, 6, 9, 9, 19] + totallen: [19] - error: false - inputs: {at: 2, length: 5, size: 5} + inputs: + length: 5 + n: 2 + replacement: true + starts: [0, 4, 4, 7, 8] + stops: [4, 4, 7, 8, 13] outputs: - tocarry: [2, 7, 12, 17, 22] + tooffsets: [0, 10, 10, 16, 17, 32] + totallen: [32] - error: false - inputs: {at: 3, length: 1, size: 4} + inputs: + length: 3 + n: 2 + replacement: false + starts: [0, 3, 3] + stops: [3, 3, 5] outputs: - tocarry: [3] + tooffsets: [0, 3, 3, 4] + totallen: [4] - error: false - inputs: {at: 3, length: 1, size: 5} + inputs: + length: 3 + n: 2 + replacement: false + starts: [0, 3, 5] + stops: [3, 3, 7] outputs: - tocarry: [3] + tooffsets: [0, 3, 3, 4] + totallen: [4] - error: false - inputs: {at: 4, length: 1, size: 5} + inputs: + length: 5 + n: 3 + replacement: true + starts: [0, 4, 4, 7, 8] + stops: [4, 4, 7, 8, 13] outputs: - tocarry: [4] + tooffsets: [0, 20, 20, 30, 31, 66] + totallen: [66] - error: false - inputs: {at: 4, length: 1, size: 6} + inputs: + length: 5 + n: 2 + replacement: false + starts: [0, 3, 3, 10, 10] + stops: [3, 3, 5, 10, 13] outputs: - tocarry: [4] -- name: awkward_RegularArray_getitem_next_range + tooffsets: [0, 3, 3, 4, 4, 7] + totallen: [7] +- name: awkward_ListArray_getitem_jagged_carrylen tests: - error: false - inputs: {length: 1, nextsize: 1, regular_start: 0, size: 1, step: 1} + inputs: + sliceouterlen: 4 + slicestarts: [0, 0, 0, 0] + slicestops: [0, 0, 0, 0] outputs: - tocarry: [0] + carrylen: [0] - error: false - inputs: {length: 1, nextsize: 1, regular_start: 0, size: 2, step: 1} + inputs: + sliceouterlen: 3 + slicestarts: [0, 0, 0] + slicestops: [0, 0, 0] outputs: - tocarry: [0] + carrylen: [0] - error: false - inputs: {length: 1, nextsize: 1, regular_start: 0, size: 5, step: 1} + inputs: + sliceouterlen: 4 + slicestarts: [0, 0, 1, 1] + slicestops: [0, 1, 1, 1] outputs: - tocarry: [0] + carrylen: [1] - error: false - inputs: {length: 1, nextsize: 1, regular_start: 0, size: 3, step: 3} + inputs: + sliceouterlen: 6 + slicestarts: [0, 1, 3, 5, 6, 8] + slicestops: [1, 3, 5, 6, 8, 10] outputs: - tocarry: [0] + carrylen: [10] - error: false - inputs: {length: 1, nextsize: 1, regular_start: 0, size: 5, step: 3} + inputs: + sliceouterlen: 5 + slicestarts: [0, 5, 5, 6, 8] + slicestops: [5, 5, 6, 8, 10] outputs: - tocarry: [0] + carrylen: [10] - error: false - inputs: {length: 1, nextsize: 2, regular_start: 0, size: 2, step: 1} + inputs: + sliceouterlen: 4 + slicestarts: [0, 3, 4, 7] + slicestops: [3, 4, 7, 11] outputs: - tocarry: [0, 1] + carrylen: [11] - error: false - inputs: {length: 1, nextsize: 2, regular_start: 0, size: 3, step: 1} + inputs: + sliceouterlen: 6 + slicestarts: [0, 1, 3, 6, 7, 9] + slicestops: [1, 3, 6, 7, 9, 12] outputs: - tocarry: [0, 1] + carrylen: [12] - error: false - inputs: {length: 1, nextsize: 3, regular_start: 0, size: 3, step: 1} + inputs: + sliceouterlen: 3 + slicestarts: [0, 0, 0] + slicestops: [0, 0, 2] outputs: - tocarry: [0, 1, 2] + carrylen: [2] - error: false - inputs: {length: 1, nextsize: 4, regular_start: 0, size: 4, step: 1} + inputs: + sliceouterlen: 3 + slicestarts: [0, 2, 2] + slicestops: [2, 2, 2] outputs: - tocarry: [0, 1, 2, 3] + carrylen: [2] - error: false - inputs: {length: 1, nextsize: 4, regular_start: 0, size: 5, step: 1} + inputs: + sliceouterlen: 3 + slicestarts: [0, 1, 1] + slicestops: [1, 1, 3] outputs: - tocarry: [0, 1, 2, 3] + carrylen: [3] - error: false - inputs: {length: 2, nextsize: 2, regular_start: 0, size: 2, step: 1} + inputs: + sliceouterlen: 5 + slicestarts: [0, 1, 1, 2, 2] + slicestops: [1, 1, 2, 2, 3] outputs: - tocarry: [0, 1, 2, 3] + carrylen: [3] - error: false - inputs: {length: 1, nextsize: 5, regular_start: 0, size: 5, step: 1} + inputs: + sliceouterlen: 3 + slicestarts: [0, 2, 2] + slicestops: [2, 2, 3] outputs: - tocarry: [0, 1, 2, 3, 4] + carrylen: [3] - error: false - inputs: {length: 1, nextsize: 5, regular_start: 0, size: 6, step: 1} + inputs: + sliceouterlen: 4 + slicestarts: [0, 2, 3, 3] + slicestops: [2, 3, 3, 3] outputs: - tocarry: [0, 1, 2, 3, 4] + carrylen: [3] - error: false - inputs: {length: 1, nextsize: 6, regular_start: 0, size: 6, step: 1} + inputs: + sliceouterlen: 5 + slicestarts: [0, 2, 2, 2, 2] + slicestops: [2, 2, 2, 2, 4] outputs: - tocarry: [0, 1, 2, 3, 4, 5] + carrylen: [4] - error: false - inputs: {length: 1, nextsize: 8, regular_start: 0, size: 8, step: 1} + inputs: + sliceouterlen: 3 + slicestarts: [0, 2, 2] + slicestops: [2, 2, 4] outputs: - tocarry: [0, 1, 2, 3, 4, 5, 6, 7] + carrylen: [4] - error: false - inputs: {length: 1, nextsize: 10, regular_start: 0, size: 10, step: 1} + inputs: + sliceouterlen: 2 + slicestarts: [0, 3] + slicestops: [3, 4] outputs: - tocarry: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + carrylen: [4] - error: false - inputs: {length: 3, nextsize: 5, regular_start: 0, size: 5, step: 1} + inputs: + sliceouterlen: 5 + slicestarts: [0, 1, 1, 3, 3] + slicestops: [1, 1, 3, 3, 5] outputs: - tocarry: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] + carrylen: [5] - error: false - inputs: {length: 5, nextsize: 5, regular_start: 0, size: 5, step: 1} + inputs: + sliceouterlen: 3 + slicestarts: [0, 2, 3] + slicestops: [2, 3, 5] outputs: - tocarry: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24] + carrylen: [5] - error: false - inputs: {length: 2, nextsize: 4, regular_start: 0, size: 5, step: 1} + inputs: + sliceouterlen: 4 + slicestarts: [0, 2, 3, 3] + slicestops: [2, 3, 3, 5] outputs: - tocarry: [0, 1, 2, 3, 5, 6, 7, 8] + carrylen: [5] - error: false - inputs: {length: 3, nextsize: 4, regular_start: 0, size: 5, step: 1} + inputs: + sliceouterlen: 3 + slicestarts: [0, 3, 3] + slicestops: [3, 3, 5] outputs: - tocarry: [0, 1, 2, 3, 5, 6, 7, 8, 10, 11, 12, 13] + carrylen: [5] - error: false - inputs: {length: 5, nextsize: 4, regular_start: 0, size: 5, step: 1} + inputs: + sliceouterlen: 3 + slicestarts: [0, 4, 5] + slicestops: [4, 4, 6] outputs: - tocarry: [0, 1, 2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 18, 20, 21, 22, - 23] + carrylen: [5] - error: false - inputs: {length: 6, nextsize: 4, regular_start: 0, size: 5, step: 1} + inputs: + sliceouterlen: 4 + slicestarts: [0, 1, 3, 4] + slicestops: [1, 3, 4, 6] outputs: - tocarry: [0, 1, 2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 18, 20, 21, 22, - 23, 25, 26, 27, 28] + carrylen: [6] - error: false - inputs: {length: 1, nextsize: 2, regular_start: 0, size: 3, step: 2} + inputs: + sliceouterlen: 5 + slicestarts: [0, 2, 2, 2, 2] + slicestops: [2, 2, 2, 2, 6] outputs: - tocarry: [0, 2] - - error: false - inputs: {length: 1, nextsize: 2, regular_start: 0, size: 5, step: 2} - outputs: - tocarry: [0, 2] - - error: false - inputs: {length: 1, nextsize: 3, regular_start: 0, size: 5, step: 2} - outputs: - tocarry: [0, 2, 4] - - error: false - inputs: {length: 1, nextsize: 3, regular_start: 0, size: 6, step: 2} - outputs: - tocarry: [0, 2, 4] - - error: false - inputs: {length: 5, nextsize: 3, regular_start: 0, size: 5, step: 2} - outputs: - tocarry: [0, 2, 4, 5, 7, 9, 10, 12, 14, 15, 17, 19, 20, 22, 24] - - error: false - inputs: {length: 6, nextsize: 3, regular_start: 0, size: 5, step: 2} - outputs: - tocarry: [0, 2, 4, 5, 7, 9, 10, 12, 14, 15, 17, 19, 20, 22, 24, 25, 27, 29] - - error: false - inputs: {length: 1, nextsize: 4, regular_start: 0, size: 8, step: 2} - outputs: - tocarry: [0, 2, 4, 6] - - error: false - inputs: {length: 1, nextsize: 2, regular_start: 0, size: 5, step: 3} - outputs: - tocarry: [0, 3] - - error: false - inputs: {length: 1, nextsize: 1, regular_start: 1, size: 2, step: 1} - outputs: - tocarry: [1] - - error: false - inputs: {length: 1, nextsize: 1, regular_start: 1, size: 3, step: 2} - outputs: - tocarry: [1] - - error: false - inputs: {length: 1, nextsize: 1, regular_start: 1, size: 3, step: 3} - outputs: - tocarry: [1] - - error: false - inputs: {length: 1, nextsize: 1, regular_start: 1, size: 5, step: 3} - outputs: - tocarry: [1] - - error: false - inputs: {length: 1, nextsize: 2, regular_start: 1, size: 3, step: 1} - outputs: - tocarry: [1, 2] + carrylen: [6] - error: false - inputs: {length: 1, nextsize: 2, regular_start: 1, size: 4, step: 1} + inputs: + sliceouterlen: 2 + slicestarts: [0, 3] + slicestops: [3, 6] outputs: - tocarry: [1, 2] + carrylen: [6] - error: false - inputs: {length: 1, nextsize: 3, regular_start: 1, size: 5, step: 1} + inputs: + sliceouterlen: 3 + slicestarts: [0, 4, 5] + slicestops: [4, 5, 6] outputs: - tocarry: [1, 2, 3] + carrylen: [6] - error: false - inputs: {length: 1, nextsize: 4, regular_start: 1, size: 5, step: 1} + inputs: + sliceouterlen: 3 + slicestarts: [0, 4, 6] + slicestops: [4, 6, 6] outputs: - tocarry: [1, 2, 3, 4] + carrylen: [6] - error: false - inputs: {length: 1, nextsize: 5, regular_start: 1, size: 6, step: 1} + inputs: + sliceouterlen: 3 + slicestarts: [0, 2, 5] + slicestops: [2, 5, 7] outputs: - tocarry: [1, 2, 3, 4, 5] + carrylen: [7] - error: false - inputs: {length: 3, nextsize: 4, regular_start: 1, size: 5, step: 1} + inputs: + sliceouterlen: 5 + slicestarts: [0, 3, 3, 3, 4] + slicestops: [3, 3, 3, 4, 7] outputs: - tocarry: [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14] + carrylen: [7] - error: false - inputs: {length: 5, nextsize: 4, regular_start: 1, size: 5, step: 1} + inputs: + sliceouterlen: 4 + slicestarts: [0, 1, 4, 5] + slicestops: [1, 4, 5, 8] outputs: - tocarry: [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, - 24] + carrylen: [8] - error: false - inputs: {length: 6, nextsize: 4, regular_start: 1, size: 5, step: 1} + inputs: + sliceouterlen: 7 + slicestarts: [0, 2, 2, 4, 4, 5, 5] + slicestops: [2, 2, 4, 4, 5, 5, 8] outputs: - tocarry: [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 23, - 24, 26, 27, 28, 29] + carrylen: [8] - error: false - inputs: {length: 2, nextsize: 4, regular_start: 1, size: 5, step: 1} + inputs: + sliceouterlen: 5 + slicestarts: [0, 2, 2, 4, 5] + slicestops: [2, 2, 4, 5, 8] outputs: - tocarry: [1, 2, 3, 4, 6, 7, 8, 9] + carrylen: [8] - error: false - inputs: {length: 1, nextsize: 2, regular_start: 1, size: 5, step: 2} + inputs: + sliceouterlen: 4 + slicestarts: [0, 3, 0, 3] + slicestops: [3, 4, 3, 4] outputs: - tocarry: [1, 3] + carrylen: [8] - error: false - inputs: {length: 1, nextsize: 2, regular_start: 1, size: 5, step: 3} + inputs: + sliceouterlen: 5 + slicestarts: [0, 3, 3, 4, 5] + slicestops: [3, 3, 4, 5, 8] outputs: - tocarry: [1, 4] + carrylen: [8] - error: false - inputs: {length: 1, nextsize: 1, regular_start: 2, size: 3, step: 1} + inputs: + sliceouterlen: 5 + slicestarts: [0, 2, 2, 4, 5] + slicestops: [2, 2, 4, 5, 9] outputs: - tocarry: [2] + carrylen: [9] - error: false - inputs: {length: 1, nextsize: 1, regular_start: 2, size: 3, step: 2} + inputs: + sliceouterlen: 5 + slicestarts: [0, 3, 3, 5, 6] + slicestops: [3, 3, 5, 6, 9] outputs: - tocarry: [2] + carrylen: [9] +- name: awkward_ListArray_getitem_jagged_descend + tests: - error: false - inputs: {length: 1, nextsize: 1, regular_start: 2, size: 3, step: 3} + inputs: + fromstarts: [0, 2] + fromstops: [2, 4] + sliceouterlen: 2 + slicestarts: [0, 2] + slicestops: [2, 4] outputs: - tocarry: [2] + tooffsets: [0, 2, 4] - error: false - inputs: {length: 1, nextsize: 1, regular_start: 2, size: 5, step: 3} + inputs: + fromstarts: [0, 3, 3, 4] + fromstops: [3, 3, 4, 5] + sliceouterlen: 4 + slicestarts: [0, 3, 3, 4] + slicestops: [3, 3, 4, 5] outputs: - tocarry: [2] + tooffsets: [0, 3, 3, 4, 5] - error: false - inputs: {length: 1, nextsize: 3, regular_start: 2, size: 5, step: 1} + inputs: + fromstarts: [0, 3, 3] + fromstops: [3, 3, 5] + sliceouterlen: 3 + slicestarts: [0, 3, 3] + slicestops: [3, 3, 5] outputs: - tocarry: [2, 3, 4] + tooffsets: [0, 3, 3, 5] - error: false - inputs: {length: 1, nextsize: 2, regular_start: 3, size: 5, step: 1} + inputs: + fromstarts: [0, 3] + fromstops: [3, 6] + sliceouterlen: 2 + slicestarts: [0, 3] + slicestops: [3, 6] outputs: - tocarry: [3, 4] -- name: awkward_RegularArray_getitem_next_range_spreadadvanced + tooffsets: [0, 3, 6] +- name: awkward_ListArray_getitem_jagged_expand tests: - error: false inputs: - fromadvanced: [0] - length: 1 - nextsize: 2 + fromstarts: [0, 2] + fromstops: [2, 4] + jaggedsize: 2 + length: 2 + singleoffsets: [0, 3, 4] outputs: - toadvanced: [0, 0] + multistarts: [0, 3, 0, 3] + multistops: [3, 4, 3, 4] + tocarry: [0, 1, 2, 3] - error: false inputs: - fromadvanced: [0, 1] - length: 2 - nextsize: 2 + fromstarts: [2] + fromstops: [4] + jaggedsize: 2 + length: 1 + singleoffsets: [0, 3, 4] outputs: - toadvanced: [0, 0, 1, 1] -- name: awkward_NumpyArray_getitem_next_range + multistarts: [0, 3] + multistops: [3, 4] + tocarry: [2, 3] +- name: awkward_ListArray_getitem_next_array tests: - error: false inputs: - carryptr: [0] - lencarry: 1 - lenhead: 6 - skip: 7 - start: 0 - step: 1 + fromarray: [0, 0, 1, 1] + fromstarts: [0] + fromstops: [2] + lenarray: 4 + lencontent: 3 + lenstarts: 1 outputs: - nextcarryptr: [0, 1, 2, 3, 4, 5] + toadvanced: [0, 1, 2, 3] + tocarry: [0, 0, 1, 1] - error: false inputs: - carryptr: [0] - lencarry: 1 - lenhead: 7 - skip: 7 - start: 0 - step: 1 + fromarray: [0, 3] + fromstarts: [0, 4, 8] + fromstops: [4, 8, 12] + lenarray: 2 + lencontent: 13 + lenstarts: 3 outputs: - nextcarryptr: [0, 1, 2, 3, 4, 5, 6] + toadvanced: [0, 1, 0, 1, 0, 1] + tocarry: [0, 3, 4, 7, 8, 11] - error: false inputs: - carryptr: [0] - lencarry: 1 - lenhead: 10 - skip: 10 - start: 0 - step: 1 + fromarray: [1, 1, 0, 0] + fromstarts: [0] + fromstops: [2] + lenarray: 4 + lencontent: 3 + lenstarts: 1 outputs: - nextcarryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + toadvanced: [0, 1, 2, 3] + tocarry: [1, 1, 0, 0] - error: false inputs: - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] - lencarry: 12 - lenhead: 7 - skip: 7 - start: 0 - step: 1 - outputs: - nextcarryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83] - - error: false - inputs: - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] - lencarry: 15 - lenhead: 7 - skip: 7 - start: 0 - step: 1 - outputs: - nextcarryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104] - - error: false - inputs: - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19] - lencarry: 20 - lenhead: 7 - skip: 7 - start: 0 - step: 1 - outputs: - nextcarryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139] - - error: false - inputs: - carryptr: [0, 1] - lencarry: 2 - lenhead: 6 - skip: 7 - start: 0 - step: 1 + fromarray: [0, 3] + fromstarts: [4, 8] + fromstops: [8, 12] + lenarray: 2 + lencontent: 13 + lenstarts: 2 outputs: - nextcarryptr: [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12] + toadvanced: [0, 1, 0, 1] + tocarry: [4, 7, 8, 11] - error: false inputs: - carryptr: [0, 1, 2, 3] - lencarry: 4 - lenhead: 6 - skip: 7 - start: 0 - step: 1 + fromarray: [2, 1, 1, 0] + fromstarts: [6] + fromstops: [10] + lenarray: 4 + lencontent: 10 + lenstarts: 1 outputs: - nextcarryptr: [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, - 21, 22, 23, 24, 25, 26] + toadvanced: [0, 1, 2, 3] + tocarry: [8, 7, 7, 6] +- name: awkward_ListArray_min_range + tests: - error: false inputs: - carryptr: [0, 1, 2, 3, 4] - lencarry: 5 - lenhead: 6 - skip: 7 - start: 0 - step: 1 + fromstarts: [0, 3, 4, 5, 8] + fromstops: [3, 3, 6, 8, 9] + lenstarts: 5 outputs: - nextcarryptr: [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, - 21, 22, 23, 24, 25, 26, 28, 29, 30, 31, 32, 33] + tomin: [0] - error: false inputs: - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] - lencarry: 12 - lenhead: 6 - skip: 7 - start: 0 - step: 1 - outputs: - nextcarryptr: [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, - 21, 22, 23, 24, 25, 26, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 40, 42, - 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 63, 64, - 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82] - - error: false - inputs: - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] - lencarry: 15 - lenhead: 6 - skip: 7 - start: 0 - step: 1 - outputs: - nextcarryptr: [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, - 21, 22, 23, 24, 25, 26, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 40, 42, - 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 63, 64, - 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 84, 85, 86, - 87, 88, 89, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103] - - error: false - inputs: - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17] - lencarry: 18 - lenhead: 6 - skip: 7 - start: 0 - step: 1 - outputs: - nextcarryptr: [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, - 21, 22, 23, 24, 25, 26, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 40, 42, - 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 63, 64, - 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 84, 85, 86, - 87, 88, 89, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 105, 106, - 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 119, 120, 121, 122, 123, - 124] - - error: false - inputs: - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23] - lencarry: 24 - lenhead: 6 - skip: 7 - start: 0 - step: 1 - outputs: - nextcarryptr: [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, - 21, 22, 23, 24, 25, 26, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 40, 42, - 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 63, 64, - 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 84, 85, 86, - 87, 88, 89, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 105, 106, - 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 119, 120, 121, 122, 123, - 124, 126, 127, 128, 129, 130, 131, 133, 134, 135, 136, 137, 138, 140, 141, - 142, 143, 144, 145, 147, 148, 149, 150, 151, 152, 154, 155, 156, 157, 158, - 159, 161, 162, 163, 164, 165, 166] - - error: false - inputs: - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24] - lencarry: 25 - lenhead: 6 - skip: 7 - start: 0 - step: 1 - outputs: - nextcarryptr: [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, - 21, 22, 23, 24, 25, 26, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 40, 42, - 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 63, 64, - 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 84, 85, 86, - 87, 88, 89, 91, 92, 93, 94, 95, 96, 98, 99, 100, 101, 102, 103, 105, 106, - 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 119, 120, 121, 122, 123, - 124, 126, 127, 128, 129, 130, 131, 133, 134, 135, 136, 137, 138, 140, 141, - 142, 143, 144, 145, 147, 148, 149, 150, 151, 152, 154, 155, 156, 157, 158, - 159, 161, 162, 163, 164, 165, 166, 168, 169, 170, 171, 172, 173] - - error: false - inputs: - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19] - lencarry: 20 - lenhead: 4 - skip: 7 - start: 0 - step: 2 - outputs: - nextcarryptr: [0, 2, 4, 6, 7, 9, 11, 13, 14, 16, 18, 20, 21, 23, 25, 27, 28, - 30, 32, 34, 35, 37, 39, 41, 42, 44, 46, 48, 49, 51, 53, 55, 56, 58, 60, 62, - 63, 65, 67, 69, 70, 72, 74, 76, 77, 79, 81, 83, 84, 86, 88, 90, 91, 93, 95, - 97, 98, 100, 102, 104, 105, 107, 109, 111, 112, 114, 116, 118, 119, 121, 123, - 125, 126, 128, 130, 132, 133, 135, 137, 139] - - error: false - inputs: - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23] - lencarry: 24 - lenhead: 4 - skip: 7 - start: 0 - step: 2 - outputs: - nextcarryptr: [0, 2, 4, 6, 7, 9, 11, 13, 14, 16, 18, 20, 21, 23, 25, 27, 28, - 30, 32, 34, 35, 37, 39, 41, 42, 44, 46, 48, 49, 51, 53, 55, 56, 58, 60, 62, - 63, 65, 67, 69, 70, 72, 74, 76, 77, 79, 81, 83, 84, 86, 88, 90, 91, 93, 95, - 97, 98, 100, 102, 104, 105, 107, 109, 111, 112, 114, 116, 118, 119, 121, 123, - 125, 126, 128, 130, 132, 133, 135, 137, 139, 140, 142, 144, 146, 147, 149, - 151, 153, 154, 156, 158, 160, 161, 163, 165, 167] - - error: false - inputs: - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24] - lencarry: 25 - lenhead: 4 - skip: 7 - start: 0 - step: 2 + fromstarts: [0, 3, 5] + fromstops: [3, 3, 7] + lenstarts: 3 outputs: - nextcarryptr: [0, 2, 4, 6, 7, 9, 11, 13, 14, 16, 18, 20, 21, 23, 25, 27, 28, - 30, 32, 34, 35, 37, 39, 41, 42, 44, 46, 48, 49, 51, 53, 55, 56, 58, 60, 62, - 63, 65, 67, 69, 70, 72, 74, 76, 77, 79, 81, 83, 84, 86, 88, 90, 91, 93, 95, - 97, 98, 100, 102, 104, 105, 107, 109, 111, 112, 114, 116, 118, 119, 121, 123, - 125, 126, 128, 130, 132, 133, 135, 137, 139, 140, 142, 144, 146, 147, 149, - 151, 153, 154, 156, 158, 160, 161, 163, 165, 167, 168, 170, 172, 174] + tomin: [0] - error: false inputs: - carryptr: [0] - lencarry: 1 - lenhead: 3 - skip: 7 - start: 1 - step: 1 + fromstarts: [6, 5, 3, 3, 0] + fromstops: [10, 6, 5, 3, 3] + lenstarts: 5 outputs: - nextcarryptr: [1, 2, 3] + tomin: [0] - error: false inputs: - carryptr: [0] - lencarry: 1 - lenhead: 6 - skip: 7 - start: 1 - step: 1 + fromstarts: [6, 5, 3, 0] + fromstops: [10, 6, 5, 3] + lenstarts: 4 outputs: - nextcarryptr: [1, 2, 3, 4, 5, 6] + tomin: [1] +- name: awkward_ListArray_rpad_and_clip_length_axis1 + tests: - error: false inputs: - carryptr: [0, 1] - lencarry: 2 - lenhead: 6 - skip: 7 - start: 1 - step: 1 + fromstarts: [0, 3, 4, 5, 8] + fromstops: [3, 3, 6, 8, 9] + lenstarts: 5 + target: 1 outputs: - nextcarryptr: [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13] + tomin: [10] - error: false inputs: - carryptr: [0, 1, 2, 3] - lencarry: 4 - lenhead: 6 - skip: 7 - start: 1 - step: 1 + fromstarts: [6, 5, 3, 0] + fromstops: [10, 6, 5, 3] + lenstarts: 4 + target: 1 outputs: - nextcarryptr: [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, - 22, 23, 24, 25, 26, 27] + tomin: [10] - error: false inputs: - carryptr: [0, 1, 2, 3, 4] - lencarry: 5 - lenhead: 6 - skip: 7 - start: 1 - step: 1 + fromstarts: [0, 3, 4, 5, 8] + fromstops: [3, 3, 6, 8, 9] + lenstarts: 5 + target: 2 outputs: - nextcarryptr: [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, - 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34] + tomin: [12] - error: false inputs: - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] - lencarry: 12 - lenhead: 6 - skip: 7 - start: 1 - step: 1 - outputs: - nextcarryptr: [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, - 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, - 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 64, 65, - 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83] - - error: false - inputs: - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] - lencarry: 15 - lenhead: 6 - skip: 7 - start: 1 - step: 1 - outputs: - nextcarryptr: [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, - 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, - 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 64, 65, - 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 85, 86, 87, - 88, 89, 90, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 104] - - error: false - inputs: - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17] - lencarry: 18 - lenhead: 6 - skip: 7 - start: 1 - step: 1 - outputs: - nextcarryptr: [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, - 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, - 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 64, 65, - 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 85, 86, 87, - 88, 89, 90, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 104, 106, 107, - 108, 109, 110, 111, 113, 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, - 125] - - error: false - inputs: - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23] - lencarry: 24 - lenhead: 6 - skip: 7 - start: 1 - step: 1 - outputs: - nextcarryptr: [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, - 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, - 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 64, 65, - 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 85, 86, 87, - 88, 89, 90, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 104, 106, 107, - 108, 109, 110, 111, 113, 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, - 125, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 141, 142, - 143, 144, 145, 146, 148, 149, 150, 151, 152, 153, 155, 156, 157, 158, 159, - 160, 162, 163, 164, 165, 166, 167] - - error: false - inputs: - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24] - lencarry: 25 - lenhead: 6 - skip: 7 - start: 1 - step: 1 - outputs: - nextcarryptr: [1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, - 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 43, - 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 64, 65, - 66, 67, 68, 69, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 85, 86, 87, - 88, 89, 90, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 104, 106, 107, - 108, 109, 110, 111, 113, 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, - 125, 127, 128, 129, 130, 131, 132, 134, 135, 136, 137, 138, 139, 141, 142, - 143, 144, 145, 146, 148, 149, 150, 151, 152, 153, 155, 156, 157, 158, 159, - 160, 162, 163, 164, 165, 166, 167, 169, 170, 171, 172, 173, 174] -- name: awkward_NumpyArray_getitem_next_range_advanced - tests: + fromstarts: [6, 5, 3, 0] + fromstops: [10, 6, 5, 3] + lenstarts: 4 + target: 3 + outputs: + tomin: [13] - error: false inputs: - advancedptr: [0, 1, 2, 3] - carryptr: [2, 0, 0, 1] - lencarry: 4 - lenhead: 3 - skip: 5 - start: 1 - step: 1 + fromstarts: [6, 5, 3, 3, 0] + fromstops: [10, 6, 5, 3, 3] + lenstarts: 5 + target: 2 outputs: - nextadvancedptr: [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3] - nextcarryptr: [11, 12, 13, 1, 2, 3, 1, 2, 3, 6, 7, 8] + tomin: [13] - error: false inputs: - advancedptr: [0, 1, 2, 3] - carryptr: [0, 1, 2, 3] - lencarry: 4 - lenhead: 1 - skip: 2 - start: 1 - step: 1 + fromstarts: [0, 3, 4, 5, 8] + fromstops: [3, 3, 6, 8, 9] + lenstarts: 5 + target: 3 outputs: - nextadvancedptr: [0, 1, 2, 3] - nextcarryptr: [1, 3, 5, 7] -- name: awkward_RegularArray_broadcast_tooffsets + tomin: [15] + - error: false + inputs: + fromstarts: [6, 5, 3, 0] + fromstops: [10, 6, 5, 3] + lenstarts: 4 + target: 4 + outputs: + tomin: [16] + - error: false + inputs: + fromstarts: [6, 5, 3, 3, 0] + fromstops: [10, 6, 5, 3, 3] + lenstarts: 5 + target: 3 + outputs: + tomin: [16] + - error: false + inputs: + fromstarts: [0, 3, 4, 5, 8] + fromstops: [3, 3, 6, 8, 9] + lenstarts: 5 + target: 4 + outputs: + tomin: [20] + - error: false + inputs: + fromstarts: [6, 5, 3, 3, 0] + fromstops: [10, 6, 5, 3, 3] + lenstarts: 5 + target: 4 + outputs: + tomin: [20] + - error: false + inputs: + fromstarts: [0, 3, 5] + fromstops: [3, 3, 7] + lenstarts: 3 + target: 3 + outputs: + tomin: [9] +- name: awkward_ListArray_validity tests: - error: false inputs: - fromoffsets: [0, 2, 4, 6] - offsetslength: 4 - size: 2 + lencontent: 0 + length: 5 + starts: [0, 0, 0, 0, 0] + stops: [0, 0, 0, 0, 0] outputs: {} - error: false inputs: - fromoffsets: [0, 3] - offsetslength: 2 - size: 3 + lencontent: 0 + length: 4 + starts: [0, 0, 0, 0] + stops: [0, 0, 0, 0] outputs: {} - error: false inputs: - fromoffsets: [0, 3, 6] - offsetslength: 3 - size: 3 + lencontent: 0 + length: 3 + starts: [0, 0, 0] + stops: [0, 0, 0] outputs: {} - error: false inputs: - fromoffsets: [0, 4] - offsetslength: 2 - size: 4 + lencontent: 1 + length: 3 + starts: [0, 0, 1] + stops: [0, 1, 1] outputs: {} - error: false inputs: - fromoffsets: [0, 5, 10, 15, 20, 25, 30] - offsetslength: 7 - size: 5 + lencontent: 4 + length: 3 + starts: [0, 0, 1] + stops: [0, 1, 4] outputs: {} - error: false inputs: - fromoffsets: [0, 5, 10, 15, 20] - offsetslength: 5 - size: 5 + lencontent: 1 + length: 4 + starts: [0, 0, 1, 1] + stops: [0, 1, 1, 1] outputs: {} - error: false inputs: - fromoffsets: [0, 5] - offsetslength: 2 - size: 5 + lencontent: 6 + length: 4 + starts: [0, 0, 1, 3] + stops: [0, 1, 3, 6] outputs: {} - error: false inputs: - fromoffsets: [0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, - 112, 119, 126, 133, 140, 147, 154, 161, 168, 175, 182, 189, 196, 203, 210] - offsetslength: 31 - size: 7 + lencontent: 10 + length: 5 + starts: [0, 0, 1, 3, 6] + stops: [0, 1, 3, 6, 10] outputs: {} -- name: awkward_RegularArray_broadcast_tooffsets_size1 - tests: - error: false inputs: - fromoffsets: [0, 5, 10] - offsetslength: 3 - outputs: - tocarry: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1] + lencontent: 19 + length: 8 + starts: [0, 0, 3, 3, 8, 12, 12, 16] + stops: [0, 3, 3, 8, 12, 12, 16, 19] + outputs: {} - error: false inputs: - fromoffsets: [0, 5, 10, 15, 20, 25, 30] - offsetslength: 7 - outputs: - tocarry: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, - 4, 4, 4, 5, 5, 5, 5, 5] + lencontent: 19 + length: 9 + starts: [0, 0, 3, 3, 8, 12, 12, 16, 19] + stops: [0, 3, 3, 8, 12, 12, 16, 19, 19] + outputs: {} - error: false inputs: - fromoffsets: [0, 4] - offsetslength: 2 - outputs: - tocarry: [0, 0, 0, 0] + lencontent: 6 + length: 3 + starts: [0, 1, 3] + stops: [1, 3, 6] + outputs: {} - error: false inputs: - fromoffsets: [0, 4, 7, 7, 9, 9, 11] - offsetslength: 7 - outputs: - tocarry: [0, 0, 0, 0, 1, 1, 1, 3, 3, 5, 5] + lencontent: 15 + length: 5 + starts: [0, 1, 3, 6, 10] + stops: [1, 3, 6, 10, 15] + outputs: {} - error: false inputs: - fromoffsets: [0, 3, 3] - offsetslength: 3 - outputs: - tocarry: [0, 0, 0] + lencontent: 12 + length: 6 + starts: [0, 1, 3, 6, 7, 9] + stops: [1, 3, 6, 7, 9, 12] + outputs: {} - error: false inputs: - fromoffsets: [0, 3, 6] - offsetslength: 3 - outputs: - tocarry: [0, 0, 0, 1, 1, 1] + lencontent: 8 + length: 4 + starts: [0, 1, 4, 5] + stops: [1, 4, 5, 8] + outputs: {} - error: false inputs: - fromoffsets: [0, 3, 3, 5] - offsetslength: 4 - outputs: - tocarry: [0, 0, 0, 2, 2] + lencontent: 3 + length: 3 + starts: [0, 2, 2] + stops: [2, 2, 3] + outputs: {} - error: false inputs: - fromoffsets: [0, 3, 3, 5, 8, 8, 10] - offsetslength: 7 - outputs: - tocarry: [0, 0, 0, 2, 2, 3, 3, 3, 5, 5] + lencontent: 4 + length: 3 + starts: [0, 2, 2] + stops: [2, 2, 4] + outputs: {} - error: false inputs: - fromoffsets: [0, 3, 3, 5, 6, 10] - offsetslength: 6 - outputs: - tocarry: [0, 0, 0, 2, 2, 3, 4, 4, 4, 4] + lencontent: 3 + length: 2 + starts: [0, 2] + stops: [2, 3] + outputs: {} - error: false inputs: - fromoffsets: [0, 2, 3] - offsetslength: 3 - outputs: - tocarry: [0, 0, 1] + lencontent: 4 + length: 2 + starts: [0, 2] + stops: [2, 4] + outputs: {} - error: false inputs: - fromoffsets: [0, 2, 4, 6, 8, 10] - offsetslength: 6 - outputs: - tocarry: [0, 0, 1, 1, 2, 2, 3, 3, 4, 4] + lencontent: 8 + length: 7 + starts: [0, 2, 2, 4, 4, 5, 5] + stops: [2, 2, 4, 4, 5, 5, 8] + outputs: {} - error: false inputs: - fromoffsets: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20] - offsetslength: 11 - outputs: - tocarry: [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9] + lencontent: 6 + length: 5 + starts: [0, 2, 2, 4, 5] + stops: [2, 2, 4, 5, 6] + outputs: {} - error: false inputs: - fromoffsets: [0, 2, 4, 6, 8, 10, 12, 13, 14, 15, 16] - offsetslength: 11 - outputs: - tocarry: [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9] + lencontent: 9 + length: 5 + starts: [0, 2, 2, 4, 5] + stops: [2, 2, 4, 5, 9] + outputs: {} - error: false inputs: - fromoffsets: [0, 1] - offsetslength: 2 - outputs: - tocarry: [0] + lencontent: 3 + length: 3 + starts: [0, 2, 3] + stops: [2, 3, 3] + outputs: {} - error: false inputs: - fromoffsets: [0, 1, 2] - offsetslength: 3 - outputs: - tocarry: [0, 1] + lencontent: 4 + length: 3 + starts: [0, 2, 3] + stops: [2, 3, 4] + outputs: {} - error: false inputs: - fromoffsets: [0, 1, 5] - offsetslength: 3 - outputs: - tocarry: [0, 1, 1, 1, 1] + lencontent: 5 + length: 3 + starts: [0, 2, 3] + stops: [2, 3, 5] + outputs: {} - error: false inputs: - fromoffsets: [0, 1, 2, 3] - offsetslength: 4 - outputs: - tocarry: [0, 1, 2] + lencontent: 6 + length: 3 + starts: [0, 2, 3] + stops: [2, 3, 6] + outputs: {} - error: false inputs: - fromoffsets: [0, 1, 2, 3, 4, 5, 6] - offsetslength: 7 - outputs: - tocarry: [0, 1, 2, 3, 4, 5] -- name: awkward_NumpyArray_getitem_next_array - tests: + lencontent: 5 + length: 4 + starts: [0, 2, 3, 3] + stops: [2, 3, 3, 5] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0] - lencarry: 1 - lenflathead: 1 - skip: 5 - outputs: - nextadvancedptr: [0] - nextcarryptr: [0] + lencontent: 7 + length: 4 + starts: [0, 2, 3, 4] + stops: [2, 3, 4, 7] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6] - lencarry: 1 - lenflathead: 18 - skip: 7 - outputs: - nextadvancedptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17] - nextcarryptr: [0, 0, 0, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6] + lencontent: 6 + length: 3 + starts: [0, 2, 4] + stops: [2, 4, 6] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 1] - lencarry: 1 - lenflathead: 2 - skip: 5 - outputs: - nextadvancedptr: [0, 1] - nextcarryptr: [0, 1] + lencontent: 7 + length: 3 + starts: [0, 2, 5] + stops: [2, 5, 7] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 1, 1, 0] - lencarry: 1 - lenflathead: 4 - skip: 2 - outputs: - nextadvancedptr: [0, 1, 2, 3] - nextcarryptr: [0, 1, 1, 0] + lencontent: 8 + length: 3 + starts: [0, 2, 6] + stops: [2, 6, 8] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 1, 2] - lencarry: 1 - lenflathead: 3 - skip: 5 - outputs: - nextadvancedptr: [0, 1, 2] - nextcarryptr: [0, 1, 2] + lencontent: 5 + length: 3 + starts: [0, 3, 3] + stops: [3, 3, 5] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 1, 2, 3] - lencarry: 1 - lenflathead: 4 - skip: 5 - outputs: - nextadvancedptr: [0, 1, 2, 3] - nextcarryptr: [0, 1, 2, 3] + lencontent: 7 + length: 3 + starts: [0, 3, 3] + stops: [3, 3, 7] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 1, 2, 3, 4] - lencarry: 1 - lenflathead: 5 - skip: 5 - outputs: - nextadvancedptr: [0, 1, 2, 3, 4] - nextcarryptr: [0, 1, 2, 3, 4] + lencontent: 8 + length: 3 + starts: [0, 3, 3] + stops: [3, 3, 8] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 1, 2, 4] - lencarry: 1 - lenflathead: 4 - skip: 5 - outputs: - nextadvancedptr: [0, 1, 2, 3] - nextcarryptr: [0, 1, 2, 4] + lencontent: 4 + length: 2 + starts: [0, 3] + stops: [3, 4] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 1, 2, 6, 8] - lencarry: 1 - lenflathead: 5 - skip: 10 - outputs: - nextadvancedptr: [0, 1, 2, 3, 4] - nextcarryptr: [0, 1, 2, 6, 8] + lencontent: 9 + length: 4 + starts: [0, 3, 3, 5] + stops: [3, 3, 5, 9] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 1, 3] - lencarry: 1 - lenflathead: 3 - skip: 5 - outputs: - nextadvancedptr: [0, 1, 2] - nextcarryptr: [0, 1, 3] + lencontent: 11 + length: 6 + starts: [0, 3, 3, 5, 6, 10] + stops: [3, 3, 5, 6, 10, 11] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 1, 3, 4] - lencarry: 1 - lenflathead: 4 - skip: 5 - outputs: - nextadvancedptr: [0, 1, 2, 3] - nextcarryptr: [0, 1, 3, 4] + lencontent: 9 + length: 5 + starts: [0, 3, 3, 5, 6] + stops: [3, 3, 5, 6, 9] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 1, 4] - lencarry: 1 - lenflathead: 3 - skip: 5 - outputs: - nextadvancedptr: [0, 1, 2] - nextcarryptr: [0, 1, 4] + lencontent: 9 + length: 6 + starts: [0, 3, 3, 5, 6, 8] + stops: [3, 3, 5, 6, 8, 9] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 1, 5, 7] - lencarry: 1 - lenflathead: 4 - skip: 9 - outputs: - nextadvancedptr: [0, 1, 2, 3] - nextcarryptr: [0, 1, 5, 7] + lencontent: 6 + length: 2 + starts: [0, 3] + stops: [3, 6] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 2] - lencarry: 1 - lenflathead: 2 - skip: 5 - outputs: - nextadvancedptr: [0, 1] - nextcarryptr: [0, 2] + lencontent: 7 + length: 2 + starts: [0, 3] + stops: [3, 7] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 2, 3] - lencarry: 1 - lenflathead: 3 - skip: 5 - outputs: - nextadvancedptr: [0, 1, 2] - nextcarryptr: [0, 2, 3] + lencontent: 11 + length: 4 + starts: [0, 3, 4, 7] + stops: [3, 4, 7, 11] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 2, 3, 4] - lencarry: 1 - lenflathead: 4 - skip: 5 - outputs: - nextadvancedptr: [0, 1, 2, 3] - nextcarryptr: [0, 2, 3, 4] + lencontent: 25 + length: 7 + starts: [0, 3, 6, 11, 14, 17, 20] + stops: [3, 6, 11, 14, 17, 20, 25] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 2, 4] - lencarry: 1 - lenflathead: 3 - skip: 5 - outputs: - nextadvancedptr: [0, 1, 2] - nextcarryptr: [0, 2, 4] + lencontent: 20 + length: 6 + starts: [0, 3, 6, 11, 14, 17] + stops: [3, 6, 11, 14, 17, 20] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 3] - lencarry: 1 - lenflathead: 2 - skip: 5 - outputs: - nextadvancedptr: [0, 1] - nextcarryptr: [0, 3] + lencontent: 19 + length: 5 + starts: [0, 3, 6, 11, 15] + stops: [3, 6, 11, 15, 19] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 3, 4] - lencarry: 1 - lenflathead: 3 - skip: 5 - outputs: - nextadvancedptr: [0, 1, 2] - nextcarryptr: [0, 3, 4] + lencontent: 10 + length: 3 + starts: [0, 3, 6] + stops: [3, 6, 10] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [0, 4] - lencarry: 1 - lenflathead: 2 - skip: 5 - outputs: - nextadvancedptr: [0, 1] - nextcarryptr: [0, 4] + lencontent: 11 + length: 3 + starts: [0, 3, 6] + stops: [3, 6, 11] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [1] - lencarry: 1 - lenflathead: 1 - skip: 5 - outputs: - nextadvancedptr: [0] - nextcarryptr: [1] + lencontent: 21 + length: 9 + starts: [0, 3, 6, 6, 10, 14, 14, 18, 21] + stops: [3, 6, 6, 10, 14, 14, 18, 21, 21] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [1, 1, 0] - lencarry: 1 - lenflathead: 3 - skip: 2 - outputs: - nextadvancedptr: [0, 1, 2] - nextcarryptr: [1, 1, 0] + lencontent: 21 + length: 8 + starts: [0, 3, 6, 6, 10, 14, 14, 18] + stops: [3, 6, 6, 10, 14, 14, 18, 21] + outputs: {} - error: false inputs: - carryptr: [0, 1] - flatheadptr: [1, 1, 0] - lencarry: 2 - lenflathead: 3 - skip: 2 - outputs: - nextadvancedptr: [0, 1, 2, 0, 1, 2] - nextcarryptr: [1, 1, 0, 3, 3, 2] + lencontent: 22 + length: 9 + starts: [0, 3, 6, 6, 11, 15, 15, 19, 22] + stops: [3, 6, 6, 11, 15, 15, 19, 22, 22] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [1, 2] - lencarry: 1 - lenflathead: 2 - skip: 5 - outputs: - nextadvancedptr: [0, 1] - nextcarryptr: [1, 2] + lencontent: 22 + length: 8 + starts: [0, 3, 6, 6, 11, 15, 15, 19] + stops: [3, 6, 6, 11, 15, 15, 19, 22] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [1, 2, 3] - lencarry: 1 - lenflathead: 3 - skip: 5 - outputs: - nextadvancedptr: [0, 1, 2] - nextcarryptr: [1, 2, 3] + lencontent: 24 + length: 9 + starts: [0, 3, 6, 8, 13, 17, 17, 21, 24] + stops: [3, 6, 8, 13, 17, 17, 21, 24, 24] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [1, 2, 3, 4] - lencarry: 1 - lenflathead: 4 - skip: 5 - outputs: - nextadvancedptr: [0, 1, 2, 3] - nextcarryptr: [1, 2, 3, 4] + lencontent: 24 + length: 8 + starts: [0, 3, 6, 8, 13, 17, 17, 21] + stops: [3, 6, 8, 13, 17, 17, 21, 24] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [1, 2, 4] - lencarry: 1 - lenflathead: 3 - skip: 5 - outputs: - nextadvancedptr: [0, 1, 2] - nextcarryptr: [1, 2, 4] + lencontent: 9 + length: 3 + starts: [0, 3, 7] + stops: [3, 7, 9] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [1, 3] - lencarry: 1 - lenflathead: 2 - skip: 5 - outputs: - nextadvancedptr: [0, 1] - nextcarryptr: [1, 3] - - error: false + lencontent: 10 + length: 2 + starts: [0, 4] + stops: [4, 10] + outputs: {} + - error: false inputs: - carryptr: [0] - flatheadptr: [1, 3, 4] - lencarry: 1 - lenflathead: 3 - skip: 5 - outputs: - nextadvancedptr: [0, 1, 2] - nextcarryptr: [1, 3, 4] + lencontent: 6 + length: 3 + starts: [0, 4, 4] + stops: [4, 4, 6] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [1, 3, 4, 5] - lencarry: 1 - lenflathead: 4 - skip: 8 - outputs: - nextadvancedptr: [0, 1, 2, 3] - nextcarryptr: [1, 3, 4, 5] + lencontent: 10 + length: 3 + starts: [0, 4, 6] + stops: [4, 6, 10] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [1, 4] - lencarry: 1 - lenflathead: 2 - skip: 5 - outputs: - nextadvancedptr: [0, 1] - nextcarryptr: [1, 4] + lencontent: 14 + length: 4 + starts: [0, 4, 6, 9] + stops: [4, 6, 9, 14] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [2, 0, 0, 1] - lencarry: 1 - lenflathead: 4 - skip: 7 - outputs: - nextadvancedptr: [0, 1, 2, 3] - nextcarryptr: [2, 0, 0, 1] + lencontent: 11 + length: 6 + starts: [0, 4, 7, 7, 9, 9] + stops: [4, 7, 7, 9, 9, 11] + outputs: {} - error: false inputs: - carryptr: [0, 1, 2, 3, 4, 5, 6] - flatheadptr: [2, 0, 0, 1] - lencarry: 7 - lenflathead: 4 - skip: 5 - outputs: - nextadvancedptr: [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, - 0, 1, 2, 3, 0, 1, 2, 3] - nextcarryptr: [2, 0, 0, 1, 7, 5, 5, 6, 12, 10, 10, 11, 17, 15, 15, 16, 22, 20, - 20, 21, 27, 25, 25, 26, 32, 30, 30, 31] + lencontent: 12 + length: 3 + starts: [0, 4, 8] + stops: [4, 8, 12] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [2] - lencarry: 1 - lenflathead: 1 - skip: 5 - outputs: - nextadvancedptr: [0] - nextcarryptr: [2] + lencontent: 30 + length: 6 + starts: [0, 5, 10, 15, 20, 25] + stops: [5, 10, 15, 20, 25, 30] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [2, 3] - lencarry: 1 - lenflathead: 2 - skip: 5 - outputs: - nextadvancedptr: [0, 1] - nextcarryptr: [2, 3] + lencontent: 10 + length: 2 + starts: [0, 5] + stops: [5, 10] + outputs: {} - error: false inputs: - carryptr: [0] - flatheadptr: [2, 3, 4] - lencarry: 1 - lenflathead: 3 - skip: 5 - outputs: - nextadvancedptr: [0, 1, 2] - nextcarryptr: [2, 3, 4] + lencontent: 12 + length: 6 + starts: [3, 0, 999, 2, 6, 10] + stops: [7, 3, 999, 4, 6, 12] + outputs: {} +- name: awkward_ListArray_getitem_jagged_apply + tests: - error: false inputs: - carryptr: [0] - flatheadptr: [2, 3, 5, 6] - lencarry: 1 - lenflathead: 4 - skip: 7 + contentlen: 0 + fromstarts: [0, 0, 0, 0] + fromstops: [0, 0, 0, 0] + sliceindex: [] + sliceinnerlen: 0 + sliceouterlen: 4 + slicestarts: [0, 0, 0, 0] + slicestops: [0, 0, 0, 0] outputs: - nextadvancedptr: [0, 1, 2, 3] - nextcarryptr: [2, 3, 5, 6] + tocarry: [] + tooffsets: [0, 0, 0, 0, 0] - error: false inputs: - carryptr: [0] - flatheadptr: [2, 4] - lencarry: 1 - lenflathead: 2 - skip: 5 + contentlen: 5 + fromstarts: [0, 3, 3] + fromstops: [3, 3, 5] + sliceindex: [] + sliceinnerlen: 0 + sliceouterlen: 3 + slicestarts: [0, 0, 0] + slicestops: [0, 0, 0] outputs: - nextadvancedptr: [0, 1] - nextcarryptr: [2, 4] + tocarry: [] + tooffsets: [0, 0, 0, 0] - error: false inputs: - carryptr: [0] - flatheadptr: [3] - lencarry: 1 - lenflathead: 1 - skip: 5 + contentlen: 5 + fromstarts: [0, 3, 3] + fromstops: [3, 3, 5] + sliceindex: [0, 1] + sliceinnerlen: 2 + sliceouterlen: 3 + slicestarts: [0, 0, 0] + slicestops: [0, 0, 2] outputs: - nextadvancedptr: [0] - nextcarryptr: [3] + tocarry: [3, 4] + tooffsets: [0, 0, 0, 2] - error: false inputs: - carryptr: [0] - flatheadptr: [3, 4] - lencarry: 1 - lenflathead: 2 - skip: 5 + contentlen: 5 + fromstarts: [0, 3, 3] + fromstops: [3, 3, 5] + sliceindex: [0, 0, 1] + sliceinnerlen: 3 + sliceouterlen: 3 + slicestarts: [0, 1, 1] + slicestops: [1, 1, 3] outputs: - nextadvancedptr: [0, 1] - nextcarryptr: [3, 4] + tocarry: [0, 3, 4] + tooffsets: [0, 1, 1, 3] - error: false inputs: - carryptr: [0] - flatheadptr: [3, 4, 5, 7, 9] - lencarry: 1 - lenflathead: 5 - skip: 10 + contentlen: 5 + fromstarts: [0, 3, 3] + fromstops: [3, 3, 5] + sliceindex: [2, 0, 1] + sliceinnerlen: 3 + sliceouterlen: 3 + slicestarts: [0, 1, 1] + slicestops: [1, 1, 3] outputs: - nextadvancedptr: [0, 1, 2, 3, 4] - nextcarryptr: [3, 4, 5, 7, 9] + tocarry: [2, 3, 4] + tooffsets: [0, 1, 1, 3] - error: false inputs: - carryptr: [0] - flatheadptr: [4] - lencarry: 1 - lenflathead: 1 - skip: 5 + contentlen: 10 + fromstarts: [0, 3, 3, 5, 6] + fromstops: [3, 3, 5, 6, 10] + sliceindex: [1, 0, 1, 0, 3] + sliceinnerlen: 5 + sliceouterlen: 5 + slicestarts: [0, 1, 1, 3, 3] + slicestops: [1, 1, 3, 3, 5] outputs: - nextadvancedptr: [0] - nextcarryptr: [4] + tocarry: [1, 3, 4, 6, 9] + tooffsets: [0, 1, 1, 3, 3, 5] - error: false inputs: - carryptr: [0] - flatheadptr: [4, 1, 1, 3] - lencarry: 1 - lenflathead: 4 - skip: 7 + contentlen: 5 + fromstarts: [0, 3, 3] + fromstops: [3, 3, 5] + sliceindex: [0, 1] + sliceinnerlen: 2 + sliceouterlen: 3 + slicestarts: [0, 2, 2] + slicestops: [2, 2, 2] outputs: - nextadvancedptr: [0, 1, 2, 3] - nextcarryptr: [4, 1, 1, 3] + tocarry: [0, 1] + tooffsets: [0, 2, 2, 2] - error: false inputs: - carryptr: [0] - flatheadptr: [4, 1, 1, 3, 0, 4] - lencarry: 1 - lenflathead: 6 - skip: 7 + contentlen: 4 + fromstarts: [0, 1, 1, 1, 1] + fromstops: [1, 1, 1, 1, 4] + sliceindex: [0, 0, 2, 1, 1, 2] + sliceinnerlen: 6 + sliceouterlen: 5 + slicestarts: [0, 2, 2, 2, 2] + slicestops: [2, 2, 2, 2, 6] outputs: - nextadvancedptr: [0, 1, 2, 3, 4, 5] - nextcarryptr: [4, 1, 1, 3, 0, 4] + tocarry: [0, 0, 3, 2, 2, 3] + tooffsets: [0, 2, 2, 2, 2, 6] - error: false inputs: - carryptr: [0] - flatheadptr: [5, 2, 2, 3, 9, 0, 1] - lencarry: 1 - lenflathead: 7 - skip: 10 + contentlen: 5 + fromstarts: [0, 3, 3] + fromstops: [3, 3, 5] + sliceindex: [0, 1, 0] + sliceinnerlen: 3 + sliceouterlen: 3 + slicestarts: [0, 2, 2] + slicestops: [2, 2, 3] outputs: - nextadvancedptr: [0, 1, 2, 3, 4, 5, 6] - nextcarryptr: [5, 2, 2, 3, 9, 0, 1] + tocarry: [0, 1, 3] + tooffsets: [0, 2, 2, 3] - error: false inputs: - carryptr: [0] - flatheadptr: [5, 7, 9] - lencarry: 1 - lenflathead: 3 - skip: 10 + contentlen: 5 + fromstarts: [0, 3, 3] + fromstops: [3, 3, 5] + sliceindex: [0, 1, 1] + sliceinnerlen: 3 + sliceouterlen: 3 + slicestarts: [0, 2, 2] + slicestops: [2, 2, 3] outputs: - nextadvancedptr: [0, 1, 2] - nextcarryptr: [5, 7, 9] + tocarry: [0, 1, 4] + tooffsets: [0, 2, 2, 3] - error: false inputs: - carryptr: [0] - flatheadptr: [7, 3, 3, 5] - lencarry: 1 - lenflathead: 4 - skip: 10 + contentlen: 5 + fromstarts: [0, 3, 3] + fromstops: [3, 3, 5] + sliceindex: [2, 0, 1] + sliceinnerlen: 3 + sliceouterlen: 3 + slicestarts: [0, 2, 2] + slicestops: [2, 2, 3] outputs: - nextadvancedptr: [0, 1, 2, 3] - nextcarryptr: [7, 3, 3, 5] + tocarry: [2, 0, 4] + tooffsets: [0, 2, 2, 3] - error: false inputs: - carryptr: [0] - flatheadptr: [7, 3, 3, 5] - lencarry: 1 - lenflathead: 4 - skip: 9 + contentlen: 5 + fromstarts: [0, 3, 3] + fromstops: [3, 3, 5] + sliceindex: [0, 2, 0, 1] + sliceinnerlen: 4 + sliceouterlen: 3 + slicestarts: [0, 2, 2] + slicestops: [2, 2, 4] outputs: - nextadvancedptr: [0, 1, 2, 3] - nextcarryptr: [7, 3, 3, 5] + tocarry: [0, 2, 3, 4] + tooffsets: [0, 2, 2, 4] - error: false inputs: - carryptr: [0] - flatheadptr: [7, 3, 3, 6] - lencarry: 1 - lenflathead: 4 - skip: 10 + contentlen: 9 + fromstarts: [0, 3, 3, 5, 6] + fromstops: [3, 3, 5, 6, 9] + sliceindex: [0, 2, 0, 1, 0, 0, 1, 2] + sliceinnerlen: 8 + sliceouterlen: 5 + slicestarts: [0, 2, 2, 4, 5] + slicestops: [2, 2, 4, 5, 8] outputs: - nextadvancedptr: [0, 1, 2, 3] - nextcarryptr: [7, 3, 3, 6] + tocarry: [0, 2, 3, 4, 5, 6, 7, 8] + tooffsets: [0, 2, 2, 4, 5, 8] - error: false inputs: - carryptr: [1, 2, 3] - flatheadptr: [2, 0, 0, 1] - lencarry: 3 - lenflathead: 4 - skip: 5 + contentlen: 9 + fromstarts: [0, 3, 3, 5, 6] + fromstops: [3, 3, 5, 6, 9] + sliceindex: [1, 2, 0, 1, 0, 0, 1, 2] + sliceinnerlen: 8 + sliceouterlen: 5 + slicestarts: [0, 2, 2, 4, 5] + slicestops: [2, 2, 4, 5, 8] outputs: - nextadvancedptr: [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3] - nextcarryptr: [7, 5, 5, 6, 12, 10, 10, 11, 17, 15, 15, 16] -- name: awkward_NumpyArray_getitem_next_at - tests: + tocarry: [1, 2, 3, 4, 5, 6, 7, 8] + tooffsets: [0, 2, 2, 4, 5, 8] - error: false inputs: - at: 0 - carryptr: [0] - lencarry: 1 - skip: 2 + contentlen: 9 + fromstarts: [0, 3, 3, 5, 6] + fromstops: [3, 3, 5, 6, 9] + sliceindex: [0, 1, 2, 0, 0, 1, 2] + sliceinnerlen: 7 + sliceouterlen: 5 + slicestarts: [0, 3, 3, 3, 4] + slicestops: [3, 3, 3, 4, 7] outputs: - nextcarryptr: [0] + tocarry: [0, 1, 2, 5, 6, 7, 8] + tooffsets: [0, 3, 3, 3, 4, 7] - error: false inputs: - at: 0 - carryptr: [0] - lencarry: 1 - skip: 7 + contentlen: 9 + fromstarts: [0, 3, 3, 5, 6] + fromstops: [3, 3, 5, 6, 9] + sliceindex: [0, 1, 2, 1, 0, 0, 1, 2] + sliceinnerlen: 8 + sliceouterlen: 5 + slicestarts: [0, 3, 3, 4, 5] + slicestops: [3, 3, 4, 5, 8] outputs: - nextcarryptr: [0] + tocarry: [0, 1, 2, 4, 5, 6, 7, 8] + tooffsets: [0, 3, 3, 4, 5, 8] - error: false inputs: - at: 0 - carryptr: [0, 1] - lencarry: 2 - skip: 2 + contentlen: 5 + fromstarts: [0, 3, 3] + fromstops: [3, 3, 5] + sliceindex: [0, 1, 2, 0, 1] + sliceinnerlen: 5 + sliceouterlen: 3 + slicestarts: [0, 3, 3] + slicestops: [3, 3, 5] outputs: - nextcarryptr: [0, 2] + tocarry: [0, 1, 2, 3, 4] + tooffsets: [0, 3, 3, 5] - error: false inputs: - at: 0 - carryptr: [0, 1] - lencarry: 2 - skip: 7 + contentlen: 5 + fromstarts: [0, 3, 3] + fromstops: [3, 3, 5] + sliceindex: [2, 1, 0, 0, 1] + sliceinnerlen: 5 + sliceouterlen: 3 + slicestarts: [0, 3, 3] + slicestops: [3, 3, 5] outputs: - nextcarryptr: [0, 7] + tocarry: [2, 1, 0, 3, 4] + tooffsets: [0, 3, 3, 5] - error: false inputs: - at: 0 - carryptr: [0, 1, 2, 3] - lencarry: 4 - skip: 7 + contentlen: 9 + fromstarts: [0, 3, 3, 5, 6] + fromstops: [3, 3, 5, 6, 9] + sliceindex: [0, 1, 2, 0, 1, 0, 0, 1, 2] + sliceinnerlen: 9 + sliceouterlen: 5 + slicestarts: [0, 3, 3, 5, 6] + slicestops: [3, 3, 5, 6, 9] outputs: - nextcarryptr: [0, 7, 14, 21] + tocarry: [0, 1, 2, 3, 4, 5, 6, 7, 8] + tooffsets: [0, 3, 3, 5, 6, 9] - error: false inputs: - at: 0 - carryptr: [0, 1, 2, 3, 4, 5, 6, 7] - lencarry: 8 - skip: 7 + contentlen: 6 + fromstarts: [0, 3] + fromstops: [3, 6] + sliceindex: [2, 1, 0, 2, 1, 0] + sliceinnerlen: 6 + sliceouterlen: 2 + slicestarts: [0, 3] + slicestops: [3, 6] outputs: - nextcarryptr: [0, 7, 14, 21, 28, 35, 42, 49] + tocarry: [2, 1, 0, 5, 4, 3] + tooffsets: [0, 3, 6] - error: false inputs: - at: 1 - carryptr: [0] - lencarry: 1 - skip: 2 + contentlen: 6 + fromstarts: [0, 3, 5] + fromstops: [3, 5, 6] + sliceindex: [2, 1, 1, 0, 1, 0] + sliceinnerlen: 6 + sliceouterlen: 3 + slicestarts: [0, 4, 5] + slicestops: [4, 4, 6] outputs: - nextcarryptr: [1] + tocarry: [2, 1, 1, 0, 5] + tooffsets: [0, 4, 4, 5] - error: false inputs: - at: 1 - carryptr: [0] - lencarry: 1 - skip: 7 + contentlen: 6 + fromstarts: [0, 3, 5] + fromstops: [3, 5, 6] + sliceindex: [2, 1, 1, 0, 1, 0] + sliceinnerlen: 6 + sliceouterlen: 3 + slicestarts: [0, 4, 5] + slicestops: [4, 5, 6] outputs: - nextcarryptr: [1] + tocarry: [2, 1, 1, 0, 4, 5] + tooffsets: [0, 4, 5, 6] - error: false inputs: - at: 1 - carryptr: [0, 1] - lencarry: 2 - skip: 2 + contentlen: 8 + fromstarts: [0, 4, 7] + fromstops: [4, 7, 8] + sliceindex: [3, 2, 2, 1, 1, 2] + sliceinnerlen: 6 + sliceouterlen: 3 + slicestarts: [0, 4, 6] + slicestops: [4, 6, 6] outputs: - nextcarryptr: [1, 3] + tocarry: [3, 2, 2, 1, 5, 6] + tooffsets: [0, 4, 6, 6] - error: false inputs: - at: 1 - carryptr: [0, 1] - lencarry: 2 - skip: 7 + contentlen: 13 + fromstarts: [0, 4, 4, 7, 8] + fromstops: [4, 4, 7, 8, 13] + sliceindex: [3, 2, 1, 1, 0, 1, 0, 0, 1, 2] + sliceinnerlen: 10 + sliceouterlen: 5 + slicestarts: [0, 5, 5, 6, 8] + slicestops: [5, 5, 6, 8, 10] outputs: - nextcarryptr: [1, 8] + tocarry: [3, 2, 1, 1, 0, 5, 7, 7, 9, 10] + tooffsets: [0, 5, 5, 6, 8, 10] +- name: awkward_UnionArray_regular_index + tests: - error: false inputs: - at: 1 - carryptr: [0, 1, 2, 3] - lencarry: 4 - skip: 7 + fromtags: [0, 1, 0, 1, 0, 1] + length: 6 + size: 2 outputs: - nextcarryptr: [1, 8, 15, 22] + current: [3, 3] + toindex: [0, 0, 1, 1, 2, 2] - error: false inputs: - at: 1 - carryptr: [0, 1, 2, 3, 4, 5, 6, 7] - lencarry: 8 - skip: 7 + fromtags: [1, 0, 1, 1] + length: 4 + size: 2 outputs: - nextcarryptr: [1, 8, 15, 22, 29, 36, 43, 50] + current: [1, 3] + toindex: [0, 0, 1, 2] - error: false inputs: - at: 2 - carryptr: [0] - lencarry: 1 - skip: 10 + fromtags: [1, 1, 0, 0, 1, 0, 1, 1] + length: 8 + size: 2 outputs: - nextcarryptr: [2] + current: [3, 5] + toindex: [0, 1, 0, 1, 2, 2, 3, 4] +- name: awkward_UnionArray_regular_index_getsize + tests: - error: false inputs: - at: 2 - carryptr: [0] - lencarry: 1 - skip: 7 + fromtags: [0, 1, 0, 1, 0, 1] + length: 6 outputs: - nextcarryptr: [2] + size: [2] - error: false inputs: - at: 2 - carryptr: [0, 1, 2, 3] - lencarry: 4 - skip: 7 + fromtags: [1, 0, 1, 1] + length: 4 outputs: - nextcarryptr: [2, 9, 16, 23] + size: [2] - error: false inputs: - at: 2 - carryptr: [0, 1, 2, 3, 4] - lencarry: 5 - skip: 7 + fromtags: [1, 1, 0, 0, 1, 0, 1, 1] + length: 8 outputs: - nextcarryptr: [2, 9, 16, 23, 30] + size: [2] +- name: awkward_IndexedArray_fill + tests: - error: false inputs: - at: 2 - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19] - lencarry: 20 - skip: 7 + base: 0 + fromindex: [0, 1, -1, -1, 4] + length: 5 + toindexoffset: 0 outputs: - nextcarryptr: [2, 9, 16, 23, 30, 37, 44, 51, 58, 65, 72, 79, 86, 93, 100, 107, - 114, 121, 128, 135] + toindex: [0, 1, -1, -1, 4] - error: false inputs: - at: 4 - carryptr: [0] - lencarry: 1 - skip: 7 + base: 0 + fromindex: [0, 1, 2, 3, -1] + length: 5 + toindexoffset: 0 outputs: - nextcarryptr: [4] + toindex: [0, 1, 2, 3, -1] - error: false inputs: - at: 5 - carryptr: [0] - lencarry: 1 - skip: 7 + base: 0 + fromindex: [0, 1, 2] + length: 3 + toindexoffset: 0 outputs: - nextcarryptr: [5] + toindex: [0, 1, 2] - error: false inputs: - at: 5 - carryptr: [0, 1, 2, 3] - lencarry: 4 - skip: 7 + base: 0 + fromindex: [-1, -1, 0, -1, 1, 2] + length: 6 + toindexoffset: 0 outputs: - nextcarryptr: [5, 12, 19, 26] + toindex: [-1, -1, 0, -1, 1, 2] - error: false inputs: - at: 5 - carryptr: [0, 1, 2, 3, 4] - lencarry: 5 - skip: 7 + base: 0 + fromindex: [2, 0, -1, 0, 1, 2] + length: 6 + toindexoffset: 0 outputs: - nextcarryptr: [5, 12, 19, 26, 33] + toindex: [2, 0, -1, 0, 1, 2] +- name: awkward_ListArray_fill + tests: - error: false inputs: - at: 5 - carryptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19] - lencarry: 20 - skip: 7 + base: 0 + fromstarts: [0, 0, 1] + fromstops: [0, 1, 3] + length: 3 + tostartsoffset: 0 + tostopsoffset: 0 outputs: - nextcarryptr: [5, 12, 19, 26, 33, 40, 47, 54, 61, 68, 75, 82, 89, 96, 103, 110, - 117, 124, 131, 138] + tostarts: [0, 0, 1] + tostops: [0, 1, 3] - error: false inputs: - at: 6 - carryptr: [0] - lencarry: 1 - skip: 7 + base: 0 + fromstarts: [0, 2, 2] + fromstops: [2, 2, 4] + length: 3 + tostartsoffset: 0 + tostopsoffset: 0 outputs: - nextcarryptr: [6] + tostarts: [0, 2, 2] + tostops: [2, 2, 4] - error: false inputs: - at: 6 - carryptr: [0, 1] - lencarry: 2 - skip: 7 + base: 0 + fromstarts: [0, 2, 4] + fromstops: [2, 4, 6] + length: 3 + tostartsoffset: 0 + tostopsoffset: 0 outputs: - nextcarryptr: [6, 13] + tostarts: [0, 2, 4] + tostops: [2, 4, 6] - error: false inputs: - at: 6 - carryptr: [0, 1, 2, 3] - lencarry: 4 - skip: 7 + base: 0 + fromstarts: [0, 3, 3, 5, 6] + fromstops: [3, 3, 5, 6, 10] + length: 5 + tostartsoffset: 0 + tostopsoffset: 0 outputs: - nextcarryptr: [6, 13, 20, 27] + tostarts: [0, 3, 3, 5, 6] + tostops: [3, 3, 5, 6, 10] - error: false inputs: - at: 6 - carryptr: [0, 1, 2, 3, 4, 5, 6, 7] - lencarry: 8 - skip: 7 - outputs: - nextcarryptr: [6, 13, 20, 27, 34, 41, 48, 55] -- name: awkward_NumpyArray_contiguous_init - tests: - - error: false - inputs: {skip: 1, stride: 280} + base: 0 + fromstarts: [0, 3, 3] + fromstops: [3, 3, 5] + length: 3 + tostartsoffset: 0 + tostopsoffset: 0 outputs: - toptr: [0] + tostarts: [0, 3, 3] + tostops: [3, 3, 5] - error: false - inputs: {skip: 5, stride: 16} + inputs: + base: 0 + fromstarts: [0, 3, 6] + fromstops: [3, 6, 11] + length: 3 + tostartsoffset: 0 + tostopsoffset: 0 outputs: - toptr: [0, 16, 32, 48, 64] + tostarts: [0, 3, 6] + tostops: [3, 6, 11] - error: false - inputs: {skip: 2, stride: 280} + inputs: + base: 0 + fromstarts: [0, 5, 10] + fromstops: [5, 10, 15] + length: 3 + tostartsoffset: 0 + tostopsoffset: 0 outputs: - toptr: [0, 280] + tostarts: [0, 5, 10] + tostops: [5, 10, 15] - error: false - inputs: {skip: 7, stride: 40} + inputs: + base: 0 + fromstarts: [0, 7] + fromstops: [7, 14] + length: 2 + tostartsoffset: 0 + tostopsoffset: 0 outputs: - toptr: [0, 40, 80, 120, 160, 200, 240] -- name: awkward_NumpyArray_contiguous_next - tests: + tostarts: [0, 7] + tostops: [7, 14] - error: false inputs: - frompos: [0] - length: 1 - skip: 6 - stride: 40 + base: 0 + fromstarts: [1, 3, 3, 3] + fromstops: [3, 3, 3, 5] + length: 4 + tostartsoffset: 0 + tostopsoffset: 0 outputs: - topos: [0, 40, 80, 120, 160, 200] + tostarts: [1, 3, 3, 3] + tostops: [3, 3, 3, 5] - error: false inputs: - frompos: [0, 280] + base: 0 + fromstarts: [3, 5] + fromstops: [5, 5] length: 2 - skip: 6 - stride: 40 + tostartsoffset: 0 + tostopsoffset: 0 outputs: - topos: [0, 40, 80, 120, 160, 200, 280, 320, 360, 400, 440, 480] -- name: awkward_ListOffsetArray_compact_offsets + tostarts: [3, 5] + tostops: [5, 5] +- name: awkward_UnionArray_fillindex tests: - error: false inputs: - fromoffsets: [3, 3, 4, 6] - length: 3 + fromindex: [0, 0, 1, 1] + length: 4 + toindexoffset: 0 outputs: - tooffsets: [0, 0, 1, 3] + toindex: [0, 0, 1, 1] - error: false inputs: - fromoffsets: [3, 3, 5] - length: 2 + fromindex: [0, 1, 2, 0, 1, 2] + length: 6 + toindexoffset: 0 outputs: - tooffsets: [0, 0, 2] + toindex: [0, 1, 2, 0, 1, 2] +- name: awkward_UnionArray_validity + tests: - error: false inputs: - fromoffsets: [5, 6, 10] - length: 2 - outputs: - tooffsets: [0, 1, 5] + index: [0, 1, 2, 3, 0, 1] + lencontents: [4, 2, 0, 945] + length: 6 + numcontents: 2 + tags: [0, 0, 0, 0, 1, 1] + outputs: {} - error: false inputs: - fromoffsets: [3, 5, 5, 5, 5, 9] - length: 5 - outputs: - tooffsets: [0, 2, 2, 2, 2, 6] + index: [0, 1, 2, 0, 1, 2, 3] + lencontents: [3, 4] + length: 7 + numcontents: 2 + tags: [0, 0, 0, 1, 1, 1, 1] + outputs: {} - error: false inputs: - fromoffsets: [3, 5, 6] - length: 2 - outputs: - tooffsets: [0, 2, 3] + index: [0, 1, 0, 1, 2, 3] + lencontents: [2, 4, 32, 49, 0, 0] + length: 6 + numcontents: 2 + tags: [0, 0, 1, 1, 1, 1] + outputs: {} - error: false inputs: - fromoffsets: [1, 4, 4, 6] - length: 3 - outputs: - tooffsets: [0, 3, 3, 5] + index: [0, 0, 1, 1, 2, 3, 2, 4] + lencontents: [5, 3, 32, 33] + length: 8 + numcontents: 2 + tags: [0, 1, 1, 0, 0, 0, 1, 0] + outputs: {} - error: false inputs: - fromoffsets: [1, 4, 7] - length: 2 - outputs: - tooffsets: [0, 3, 6] + index: [0, 0, 1, 1, 2, 3, 2, 4] + lencontents: [5, 3, 32, 625, 0, 0, 0] + length: 8 + numcontents: 2 + tags: [0, 1, 1, 0, 0, 0, 1, 0] + outputs: {} - error: false inputs: - fromoffsets: [11, 14, 17, 20] - length: 3 - outputs: - tooffsets: [0, 3, 6, 9] + index: [0, 0, 1, 1, 2, 2, 3] + lencontents: [3, 4, 32, 177] + length: 7 + numcontents: 2 + tags: [0, 1, 1, 0, 0, 1, 1] + outputs: {} +- name: awkward_ByteMaskedArray_reduce_next_nonlocal_nextshifts_64 + tests: - error: false inputs: - fromoffsets: [20, 25] - length: 1 + length: 7 + mask: [0, 0, 0, 1, 1, 0, 0] + valid_when: false outputs: - tooffsets: [0, 5] -- name: awkward_ListOffsetArray_flatten_offsets + nextshifts: [0, 0, 0, 2, 2] +- name: awkward_IndexedArray_index_of_nulls tests: - error: false inputs: - inneroffsets: [0] - inneroffsetslen: 1 - outeroffsets: [0, 0, 0, 0, 0] - outeroffsetslen: 5 + fromindex: [-1, -1, 0, 1, 2, -1, -1, -1, 3, -1, 4, 5, -1, -1, 6, 7, 8] + lenindex: 17 + parents: [0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4] + starts: [0, 5, 8, 11, 14] outputs: - tooffsets: [0, 0, 0, 0, 0] + toindex: [0, 1, 0, 1, 2, 1, 1, 2] - error: false inputs: - inneroffsets: [0, 1, 2, 3] - inneroffsetslen: 4 - outeroffsets: [0, 0, 0, 1, 3] - outeroffsetslen: 5 + fromindex: [-1, -1, 3, 5, 6, -1, -1, -1, -1, 7, 0, -1, 4, -1, 8, 1, 2] + lenindex: 17 + parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 4] + starts: [0, 5, 10, 15, 16] outputs: - tooffsets: [0, 0, 0, 1, 3] + toindex: [0, 1, 0, 1, 2, 3, 1, 3] - error: false inputs: - inneroffsets: [0, 1, 2, 3, 4, 5, 6] - inneroffsetslen: 7 - outeroffsets: [0, 0, 1, 3, 6] - outeroffsetslen: 5 + fromindex: [-1, -1, 0, 1, 2] + lenindex: 5 + parents: [0, 0, 0, 0, 0] + starts: [0] outputs: - tooffsets: [0, 0, 1, 3, 6] + toindex: [0, 1] - error: false inputs: - inneroffsets: [0, 1, 1, 5] - inneroffsetslen: 4 - outeroffsets: [0, 0, 1, 3] - outeroffsetslen: 4 + fromindex: [0, -1, 3, 5, 6, 1, -1, 4, -1, 7, 2, -1, -1, -1, 8, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1] + lenindex: 25 + parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, + 4, 4, 4] + starts: [0, 5, 10, 15, 20] outputs: - tooffsets: [0, 0, 1, 5] + toindex: [1, 1, 3, 1, 2, 3, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4] - error: false inputs: - inneroffsets: [0, 1, 1, 6, 6] - inneroffsetslen: 5 - outeroffsets: [0, 0, 1, 4] - outeroffsetslen: 4 + fromindex: [0, -1, 1, 2, -1, 3, 4, 5] + lenindex: 8 + parents: [0, 0, 0, 0, 0, 0, 0, 0] + starts: [0] outputs: - tooffsets: [0, 0, 1, 6] + toindex: [1, 4] - error: false inputs: - inneroffsets: [0, 4, 8, 12, 14, 16] - inneroffsetslen: 6 - outeroffsets: [0, 3, 3, 5] - outeroffsetslen: 4 + fromindex: [0, 1, -1, 2] + lenindex: 4 + parents: [0, 0, 0, 0] + starts: [0] outputs: - tooffsets: [0, 12, 12, 16] + toindex: [2] - error: false inputs: - inneroffsets: [0, 1, 2, 5, 5, 7, 7, 11] - inneroffsetslen: 8 - outeroffsets: [0, 1, 2, 2, 5, 7] - outeroffsetslen: 6 + fromindex: [0, 1, -1, -1, 4] + lenindex: 5 + parents: [0, 0, 0, 0, 0] + starts: [0] outputs: - tooffsets: [0, 1, 2, 2, 7, 11] + toindex: [2, 3] - error: false inputs: - inneroffsets: [0, 1, 2, 3, 4, 5, 6] - inneroffsetslen: 7 - outeroffsets: [0, 1, 3, 6] - outeroffsetslen: 4 + fromindex: [0, 1, -1, 2, 3, -1] + lenindex: 6 + parents: [0, 0, 0, 0, 0, 0] + starts: [0] outputs: - tooffsets: [0, 1, 3, 6] + toindex: [2, 5] - error: false inputs: - inneroffsets: [0, 5, 10, 15, 20, 25, 30] - inneroffsetslen: 7 - outeroffsets: [0, 3, 6] - outeroffsetslen: 3 + fromindex: [0, 1, -1, 2, 3, -1, 4, 5, -1, 6, 7, -1] + lenindex: 12 + parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] + starts: [0, 6] outputs: - tooffsets: [0, 15, 30] + toindex: [2, 5, 2, 5] - error: false inputs: - inneroffsets: [0, 2, 6] - inneroffsetslen: 3 - outeroffsets: [0, 1, 1, 1, 2] - outeroffsetslen: 5 + fromindex: [0, 1, 2, -1, -1, -1, -1, 7, 8] + lenindex: 9 + parents: [0, 0, 0, 0, 1, 1, 1, 1, 1] + starts: [0, 4] outputs: - tooffsets: [0, 2, 2, 2, 6] + toindex: [3, 0, 1, 2] +- name: awkward_IndexedArray_reduce_next_fix_offsets_64 + tests: - error: false inputs: - inneroffsets: [0, 0, 2, 6] - inneroffsetslen: 4 - outeroffsets: [0, 2, 2, 2, 3] - outeroffsetslen: 5 + outindexlength: 6 + starts: [0, 1, 2, 5] + startslength: 4 outputs: - tooffsets: [0, 2, 2, 2, 6] + outoffsets: [0, 1, 2, 5, 6] - error: false inputs: - inneroffsets: [0, 0, 0, 2, 6] - inneroffsetslen: 5 - outeroffsets: [0, 3, 3, 3, 4] - outeroffsetslen: 5 + outindexlength: 2 + starts: [0] + startslength: 1 outputs: - tooffsets: [0, 2, 2, 2, 6] + outoffsets: [0, 2] - error: false inputs: - inneroffsets: [0, 0, 0, 0, 2, 7, 7] - inneroffsetslen: 7 - outeroffsets: [0, 4, 4, 4, 6] - outeroffsetslen: 5 + outindexlength: 9 + starts: [0, 3, 3, 5, 6] + startslength: 5 outputs: - tooffsets: [0, 2, 2, 2, 7] + outoffsets: [0, 3, 3, 5, 6, 9] - error: false inputs: - inneroffsets: [0, 3, 5, 6, 6] - inneroffsetslen: 5 - outeroffsets: [0, 1, 2, 3, 4] - outeroffsetslen: 5 + outindexlength: 6 + starts: [0, 3] + startslength: 2 outputs: - tooffsets: [0, 3, 5, 6, 6] + outoffsets: [0, 3, 6] - error: false inputs: - inneroffsets: [0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98, 105, - 112, 119, 126, 133, 140, 147, 154, 161, 168, 175, 182, 189, 196, 203, 210] - inneroffsetslen: 31 - outeroffsets: [0, 5, 10, 15, 20, 25, 30] - outeroffsetslen: 7 + outindexlength: 4 + starts: [0] + startslength: 1 outputs: - tooffsets: [0, 35, 70, 105, 140, 175, 210] + outoffsets: [0, 4] - error: false inputs: - inneroffsets: [0, 2, 4, 6, 8, 10, 12, 13, 14, 15, 16] - inneroffsetslen: 11 - outeroffsets: [0, 2, 4, 6, 8, 10] - outeroffsetslen: 6 + outindexlength: 5 + starts: [0] + startslength: 1 outputs: - tooffsets: [0, 4, 8, 12, 14, 16] + outoffsets: [0, 5] - error: false inputs: - inneroffsets: [0, 3, 5, 6, 6, 10] - inneroffsetslen: 6 - outeroffsets: [0, 2, 2, 3, 5] - outeroffsetslen: 5 + outindexlength: 8 + starts: [0] + startslength: 1 outputs: - tooffsets: [0, 5, 5, 6, 10] + outoffsets: [0, 8] +- name: awkward_IndexedArray_reduce_next_nonlocal_nextshifts_64 + tests: - error: false inputs: - inneroffsets: [0, 3, 3, 5, 6, 6, 10] - inneroffsetslen: 7 - outeroffsets: [0, 3, 3, 4, 6] - outeroffsetslen: 5 + index: [0, 1, 2, -1, 3, -1, 4] + length: 7 outputs: - tooffsets: [0, 5, 5, 6, 10] + nextshifts: [0, 0, 0, 1, 2] - error: false inputs: - inneroffsets: [0, 3, 3, 3, 5, 6, 6, 10] - inneroffsetslen: 8 - outeroffsets: [0, 4, 4, 5, 7] - outeroffsetslen: 5 - outputs: - tooffsets: [0, 5, 5, 6, 10] - - error: false - inputs: - inneroffsets: [0, 3, 3, 5, 5, 8] - inneroffsetslen: 6 - outeroffsets: [0, 3, 3, 5] - outeroffsetslen: 4 + index: [0, 1, 2, -1, -1, -1, -1, 7, 8] + length: 9 outputs: - tooffsets: [0, 5, 5, 8] + nextshifts: [0, 0, 0, 4, 4] - error: false inputs: - inneroffsets: [0, 3, 6, 9, 12, 14, 16] - inneroffsetslen: 7 - outeroffsets: [0, 2, 4, 5, 6, 6, 6] - outeroffsetslen: 7 + index: [0, 1, -1, 2, 3, -1] + length: 6 outputs: - tooffsets: [0, 6, 12, 14, 16, 16, 16] + nextshifts: [0, 0, 1, 1] - error: false inputs: - inneroffsets: [0, 2, 4, 6, 8, 10] - inneroffsetslen: 6 - outeroffsets: [0, 3, 3, 5] - outeroffsetslen: 4 + index: [0, 1, -1, 2, 3, 4] + length: 6 outputs: - tooffsets: [0, 6, 6, 10] + nextshifts: [0, 0, 1, 1, 1] - error: false inputs: - inneroffsets: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20] - inneroffsetslen: 11 - outeroffsets: [0, 3, 3, 5, 8, 8, 10] - outeroffsetslen: 7 + index: [0, 1, -1, 2, 3, -1, 4] + length: 7 outputs: - tooffsets: [0, 6, 6, 10, 16, 16, 20] + nextshifts: [0, 0, 1, 1, 2] - error: false inputs: - inneroffsets: [0, 4, 4, 4, 4, 6, 7, 7, 12, 12] - inneroffsetslen: 10 - outeroffsets: [0, 5, 5, 6, 9] - outeroffsetslen: 5 + index: [0, 1, -1, 2, 3, -1, 4, 5, -1, 6, 7, -1] + length: 12 outputs: - tooffsets: [0, 6, 6, 7, 12] + nextshifts: [0, 0, 1, 1, 2, 2, 3, 3] - error: false inputs: - inneroffsets: [0, 3, 6, 9, 11, 13, 14] - inneroffsetslen: 7 - outeroffsets: [0, 3, 5, 6] - outeroffsetslen: 4 + index: [0, 1, -1, -1, 4] + length: 5 outputs: - tooffsets: [0, 9, 13, 14] + nextshifts: [0, 0, 2] - error: false inputs: - inneroffsets: [0, 3, 5, 6, 6] - inneroffsetslen: 5 - outeroffsets: [1, 2, 3, 4] - outeroffsetslen: 4 + index: [4, 2, -1, -1, 1, 0, 1] + length: 7 outputs: - tooffsets: [3, 5, 6, 6] + nextshifts: [0, 0, 2, 2, 2] - error: false inputs: - inneroffsets: [0, 3, 3, 5, 6, 6, 10] - inneroffsetslen: 7 - outeroffsets: [3, 3, 4, 6] - outeroffsetslen: 4 + index: [-1, -1, 0, 1, 2] + length: 5 outputs: - tooffsets: [5, 5, 6, 10] + nextshifts: [2, 2, 2] - error: false inputs: - inneroffsets: [0, 3, 3, 3, 5, 6, 6, 10] - inneroffsetslen: 8 - outeroffsets: [4, 4, 5, 7] - outeroffsetslen: 4 + index: [-1, -1, 0, 1, 2, -1, -1, -1, 3, -1, 4, 5, -1, -1, 6, 7, 8] + length: 17 outputs: - tooffsets: [5, 5, 6, 10] -- name: awkward_ListOffsetArray_getitem_adjust_offsets + nextshifts: [2, 2, 2, 5, 6, 6, 8, 8, 8] +- name: awkward_IndexedArray_reduce_next_nonlocal_nextshifts_fromshifts_64 tests: - error: false inputs: - fromoffsets: [0, 3, 3, 5, 6, 10] - length: 5 - nonzero: [1, 3, 4, 6, 9] - nonzerolength: 5 + index: [0, 3, 4, 1, -1, 5, 2] + length: 7 + shifts: [0, 0, 1, 0, 0, 1, 0] outputs: - tononzero: [1, 0, 1, 0, 3] - tooffsets: [0, 1, 1, 3, 3, 5] + nextshifts: [0, 0, 1, 0, 2, 1] - error: false inputs: - fromoffsets: [0, 3, 3, 5] - length: 3 - nonzero: [0, 1, 4] - nonzerolength: 3 + index: [0, 3, 4, 1, -1, 5, 2] + length: 7 + shifts: [0, 1, 1, 0, 1, 1, 0] outputs: - tononzero: [0, 1, 1] - tooffsets: [0, 2, 2, 3] + nextshifts: [0, 1, 1, 0, 2, 1] - error: false inputs: - fromoffsets: [0, 3, 3, 5] - length: 3 - nonzero: [0, 2, 3, 4] - nonzerolength: 4 + index: [0, -1, 3, 5, 6, 1, -1, 4, -1, 7, 2, -1, -1, -1, 8, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1] + length: 25 + shifts: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0] outputs: - tononzero: [0, 2, 0, 1] - tooffsets: [0, 2, 2, 4] + nextshifts: [0, 1, 1, 1, 1, 2, 3, 3, 6] - error: false inputs: - fromoffsets: [0, 3, 3, 5, 6, 9] - length: 5 - nonzero: [0, 2, 3, 4, 5, 6, 7, 8] - nonzerolength: 8 + index: [0, -1, 4, 1, 3, 5, 2] + length: 7 + shifts: [0, 1, 1, 0, 1, 1, 0] outputs: - tononzero: [0, 2, 0, 1, 0, 0, 1, 2] - tooffsets: [0, 2, 2, 4, 5, 8] + nextshifts: [0, 2, 1, 2, 2, 1] - error: false inputs: - fromoffsets: [0, 3, 3, 5, 6, 9] - length: 5 - nonzero: [1, 2, 3, 4, 5, 6, 7, 8] - nonzerolength: 8 + index: [-1, -1, 3, 5, 6, -1, -1, -1, -1, 7, 0, -1, 4, -1, 8, 1, 2] + length: 17 + shifts: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] outputs: - tononzero: [1, 2, 0, 1, 0, 0, 1, 2] - tooffsets: [0, 2, 2, 4, 5, 8] + nextshifts: [2, 2, 2, 6, 6, 7, 8, 8, 8] +- name: awkward_ListArray_getitem_next_array_advanced + tests: - error: false inputs: - fromoffsets: [0, 3, 3, 5, 6, 9] - length: 5 - nonzero: [0, 1, 2, 5, 6, 7, 8] - nonzerolength: 7 + fromadvanced: [0, 1] + fromarray: [0, 0] + fromstarts: [0, 0] + fromstops: [1, 1] + lenarray: 2 + lencontent: 5 + lenstarts: 2 outputs: - tononzero: [0, 1, 2, 0, 0, 1, 2] - tooffsets: [0, 3, 3, 3, 4, 7] + toadvanced: [0, 1] + tocarry: [0, 0] - error: false inputs: - fromoffsets: [0, 3, 3, 5, 6, 9] - length: 5 - nonzero: [0, 1, 2, 4, 5, 6, 7, 8] - nonzerolength: 8 + fromadvanced: [0] + fromarray: [0] + fromstarts: [0] + fromstops: [2] + lenarray: 1 + lencontent: 4 + lenstarts: 1 outputs: - tononzero: [0, 1, 2, 1, 0, 0, 1, 2] - tooffsets: [0, 3, 3, 4, 5, 8] + toadvanced: [0] + tocarry: [0] - error: false inputs: - fromoffsets: [0, 3, 3, 5] - length: 3 - nonzero: [0, 1, 2, 3, 4] - nonzerolength: 5 + fromadvanced: [0, 1, 2, 3] + fromarray: [0, 1, -1, 1] + fromstarts: [0, 0, 0, 0] + fromstops: [3, 3, 3, 3] + lenarray: 4 + lencontent: 6 + lenstarts: 4 outputs: - tononzero: [0, 1, 2, 0, 1] - tooffsets: [0, 3, 3, 5] + toadvanced: [0, 1, 2, 3] + tocarry: [0, 1, 2, 1] - error: false inputs: - fromoffsets: [0, 3, 3, 5, 6, 9] - length: 5 - nonzero: [0, 1, 2, 3, 4, 5, 6, 7, 8] - nonzerolength: 9 + fromadvanced: [0, 1, 2, 3] + fromarray: [0, 0, 0, 0] + fromstarts: [0, 3, 3, 3] + fromstops: [3, 6, 6, 6] + lenarray: 4 + lencontent: 6 + lenstarts: 4 outputs: - tononzero: [0, 1, 2, 0, 1, 0, 0, 1, 2] - tooffsets: [0, 3, 3, 5, 6, 9] -- name: awkward_ListOffsetArray_getitem_adjust_offsets_index - tests: + toadvanced: [0, 1, 2, 3] + tocarry: [0, 3, 3, 3] - error: false inputs: - fromoffsets: [0, 3, 3, 5] - index: [0, 1, 1, 2] - indexlength: 4 - length: 3 - masklength: 5 - nonzero: [0, 1, 4] - nonzerolength: 3 - originalmask: [0, 0, 1, 0, 0] + fromadvanced: [0, 1] + fromarray: [1, 0] + fromstarts: [0, 0] + fromstops: [3, 3] + lenarray: 2 + lencontent: 5 + lenstarts: 2 outputs: - tononzero: [0, 1, 1] - tooffsets: [0, 3, 3, 4] + toadvanced: [0, 1] + tocarry: [1, 0] - error: false inputs: - fromoffsets: [0, 3, 3, 5] - index: [0, 1, 1, 2, 3] - indexlength: 5 - length: 3 - masklength: 5 - nonzero: [0, 2, 3, 4] - nonzerolength: 4 - originalmask: [0, 1, 0, 0, 0] + fromadvanced: [0, 1, 2, 3] + fromarray: [1, 0, 0, 1] + fromstarts: [0, 0, 0, 0] + fromstops: [3, 3, 3, 3] + lenarray: 4 + lencontent: 6 + lenstarts: 4 outputs: - tononzero: [0, 2, 0, 1] - tooffsets: [0, 3, 3, 5] -- name: awkward_ListOffsetArray_toRegularArray - tests: + toadvanced: [0, 1, 2, 3] + tocarry: [1, 0, 0, 1] - error: false inputs: - fromoffsets: [0, 1, 2, 3] - offsetslength: 4 + fromadvanced: [0, 1] + fromarray: [0, 0] + fromstarts: [1, 0] + fromstops: [3, 2] + lenarray: 2 + lencontent: 3 + lenstarts: 2 outputs: - size: [1] + toadvanced: [0, 1] + tocarry: [1, 0] - error: false inputs: - fromoffsets: [0, 2, 4] - offsetslength: 3 + fromadvanced: [0, 1, 2, 3] + fromarray: [0, 1, -1, 1] + fromstarts: [10, 10, 10, 10] + fromstops: [15, 15, 15, 15] + lenarray: 4 + lencontent: 30 + lenstarts: 4 outputs: - size: [2] + toadvanced: [0, 1, 2, 3] + tocarry: [10, 11, 14, 11] - error: false inputs: - fromoffsets: [0, 2, 4, 6] - offsetslength: 4 + fromadvanced: [0] + fromarray: [0] + fromstarts: [1] + fromstops: [3] + lenarray: 1 + lencontent: 3 + lenstarts: 1 outputs: - size: [2] + toadvanced: [0] + tocarry: [1] - error: false inputs: - fromoffsets: [0, 4] - offsetslength: 2 + fromadvanced: [0, 1, 2, 3] + fromarray: [1, 0, 0, 1] + fromstarts: [10, 10, 10, 10] + fromstops: [15, 15, 15, 15] + lenarray: 4 + lencontent: 30 + lenstarts: 4 outputs: - size: [4] + toadvanced: [0, 1, 2, 3] + tocarry: [11, 10, 10, 11] - error: false inputs: - fromoffsets: [0, 5, 10] - offsetslength: 3 + fromadvanced: [0, 1, 2, 3] + fromarray: [1, -2, 0, -1] + fromstarts: [10, 10, 10, 10] + fromstops: [15, 15, 15, 15] + lenarray: 4 + lencontent: 30 + lenstarts: 4 outputs: - size: [5] -- name: awkward_MaskedArray_getitem_next_jagged_project - tests: + toadvanced: [0, 1, 2, 3] + tocarry: [11, 13, 10, 14] - error: false inputs: - index: [0, 1, 2, 3] - length: 4 - starts_in: [0, 2, 3, 3] - stops_in: [2, 3, 3, 3] + fromadvanced: [0, 1, 2, 3] + fromarray: [1, -2, 0, -1] + fromstarts: [10, 0, 0, 5] + fromstops: [15, 5, 5, 10] + lenarray: 4 + lencontent: 30 + lenstarts: 4 outputs: - starts_out: [0, 2, 3, 3] - stops_out: [2, 3, 3, 3] + toadvanced: [0, 1, 2, 3] + tocarry: [11, 3, 0, 9] - error: false inputs: - index: [0, 1, 2, 3] - length: 4 - starts_in: [0, 2, 3, 3] - stops_in: [2, 3, 3, 5] + fromadvanced: [0, 1, 2, 3] + fromarray: [1, 0, 0, 1] + fromstarts: [0, 15, 15, 15] + fromstops: [5, 20, 20, 20] + lenarray: 4 + lencontent: 30 + lenstarts: 4 outputs: - starts_out: [0, 2, 3, 3] - stops_out: [2, 3, 3, 5] + toadvanced: [0, 1, 2, 3] + tocarry: [1, 15, 15, 16] - error: false inputs: - index: [0, 1, 2, 3] - length: 4 - starts_in: [0, 2, 3, 3] - stops_in: [2, 3, 3, 6] + fromadvanced: [0, 1] + fromarray: [1, 2] + fromstarts: [0, 0] + fromstops: [3, 3] + lenarray: 2 + lencontent: 5 + lenstarts: 2 outputs: - starts_out: [0, 2, 3, 3] - stops_out: [2, 3, 3, 6] + toadvanced: [0, 1] + tocarry: [1, 2] - error: false inputs: - index: [0, 1, 2, 3] - length: 4 - starts_in: [0, 2, 3, 4] - stops_in: [2, 3, 4, 7] - outputs: - starts_out: [0, 2, 3, 4] - stops_out: [2, 3, 4, 7] -- name: awkward_new_Identities - tests: - - error: false - inputs: {length: 2} - outputs: - toptr: [0, 1] - - error: false - inputs: {length: 3} - outputs: - toptr: [0, 1, 2] - - error: false - inputs: {length: 4} - outputs: - toptr: [0, 1, 2, 3] - - error: false - inputs: {length: 5} - outputs: - toptr: [0, 1, 2, 3, 4] - - error: false - inputs: {length: 8} - outputs: - toptr: [0, 1, 2, 3, 4, 5, 6, 7] - - error: false - inputs: {length: 9} - outputs: - toptr: [0, 1, 2, 3, 4, 5, 6, 7, 8] - - error: false - inputs: {length: 10} - outputs: - toptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - - error: false - inputs: {length: 40} + fromadvanced: [0, 1, 2, 3] + fromarray: [2, 0, 0, 1] + fromstarts: [10, 10, 10, 10] + fromstops: [15, 15, 15, 15] + lenarray: 4 + lencontent: 30 + lenstarts: 4 outputs: - toptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39] -- name: awkward_ListOffsetArray_reduce_global_startstop_64 - tests: + toadvanced: [0, 1, 2, 3] + tocarry: [12, 10, 10, 11] - error: false inputs: - length: 3 - offsets: [0, 0, 0, 0] + fromadvanced: [0, 1, 2, 3] + fromarray: [2, 2, 2, 2] + fromstarts: [10, 0, 0, 5] + fromstops: [15, 5, 5, 10] + lenarray: 4 + lencontent: 30 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [0] + toadvanced: [0, 1, 2, 3] + tocarry: [12, 2, 2, 7] - error: false inputs: - length: 4 - offsets: [0, 3, 4, 7, 10] + fromadvanced: [0, 1, 2, 3] + fromarray: [-2, -2, -2, -2] + fromstarts: [10, 10, 10, 10] + fromstops: [15, 15, 15, 15] + lenarray: 4 + lencontent: 30 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [10] + toadvanced: [0, 1, 2, 3] + tocarry: [13, 13, 13, 13] - error: false inputs: - length: 6 - offsets: [0, 3, 5, 7, 8, 9, 10] + fromadvanced: [0, 1, 2, 3] + fromarray: [-2, -2, -2, -2] + fromstarts: [10, 0, 0, 5] + fromstops: [15, 5, 5, 10] + lenarray: 4 + lencontent: 30 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [10] + toadvanced: [0, 1, 2, 3] + tocarry: [13, 3, 3, 8] - error: false inputs: - length: 3 - offsets: [0, 3, 6, 10] + fromadvanced: [0, 1, 2, 3] + fromarray: [1, 0, 0, 1] + fromstarts: [0, 3, 3, 3] + fromstops: [3, 6, 6, 6] + lenarray: 4 + lencontent: 6 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [10] + toadvanced: [0, 1, 2, 3] + tocarry: [1, 3, 3, 4] - error: false inputs: - length: 2 - offsets: [0, 5, 10] + fromadvanced: [0, 1, 2, 3] + fromarray: [1, 0, 0, 1] + fromstarts: [0, 5, 10, 5] + fromstops: [5, 10, 15, 10] + lenarray: 4 + lencontent: 30 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [10] + toadvanced: [0, 1, 2, 3] + tocarry: [1, 5, 10, 6] - error: false inputs: - length: 3 - offsets: [0, 3, 6, 11] + fromadvanced: [0, 1, 2, 3] + fromarray: [0, 1, -1, 1] + fromstarts: [15, 0, 0, 15] + fromstops: [20, 5, 5, 20] + lenarray: 4 + lencontent: 30 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [11] + toadvanced: [0, 1, 2, 3] + tocarry: [15, 1, 4, 16] - error: false inputs: - length: 3 - offsets: [0, 4, 8, 12] + fromadvanced: [0, 1, 2, 3] + fromarray: [0, 1, -1, 1] + fromstarts: [15, 15, 15, 15] + fromstops: [20, 20, 20, 20] + lenarray: 4 + lencontent: 30 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [12] + toadvanced: [0, 1, 2, 3] + tocarry: [15, 16, 19, 16] - error: false inputs: - length: 3 - offsets: [0, 5, 9, 12] + fromadvanced: [0, 1, 2, 3] + fromarray: [1, 0, 0, 1] + fromstarts: [15, 15, 15, 15] + fromstops: [20, 20, 20, 20] + lenarray: 4 + lencontent: 30 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [12] + toadvanced: [0, 1, 2, 3] + tocarry: [16, 15, 15, 16] - error: false inputs: - length: 5 - offsets: [0, 3, 6, 9, 12, 15] + fromadvanced: [0, 1, 2, 3] + fromarray: [-1, -1, -1, -1] + fromstarts: [15, 0, 0, 15] + fromstops: [20, 5, 5, 20] + lenarray: 4 + lencontent: 30 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [15] + toadvanced: [0, 1, 2, 3] + tocarry: [19, 4, 4, 19] - error: false inputs: - length: 3 - offsets: [0, 5, 10, 15] + fromadvanced: [0, 1] + fromarray: [-1, 0] + fromstarts: [0, 0] + fromstops: [3, 3] + lenarray: 2 + lencontent: 5 + lenstarts: 2 outputs: - globalstart: [0] - globalstop: [15] + toadvanced: [0, 1] + tocarry: [2, 0] - error: false inputs: - length: 9 - offsets: [0, 0, 1, 3, 6, 10, 13, 15, 16, 16] + fromadvanced: [0, 1, 2, 3] + fromarray: [-1, -1, -1, -1] + fromstarts: [0, 0, 0, 0] + fromstops: [3, 3, 3, 3] + lenarray: 4 + lencontent: 6 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [16] + toadvanced: [0, 1, 2, 3] + tocarry: [2, 2, 2, 2] - error: false inputs: - length: 5 - offsets: [0, 3, 6, 10, 14, 17] + fromadvanced: [0, 1] + fromarray: [1, 2] + fromstarts: [1, 1] + fromstops: [4, 4] + lenarray: 2 + lencontent: 4 + lenstarts: 2 outputs: - globalstart: [0] - globalstop: [17] + toadvanced: [0, 1] + tocarry: [2, 3] - error: false inputs: - length: 5 - offsets: [0, 5, 8, 11, 14, 17] + fromadvanced: [0, 1, 2, 3] + fromarray: [-1, -1, -1, -1] + fromstarts: [0, 3, 3, 3] + fromstops: [3, 6, 6, 6] + lenarray: 4 + lencontent: 6 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [17] + toadvanced: [0, 1, 2, 3] + tocarry: [2, 5, 5, 5] - error: false inputs: - length: 6 - offsets: [0, 3, 6, 9, 12, 15, 18] + fromadvanced: [0, 1, 2, 3] + fromarray: [0, 0, 0, 0] + fromstarts: [3, 0, 0, 3] + fromstops: [6, 3, 3, 6] + lenarray: 4 + lencontent: 6 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [18] + toadvanced: [0, 1, 2, 3] + tocarry: [3, 0, 0, 3] - error: false inputs: - length: 9 - offsets: [0, 0, 3, 3, 8, 12, 12, 16, 19, 19] + fromadvanced: [0] + fromarray: [1] + fromstarts: [2] + fromstops: [5] + lenarray: 1 + lencontent: 5 + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [19] + toadvanced: [0] + tocarry: [3] - error: false inputs: - length: 8 - offsets: [0, 0, 3, 3, 8, 12, 12, 16, 19] + fromadvanced: [0, 1] + fromarray: [-1, 0] + fromstarts: [1, 1] + fromstops: [4, 4] + lenarray: 2 + lencontent: 4 + lenstarts: 2 outputs: - globalstart: [0] - globalstop: [19] + toadvanced: [0, 1] + tocarry: [3, 1] - error: false inputs: - length: 5 - offsets: [0, 3, 8, 12, 16, 19] + fromadvanced: [0, 1, 2, 3] + fromarray: [0, 1, -1, 1] + fromstarts: [3, 0, 0, 3] + fromstops: [6, 3, 3, 6] + lenarray: 4 + lencontent: 6 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [19] + toadvanced: [0, 1, 2, 3] + tocarry: [3, 1, 2, 4] - error: false inputs: - length: 5 - offsets: [0, 5, 8, 11, 14, 19] + fromadvanced: [0, 1, 2, 3] + fromarray: [0, 0, 0, 0] + fromstarts: [3, 3, 3, 3] + fromstops: [6, 6, 6, 6] + lenarray: 4 + lencontent: 6 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [19] + toadvanced: [0, 1, 2, 3] + tocarry: [3, 3, 3, 3] - error: false inputs: - length: 6 - offsets: [0, 3, 6, 11, 14, 17, 20] + fromadvanced: [0, 1, 2, 3] + fromarray: [0, 1, -1, 1] + fromstarts: [3, 3, 3, 3] + fromstops: [6, 6, 6, 6] + lenarray: 4 + lencontent: 6 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [20] + toadvanced: [0, 1, 2, 3] + tocarry: [3, 4, 5, 4] - error: false inputs: - length: 4 - offsets: [0, 5, 10, 15, 20] + fromadvanced: [0, 1] + fromarray: [1, 1] + fromstarts: [3, 0] + fromstops: [5, 3] + lenarray: 2 + lencontent: 5 + lenstarts: 2 outputs: - globalstart: [0] - globalstop: [20] + toadvanced: [0, 1] + tocarry: [4, 1] - error: false inputs: - length: 9 - offsets: [0, 3, 6, 6, 10, 14, 14, 18, 21, 21] + fromadvanced: [0, 1, 2, 3] + fromarray: [1, 1, 0, 0] + fromstarts: [3, 0, 0, 6] + fromstops: [5, 3, 3, 9] + lenarray: 4 + lencontent: 9 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [21] + toadvanced: [0, 1, 2, 3] + tocarry: [4, 1, 0, 6] - error: false inputs: - length: 8 - offsets: [0, 3, 6, 6, 10, 14, 14, 18, 21] + fromadvanced: [0, 1, 2, 3] + fromarray: [-1, -1, -1, -1] + fromstarts: [0, 15, 15, 15] + fromstops: [5, 20, 20, 20] + lenarray: 4 + lencontent: 30 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [21] + toadvanced: [0, 1, 2, 3] + tocarry: [4, 19, 19, 19] - error: false inputs: - length: 7 - offsets: [0, 3, 6, 9, 12, 15, 18, 21] + fromadvanced: [0, 1, 2, 3] + fromarray: [1, -1, 0, 0] + fromstarts: [3, 0, 0, 3] + fromstops: [5, 3, 3, 5] + lenarray: 4 + lencontent: 5 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [21] + toadvanced: [0, 1, 2, 3] + tocarry: [4, 2, 0, 3] - error: false inputs: - length: 6 - offsets: [0, 3, 6, 11, 15, 19, 22] + fromadvanced: [0, 1, 2, 3] + fromarray: [1, 0, 0, 1] + fromstarts: [3, 3, 3, 3] + fromstops: [6, 6, 6, 6] + lenarray: 4 + lencontent: 6 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [22] + toadvanced: [0, 1, 2, 3] + tocarry: [4, 3, 3, 4] - error: false inputs: - length: 9 - offsets: [0, 3, 6, 6, 11, 15, 15, 19, 22, 22] + fromadvanced: [0, 1, 2, 3] + fromarray: [-1, -1, -1, -1] + fromstarts: [0, 5, 10, 5] + fromstops: [5, 10, 15, 10] + lenarray: 4 + lencontent: 30 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [22] + toadvanced: [0, 1, 2, 3] + tocarry: [4, 9, 14, 9] - error: false inputs: - length: 8 - offsets: [0, 3, 6, 6, 11, 15, 15, 19, 22] + fromadvanced: [0, 1, 2, 3, 4, 5] + fromarray: [2, 0, 1, 1, 2, 0] + fromstarts: [3, 0, 3, 3, 3, 0] + fromstops: [6, 3, 6, 6, 6, 3] + lenarray: 6 + lencontent: 6 + lenstarts: 6 outputs: - globalstart: [0] - globalstop: [22] + toadvanced: [0, 1, 2, 3, 4, 5] + tocarry: [5, 0, 4, 4, 5, 0] - error: false inputs: - length: 6 - offsets: [0, 5, 10, 11, 12, 17, 22] + fromadvanced: [0, 1, 2, 3] + fromarray: [0, 1, -1, 1] + fromstarts: [5, 0, 0, 5] + fromstops: [10, 5, 5, 10] + lenarray: 4 + lencontent: 30 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [22] + toadvanced: [0, 1, 2, 3] + tocarry: [5, 1, 4, 6] - error: false inputs: - length: 6 - offsets: [0, 5, 6, 11, 16, 17, 22] + fromadvanced: [0, 1, 2, 3] + fromarray: [-1, -1, -1, -1] + fromstarts: [3, 0, 0, 3] + fromstops: [6, 3, 3, 6] + lenarray: 4 + lencontent: 6 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [22] + toadvanced: [0, 1, 2, 3] + tocarry: [5, 2, 2, 5] - error: false inputs: - length: 9 - offsets: [0, 3, 6, 8, 13, 17, 17, 21, 24, 24] + fromadvanced: [0, 1, 2, 3] + fromarray: [1, 1, 0, 0] + fromstarts: [6, 0, 0, 6] + fromstops: [9, 3, 3, 9] + lenarray: 4 + lencontent: 9 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [24] + toadvanced: [0, 1, 2, 3] + tocarry: [7, 1, 0, 6] - error: false inputs: - length: 8 - offsets: [0, 3, 6, 8, 13, 17, 17, 21, 24] + fromadvanced: [0, 1, 2, 3] + fromarray: [-1, -1, -1, -1] + fromstarts: [5, 0, 0, 5] + fromstops: [10, 5, 5, 10] + lenarray: 4 + lencontent: 30 + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [24] + toadvanced: [0, 1, 2, 3] + tocarry: [9, 4, 4, 9] +- name: awkward_ListArray_getitem_next_at + tests: - error: false inputs: - length: 7 - offsets: [0, 3, 6, 11, 14, 17, 20, 25] + at: 0 + fromstarts: [] + fromstops: [] + lenstarts: 0 outputs: - globalstart: [0] - globalstop: [25] + tocarry: [] - error: false inputs: - length: 5 - offsets: [0, 5, 10, 15, 20, 25] + at: 0 + fromstarts: [0] + fromstops: [1] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [25] + tocarry: [0] - error: false inputs: - length: 6 - offsets: [0, 3, 8, 13, 18, 23, 28] + at: 0 + fromstarts: [0] + fromstops: [2] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [28] + tocarry: [0] - error: false inputs: - length: 6 - offsets: [0, 4, 9, 13, 18, 23, 28] + at: 0 + fromstarts: [0] + fromstops: [3] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [28] + tocarry: [0] - error: false inputs: - length: 6 - offsets: [0, 5, 10, 14, 18, 23, 28] + at: -5 + fromstarts: [0] + fromstops: [5] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [28] + tocarry: [0] - error: false inputs: - length: 6 - offsets: [0, 5, 10, 15, 19, 24, 28] + at: 0 + fromstarts: [0, 1] + fromstops: [1, 2] + lenstarts: 2 outputs: - globalstart: [0] - globalstop: [28] + tocarry: [0, 1] - error: false inputs: - length: 6 - offsets: [0, 5, 10, 15, 20, 24, 28] + at: 0 + fromstarts: [0, 1, 2, 3] + fromstops: [1, 2, 3, 4] + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [28] + tocarry: [0, 1, 2, 3] - error: false inputs: - length: 6 - offsets: [0, 5, 10, 15, 20, 25, 28] + at: 0 + fromstarts: [0, 1, 2, 3, 4] + fromstops: [1, 2, 3, 4, 5] + lenstarts: 5 outputs: - globalstart: [0] - globalstop: [28] + tocarry: [0, 1, 2, 3, 4] - error: false inputs: - length: 6 - offsets: [0, 4, 9, 14, 19, 24, 29] + at: 0 + fromstarts: [0, 2, 3] + fromstops: [2, 3, 5] + lenstarts: 3 outputs: - globalstart: [0] - globalstop: [29] + tocarry: [0, 2, 3] - error: false inputs: - length: 7 - offsets: [0, 5, 10, 15, 18, 21, 24, 29] + at: 0 + fromstarts: [0, 3, 5, 6] + fromstops: [3, 5, 6, 10] + lenstarts: 4 outputs: - globalstart: [0] - globalstop: [29] + tocarry: [0, 3, 5, 6] - error: false inputs: - length: 6 - offsets: [0, 5, 10, 15, 20, 25, 29] + at: 0 + fromstarts: [10] + fromstops: [15] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [29] + tocarry: [10] - error: false inputs: - length: 6 - offsets: [0, 5, 10, 15, 20, 25, 30] + at: 1 + fromstarts: [0] + fromstops: [2] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [30] + tocarry: [1] - error: false inputs: - length: 3 - offsets: [0, 1, 1, 3] + at: 1 + fromstarts: [0] + fromstops: [3] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [3] + tocarry: [1] - error: false inputs: - length: 1 - offsets: [0, 3] + at: -2 + fromstarts: [0] + fromstops: [3] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [3] + tocarry: [1] - error: false inputs: - length: 1 - offsets: [0, 4] + at: 1 + fromstarts: [0] + fromstops: [5] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [4] + tocarry: [1] - error: false inputs: - length: 3 - offsets: [0, 2, 3, 5] + at: 1 + fromstarts: [10] + fromstops: [15] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [5] + tocarry: [11] - error: false inputs: - length: 3 - offsets: [0, 3, 3, 5] + at: 0 + fromstarts: [1] + fromstops: [2] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [5] + tocarry: [1] - error: false inputs: - length: 1 - offsets: [0, 5] + at: 0 + fromstarts: [1] + fromstops: [3] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [5] + tocarry: [1] - error: false inputs: - length: 4 - offsets: [0, 1, 2, 5, 6] + at: -2 + fromstarts: [10] + fromstops: [15] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [6] + tocarry: [13] - error: false inputs: - length: 5 - offsets: [0, 2, 2, 4, 5, 6] + at: 1 + fromstarts: [0, 3] + fromstops: [3, 5] + lenstarts: 2 outputs: - globalstart: [0] - globalstop: [6] + tocarry: [1, 4] - error: false inputs: - length: 3 - offsets: [0, 2, 4, 6] + at: 1 + fromstarts: [0, 5] + fromstops: [5, 10] + lenstarts: 2 outputs: - globalstart: [0] - globalstop: [6] + tocarry: [1, 6] - error: false inputs: - length: 4 - offsets: [0, 3, 3, 5, 6] + at: 1 + fromstarts: [15] + fromstops: [20] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [6] + tocarry: [16] - error: false inputs: - length: 3 - offsets: [0, 3, 3, 6] + at: -2 + fromstarts: [15] + fromstops: [20] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [6] + tocarry: [18] - error: false inputs: - length: 2 - offsets: [0, 3, 6] + at: -1 + fromstarts: [15] + fromstops: [20] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [6] + tocarry: [19] - error: false inputs: - length: 3 - offsets: [0, 4, 4, 6] + at: -1 + fromstarts: [0] + fromstops: [3] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [6] + tocarry: [2] - error: false inputs: - length: 2 - offsets: [0, 4, 6] + at: 1 + fromstarts: [1] + fromstops: [3] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [6] + tocarry: [2] - error: false inputs: - length: 3 - offsets: [0, 3, 3, 7] + at: 1 + fromstarts: [1] + fromstops: [4] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [7] + tocarry: [2] - error: false inputs: - length: 7 - offsets: [0, 2, 3, 4, 5, 6, 7, 8] + at: 0 + fromstarts: [2] + fromstops: [3] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [8] + tocarry: [2] - error: false inputs: - length: 6 - offsets: [0, 2, 3, 4, 5, 6, 8] + at: 1 + fromstarts: [2] + fromstops: [5] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [8] + tocarry: [3] - error: false inputs: - length: 5 - offsets: [0, 3, 3, 5, 6, 8] + at: 0 + fromstarts: [3] + fromstops: [5] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [8] + tocarry: [3] - error: false inputs: - length: 7 - offsets: [0, 3, 3, 5, 6, 6, 6, 9] + at: 0 + fromstarts: [3] + fromstops: [6] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [9] + tocarry: [3] - error: false inputs: - length: 6 - offsets: [0, 3, 3, 5, 6, 8, 9] + at: 0 + fromstarts: [3, 5, 6] + fromstops: [5, 6, 9] + lenstarts: 3 outputs: - globalstart: [0] - globalstop: [9] + tocarry: [3, 5, 6] - error: false inputs: - length: 5 - offsets: [0, 3, 3, 5, 6, 9] + at: -1 + fromstarts: [0] + fromstops: [5] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [9] + tocarry: [4] - error: false inputs: - length: 5 - offsets: [0, 3, 4, 6, 6, 9] + at: 4 + fromstarts: [0] + fromstops: [5] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [9] + tocarry: [4] - error: false inputs: - length: 6 - offsets: [0, 3, 5, 5, 6, 8, 9] + at: 1 + fromstarts: [3] + fromstops: [5] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [9] + tocarry: [4] - error: false inputs: - length: 6 - offsets: [0, 3, 5, 6, 7, 7, 9] + at: 1 + fromstarts: [3] + fromstops: [6] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [9] + tocarry: [4] - error: false inputs: - length: 5 - offsets: [0, 3, 5, 6, 7, 9] + at: -2 + fromstarts: [3] + fromstops: [6] + lenstarts: 1 outputs: - globalstart: [0] - globalstop: [9] + tocarry: [4] - error: false inputs: - length: 3 - offsets: [0, 3, 6, 9] + at: -1 + fromstarts: [3, 5, 6] + fromstops: [5, 6, 9] + lenstarts: 3 outputs: - globalstart: [0] - globalstop: [9] -- name: awkward_ListOffsetArray_reduce_nonlocal_maxcount_offsetscopy_64 - tests: + tocarry: [4, 5, 8] - error: false inputs: - length: 3 - offsets: [0, 2, 3, 5] + at: -1 + fromstarts: [0, 5] + fromstops: [5, 10] + lenstarts: 2 outputs: - maxcount: [2] - offsetscopy: [0, 2, 3, 5] + tocarry: [4, 9] - error: false inputs: - length: 3 - offsets: [0, 2, 4, 6] + at: 0 + fromstarts: [5, 10] + fromstops: [10, 15] + lenstarts: 2 outputs: - maxcount: [2] - offsetscopy: [0, 2, 4, 6] + tocarry: [5, 10] - error: false inputs: - length: 3 - offsets: [0, 3, 3, 5] + at: -1 + fromstarts: [3] + fromstops: [6] + lenstarts: 1 outputs: - maxcount: [3] - offsetscopy: [0, 3, 3, 5] + tocarry: [5] - error: false inputs: - length: 6 - offsets: [0, 3, 3, 5, 6, 8, 9] + at: 0 + fromstarts: [5] + fromstops: [10] + lenstarts: 1 outputs: - maxcount: [3] - offsetscopy: [0, 3, 3, 5, 6, 8, 9] + tocarry: [5] - error: false inputs: - length: 5 - offsets: [0, 3, 3, 5, 6, 9] + at: -5 + fromstarts: [5] + fromstops: [10] + lenstarts: 1 outputs: - maxcount: [3] - offsetscopy: [0, 3, 3, 5, 6, 9] + tocarry: [5] - error: false inputs: - length: 6 - offsets: [0, 3, 5, 5, 6, 8, 9] + at: 1 + fromstarts: [5, 10] + fromstops: [10, 15] + lenstarts: 2 outputs: - maxcount: [3] - offsetscopy: [0, 3, 5, 5, 6, 8, 9] + tocarry: [6, 11] - error: false inputs: - length: 6 - offsets: [0, 3, 5, 6, 7, 7, 9] + at: 1 + fromstarts: [5] + fromstops: [10] + lenstarts: 1 outputs: - maxcount: [3] - offsetscopy: [0, 3, 5, 6, 7, 7, 9] + tocarry: [6] - error: false inputs: - length: 5 - offsets: [0, 3, 5, 6, 7, 9] + at: 1 + fromstarts: [6] + fromstops: [10] + lenstarts: 1 outputs: - maxcount: [3] - offsetscopy: [0, 3, 5, 6, 7, 9] + tocarry: [7] - error: false inputs: - length: 6 - offsets: [0, 3, 5, 7, 8, 9, 10] + at: 1 + fromstarts: [6] + fromstops: [9] + lenstarts: 1 outputs: - maxcount: [3] - offsetscopy: [0, 3, 5, 7, 8, 9, 10] + tocarry: [7] - error: false inputs: - length: 2 - offsets: [0, 3, 6] + at: -2 + fromstarts: [5] + fromstops: [10] + lenstarts: 1 outputs: - maxcount: [3] - offsetscopy: [0, 3, 6] + tocarry: [8] - error: false inputs: - length: 5 - offsets: [0, 3, 6, 9, 12, 15] + at: -1 + fromstarts: [5, 10] + fromstops: [10, 15] + lenstarts: 2 outputs: - maxcount: [3] - offsetscopy: [0, 3, 6, 9, 12, 15] + tocarry: [9, 14] - error: false inputs: - length: 9 - offsets: [0, 0, 1, 3, 6, 10, 13, 15, 16, 16] + at: -1 + fromstarts: [5] + fromstops: [10] + lenstarts: 1 outputs: - maxcount: [4] - offsetscopy: [0, 0, 1, 3, 6, 10, 13, 15, 16, 16] + tocarry: [9] - error: false inputs: - length: 3 - offsets: [0, 3, 3, 7] + at: 4 + fromstarts: [5] + fromstops: [10] + lenstarts: 1 outputs: - maxcount: [4] - offsetscopy: [0, 3, 3, 7] + tocarry: [9] +- name: awkward_ListArray_getitem_next_range_counts + tests: - error: false inputs: - length: 3 - offsets: [0, 3, 6, 10] + fromoffsets: [0, 2, 2, 4, 4, 5, 6, 7, 9, 9] + lenstarts: 9 outputs: - maxcount: [4] - offsetscopy: [0, 3, 6, 10] + total: [9] - error: false inputs: - length: 3 - offsets: [0, 4, 4, 6] + fromoffsets: [0, 2, 4, 5, 6, 7, 9] + lenstarts: 6 outputs: - maxcount: [4] - offsetscopy: [0, 4, 4, 6] + total: [9] +- name: awkward_ListArray_localindex + tests: - error: false inputs: - length: 2 - offsets: [0, 4, 6] + length: 1 + offsets: [0, 1] outputs: - maxcount: [4] - offsetscopy: [0, 4, 6] + toindex: [0] - error: false inputs: length: 3 - offsets: [0, 4, 8, 12] + offsets: [0, 2, 3, 5] outputs: - maxcount: [4] - offsetscopy: [0, 4, 8, 12] + toindex: [0, 1, 0, 0, 1] - error: false inputs: - length: 6 - offsets: [0, 3, 8, 13, 18, 23, 28] + length: 4 + offsets: [0, 2, 3, 3, 6] outputs: - maxcount: [5] - offsetscopy: [0, 3, 8, 13, 18, 23, 28] + toindex: [0, 1, 0, 0, 1, 2] - error: false inputs: - length: 6 - offsets: [0, 4, 9, 13, 18, 23, 28] + length: 2 + offsets: [0, 2, 3] outputs: - maxcount: [5] - offsetscopy: [0, 4, 9, 13, 18, 23, 28] + toindex: [0, 1, 0] - error: false inputs: - length: 6 - offsets: [0, 4, 9, 14, 19, 24, 29] + length: 1 + offsets: [0, 2] outputs: - maxcount: [5] - offsetscopy: [0, 4, 9, 14, 19, 24, 29] + toindex: [0, 1] - error: false inputs: - length: 6 - offsets: [0, 5, 10, 11, 12, 17, 22] + length: 4 + offsets: [0, 3, 3, 4, 5] outputs: - maxcount: [5] - offsetscopy: [0, 5, 10, 11, 12, 17, 22] + toindex: [0, 1, 2, 0, 0] - error: false inputs: - length: 6 - offsets: [0, 5, 10, 14, 18, 23, 28] + length: 7 + offsets: [0, 3, 3, 5, 6, 10, 10, 13] outputs: - maxcount: [5] - offsetscopy: [0, 5, 10, 14, 18, 23, 28] + toindex: [0, 1, 2, 0, 1, 0, 0, 1, 2, 3, 0, 1, 2] - error: false inputs: - length: 3 - offsets: [0, 5, 10, 15] + length: 5 + offsets: [0, 3, 3, 5, 6, 10] outputs: - maxcount: [5] - offsetscopy: [0, 5, 10, 15] + toindex: [0, 1, 2, 0, 1, 0, 0, 1, 2, 3] - error: false inputs: length: 6 - offsets: [0, 5, 10, 15, 19, 24, 28] + offsets: [0, 3, 3, 5, 6, 6, 10] outputs: - maxcount: [5] - offsetscopy: [0, 5, 10, 15, 19, 24, 28] + toindex: [0, 1, 2, 0, 1, 0, 0, 1, 2, 3] - error: false inputs: - length: 4 - offsets: [0, 5, 10, 15, 20] + length: 3 + offsets: [0, 3, 3, 5] outputs: - maxcount: [5] - offsetscopy: [0, 5, 10, 15, 20] + toindex: [0, 1, 2, 0, 1] - error: false inputs: - length: 6 - offsets: [0, 5, 10, 15, 20, 24, 28] + length: 5 + offsets: [0, 4, 4, 7, 8, 13] outputs: - maxcount: [5] - offsetscopy: [0, 5, 10, 15, 20, 24, 28] + toindex: [0, 1, 2, 3, 0, 1, 2, 0, 0, 1, 2, 3, 4] +- name: awkward_ListArray_num + tests: - error: false inputs: - length: 5 - offsets: [0, 5, 10, 15, 20, 25] + fromstarts: [0, 0] + fromstops: [0, 0] + length: 2 outputs: - maxcount: [5] - offsetscopy: [0, 5, 10, 15, 20, 25] + tonum: [0, 0] - error: false inputs: - length: 6 - offsets: [0, 5, 10, 15, 20, 25, 28] + fromstarts: [0] + fromstops: [0] + length: 1 outputs: - maxcount: [5] - offsetscopy: [0, 5, 10, 15, 20, 25, 28] + tonum: [0] - error: false inputs: - length: 6 - offsets: [0, 5, 10, 15, 20, 25, 29] + fromstarts: [0, 0, 1] + fromstops: [0, 1, 1] + length: 3 outputs: - maxcount: [5] - offsetscopy: [0, 5, 10, 15, 20, 25, 29] + tonum: [0, 1, 0] - error: false inputs: - length: 6 - offsets: [0, 5, 10, 15, 20, 25, 30] + fromstarts: [0, 0, 1, 1, 2, 4, 4, 5, 7] + fromstops: [0, 1, 1, 2, 4, 4, 5, 7, 10] + length: 9 outputs: - maxcount: [5] - offsetscopy: [0, 5, 10, 15, 20, 25, 30] + tonum: [0, 1, 0, 1, 2, 0, 1, 2, 3] - error: false inputs: - length: 6 - offsets: [0, 5, 6, 11, 16, 17, 22] + fromstarts: [0, 0, 1] + fromstops: [0, 1, 2] + length: 3 outputs: - maxcount: [5] - offsetscopy: [0, 5, 6, 11, 16, 17, 22] + tonum: [0, 1, 1] - error: false inputs: - length: 5 - offsets: [0, 5, 8, 11, 14, 17] + fromstarts: [0, 0, 1, 2, 2, 3, 3, 3, 4, 5] + fromstops: [0, 1, 2, 2, 3, 3, 3, 4, 5, 5] + length: 10 outputs: - maxcount: [5] - offsetscopy: [0, 5, 8, 11, 14, 17] + tonum: [0, 1, 1, 0, 1, 0, 0, 1, 1, 0] - error: false inputs: - length: 3 - offsets: [0, 5, 9, 12] + fromstarts: [0, 0, 1, 3] + fromstops: [0, 1, 3, 6] + length: 4 outputs: - maxcount: [5] - offsetscopy: [0, 5, 9, 12] -- name: awkward_ByteMaskedArray_overlay_mask - tests: + tonum: [0, 1, 2, 3] - error: false inputs: - length: 2 - mymask: [0, 0] - theirmask: [0, 0] - validwhen: false + fromstarts: [0, 1, 2, 2, 3, 3, 3, 4] + fromstops: [1, 2, 2, 3, 3, 3, 4, 5] + length: 8 outputs: - tomask: [0, 0] -- name: awkward_Identities_from_UnionArray - tests: + tonum: [1, 1, 0, 1, 0, 0, 1, 1] - error: false inputs: - fromindex: [0, 1, 0, 1, 2, 2, 4, 3] - fromlength: 8 - fromptr: [0, 1, 2, 3, 4, 5, 6, 7] - fromtags: [1, 1, 0, 0, 1, 0, 1, 1] - fromwidth: 1 - tolength: 5 - which: 1 + fromstarts: [0, 1, 2, 3] + fromstops: [1, 2, 3, 4] + length: 4 outputs: - toptr: [0, 1, 4, 7, 6] - uniquecontents: [1] + tonum: [1, 1, 1, 1] - error: false inputs: - fromindex: [0, 1, 0, 1, 2, 2, 4, 3] - fromlength: 8 - fromptr: [0, 1, 2, 3, 4, 5, 6, 7] - fromtags: [1, 1, 0, 0, 1, 0, 1, 1] - fromwidth: 1 - tolength: 3 - which: 0 + fromstarts: [0, 0, 0, 0, 0] + fromstops: [1, 1, 1, 1, 1] + length: 5 outputs: - toptr: [2, 3, 5] - uniquecontents: [1] -- name: awkward_IndexedArray_flatten_none2empty - tests: + tonum: [1, 1, 1, 1, 1] - error: false inputs: - offsets: [0, 1, 1, 6] - offsetslength: 4 - outindex: [0, 1, 2, 1] - outindexlength: 4 + fromstarts: [0, 1, 3] + fromstops: [1, 3, 6] + length: 3 outputs: - outoffsets: [0, 1, 1, 6, 6] + tonum: [1, 2, 3] - error: false inputs: - offsets: [0, 3, 3, 5] - offsetslength: 4 - outindex: [0, 1, 1, 1, 2] - outindexlength: 5 + fromstarts: [0, 2, 3, 3] + fromstops: [2, 3, 3, 5] + length: 4 outputs: - outoffsets: [0, 3, 3, 3, 3, 5] + tonum: [2, 1, 0, 2] - error: false inputs: - offsets: [0, 3, 3, 4, 7] - offsetslength: 5 - outindex: [0, 1, 2, 1, 3] - outindexlength: 5 + fromstarts: [3, 3, 3, 0] + fromstops: [5, 5, 3, 3] + length: 4 outputs: - outoffsets: [0, 3, 3, 4, 4, 7] + tonum: [2, 2, 0, 3] - error: false inputs: - offsets: [0, 3, 3, 5, 6, 6, 10] - offsetslength: 7 - outindex: [0, 1, 2, 3, 4, 1, 5] - outindexlength: 7 + fromstarts: [0, 0, 0, 0, 0] + fromstops: [2, 2, 2, 2, 2] + length: 5 outputs: - outoffsets: [0, 3, 3, 5, 6, 6, 6, 10] + tonum: [2, 2, 2, 2, 2] - error: false inputs: - offsets: [0, 4, 4, 6] - offsetslength: 4 - outindex: [0, 1, 1, 1, 2, 1] - outindexlength: 6 + fromstarts: [0, 2, 5] + fromstops: [2, 5, 9] + length: 3 outputs: - outoffsets: [0, 4, 4, 4, 4, 6, 6] + tonum: [2, 3, 4] - error: false inputs: - offsets: [0, 4, 4, 6, 7, 7, 12] - offsetslength: 7 - outindex: [0, 1, 1, 1, 2, 3, 4, 5, 1] - outindexlength: 9 + fromstarts: [0, 3, 3, 10, 10] + fromstops: [3, 3, 5, 10, 13] + length: 5 outputs: - outoffsets: [0, 4, 4, 4, 4, 6, 7, 7, 12, 12] + tonum: [3, 0, 2, 0, 3] - error: false inputs: - offsets: [0, 5, 5, 6, 9] - offsetslength: 5 - outindex: [0, 1, 1, 2, 1, 3] - outindexlength: 6 + fromstarts: [0, 3, 3] + fromstops: [3, 3, 5] + length: 3 outputs: - outoffsets: [0, 5, 5, 5, 6, 6, 9] -- name: awkward_IndexedArray_reduce_next_64 - tests: + tonum: [3, 0, 2] - error: false inputs: - index: [0, 1] - length: 2 - parents: [0, 0] + fromstarts: [0, 3, 5] + fromstops: [3, 3, 7] + length: 3 outputs: - nextcarry: [0, 1] - nextparents: [0, 0] - outindex: [0, 1] + tonum: [3, 0, 2] - error: false inputs: - index: [0, 1, 2, 3, 4, 5, 6] - length: 7 - parents: [0, 0, 2, 2, 3, 4, 4] + fromstarts: [0, 3, 3, 5, 6] + fromstops: [3, 3, 5, 6, 10] + length: 5 outputs: - nextcarry: [0, 1, 2, 3, 4, 5, 6] - nextparents: [0, 0, 2, 2, 3, 4, 4] - outindex: [0, 1, 2, 3, 4, 5, 6] + tonum: [3, 0, 2, 1, 4] - error: false inputs: - index: [1, 2] - length: 2 - parents: [0, 0] - outputs: - nextcarry: [1, 2] - nextparents: [0, 0] - outindex: [0, 1] + fromstarts: [0, 3, 5, 6] + fromstops: [3, 5, 6, 6] + length: 4 + outputs: + tonum: [3, 2, 1, 0] - error: false inputs: - index: [1, 2, 3] + fromstarts: [0, 3, 6] + fromstops: [3, 6, 9] length: 3 - parents: [0, 0, 0] outputs: - nextcarry: [1, 2, 3] - nextparents: [0, 0, 0] - outindex: [0, 1, 2] + tonum: [3, 3, 3] - error: false inputs: - index: [1, 2, 3, 4] - length: 4 - parents: [0, 0, 0, 0] + fromstarts: [0, 0, 0, 0, 0] + fromstops: [3, 3, 3, 3, 3] + length: 5 outputs: - nextcarry: [1, 2, 3, 4] - nextparents: [0, 0, 0, 0] - outindex: [0, 1, 2, 3] + tonum: [3, 3, 3, 3, 3] - error: false inputs: - index: [2, 3] - length: 2 - parents: [0, 0] + fromstarts: [0, 0, 0, 0, 0] + fromstops: [4, 4, 4, 4, 4] + length: 5 outputs: - nextcarry: [2, 3] - nextparents: [0, 0] - outindex: [0, 1] + tonum: [4, 4, 4, 4, 4] - error: false inputs: - index: [2, 3, 4] + fromstarts: [0, 5, 10] + fromstops: [5, 10, 15] length: 3 - parents: [0, 0, 0] outputs: - nextcarry: [2, 3, 4] - nextparents: [0, 0, 0] - outindex: [0, 1, 2] + tonum: [5, 5, 5] +- name: awkward_ListArray_rpad_axis1 + tests: - error: false inputs: - index: [3, 4] - length: 2 - parents: [0, 0] + fromstarts: [0, 3, 4, 5, 8] + fromstops: [3, 3, 6, 8, 9] + length: 5 + target: 4 outputs: - nextcarry: [3, 4] - nextparents: [0, 0] - outindex: [0, 1] + toindex: [0, 1, 2, -1, -1, -1, -1, -1, 4, 5, -1, -1, 5, 6, 7, -1, 8, -1, -1, + -1] + tostarts: [0, 4, 8, 12, 16] + tostops: [4, 8, 12, 16, 20] - error: false inputs: - index: [4, 3, 2, 1, 0] + fromstarts: [0, 3, 4, 5, 8] + fromstops: [3, 3, 6, 8, 9] length: 5 - parents: [0, 0, 0, 0, 0] + target: 3 outputs: - nextcarry: [4, 3, 2, 1, 0] - nextparents: [0, 0, 0, 0, 0] - outindex: [0, 1, 2, 3, 4] + toindex: [0, 1, 2, -1, -1, -1, 4, 5, -1, 5, 6, 7, 8, -1, -1] + tostarts: [0, 3, 6, 9, 12] + tostops: [3, 6, 9, 12, 15] - error: false inputs: - index: [5, 2, 4, 1, 3, 0] - length: 6 - parents: [0, 0, 1, 1, 2, 2] + fromstarts: [0, 3, 5] + fromstops: [3, 3, 7] + length: 3 + target: 3 outputs: - nextcarry: [5, 2, 4, 1, 3, 0] - nextparents: [0, 0, 1, 1, 2, 2] - outindex: [0, 1, 2, 3, 4, 5] + toindex: [0, 1, 2, -1, -1, -1, 5, 6, -1] + tostarts: [0, 3, 6] + tostops: [3, 6, 9] - error: false inputs: - index: [5, 4, 3, 2, 1, 0] - length: 6 - parents: [0, 0, 0, 1, 1, 1] + fromstarts: [0, 3, 4, 5, 8] + fromstops: [3, 3, 6, 8, 9] + length: 5 + target: 2 outputs: - nextcarry: [5, 4, 3, 2, 1, 0] - nextparents: [0, 0, 0, 1, 1, 1] - outindex: [0, 1, 2, 3, 4, 5] -- name: awkward_IndexedArray_simplify - tests: + toindex: [0, 1, 2, -1, -1, 4, 5, 5, 6, 7, 8, -1] + tostarts: [0, 3, 5, 7, 10] + tostops: [3, 5, 7, 10, 12] - error: false inputs: - innerindex: [0, 1] - innerlength: 2 - outerindex: [0, 1] - outerlength: 2 + fromstarts: [0, 3, 4, 5, 8] + fromstops: [3, 3, 6, 8, 9] + length: 5 + target: 1 outputs: - toindex: [0, 1] + toindex: [0, 1, 2, -1, 4, 5, 5, 6, 7, 8] + tostarts: [0, 3, 4, 6, 9] + tostops: [3, 4, 6, 9, 10] - error: false inputs: - innerindex: [0, 1, 1, 1, 2] - innerlength: 5 - outerindex: [0, 1, 2] - outerlength: 3 + fromstarts: [6, 5, 3, 0] + fromstops: [10, 6, 5, 3] + length: 4 + target: 4 outputs: - toindex: [0, 1, 1] + toindex: [6, 7, 8, 9, 5, -1, -1, -1, 3, 4, -1, -1, 0, 1, 2, -1] + tostarts: [0, 4, 8, 12] + tostops: [4, 8, 12, 16] - error: false inputs: - innerindex: [0, 1, 1, 1, 4] - innerlength: 5 - outerindex: [0, 1, 2] - outerlength: 3 + fromstarts: [6, 5, 3, 3, 0] + fromstops: [10, 6, 5, 3, 3] + length: 5 + target: 4 outputs: - toindex: [0, 1, 1] + toindex: [6, 7, 8, 9, 5, -1, -1, -1, 3, 4, -1, -1, -1, -1, -1, -1, 0, 1, 2, + -1] + tostarts: [0, 4, 8, 12, 16] + tostops: [4, 8, 12, 16, 20] - error: false inputs: - innerindex: [0, 1, 2] - innerlength: 3 - outerindex: [0, 1, 1, 1, 1, 2] - outerlength: 6 + fromstarts: [6, 5, 3, 0] + fromstops: [10, 6, 5, 3] + length: 4 + target: 3 outputs: - toindex: [0, 1, 1, 1, 1, 2] + toindex: [6, 7, 8, 9, 5, -1, -1, 3, 4, -1, 0, 1, 2] + tostarts: [0, 4, 7, 10] + tostops: [4, 7, 10, 13] - error: false inputs: - innerindex: [0, 1, 2, 1, 1] - innerlength: 5 - outerindex: [0, 1, 1, 1, 2] - outerlength: 5 + fromstarts: [6, 5, 3, 3, 0] + fromstops: [10, 6, 5, 3, 3] + length: 5 + target: 3 outputs: - toindex: [0, 1, 1, 1, 2] + toindex: [6, 7, 8, 9, 5, -1, -1, 3, 4, -1, -1, -1, -1, 0, 1, 2] + tostarts: [0, 4, 7, 10, 13] + tostops: [4, 7, 10, 13, 16] - error: false inputs: - innerindex: [0, 1, 1, 1, 2] - innerlength: 5 - outerindex: [0, 1, 2, 3, 4, 1, 1] - outerlength: 7 + fromstarts: [6, 5, 3, 3, 0] + fromstops: [10, 6, 5, 3, 3] + length: 5 + target: 2 outputs: - toindex: [0, 1, 1, 1, 2, 1, 1] + toindex: [6, 7, 8, 9, 5, -1, 3, 4, -1, -1, 0, 1, 2] + tostarts: [0, 4, 6, 8, 10] + tostops: [4, 6, 8, 10, 13] - error: false inputs: - innerindex: [0, 1, 1, 1, 4] - innerlength: 5 - outerindex: [0, 1, 2, 3, 4, 1, 1] - outerlength: 7 + fromstarts: [6, 5, 3, 0] + fromstops: [10, 6, 5, 3] + length: 4 + target: 1 outputs: - toindex: [0, 1, 1, 1, 4, 1, 1] + toindex: [6, 7, 8, 9, 5, 3, 4, 0, 1, 2] + tostarts: [0, 4, 5, 7] + tostops: [4, 5, 7, 10] +- name: awkward_ListOffsetArray_reduce_local_outoffsets_64 + tests: - error: false inputs: - innerindex: [0, 1, 2, 1] - innerlength: 4 - outerindex: [0, 1, 1, 2] - outerlength: 4 + lenparents: 10 + outlength: 1 + parents: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] outputs: - toindex: [0, 1, 1, 2] + outoffsets: [0, 10] - error: false inputs: - innerindex: [0, 1, 1, 2] - innerlength: 4 - outerindex: [0, 1, 1, 3] - outerlength: 4 + lenparents: 1 + outlength: 1 + parents: [0] outputs: - toindex: [0, 1, 1, 2] + outoffsets: [0, 1] - error: false inputs: - innerindex: [0, 1, 1, 2] - innerlength: 4 - outerindex: [0, 1, 2, 3] - outerlength: 4 + lenparents: 3 + outlength: 3 + parents: [0, 2, 2] outputs: - toindex: [0, 1, 1, 2] + outoffsets: [0, 1, 1, 3] - error: false inputs: - innerindex: [0, 1, 2, 3] - innerlength: 4 - outerindex: [0, 1, 1, 2, 3] - outerlength: 5 + lenparents: 3 + outlength: 4 + parents: [0, 1, 3] outputs: - toindex: [0, 1, 1, 2, 3] + outoffsets: [0, 1, 2, 2, 3] - error: false inputs: - innerindex: [0, 1, 2, 3] - innerlength: 4 - outerindex: [0, 1, 1, 3] - outerlength: 4 + lenparents: 3 + outlength: 3 + parents: [0, 1, 1] outputs: - toindex: [0, 1, 1, 3] + outoffsets: [0, 1, 3, 3] - error: false inputs: - innerindex: [0, 1, 2] - innerlength: 3 - outerindex: [0, 1, 2] - outerlength: 3 + lenparents: 4 + outlength: 3 + parents: [0, 1, 1, 2] outputs: - toindex: [0, 1, 2] + outoffsets: [0, 1, 3, 4] - error: false inputs: - innerindex: [0, 1, 2, 3] - innerlength: 4 - outerindex: [0, 1, 2, 1, 3] - outerlength: 5 + lenparents: 2 + outlength: 1 + parents: [0, 0] outputs: - toindex: [0, 1, 2, 1, 3] + outoffsets: [0, 2] - error: false inputs: - innerindex: [0, 1, 2, 1, 4] - innerlength: 5 - outerindex: [0, 1, 2, 3, 4] - outerlength: 5 + lenparents: 6 + outlength: 5 + parents: [0, 0, 2, 2, 3, 4] outputs: - toindex: [0, 1, 2, 1, 4] + outoffsets: [0, 2, 2, 4, 5, 6] - error: false inputs: - innerindex: [0, 1, 2, 3, 4, 5, 6, 7, 1, 1] - innerlength: 10 - outerindex: [0, 1, 2, 3, 4, 1, 1, 1, 5, 6, 1, 1, 7, 8, 9, 1] - outerlength: 16 + lenparents: 7 + outlength: 5 + parents: [0, 0, 2, 2, 3, 4, 4] outputs: - toindex: [0, 1, 2, 3, 4, 1, 1, 1, 5, 6, 1, 1, 7, 1, 1, 1] + outoffsets: [0, 2, 2, 4, 5, 7] - error: false inputs: - innerindex: [0, 1, 1, 2, 1, 1, 3, 4] - innerlength: 8 - outerindex: [2, 2, 1, 6, 5] - outerlength: 5 + lenparents: 3 + outlength: 2 + parents: [0, 0, 1] outputs: - toindex: [1, 1, 1, 3, 1] + outoffsets: [0, 2, 3] - error: false inputs: - innerindex: [13, 9, 13, 4, 8, 3, 15, 1, 16, 2, 8] - innerlength: 11 - outerindex: [0, 3, 6] - outerlength: 3 + lenparents: 4 + outlength: 2 + parents: [0, 0, 1, 1] outputs: - toindex: [13, 4, 15] + outoffsets: [0, 2, 4] - error: false inputs: - innerindex: [13, 9, 13, 4, 8, 3, 15, 1, 16, 2, 8] - innerlength: 11 - outerindex: [0, 1, 2, 3, 4, 5, 6, 7, 8] - outerlength: 9 + lenparents: 3 + outlength: 1 + parents: [0, 0, 0] outputs: - toindex: [13, 9, 13, 4, 8, 3, 15, 1, 16] + outoffsets: [0, 3] - error: false inputs: - innerindex: [13, 9, 13, 4, 8, 3, 15, 1, 16, 2, 8] - innerlength: 11 - outerindex: [0, 1, 3, 4, 6, 7] - outerlength: 6 + lenparents: 6 + outlength: 2 + parents: [0, 0, 0, 1, 1, 1] outputs: - toindex: [13, 9, 4, 8, 15, 1] + outoffsets: [0, 3, 6] - error: false inputs: - innerindex: [2, 1, 1, 0] - innerlength: 4 - outerindex: [0, 1, 2, 1, 3] - outerlength: 5 + lenparents: 4 + outlength: 1 + parents: [0, 0, 0, 0] outputs: - toindex: [2, 1, 1, 1, 0] + outoffsets: [0, 4] - error: false inputs: - innerindex: [3, 1, 1, 7] - innerlength: 4 - outerindex: [0, 1, 1, 2, 3] - outerlength: 5 + lenparents: 6 + outlength: 3 + parents: [0, 0, 0, 0, 2, 2] outputs: - toindex: [3, 1, 1, 1, 7] + outoffsets: [0, 4, 4, 6] - error: false inputs: - innerindex: [3, 1, 2, 1] - innerlength: 4 - outerindex: [0, 1, 2, 1, 3] - outerlength: 5 + lenparents: 8 + outlength: 2 + parents: [0, 0, 0, 0, 1, 1, 1, 1] outputs: - toindex: [3, 1, 2, 1, 1] + outoffsets: [0, 4, 8] - error: false inputs: - innerindex: [4, 3, 2, 1, 0] - innerlength: 5 - outerindex: [0] - outerlength: 1 + lenparents: 5 + outlength: 1 + parents: [0, 0, 0, 0, 0] outputs: - toindex: [4] + outoffsets: [0, 5] - error: false inputs: - innerindex: [4, 3, 2, 1, 0] - innerlength: 5 - outerindex: [0, 1] - outerlength: 2 + lenparents: 6 + outlength: 1 + parents: [0, 0, 0, 0, 0, 0] outputs: - toindex: [4, 3] + outoffsets: [0, 6] - error: false inputs: - innerindex: [4, 5, 6, 7, 3, 1, 2, 0, 1, 1] - innerlength: 10 - outerindex: [0, 4, 5, 7] - outerlength: 4 + lenparents: 7 + outlength: 1 + parents: [0, 0, 0, 0, 0, 0, 0] outputs: - toindex: [4, 3, 1, 0] + outoffsets: [0, 7] - error: false inputs: - innerindex: [4, 3, 2, 1, 0] - innerlength: 5 - outerindex: [0, 1, 2] - outerlength: 3 + lenparents: 8 + outlength: 1 + parents: [0, 0, 0, 0, 0, 0, 0, 0] outputs: - toindex: [4, 3, 2] + outoffsets: [0, 8] - error: false inputs: - innerindex: [4, 3, 2, 1, 0] - innerlength: 5 - outerindex: [0, 1, 2, 3, 4] - outerlength: 5 + lenparents: 9 + outlength: 1 + parents: [0, 0, 0, 0, 0, 0, 0, 0, 0] outputs: - toindex: [4, 3, 2, 1, 0] + outoffsets: [0, 9] +- name: awkward_ListOffsetArray_reduce_nonlocal_findgaps_64 + tests: - error: false inputs: - innerindex: [4, 3, 2, 1, 0] - innerlength: 5 - outerindex: [0, 1, 2, 3] - outerlength: 4 + lenparents: 10 + parents: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] outputs: - toindex: [4, 3, 2, 1] + gaps: [1] - error: false inputs: - innerindex: [0, 1, 1, 1, 2, 3, 4, 5, 6, 7] - innerlength: 10 - outerindex: [6, 7, 8, 9, 5, 1, 1, 1, 3, 4, 1, 1, 0, 1, 2, 1] - outerlength: 16 + lenparents: 4 + parents: [0, 0, 0, 0] outputs: - toindex: [4, 5, 6, 7, 3, 1, 1, 1, 1, 2, 1, 1, 0, 1, 1, 1] + gaps: [1] - error: false inputs: - innerindex: [0, 1, 1, 1, 2, 3, 4, 5, 6, 7] - innerlength: 10 - outerindex: [6, 7, 8, 9, 5, 1, 1, 3, 4, 1, 0, 1, 2] - outerlength: 13 + lenparents: 3 + parents: [0, 0, 0] outputs: - toindex: [4, 5, 6, 7, 3, 1, 1, 1, 2, 1, 0, 1, 1] + gaps: [1] - error: false inputs: - innerindex: [0, 1, 1, 1, 2, 3, 4, 5, 6, 7] - innerlength: 10 - outerindex: [6, 7, 8, 9, 5, 3, 4, 0, 1, 2] - outerlength: 10 + lenparents: 2 + parents: [0, 0] outputs: - toindex: [4, 5, 6, 7, 3, 1, 2, 0, 1, 1] + gaps: [1] - error: false inputs: - innerindex: [6, 5, 1, 3, 1, 1, 0] - innerlength: 7 - outerindex: [0, 2, 4, 6] - outerlength: 4 + lenparents: 1 + parents: [0] outputs: - toindex: [6, 1, 1, 0] + gaps: [1] - error: false inputs: - innerindex: [6, 5, 4, 3, 2, 1, 0] - innerlength: 7 - outerindex: [0, 2, 4, 6] - outerlength: 4 + lenparents: 11 + parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1] outputs: - toindex: [6, 4, 2, 0] -- name: awkward_IndexedArray_validity - tests: + gaps: [1, 1] - error: false inputs: - index: [0, 1, 1, 1, 1, 2] - isoption: true - lencontent: 3 - length: 6 - outputs: {} + lenparents: 13 + parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1] + outputs: + gaps: [1, 1] - error: false inputs: - index: [0, 1, 1, 1, 1] - isoption: true - lencontent: 2 - length: 5 - outputs: {} + lenparents: 12 + parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] + outputs: + gaps: [1, 1] - error: false inputs: - index: [0, 1, 1, 1, 2, 3, 4] - isoption: true - lencontent: 5 - length: 7 - outputs: {} + lenparents: 10 + parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1] + outputs: + gaps: [1, 1] - error: false inputs: - index: [0, 1, 1, 1, 2, 3] - isoption: true - lencontent: 4 - length: 6 - outputs: {} + lenparents: 11 + parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] + outputs: + gaps: [1, 1] - error: false inputs: - index: [0, 1, 1, 1, 2] - isoption: true - lencontent: 3 - length: 5 - outputs: {} + lenparents: 12 + parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1] + outputs: + gaps: [1, 1] - error: false inputs: - index: [0, 1, 1, 1] - isoption: true - lencontent: 2 - length: 4 - outputs: {} + lenparents: 8 + parents: [0, 0, 0, 0, 1, 1, 1, 1] + outputs: + gaps: [1, 1] - error: false inputs: - index: [0, 1, 1, 2, 1, 3] - isoption: true - lencontent: 4 - length: 6 - outputs: {} + lenparents: 6 + parents: [0, 0, 0, 1, 1, 1] + outputs: + gaps: [1, 1] - error: false inputs: - index: [0, 1, 1, 2, 1] - isoption: true - lencontent: 3 - length: 5 - outputs: {} + lenparents: 5 + parents: [0, 0, 0, 1, 1] + outputs: + gaps: [1, 1] - error: false inputs: - index: [0, 1, 1, 2, 3, 1, 4, 5, 6] - isoption: true - lencontent: 7 - length: 9 - outputs: {} + lenparents: 4 + parents: [0, 0, 1, 1] + outputs: + gaps: [1, 1] - error: false inputs: - index: [0, 1, 1, 2, 3, 4, 1, 5] - isoption: true - lencontent: 6 - length: 8 - outputs: {} - - error: false - inputs: - index: [0, 1, 1, 2, 3, 4, 5, 6, 7] - isoption: true - lencontent: 8 - length: 9 - outputs: {} - - error: false - inputs: - index: [0, 1, 1, 2, 3, 4, 5] - isoption: true - lencontent: 6 - length: 7 - outputs: {} - - error: false - inputs: - index: [0, 1, 1, 2, 3] - isoption: true - lencontent: 4 - length: 5 - outputs: {} - - error: false - inputs: - index: [0, 1, 1, 2] - isoption: true - lencontent: 3 - length: 4 - outputs: {} - - error: false - inputs: - index: [0, 1, 1] - isoption: true - lencontent: 2 - length: 3 - outputs: {} - - error: false - inputs: - index: [0, 1, 2, 1, 1] - isoption: true - lencontent: 3 - length: 5 - outputs: {} - - error: false - inputs: - index: [0, 1, 2, 1, 3, 1, 4] - isoption: true - lencontent: 5 - length: 7 - outputs: {} - - error: false - inputs: - index: [0, 1, 2, 1, 3] - isoption: true - lencontent: 4 - length: 5 - outputs: {} - - error: false - inputs: - index: [0, 1, 2, 1] - isoption: true - lencontent: 3 - length: 4 - outputs: {} - - error: false - inputs: - index: [0, 1, 2, 3, 1, 4, 5, 6, 7, 8, 1, 9] - isoption: true - lencontent: 10 - length: 12 - outputs: {} - - error: false - inputs: - index: [0, 1, 2, 3, 1, 4, 5, 6] - isoption: true - lencontent: 7 - length: 8 - outputs: {} - - error: false - inputs: - index: [0, 1, 2, 3, 1, 4] - isoption: true - lencontent: 5 - length: 6 - outputs: {} - - error: false - inputs: - index: [0, 1, 2, 3, 1] - isoption: true - lencontent: 4 - length: 5 - outputs: {} - - error: false - inputs: - index: [1, 0, 1, 1, 1] - isoption: true - lencontent: 2 - length: 5 - outputs: {} - - error: false - inputs: - index: [1, 0, 1, 1, 2] - isoption: true - lencontent: 3 - length: 5 - outputs: {} - - error: false - inputs: - index: [1, 0, 1, 2, 1, 3] - isoption: true - lencontent: 4 - length: 6 - outputs: {} - - error: false - inputs: - index: [1, 0, 1, 2, 1] - isoption: true - lencontent: 3 - length: 5 - outputs: {} - - error: false - inputs: - index: [1, 0, 1, 2, 3] - isoption: true - lencontent: 4 - length: 5 - outputs: {} - - error: false - inputs: - index: [1, 0, 1, 2] - isoption: true - lencontent: 3 - length: 4 - outputs: {} - - error: false - inputs: - index: [1, 1, 0, 1, 1] - isoption: true - lencontent: 2 - length: 5 - outputs: {} - - error: false - inputs: - index: [1, 1, 0, 1, 2] - isoption: true - lencontent: 3 - length: 5 - outputs: {} - - error: false - inputs: - index: [1, 1, 1, 0, 1] - isoption: true - lencontent: 2 - length: 5 - outputs: {} - - error: false - inputs: - index: [1, 4, 4, 1, 0] - isoption: true - lencontent: 10 - length: 5 - outputs: {} - - error: false - inputs: - index: [2, 1, 4, 0, 8] - isoption: true - lencontent: 10 - length: 5 - outputs: {} - - error: false - inputs: - index: [2, 2, 0, 1, 4] - isoption: true - lencontent: 5 - length: 5 - outputs: {} - - error: false - inputs: - index: [2, 4, 4, 0, 8] - isoption: false - lencontent: 10 - length: 5 - outputs: {} - - error: false - inputs: - index: [6, 4, 4, 8, 0] - isoption: false - lencontent: 10 - length: 5 - outputs: {} - - error: false - inputs: - index: [6, 5, 4, 3, 2, 1, 0] - isoption: false - lencontent: 7 - length: 7 - outputs: {} -- name: awkward_IndexedOptionArray_rpad_and_clip_mask_axis1 - tests: - - error: false - inputs: - frommask: [0, 0, 0, 0] - length: 4 - outputs: - toindex: [0, 1, 2, 3] -- name: awkward_index_rpad_and_clip_axis1 - tests: - - error: false - inputs: {length: 4, target: 1} - outputs: - tostarts: [0, 1, 2, 3] - tostops: [1, 2, 3, 4] - - error: false - inputs: {length: 5, target: 1} - outputs: - tostarts: [0, 1, 2, 3, 4] - tostops: [1, 2, 3, 4, 5] - - error: false - inputs: {length: 6, target: 1} - outputs: - tostarts: [0, 1, 2, 3, 4, 5] - tostops: [1, 2, 3, 4, 5, 6] - - error: false - inputs: {length: 3, target: 2} - outputs: - tostarts: [0, 2, 4] - tostops: [2, 4, 6] - - error: false - inputs: {length: 7, target: 2} - outputs: - tostarts: [0, 2, 4, 6, 8, 10, 12] - tostops: [2, 4, 6, 8, 10, 12, 14] - - error: false - inputs: {length: 6, target: 2} - outputs: - tostarts: [0, 2, 4, 6, 8, 10] - tostops: [2, 4, 6, 8, 10, 12] - - error: false - inputs: {length: 5, target: 2} - outputs: - tostarts: [0, 2, 4, 6, 8] - tostops: [2, 4, 6, 8, 10] - - error: false - inputs: {length: 6, target: 3} - outputs: - tostarts: [0, 3, 6, 9, 12, 15] - tostops: [3, 6, 9, 12, 15, 18] - - error: false - inputs: {length: 5, target: 3} - outputs: - tostarts: [0, 3, 6, 9, 12] - tostops: [3, 6, 9, 12, 15] - - error: false - inputs: {length: 6, target: 4} - outputs: - tostarts: [0, 4, 8, 12, 16, 20] - tostops: [4, 8, 12, 16, 20, 24] - - error: false - inputs: {length: 5, target: 4} - outputs: - tostarts: [0, 4, 8, 12, 16] - tostops: [4, 8, 12, 16, 20] - - error: false - inputs: {length: 6, target: 5} - outputs: - tostarts: [0, 5, 10, 15, 20, 25] - tostops: [5, 10, 15, 20, 25, 30] - - error: false - inputs: {length: 5, target: 5} - outputs: - tostarts: [0, 5, 10, 15, 20] - tostops: [5, 10, 15, 20, 25] -- name: awkward_ListArray_combinations_length - tests: - - error: false - inputs: - length: 5 - n: 3 - replacement: false - starts: [0, 4, 4, 7, 8] - stops: [4, 4, 7, 8, 13] - outputs: - tooffsets: [0, 4, 4, 5, 5, 15] - totallen: [15] - - error: false - inputs: - length: 5 - n: 2 - replacement: false - starts: [0, 4, 4, 7, 8] - stops: [4, 4, 7, 8, 13] - outputs: - tooffsets: [0, 6, 6, 9, 9, 19] - totallen: [19] - - error: false - inputs: - length: 5 - n: 2 - replacement: true - starts: [0, 4, 4, 7, 8] - stops: [4, 4, 7, 8, 13] - outputs: - tooffsets: [0, 10, 10, 16, 17, 32] - totallen: [32] - - error: false - inputs: - length: 3 - n: 2 - replacement: false - starts: [0, 3, 3] - stops: [3, 3, 5] - outputs: - tooffsets: [0, 3, 3, 4] - totallen: [4] - - error: false - inputs: - length: 3 - n: 2 - replacement: false - starts: [0, 3, 5] - stops: [3, 3, 7] - outputs: - tooffsets: [0, 3, 3, 4] - totallen: [4] - - error: false - inputs: - length: 5 - n: 3 - replacement: true - starts: [0, 4, 4, 7, 8] - stops: [4, 4, 7, 8, 13] - outputs: - tooffsets: [0, 20, 20, 30, 31, 66] - totallen: [66] - - error: false - inputs: - length: 5 - n: 2 - replacement: false - starts: [0, 3, 3, 10, 10] - stops: [3, 3, 5, 10, 13] - outputs: - tooffsets: [0, 3, 3, 4, 4, 7] - totallen: [7] -- name: awkward_ListArray_getitem_jagged_carrylen - tests: - - error: false - inputs: - sliceouterlen: 4 - slicestarts: [0, 0, 0, 0] - slicestops: [0, 0, 0, 0] - outputs: - carrylen: [0] - - error: false - inputs: - sliceouterlen: 3 - slicestarts: [0, 0, 0] - slicestops: [0, 0, 0] - outputs: - carrylen: [0] - - error: false - inputs: - sliceouterlen: 4 - slicestarts: [0, 0, 1, 1] - slicestops: [0, 1, 1, 1] - outputs: - carrylen: [1] - - error: false - inputs: - sliceouterlen: 6 - slicestarts: [0, 1, 3, 5, 6, 8] - slicestops: [1, 3, 5, 6, 8, 10] - outputs: - carrylen: [10] - - error: false - inputs: - sliceouterlen: 5 - slicestarts: [0, 5, 5, 6, 8] - slicestops: [5, 5, 6, 8, 10] - outputs: - carrylen: [10] - - error: false - inputs: - sliceouterlen: 4 - slicestarts: [0, 3, 4, 7] - slicestops: [3, 4, 7, 11] - outputs: - carrylen: [11] - - error: false - inputs: - sliceouterlen: 6 - slicestarts: [0, 1, 3, 6, 7, 9] - slicestops: [1, 3, 6, 7, 9, 12] - outputs: - carrylen: [12] - - error: false - inputs: - sliceouterlen: 3 - slicestarts: [0, 0, 0] - slicestops: [0, 0, 2] - outputs: - carrylen: [2] - - error: false - inputs: - sliceouterlen: 3 - slicestarts: [0, 2, 2] - slicestops: [2, 2, 2] - outputs: - carrylen: [2] - - error: false - inputs: - sliceouterlen: 3 - slicestarts: [0, 1, 1] - slicestops: [1, 1, 3] - outputs: - carrylen: [3] - - error: false - inputs: - sliceouterlen: 5 - slicestarts: [0, 1, 1, 2, 2] - slicestops: [1, 1, 2, 2, 3] - outputs: - carrylen: [3] - - error: false - inputs: - sliceouterlen: 3 - slicestarts: [0, 2, 2] - slicestops: [2, 2, 3] - outputs: - carrylen: [3] - - error: false - inputs: - sliceouterlen: 4 - slicestarts: [0, 2, 3, 3] - slicestops: [2, 3, 3, 3] - outputs: - carrylen: [3] - - error: false - inputs: - sliceouterlen: 5 - slicestarts: [0, 2, 2, 2, 2] - slicestops: [2, 2, 2, 2, 4] - outputs: - carrylen: [4] - - error: false - inputs: - sliceouterlen: 3 - slicestarts: [0, 2, 2] - slicestops: [2, 2, 4] - outputs: - carrylen: [4] - - error: false - inputs: - sliceouterlen: 2 - slicestarts: [0, 3] - slicestops: [3, 4] - outputs: - carrylen: [4] - - error: false - inputs: - sliceouterlen: 5 - slicestarts: [0, 1, 1, 3, 3] - slicestops: [1, 1, 3, 3, 5] - outputs: - carrylen: [5] - - error: false - inputs: - sliceouterlen: 3 - slicestarts: [0, 2, 3] - slicestops: [2, 3, 5] - outputs: - carrylen: [5] - - error: false - inputs: - sliceouterlen: 4 - slicestarts: [0, 2, 3, 3] - slicestops: [2, 3, 3, 5] - outputs: - carrylen: [5] - - error: false - inputs: - sliceouterlen: 3 - slicestarts: [0, 3, 3] - slicestops: [3, 3, 5] - outputs: - carrylen: [5] - - error: false - inputs: - sliceouterlen: 3 - slicestarts: [0, 4, 5] - slicestops: [4, 4, 6] - outputs: - carrylen: [5] - - error: false - inputs: - sliceouterlen: 4 - slicestarts: [0, 1, 3, 4] - slicestops: [1, 3, 4, 6] - outputs: - carrylen: [6] - - error: false - inputs: - sliceouterlen: 5 - slicestarts: [0, 2, 2, 2, 2] - slicestops: [2, 2, 2, 2, 6] - outputs: - carrylen: [6] - - error: false - inputs: - sliceouterlen: 2 - slicestarts: [0, 3] - slicestops: [3, 6] - outputs: - carrylen: [6] - - error: false - inputs: - sliceouterlen: 3 - slicestarts: [0, 4, 5] - slicestops: [4, 5, 6] - outputs: - carrylen: [6] - - error: false - inputs: - sliceouterlen: 3 - slicestarts: [0, 4, 6] - slicestops: [4, 6, 6] - outputs: - carrylen: [6] - - error: false - inputs: - sliceouterlen: 3 - slicestarts: [0, 2, 5] - slicestops: [2, 5, 7] - outputs: - carrylen: [7] - - error: false - inputs: - sliceouterlen: 5 - slicestarts: [0, 3, 3, 3, 4] - slicestops: [3, 3, 3, 4, 7] - outputs: - carrylen: [7] - - error: false - inputs: - sliceouterlen: 4 - slicestarts: [0, 1, 4, 5] - slicestops: [1, 4, 5, 8] - outputs: - carrylen: [8] - - error: false - inputs: - sliceouterlen: 7 - slicestarts: [0, 2, 2, 4, 4, 5, 5] - slicestops: [2, 2, 4, 4, 5, 5, 8] - outputs: - carrylen: [8] - - error: false - inputs: - sliceouterlen: 5 - slicestarts: [0, 2, 2, 4, 5] - slicestops: [2, 2, 4, 5, 8] - outputs: - carrylen: [8] - - error: false - inputs: - sliceouterlen: 4 - slicestarts: [0, 3, 0, 3] - slicestops: [3, 4, 3, 4] - outputs: - carrylen: [8] - - error: false - inputs: - sliceouterlen: 5 - slicestarts: [0, 3, 3, 4, 5] - slicestops: [3, 3, 4, 5, 8] - outputs: - carrylen: [8] - - error: false - inputs: - sliceouterlen: 5 - slicestarts: [0, 2, 2, 4, 5] - slicestops: [2, 2, 4, 5, 9] - outputs: - carrylen: [9] - - error: false - inputs: - sliceouterlen: 5 - slicestarts: [0, 3, 3, 5, 6] - slicestops: [3, 3, 5, 6, 9] - outputs: - carrylen: [9] -- name: awkward_ListArray_getitem_jagged_descend - tests: - - error: false - inputs: - fromstarts: [0, 2] - fromstops: [2, 4] - sliceouterlen: 2 - slicestarts: [0, 2] - slicestops: [2, 4] - outputs: - tooffsets: [0, 2, 4] - - error: false - inputs: - fromstarts: [0, 3, 3, 4] - fromstops: [3, 3, 4, 5] - sliceouterlen: 4 - slicestarts: [0, 3, 3, 4] - slicestops: [3, 3, 4, 5] - outputs: - tooffsets: [0, 3, 3, 4, 5] - - error: false - inputs: - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - sliceouterlen: 3 - slicestarts: [0, 3, 3] - slicestops: [3, 3, 5] - outputs: - tooffsets: [0, 3, 3, 5] - - error: false - inputs: - fromstarts: [0, 3] - fromstops: [3, 6] - sliceouterlen: 2 - slicestarts: [0, 3] - slicestops: [3, 6] - outputs: - tooffsets: [0, 3, 6] -- name: awkward_ListArray_getitem_jagged_expand - tests: - - error: false - inputs: - fromstarts: [0, 2] - fromstops: [2, 4] - jaggedsize: 2 - length: 2 - singleoffsets: [0, 3, 4] - outputs: - multistarts: [0, 3, 0, 3] - multistops: [3, 4, 3, 4] - tocarry: [0, 1, 2, 3] - - error: false - inputs: - fromstarts: [2] - fromstops: [4] - jaggedsize: 2 - length: 1 - singleoffsets: [0, 3, 4] - outputs: - multistarts: [0, 3] - multistops: [3, 4] - tocarry: [2, 3] -- name: awkward_ListArray_getitem_next_array - tests: - - error: false - inputs: - fromarray: [0, 0, 1, 1] - fromstarts: [0] - fromstops: [2] - lenarray: 4 - lencontent: 3 - lenstarts: 1 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [0, 0, 1, 1] - - error: false - inputs: - fromarray: [0, 3] - fromstarts: [0, 4, 8] - fromstops: [4, 8, 12] - lenarray: 2 - lencontent: 13 - lenstarts: 3 - outputs: - toadvanced: [0, 1, 0, 1, 0, 1] - tocarry: [0, 3, 4, 7, 8, 11] - - error: false - inputs: - fromarray: [1, 1, 0, 0] - fromstarts: [0] - fromstops: [2] - lenarray: 4 - lencontent: 3 - lenstarts: 1 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [1, 1, 0, 0] - - error: false - inputs: - fromarray: [0, 3] - fromstarts: [4, 8] - fromstops: [8, 12] - lenarray: 2 - lencontent: 13 - lenstarts: 2 - outputs: - toadvanced: [0, 1, 0, 1] - tocarry: [4, 7, 8, 11] - - error: false - inputs: - fromarray: [2, 1, 1, 0] - fromstarts: [6] - fromstops: [10] - lenarray: 4 - lencontent: 10 - lenstarts: 1 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [8, 7, 7, 6] -- name: awkward_ListArray_min_range - tests: - - error: false - inputs: - fromstarts: [0, 3, 4, 5, 8] - fromstops: [3, 3, 6, 8, 9] - lenstarts: 5 - outputs: - tomin: [0] - - error: false - inputs: - fromstarts: [0, 3, 5] - fromstops: [3, 3, 7] - lenstarts: 3 - outputs: - tomin: [0] - - error: false - inputs: - fromstarts: [6, 5, 3, 3, 0] - fromstops: [10, 6, 5, 3, 3] - lenstarts: 5 - outputs: - tomin: [0] - - error: false - inputs: - fromstarts: [6, 5, 3, 0] - fromstops: [10, 6, 5, 3] - lenstarts: 4 - outputs: - tomin: [1] -- name: awkward_ListArray_rpad_and_clip_length_axis1 - tests: - - error: false - inputs: - fromstarts: [0, 3, 4, 5, 8] - fromstops: [3, 3, 6, 8, 9] - lenstarts: 5 - target: 1 - outputs: - tomin: [10] - - error: false - inputs: - fromstarts: [6, 5, 3, 0] - fromstops: [10, 6, 5, 3] - lenstarts: 4 - target: 1 - outputs: - tomin: [10] - - error: false - inputs: - fromstarts: [0, 3, 4, 5, 8] - fromstops: [3, 3, 6, 8, 9] - lenstarts: 5 - target: 2 - outputs: - tomin: [12] - - error: false - inputs: - fromstarts: [6, 5, 3, 0] - fromstops: [10, 6, 5, 3] - lenstarts: 4 - target: 3 - outputs: - tomin: [13] - - error: false - inputs: - fromstarts: [6, 5, 3, 3, 0] - fromstops: [10, 6, 5, 3, 3] - lenstarts: 5 - target: 2 - outputs: - tomin: [13] - - error: false - inputs: - fromstarts: [0, 3, 4, 5, 8] - fromstops: [3, 3, 6, 8, 9] - lenstarts: 5 - target: 3 - outputs: - tomin: [15] - - error: false - inputs: - fromstarts: [6, 5, 3, 0] - fromstops: [10, 6, 5, 3] - lenstarts: 4 - target: 4 - outputs: - tomin: [16] - - error: false - inputs: - fromstarts: [6, 5, 3, 3, 0] - fromstops: [10, 6, 5, 3, 3] - lenstarts: 5 - target: 3 - outputs: - tomin: [16] - - error: false - inputs: - fromstarts: [0, 3, 4, 5, 8] - fromstops: [3, 3, 6, 8, 9] - lenstarts: 5 - target: 4 - outputs: - tomin: [20] - - error: false - inputs: - fromstarts: [6, 5, 3, 3, 0] - fromstops: [10, 6, 5, 3, 3] - lenstarts: 5 - target: 4 - outputs: - tomin: [20] - - error: false - inputs: - fromstarts: [0, 3, 5] - fromstops: [3, 3, 7] - lenstarts: 3 - target: 3 - outputs: - tomin: [9] -- name: awkward_ListArray_validity - tests: - - error: false - inputs: - lencontent: 0 - length: 5 - starts: [0, 0, 0, 0, 0] - stops: [0, 0, 0, 0, 0] - outputs: {} - - error: false - inputs: - lencontent: 0 - length: 4 - starts: [0, 0, 0, 0] - stops: [0, 0, 0, 0] - outputs: {} - - error: false - inputs: - lencontent: 0 - length: 3 - starts: [0, 0, 0] - stops: [0, 0, 0] - outputs: {} - - error: false - inputs: - lencontent: 1 - length: 3 - starts: [0, 0, 1] - stops: [0, 1, 1] - outputs: {} - - error: false - inputs: - lencontent: 4 - length: 3 - starts: [0, 0, 1] - stops: [0, 1, 4] - outputs: {} - - error: false - inputs: - lencontent: 1 - length: 4 - starts: [0, 0, 1, 1] - stops: [0, 1, 1, 1] - outputs: {} - - error: false - inputs: - lencontent: 6 - length: 4 - starts: [0, 0, 1, 3] - stops: [0, 1, 3, 6] - outputs: {} - - error: false - inputs: - lencontent: 10 - length: 5 - starts: [0, 0, 1, 3, 6] - stops: [0, 1, 3, 6, 10] - outputs: {} - - error: false - inputs: - lencontent: 19 - length: 8 - starts: [0, 0, 3, 3, 8, 12, 12, 16] - stops: [0, 3, 3, 8, 12, 12, 16, 19] - outputs: {} - - error: false - inputs: - lencontent: 19 - length: 9 - starts: [0, 0, 3, 3, 8, 12, 12, 16, 19] - stops: [0, 3, 3, 8, 12, 12, 16, 19, 19] - outputs: {} - - error: false - inputs: - lencontent: 6 - length: 3 - starts: [0, 1, 3] - stops: [1, 3, 6] - outputs: {} - - error: false - inputs: - lencontent: 15 - length: 5 - starts: [0, 1, 3, 6, 10] - stops: [1, 3, 6, 10, 15] - outputs: {} - - error: false - inputs: - lencontent: 12 - length: 6 - starts: [0, 1, 3, 6, 7, 9] - stops: [1, 3, 6, 7, 9, 12] - outputs: {} - - error: false - inputs: - lencontent: 8 - length: 4 - starts: [0, 1, 4, 5] - stops: [1, 4, 5, 8] - outputs: {} - - error: false - inputs: - lencontent: 3 - length: 3 - starts: [0, 2, 2] - stops: [2, 2, 3] - outputs: {} - - error: false - inputs: - lencontent: 4 - length: 3 - starts: [0, 2, 2] - stops: [2, 2, 4] - outputs: {} - - error: false - inputs: - lencontent: 3 - length: 2 - starts: [0, 2] - stops: [2, 3] - outputs: {} - - error: false - inputs: - lencontent: 4 - length: 2 - starts: [0, 2] - stops: [2, 4] - outputs: {} - - error: false - inputs: - lencontent: 8 - length: 7 - starts: [0, 2, 2, 4, 4, 5, 5] - stops: [2, 2, 4, 4, 5, 5, 8] - outputs: {} - - error: false - inputs: - lencontent: 6 - length: 5 - starts: [0, 2, 2, 4, 5] - stops: [2, 2, 4, 5, 6] - outputs: {} - - error: false - inputs: - lencontent: 9 - length: 5 - starts: [0, 2, 2, 4, 5] - stops: [2, 2, 4, 5, 9] - outputs: {} - - error: false - inputs: - lencontent: 3 - length: 3 - starts: [0, 2, 3] - stops: [2, 3, 3] - outputs: {} - - error: false - inputs: - lencontent: 4 - length: 3 - starts: [0, 2, 3] - stops: [2, 3, 4] - outputs: {} - - error: false - inputs: - lencontent: 5 - length: 3 - starts: [0, 2, 3] - stops: [2, 3, 5] - outputs: {} - - error: false - inputs: - lencontent: 6 - length: 3 - starts: [0, 2, 3] - stops: [2, 3, 6] - outputs: {} - - error: false - inputs: - lencontent: 5 - length: 4 - starts: [0, 2, 3, 3] - stops: [2, 3, 3, 5] - outputs: {} - - error: false - inputs: - lencontent: 7 - length: 4 - starts: [0, 2, 3, 4] - stops: [2, 3, 4, 7] - outputs: {} - - error: false - inputs: - lencontent: 6 - length: 3 - starts: [0, 2, 4] - stops: [2, 4, 6] - outputs: {} - - error: false - inputs: - lencontent: 7 - length: 3 - starts: [0, 2, 5] - stops: [2, 5, 7] - outputs: {} - - error: false - inputs: - lencontent: 8 - length: 3 - starts: [0, 2, 6] - stops: [2, 6, 8] - outputs: {} - - error: false - inputs: - lencontent: 5 - length: 3 - starts: [0, 3, 3] - stops: [3, 3, 5] - outputs: {} - - error: false - inputs: - lencontent: 7 - length: 3 - starts: [0, 3, 3] - stops: [3, 3, 7] - outputs: {} - - error: false - inputs: - lencontent: 8 - length: 3 - starts: [0, 3, 3] - stops: [3, 3, 8] - outputs: {} - - error: false - inputs: - lencontent: 4 - length: 2 - starts: [0, 3] - stops: [3, 4] - outputs: {} - - error: false - inputs: - lencontent: 9 - length: 4 - starts: [0, 3, 3, 5] - stops: [3, 3, 5, 9] - outputs: {} - - error: false - inputs: - lencontent: 11 - length: 6 - starts: [0, 3, 3, 5, 6, 10] - stops: [3, 3, 5, 6, 10, 11] - outputs: {} - - error: false - inputs: - lencontent: 9 - length: 5 - starts: [0, 3, 3, 5, 6] - stops: [3, 3, 5, 6, 9] - outputs: {} - - error: false - inputs: - lencontent: 9 - length: 6 - starts: [0, 3, 3, 5, 6, 8] - stops: [3, 3, 5, 6, 8, 9] - outputs: {} - - error: false - inputs: - lencontent: 6 - length: 2 - starts: [0, 3] - stops: [3, 6] - outputs: {} - - error: false - inputs: - lencontent: 7 - length: 2 - starts: [0, 3] - stops: [3, 7] - outputs: {} - - error: false - inputs: - lencontent: 11 - length: 4 - starts: [0, 3, 4, 7] - stops: [3, 4, 7, 11] - outputs: {} - - error: false - inputs: - lencontent: 25 - length: 7 - starts: [0, 3, 6, 11, 14, 17, 20] - stops: [3, 6, 11, 14, 17, 20, 25] - outputs: {} - - error: false - inputs: - lencontent: 20 - length: 6 - starts: [0, 3, 6, 11, 14, 17] - stops: [3, 6, 11, 14, 17, 20] - outputs: {} - - error: false - inputs: - lencontent: 19 - length: 5 - starts: [0, 3, 6, 11, 15] - stops: [3, 6, 11, 15, 19] - outputs: {} - - error: false - inputs: - lencontent: 10 - length: 3 - starts: [0, 3, 6] - stops: [3, 6, 10] - outputs: {} - - error: false - inputs: - lencontent: 11 - length: 3 - starts: [0, 3, 6] - stops: [3, 6, 11] - outputs: {} - - error: false - inputs: - lencontent: 21 - length: 9 - starts: [0, 3, 6, 6, 10, 14, 14, 18, 21] - stops: [3, 6, 6, 10, 14, 14, 18, 21, 21] - outputs: {} - - error: false - inputs: - lencontent: 21 - length: 8 - starts: [0, 3, 6, 6, 10, 14, 14, 18] - stops: [3, 6, 6, 10, 14, 14, 18, 21] - outputs: {} - - error: false - inputs: - lencontent: 22 - length: 9 - starts: [0, 3, 6, 6, 11, 15, 15, 19, 22] - stops: [3, 6, 6, 11, 15, 15, 19, 22, 22] - outputs: {} - - error: false - inputs: - lencontent: 22 - length: 8 - starts: [0, 3, 6, 6, 11, 15, 15, 19] - stops: [3, 6, 6, 11, 15, 15, 19, 22] - outputs: {} - - error: false - inputs: - lencontent: 24 - length: 9 - starts: [0, 3, 6, 8, 13, 17, 17, 21, 24] - stops: [3, 6, 8, 13, 17, 17, 21, 24, 24] - outputs: {} - - error: false - inputs: - lencontent: 24 - length: 8 - starts: [0, 3, 6, 8, 13, 17, 17, 21] - stops: [3, 6, 8, 13, 17, 17, 21, 24] - outputs: {} - - error: false - inputs: - lencontent: 9 - length: 3 - starts: [0, 3, 7] - stops: [3, 7, 9] - outputs: {} - - error: false - inputs: - lencontent: 10 - length: 2 - starts: [0, 4] - stops: [4, 10] - outputs: {} - - error: false - inputs: - lencontent: 6 - length: 3 - starts: [0, 4, 4] - stops: [4, 4, 6] - outputs: {} - - error: false - inputs: - lencontent: 10 - length: 3 - starts: [0, 4, 6] - stops: [4, 6, 10] - outputs: {} - - error: false - inputs: - lencontent: 14 - length: 4 - starts: [0, 4, 6, 9] - stops: [4, 6, 9, 14] - outputs: {} - - error: false - inputs: - lencontent: 11 - length: 6 - starts: [0, 4, 7, 7, 9, 9] - stops: [4, 7, 7, 9, 9, 11] - outputs: {} - - error: false - inputs: - lencontent: 12 - length: 3 - starts: [0, 4, 8] - stops: [4, 8, 12] - outputs: {} - - error: false - inputs: - lencontent: 30 - length: 6 - starts: [0, 5, 10, 15, 20, 25] - stops: [5, 10, 15, 20, 25, 30] - outputs: {} - - error: false - inputs: - lencontent: 10 - length: 2 - starts: [0, 5] - stops: [5, 10] - outputs: {} - - error: false - inputs: - lencontent: 12 - length: 6 - starts: [3, 0, 999, 2, 6, 10] - stops: [7, 3, 999, 4, 6, 12] - outputs: {} -- name: awkward_ListArray_getitem_jagged_apply - tests: - - error: false - inputs: - contentlen: 0 - fromstarts: [0, 0, 0, 0] - fromstops: [0, 0, 0, 0] - sliceindex: [] - sliceinnerlen: 0 - sliceouterlen: 4 - slicestarts: [0, 0, 0, 0] - slicestops: [0, 0, 0, 0] - outputs: - tocarry: [] - tooffsets: [0, 0, 0, 0, 0] - - error: false - inputs: - contentlen: 5 - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - sliceindex: [] - sliceinnerlen: 0 - sliceouterlen: 3 - slicestarts: [0, 0, 0] - slicestops: [0, 0, 0] - outputs: - tocarry: [] - tooffsets: [0, 0, 0, 0] - - error: false - inputs: - contentlen: 5 - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - sliceindex: [0, 1] - sliceinnerlen: 2 - sliceouterlen: 3 - slicestarts: [0, 0, 0] - slicestops: [0, 0, 2] - outputs: - tocarry: [3, 4] - tooffsets: [0, 0, 0, 2] - - error: false - inputs: - contentlen: 5 - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - sliceindex: [0, 0, 1] - sliceinnerlen: 3 - sliceouterlen: 3 - slicestarts: [0, 1, 1] - slicestops: [1, 1, 3] - outputs: - tocarry: [0, 3, 4] - tooffsets: [0, 1, 1, 3] - - error: false - inputs: - contentlen: 5 - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - sliceindex: [2, 0, 1] - sliceinnerlen: 3 - sliceouterlen: 3 - slicestarts: [0, 1, 1] - slicestops: [1, 1, 3] - outputs: - tocarry: [2, 3, 4] - tooffsets: [0, 1, 1, 3] - - error: false - inputs: - contentlen: 10 - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 10] - sliceindex: [1, 0, 1, 0, 3] - sliceinnerlen: 5 - sliceouterlen: 5 - slicestarts: [0, 1, 1, 3, 3] - slicestops: [1, 1, 3, 3, 5] - outputs: - tocarry: [1, 3, 4, 6, 9] - tooffsets: [0, 1, 1, 3, 3, 5] - - error: false - inputs: - contentlen: 5 - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - sliceindex: [0, 1] - sliceinnerlen: 2 - sliceouterlen: 3 - slicestarts: [0, 2, 2] - slicestops: [2, 2, 2] - outputs: - tocarry: [0, 1] - tooffsets: [0, 2, 2, 2] - - error: false - inputs: - contentlen: 4 - fromstarts: [0, 1, 1, 1, 1] - fromstops: [1, 1, 1, 1, 4] - sliceindex: [0, 0, 2, 1, 1, 2] - sliceinnerlen: 6 - sliceouterlen: 5 - slicestarts: [0, 2, 2, 2, 2] - slicestops: [2, 2, 2, 2, 6] - outputs: - tocarry: [0, 0, 3, 2, 2, 3] - tooffsets: [0, 2, 2, 2, 2, 6] - - error: false - inputs: - contentlen: 5 - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - sliceindex: [0, 1, 0] - sliceinnerlen: 3 - sliceouterlen: 3 - slicestarts: [0, 2, 2] - slicestops: [2, 2, 3] - outputs: - tocarry: [0, 1, 3] - tooffsets: [0, 2, 2, 3] - - error: false - inputs: - contentlen: 5 - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - sliceindex: [0, 1, 1] - sliceinnerlen: 3 - sliceouterlen: 3 - slicestarts: [0, 2, 2] - slicestops: [2, 2, 3] - outputs: - tocarry: [0, 1, 4] - tooffsets: [0, 2, 2, 3] - - error: false - inputs: - contentlen: 5 - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - sliceindex: [2, 0, 1] - sliceinnerlen: 3 - sliceouterlen: 3 - slicestarts: [0, 2, 2] - slicestops: [2, 2, 3] - outputs: - tocarry: [2, 0, 4] - tooffsets: [0, 2, 2, 3] - - error: false - inputs: - contentlen: 5 - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - sliceindex: [0, 2, 0, 1] - sliceinnerlen: 4 - sliceouterlen: 3 - slicestarts: [0, 2, 2] - slicestops: [2, 2, 4] - outputs: - tocarry: [0, 2, 3, 4] - tooffsets: [0, 2, 2, 4] - - error: false - inputs: - contentlen: 9 - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 9] - sliceindex: [0, 2, 0, 1, 0, 0, 1, 2] - sliceinnerlen: 8 - sliceouterlen: 5 - slicestarts: [0, 2, 2, 4, 5] - slicestops: [2, 2, 4, 5, 8] - outputs: - tocarry: [0, 2, 3, 4, 5, 6, 7, 8] - tooffsets: [0, 2, 2, 4, 5, 8] - - error: false - inputs: - contentlen: 9 - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 9] - sliceindex: [1, 2, 0, 1, 0, 0, 1, 2] - sliceinnerlen: 8 - sliceouterlen: 5 - slicestarts: [0, 2, 2, 4, 5] - slicestops: [2, 2, 4, 5, 8] - outputs: - tocarry: [1, 2, 3, 4, 5, 6, 7, 8] - tooffsets: [0, 2, 2, 4, 5, 8] - - error: false - inputs: - contentlen: 9 - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 9] - sliceindex: [0, 1, 2, 0, 0, 1, 2] - sliceinnerlen: 7 - sliceouterlen: 5 - slicestarts: [0, 3, 3, 3, 4] - slicestops: [3, 3, 3, 4, 7] - outputs: - tocarry: [0, 1, 2, 5, 6, 7, 8] - tooffsets: [0, 3, 3, 3, 4, 7] - - error: false - inputs: - contentlen: 9 - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 9] - sliceindex: [0, 1, 2, 1, 0, 0, 1, 2] - sliceinnerlen: 8 - sliceouterlen: 5 - slicestarts: [0, 3, 3, 4, 5] - slicestops: [3, 3, 4, 5, 8] - outputs: - tocarry: [0, 1, 2, 4, 5, 6, 7, 8] - tooffsets: [0, 3, 3, 4, 5, 8] - - error: false - inputs: - contentlen: 5 - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - sliceindex: [0, 1, 2, 0, 1] - sliceinnerlen: 5 - sliceouterlen: 3 - slicestarts: [0, 3, 3] - slicestops: [3, 3, 5] - outputs: - tocarry: [0, 1, 2, 3, 4] - tooffsets: [0, 3, 3, 5] - - error: false - inputs: - contentlen: 5 - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - sliceindex: [2, 1, 0, 0, 1] - sliceinnerlen: 5 - sliceouterlen: 3 - slicestarts: [0, 3, 3] - slicestops: [3, 3, 5] - outputs: - tocarry: [2, 1, 0, 3, 4] - tooffsets: [0, 3, 3, 5] - - error: false - inputs: - contentlen: 9 - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 9] - sliceindex: [0, 1, 2, 0, 1, 0, 0, 1, 2] - sliceinnerlen: 9 - sliceouterlen: 5 - slicestarts: [0, 3, 3, 5, 6] - slicestops: [3, 3, 5, 6, 9] - outputs: - tocarry: [0, 1, 2, 3, 4, 5, 6, 7, 8] - tooffsets: [0, 3, 3, 5, 6, 9] - - error: false - inputs: - contentlen: 6 - fromstarts: [0, 3] - fromstops: [3, 6] - sliceindex: [2, 1, 0, 2, 1, 0] - sliceinnerlen: 6 - sliceouterlen: 2 - slicestarts: [0, 3] - slicestops: [3, 6] - outputs: - tocarry: [2, 1, 0, 5, 4, 3] - tooffsets: [0, 3, 6] - - error: false - inputs: - contentlen: 6 - fromstarts: [0, 3, 5] - fromstops: [3, 5, 6] - sliceindex: [2, 1, 1, 0, 1, 0] - sliceinnerlen: 6 - sliceouterlen: 3 - slicestarts: [0, 4, 5] - slicestops: [4, 4, 6] - outputs: - tocarry: [2, 1, 1, 0, 5] - tooffsets: [0, 4, 4, 5] - - error: false - inputs: - contentlen: 6 - fromstarts: [0, 3, 5] - fromstops: [3, 5, 6] - sliceindex: [2, 1, 1, 0, 1, 0] - sliceinnerlen: 6 - sliceouterlen: 3 - slicestarts: [0, 4, 5] - slicestops: [4, 5, 6] - outputs: - tocarry: [2, 1, 1, 0, 4, 5] - tooffsets: [0, 4, 5, 6] - - error: false - inputs: - contentlen: 8 - fromstarts: [0, 4, 7] - fromstops: [4, 7, 8] - sliceindex: [3, 2, 2, 1, 1, 2] - sliceinnerlen: 6 - sliceouterlen: 3 - slicestarts: [0, 4, 6] - slicestops: [4, 6, 6] - outputs: - tocarry: [3, 2, 2, 1, 5, 6] - tooffsets: [0, 4, 6, 6] - - error: false - inputs: - contentlen: 13 - fromstarts: [0, 4, 4, 7, 8] - fromstops: [4, 4, 7, 8, 13] - sliceindex: [3, 2, 1, 1, 0, 1, 0, 0, 1, 2] - sliceinnerlen: 10 - sliceouterlen: 5 - slicestarts: [0, 5, 5, 6, 8] - slicestops: [5, 5, 6, 8, 10] - outputs: - tocarry: [3, 2, 1, 1, 0, 5, 7, 7, 9, 10] - tooffsets: [0, 5, 5, 6, 8, 10] -- name: awkward_UnionArray_regular_index - tests: - - error: false - inputs: - fromtags: [0, 1, 0, 1, 0, 1] - length: 6 - size: 2 - outputs: - current: [3, 3] - toindex: [0, 0, 1, 1, 2, 2] - - error: false - inputs: - fromtags: [1, 0, 1, 1] - length: 4 - size: 2 - outputs: - current: [1, 3] - toindex: [0, 0, 1, 2] - - error: false - inputs: - fromtags: [1, 1, 0, 0, 1, 0, 1, 1] - length: 8 - size: 2 - outputs: - current: [3, 5] - toindex: [0, 1, 0, 1, 2, 2, 3, 4] -- name: awkward_UnionArray_regular_index_getsize - tests: - - error: false - inputs: - fromtags: [0, 1, 0, 1, 0, 1] - length: 6 - outputs: - size: [2] - - error: false - inputs: - fromtags: [1, 0, 1, 1] - length: 4 - outputs: - size: [2] - - error: false - inputs: - fromtags: [1, 1, 0, 0, 1, 0, 1, 1] - length: 8 - outputs: - size: [2] -- name: awkward_IndexedArray_fill - tests: - - error: false - inputs: - base: 0 - fromindex: [0, 1, -1, -1, 4] - length: 5 - toindexoffset: 0 - outputs: - toindex: [0, 1, -1, -1, 4] - - error: false - inputs: - base: 0 - fromindex: [0, 1, 2, 3, -1] - length: 5 - toindexoffset: 0 - outputs: - toindex: [0, 1, 2, 3, -1] - - error: false - inputs: - base: 0 - fromindex: [0, 1, 2] - length: 3 - toindexoffset: 0 - outputs: - toindex: [0, 1, 2] - - error: false - inputs: - base: 0 - fromindex: [-1, -1, 0, -1, 1, 2] - length: 6 - toindexoffset: 0 - outputs: - toindex: [-1, -1, 0, -1, 1, 2] - - error: false - inputs: - base: 0 - fromindex: [2, 0, -1, 0, 1, 2] - length: 6 - toindexoffset: 0 - outputs: - toindex: [2, 0, -1, 0, 1, 2] -- name: awkward_ListArray_fill - tests: - - error: false - inputs: - base: 0 - fromstarts: [0, 0, 1] - fromstops: [0, 1, 3] - length: 3 - tostartsoffset: 0 - tostopsoffset: 0 - outputs: - tostarts: [0, 0, 1] - tostops: [0, 1, 3] - - error: false - inputs: - base: 0 - fromstarts: [0, 2, 2] - fromstops: [2, 2, 4] - length: 3 - tostartsoffset: 0 - tostopsoffset: 0 - outputs: - tostarts: [0, 2, 2] - tostops: [2, 2, 4] - - error: false - inputs: - base: 0 - fromstarts: [0, 2, 4] - fromstops: [2, 4, 6] - length: 3 - tostartsoffset: 0 - tostopsoffset: 0 - outputs: - tostarts: [0, 2, 4] - tostops: [2, 4, 6] - - error: false - inputs: - base: 0 - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 10] - length: 5 - tostartsoffset: 0 - tostopsoffset: 0 - outputs: - tostarts: [0, 3, 3, 5, 6] - tostops: [3, 3, 5, 6, 10] - - error: false - inputs: - base: 0 - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - length: 3 - tostartsoffset: 0 - tostopsoffset: 0 - outputs: - tostarts: [0, 3, 3] - tostops: [3, 3, 5] - - error: false - inputs: - base: 0 - fromstarts: [0, 3, 6] - fromstops: [3, 6, 11] - length: 3 - tostartsoffset: 0 - tostopsoffset: 0 - outputs: - tostarts: [0, 3, 6] - tostops: [3, 6, 11] - - error: false - inputs: - base: 0 - fromstarts: [0, 5, 10] - fromstops: [5, 10, 15] - length: 3 - tostartsoffset: 0 - tostopsoffset: 0 - outputs: - tostarts: [0, 5, 10] - tostops: [5, 10, 15] - - error: false - inputs: - base: 0 - fromstarts: [0, 7] - fromstops: [7, 14] - length: 2 - tostartsoffset: 0 - tostopsoffset: 0 - outputs: - tostarts: [0, 7] - tostops: [7, 14] - - error: false - inputs: - base: 0 - fromstarts: [1, 3, 3, 3] - fromstops: [3, 3, 3, 5] - length: 4 - tostartsoffset: 0 - tostopsoffset: 0 - outputs: - tostarts: [1, 3, 3, 3] - tostops: [3, 3, 3, 5] - - error: false - inputs: - base: 0 - fromstarts: [3, 5] - fromstops: [5, 5] - length: 2 - tostartsoffset: 0 - tostopsoffset: 0 - outputs: - tostarts: [3, 5] - tostops: [5, 5] -- name: awkward_UnionArray_fillindex - tests: - - error: false - inputs: - fromindex: [0, 0, 1, 1] - length: 4 - toindexoffset: 0 - outputs: - toindex: [0, 0, 1, 1] - - error: false - inputs: - fromindex: [0, 1, 2, 0, 1, 2] - length: 6 - toindexoffset: 0 - outputs: - toindex: [0, 1, 2, 0, 1, 2] -- name: awkward_UnionArray_validity - tests: - - error: false - inputs: - index: [0, 1, 2, 3, 0, 1] - lencontents: [4, 2, 0, 945] - length: 6 - numcontents: 2 - tags: [0, 0, 0, 0, 1, 1] - outputs: {} - - error: false - inputs: - index: [0, 1, 2, 0, 1, 2, 3] - lencontents: [3, 4] - length: 7 - numcontents: 2 - tags: [0, 0, 0, 1, 1, 1, 1] - outputs: {} - - error: false - inputs: - index: [0, 1, 0, 1, 2, 3] - lencontents: [2, 4, 32, 49, 0, 0] - length: 6 - numcontents: 2 - tags: [0, 0, 1, 1, 1, 1] - outputs: {} - - error: false - inputs: - index: [0, 0, 1, 1, 2, 3, 2, 4] - lencontents: [5, 3, 32, 33] - length: 8 - numcontents: 2 - tags: [0, 1, 1, 0, 0, 0, 1, 0] - outputs: {} - - error: false - inputs: - index: [0, 0, 1, 1, 2, 3, 2, 4] - lencontents: [5, 3, 32, 625, 0, 0, 0] - length: 8 - numcontents: 2 - tags: [0, 1, 1, 0, 0, 0, 1, 0] - outputs: {} - - error: false - inputs: - index: [0, 0, 1, 1, 2, 2, 3] - lencontents: [3, 4, 32, 177] - length: 7 - numcontents: 2 - tags: [0, 1, 1, 0, 0, 1, 1] - outputs: {} -- name: awkward_ByteMaskedArray_mask - tests: - - error: false - inputs: - frommask: [1, 1, 1, 1, 1] - length: 5 - validwhen: true - outputs: - tomask: [0, 0, 0, 0, 0] -- name: awkward_ByteMaskedArray_reduce_next_nonlocal_nextshifts_64 - tests: - - error: false - inputs: - length: 7 - mask: [0, 0, 0, 1, 1, 0, 0] - valid_when: false - outputs: - nextshifts: [0, 0, 0, 2, 2] -- name: awkward_IndexedArray_getitem_adjust_outindex - tests: - - error: false - inputs: - fromindex: [0, 1, 2, 3, -1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [0, -1] - tomask: [0, 0, 0, 0, 1] - tononzero: [0] - - error: false - inputs: - fromindex: [0, 1, 2, 3, -1] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [0, 1, -1] - tomask: [0, 0, 0, 0, 1] - tononzero: [0, 1] - - error: false - inputs: - fromindex: [0, 1, 2, 3, -1] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [0, -1] - tomask: [0, 0, 0, 0, 1] - tononzero: [1] - - error: false - inputs: - fromindex: [0, 1, 2, 3, -1] - fromindexlength: 5 - nonzero: [0, 2] - nonzerolength: 2 - outputs: - toindex: [0, 1, -1] - tomask: [0, 0, 0, 0, 1] - tononzero: [0, 2] - - error: false - inputs: - fromindex: [0, 1, 2, 3, -1] - fromindexlength: 5 - nonzero: [0, 3] - nonzerolength: 2 - outputs: - toindex: [0, 1, -1] - tomask: [0, 0, 0, 0, 1] - tononzero: [0, 3] - - error: false - inputs: - fromindex: [0, 1, 2, 3, -1] - fromindexlength: 5 - nonzero: [1, 2] - nonzerolength: 2 - outputs: - toindex: [0, 1, -1] - tomask: [0, 0, 0, 0, 1] - tononzero: [1, 2] - - error: false - inputs: - fromindex: [0, 1, 2, 3, -1] - fromindexlength: 5 - nonzero: [1, 3] - nonzerolength: 2 - outputs: - toindex: [0, 1, -1] - tomask: [0, 0, 0, 0, 1] - tononzero: [1, 3] - - error: false - inputs: - fromindex: [0, 1, 2, 3, -1] - fromindexlength: 5 - nonzero: [2, 3] - nonzerolength: 2 - outputs: - toindex: [0, 1, -1] - tomask: [0, 0, 0, 0, 1] - tononzero: [2, 3] - - error: false - inputs: - fromindex: [0, 1, 2, 3, -1] - fromindexlength: 5 - nonzero: [2] - nonzerolength: 1 - outputs: - toindex: [0, -1] - tomask: [0, 0, 0, 0, 1] - tononzero: [2] - - error: false - inputs: - fromindex: [0, 1, 2, 3, -1] - fromindexlength: 5 - nonzero: [0, 1, 2] - nonzerolength: 3 - outputs: - toindex: [0, 1, 2, -1] - tomask: [0, 0, 0, 0, 1] - tononzero: [0, 1, 2] - - error: false - inputs: - fromindex: [0, 1, 2, 3, -1] - fromindexlength: 5 - nonzero: [0, 1, 3] - nonzerolength: 3 - outputs: - toindex: [0, 1, 2, -1] - tomask: [0, 0, 0, 0, 1] - tononzero: [0, 1, 3] - - error: false - inputs: - fromindex: [0, 1, 2, 3, -1] - fromindexlength: 5 - nonzero: [0, 2, 3] - nonzerolength: 3 - outputs: - toindex: [0, 1, 2, -1] - tomask: [0, 0, 0, 0, 1] - tononzero: [0, 2, 3] - - error: false - inputs: - fromindex: [0, 1, 2, 3, -1] - fromindexlength: 5 - nonzero: [1, 2, 3] - nonzerolength: 3 - outputs: - toindex: [0, 1, 2, -1] - tomask: [0, 0, 0, 0, 1] - tononzero: [1, 2, 3] - - error: false - inputs: - fromindex: [0, 1, 2, 3, -1] - fromindexlength: 5 - nonzero: [0, 1, 2, 3] - nonzerolength: 4 - outputs: - toindex: [0, 1, 2, 3, -1] - tomask: [0, 0, 0, 0, 1] - tononzero: [0, 1, 2, 3] - - error: false - inputs: - fromindex: [0, 1, 2, 3, -1] - fromindexlength: 5 - nonzero: [3] - nonzerolength: 1 - outputs: - toindex: [0, -1] - tomask: [0, 0, 0, 0, 1] - tononzero: [3] - - error: false - inputs: - fromindex: [0, 1, 2, 3, -1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1] - tomask: [0, 0, 0, 0, 1] - tononzero: [] - - error: false - inputs: - fromindex: [0, 1, 2, -1, 3, 4] - fromindexlength: 6 - nonzero: [0, 1, 4] - nonzerolength: 3 - outputs: - toindex: [0, 1, -1, 2] - tomask: [0, 0, 0, 1, 0, 0] - tononzero: [0, 1, 5] - - error: false - inputs: - fromindex: [0, 1, 2, -1, 3] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [0, -1] - tomask: [0, 0, 0, 1, 0] - tononzero: [0] - - error: false - inputs: - fromindex: [0, 1, 2, -1, 3] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [0, 1, -1] - tomask: [0, 0, 0, 1, 0] - tononzero: [0, 1] - - error: false - inputs: - fromindex: [0, 1, 2, -1, 3] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [0, -1] - tomask: [0, 0, 0, 1, 0] - tononzero: [1] - - error: false - inputs: - fromindex: [0, 1, 2, -1, 3] - fromindexlength: 5 - nonzero: [0, 2] - nonzerolength: 2 - outputs: - toindex: [0, 1, -1] - tomask: [0, 0, 0, 1, 0] - tononzero: [0, 2] - - error: false - inputs: - fromindex: [0, 1, 2, -1, 3] - fromindexlength: 5 - nonzero: [0, 3] - nonzerolength: 2 - outputs: - toindex: [0, -1, 1] - tomask: [0, 0, 0, 1, 0] - tononzero: [0, 4] - - error: false - inputs: - fromindex: [0, 1, 2, -1, 3] - fromindexlength: 5 - nonzero: [1, 2] - nonzerolength: 2 - outputs: - toindex: [0, 1, -1] - tomask: [0, 0, 0, 1, 0] - tononzero: [1, 2] - - error: false - inputs: - fromindex: [0, 1, 2, -1, 3] - fromindexlength: 5 - nonzero: [1, 3] - nonzerolength: 2 - outputs: - toindex: [0, -1, 1] - tomask: [0, 0, 0, 1, 0] - tononzero: [1, 4] - - error: false - inputs: - fromindex: [0, 1, 2, -1, 3] - fromindexlength: 5 - nonzero: [0, 1, 3] - nonzerolength: 3 - outputs: - toindex: [0, 1, -1, 2] - tomask: [0, 0, 0, 1, 0] - tononzero: [0, 1, 4] - - error: false - inputs: - fromindex: [0, 1, 2, -1, 3] - fromindexlength: 5 - nonzero: [0, 2, 3] - nonzerolength: 3 - outputs: - toindex: [0, 1, -1, 2] - tomask: [0, 0, 0, 1, 0] - tononzero: [0, 2, 4] - - error: false - inputs: - fromindex: [0, 1, 2, -1, 3] - fromindexlength: 5 - nonzero: [1, 2, 3] - nonzerolength: 3 - outputs: - toindex: [0, 1, -1, 2] - tomask: [0, 0, 0, 1, 0] - tononzero: [1, 2, 4] - - error: false - inputs: - fromindex: [0, 1, 2, -1, 3] - fromindexlength: 5 - nonzero: [2, 3] - nonzerolength: 2 - outputs: - toindex: [0, -1, 1] - tomask: [0, 0, 0, 1, 0] - tononzero: [2, 4] - - error: false - inputs: - fromindex: [0, 1, 2, -1, 3] - fromindexlength: 5 - nonzero: [2] - nonzerolength: 1 - outputs: - toindex: [0, -1] - tomask: [0, 0, 0, 1, 0] - tononzero: [2] - - error: false - inputs: - fromindex: [0, 1, 2, -1, 3] - fromindexlength: 5 - nonzero: [0, 1, 2] - nonzerolength: 3 - outputs: - toindex: [0, 1, 2, -1] - tomask: [0, 0, 0, 1, 0] - tononzero: [0, 1, 2] - - error: false - inputs: - fromindex: [0, 1, 2, -1, 3] - fromindexlength: 5 - nonzero: [0, 1, 2, 3] - nonzerolength: 4 - outputs: - toindex: [0, 1, 2, -1, 3] - tomask: [0, 0, 0, 1, 0] - tononzero: [0, 1, 2, 4] - - error: false - inputs: - fromindex: [0, 1, 2, -1, 3] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1] - tomask: [0, 0, 0, 1, 0] - tononzero: [] - - error: false - inputs: - fromindex: [0, 1, 2, -1, 3] - fromindexlength: 5 - nonzero: [3] - nonzerolength: 1 - outputs: - toindex: [-1, 0] - tomask: [0, 0, 0, 1, 0] - tononzero: [4] - - error: false - inputs: - fromindex: [0, 1, 2, -1, -1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [0, -1, -1] - tomask: [0, 0, 0, 1, 1] - tononzero: [0] - - error: false - inputs: - fromindex: [0, 1, 2, -1, -1] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [0, 1, -1, -1] - tomask: [0, 0, 0, 1, 1] - tononzero: [0, 1] - - error: false - inputs: - fromindex: [0, 1, 2, -1, -1] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [0, -1, -1] - tomask: [0, 0, 0, 1, 1] - tononzero: [1] - - error: false - inputs: - fromindex: [0, 1, 2, -1, -1] - fromindexlength: 5 - nonzero: [0, 2] - nonzerolength: 2 - outputs: - toindex: [0, 1, -1, -1] - tomask: [0, 0, 0, 1, 1] - tononzero: [0, 2] - - error: false - inputs: - fromindex: [0, 1, 2, -1, -1] - fromindexlength: 5 - nonzero: [1, 2] - nonzerolength: 2 - outputs: - toindex: [0, 1, -1, -1] - tomask: [0, 0, 0, 1, 1] - tononzero: [1, 2] - - error: false - inputs: - fromindex: [0, 1, 2, -1, -1] - fromindexlength: 5 - nonzero: [2] - nonzerolength: 1 - outputs: - toindex: [0, -1, -1] - tomask: [0, 0, 0, 1, 1] - tononzero: [2] - - error: false - inputs: - fromindex: [0, 1, 2, -1, -1] - fromindexlength: 5 - nonzero: [0, 1, 2] - nonzerolength: 3 - outputs: - toindex: [0, 1, 2, -1, -1] - tomask: [0, 0, 0, 1, 1] - tononzero: [0, 1, 2] - - error: false - inputs: - fromindex: [0, 1, 2, -1, -1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1] - tomask: [0, 0, 0, 1, 1] - tononzero: [] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3, 4, 5, 6] - fromindexlength: 8 - nonzero: [1, 4, 5] - nonzerolength: 3 - outputs: - toindex: [0, -1, 1, 2] - tomask: [0, 0, 1, 0, 0, 0, 0, 0] - tononzero: [1, 5, 6] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [0, -1] - tomask: [0, 0, 1, 0, 0] - tononzero: [0] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [0, 1, -1] - tomask: [0, 0, 1, 0, 0] - tononzero: [0, 1] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [0, -1] - tomask: [0, 0, 1, 0, 0] - tononzero: [1] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3] - fromindexlength: 5 - nonzero: [0, 2] - nonzerolength: 2 - outputs: - toindex: [0, -1, 1] - tomask: [0, 0, 1, 0, 0] - tononzero: [0, 3] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3] - fromindexlength: 5 - nonzero: [0, 3] - nonzerolength: 2 - outputs: - toindex: [0, -1, 1] - tomask: [0, 0, 1, 0, 0] - tononzero: [0, 4] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3] - fromindexlength: 5 - nonzero: [1, 2] - nonzerolength: 2 - outputs: - toindex: [0, -1, 1] - tomask: [0, 0, 1, 0, 0] - tononzero: [1, 3] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3] - fromindexlength: 5 - nonzero: [1, 3] - nonzerolength: 2 - outputs: - toindex: [0, -1, 1] - tomask: [0, 0, 1, 0, 0] - tononzero: [1, 4] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3] - fromindexlength: 5 - nonzero: [0, 1, 2] - nonzerolength: 3 - outputs: - toindex: [0, 1, -1, 2] - tomask: [0, 0, 1, 0, 0] - tononzero: [0, 1, 3] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3] - fromindexlength: 5 - nonzero: [0, 1, 3] - nonzerolength: 3 - outputs: - toindex: [0, 1, -1, 2] - tomask: [0, 0, 1, 0, 0] - tononzero: [0, 1, 4] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3] - fromindexlength: 5 - nonzero: [0, 2, 3] - nonzerolength: 3 - outputs: - toindex: [0, -1, 1, 2] - tomask: [0, 0, 1, 0, 0] - tononzero: [0, 3, 4] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3] - fromindexlength: 5 - nonzero: [1, 2, 3] - nonzerolength: 3 - outputs: - toindex: [0, -1, 1, 2] - tomask: [0, 0, 1, 0, 0] - tononzero: [1, 3, 4] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3] - fromindexlength: 5 - nonzero: [0, 1, 2, 3] - nonzerolength: 4 - outputs: - toindex: [0, 1, -1, 2, 3] - tomask: [0, 0, 1, 0, 0] - tononzero: [0, 1, 3, 4] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1] - tomask: [0, 0, 1, 0, 0] - tononzero: [] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3] - fromindexlength: 5 - nonzero: [2, 3] - nonzerolength: 2 - outputs: - toindex: [-1, 0, 1] - tomask: [0, 0, 1, 0, 0] - tononzero: [3, 4] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3] - fromindexlength: 5 - nonzero: [2] - nonzerolength: 1 - outputs: - toindex: [-1, 0] - tomask: [0, 0, 1, 0, 0] - tononzero: [3] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3] - fromindexlength: 5 - nonzero: [3] - nonzerolength: 1 - outputs: - toindex: [-1, 0] - tomask: [0, 0, 1, 0, 0] - tononzero: [4] - - error: false - inputs: - fromindex: [0, 1, -1, 2, -1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [0, -1, -1] - tomask: [0, 0, 1, 0, 1] - tononzero: [0] - - error: false - inputs: - fromindex: [0, 1, -1, 2, -1] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [0, 1, -1, -1] - tomask: [0, 0, 1, 0, 1] - tononzero: [0, 1] - - error: false - inputs: - fromindex: [0, 1, -1, 2, -1] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [0, -1, -1] - tomask: [0, 0, 1, 0, 1] - tononzero: [1] - - error: false - inputs: - fromindex: [0, 1, -1, 2, -1] - fromindexlength: 5 - nonzero: [0, 2] - nonzerolength: 2 - outputs: - toindex: [0, -1, 1, -1] - tomask: [0, 0, 1, 0, 1] - tononzero: [0, 3] - - error: false - inputs: - fromindex: [0, 1, -1, 2, -1] - fromindexlength: 5 - nonzero: [1, 2] - nonzerolength: 2 - outputs: - toindex: [0, -1, 1, -1] - tomask: [0, 0, 1, 0, 1] - tononzero: [1, 3] - - error: false - inputs: - fromindex: [0, 1, -1, 2, -1] - fromindexlength: 5 - nonzero: [0, 1, 2] - nonzerolength: 3 - outputs: - toindex: [0, 1, -1, 2, -1] - tomask: [0, 0, 1, 0, 1] - tononzero: [0, 1, 3] - - error: false - inputs: - fromindex: [0, 1, -1, 2, -1] - fromindexlength: 5 - nonzero: [2] - nonzerolength: 1 - outputs: - toindex: [-1, 0, -1] - tomask: [0, 0, 1, 0, 1] - tononzero: [3] - - error: false - inputs: - fromindex: [0, 1, -1, 2, -1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1] - tomask: [0, 0, 1, 0, 1] - tononzero: [] - - error: false - inputs: - fromindex: [0, 1, -1, -1, 2] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [0, -1, -1] - tomask: [0, 0, 1, 1, 0] - tononzero: [0] - - error: false - inputs: - fromindex: [0, 1, -1, -1, 2] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [0, 1, -1, -1] - tomask: [0, 0, 1, 1, 0] - tononzero: [0, 1] - - error: false - inputs: - fromindex: [0, 1, -1, -1, 2] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [0, -1, -1] - tomask: [0, 0, 1, 1, 0] - tononzero: [1] - - error: false - inputs: - fromindex: [0, 1, -1, -1, 2] - fromindexlength: 5 - nonzero: [0, 2] - nonzerolength: 2 - outputs: - toindex: [0, -1, -1, 1] - tomask: [0, 0, 1, 1, 0] - tononzero: [0, 4] - - error: false - inputs: - fromindex: [0, 1, -1, -1, 2] - fromindexlength: 5 - nonzero: [1, 2] - nonzerolength: 2 - outputs: - toindex: [0, -1, -1, 1] - tomask: [0, 0, 1, 1, 0] - tononzero: [1, 4] - - error: false - inputs: - fromindex: [0, 1, -1, -1, 2] - fromindexlength: 5 - nonzero: [0, 1, 2] - nonzerolength: 3 - outputs: - toindex: [0, 1, -1, -1, 2] - tomask: [0, 0, 1, 1, 0] - tononzero: [0, 1, 4] - - error: false - inputs: - fromindex: [0, 1, -1, -1, 2] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1] - tomask: [0, 0, 1, 1, 0] - tononzero: [] - - error: false - inputs: - fromindex: [0, 1, -1, -1, 2] - fromindexlength: 5 - nonzero: [2] - nonzerolength: 1 - outputs: - toindex: [-1, -1, 0] - tomask: [0, 0, 1, 1, 0] - tononzero: [4] - - error: false - inputs: - fromindex: [0, 1, -1, -1, -1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [0, -1, -1, -1] - tomask: [0, 0, 1, 1, 1] - tononzero: [0] - - error: false - inputs: - fromindex: [0, 1, -1, -1, -1] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [0, 1, -1, -1, -1] - tomask: [0, 0, 1, 1, 1] - tononzero: [0, 1] - - error: false - inputs: - fromindex: [0, 1, -1, -1, -1] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [0, -1, -1, -1] - tomask: [0, 0, 1, 1, 1] - tononzero: [1] - - error: false - inputs: - fromindex: [0, 1, -1, -1, -1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1, -1] - tomask: [0, 0, 1, 1, 1] - tononzero: [] - - error: false - inputs: - fromindex: [0, -1, 1, 2, 3] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [0, -1] - tomask: [0, 1, 0, 0, 0] - tononzero: [0] - - error: false - inputs: - fromindex: [0, -1, 1, 2, 3] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [0, -1, 1] - tomask: [0, 1, 0, 0, 0] - tononzero: [0, 2] - - error: false - inputs: - fromindex: [0, -1, 1, 2, 3] - fromindexlength: 5 - nonzero: [0, 2] - nonzerolength: 2 - outputs: - toindex: [0, -1, 1] - tomask: [0, 1, 0, 0, 0] - tononzero: [0, 3] - - error: false - inputs: - fromindex: [0, -1, 1, 2, 3] - fromindexlength: 5 - nonzero: [0, 3] - nonzerolength: 2 - outputs: - toindex: [0, -1, 1] - tomask: [0, 1, 0, 0, 0] - tononzero: [0, 4] - - error: false - inputs: - fromindex: [0, -1, 1, 2, 3] - fromindexlength: 5 - nonzero: [0, 1, 2] - nonzerolength: 3 - outputs: - toindex: [0, -1, 1, 2] - tomask: [0, 1, 0, 0, 0] - tononzero: [0, 2, 3] - - error: false - inputs: - fromindex: [0, -1, 1, 2, 3] - fromindexlength: 5 - nonzero: [0, 1, 3] - nonzerolength: 3 - outputs: - toindex: [0, -1, 1, 2] - tomask: [0, 1, 0, 0, 0] - tononzero: [0, 2, 4] - - error: false - inputs: - fromindex: [0, -1, 1, 2, 3] - fromindexlength: 5 - nonzero: [0, 2, 3] - nonzerolength: 3 - outputs: - toindex: [0, -1, 1, 2] - tomask: [0, 1, 0, 0, 0] - tononzero: [0, 3, 4] - - error: false - inputs: - fromindex: [0, -1, 1, 2, 3] - fromindexlength: 5 - nonzero: [0, 1, 2, 3] - nonzerolength: 4 - outputs: - toindex: [0, -1, 1, 2, 3] - tomask: [0, 1, 0, 0, 0] - tononzero: [0, 2, 3, 4] - - error: false - inputs: - fromindex: [0, -1, 1, 2, 3] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1] - tomask: [0, 1, 0, 0, 0] - tononzero: [] - - error: false - inputs: - fromindex: [0, -1, 1, 2, 3] - fromindexlength: 5 - nonzero: [1, 2, 3] - nonzerolength: 3 - outputs: - toindex: [-1, 0, 1, 2] - tomask: [0, 1, 0, 0, 0] - tononzero: [2, 3, 4] - - error: false - inputs: - fromindex: [0, -1, 1, 2, 3] - fromindexlength: 5 - nonzero: [1, 2] - nonzerolength: 2 - outputs: - toindex: [-1, 0, 1] - tomask: [0, 1, 0, 0, 0] - tononzero: [2, 3] - - error: false - inputs: - fromindex: [0, -1, 1, 2, 3] - fromindexlength: 5 - nonzero: [1, 3] - nonzerolength: 2 - outputs: - toindex: [-1, 0, 1] - tomask: [0, 1, 0, 0, 0] - tononzero: [2, 4] - - error: false - inputs: - fromindex: [0, -1, 1, 2, 3] - fromindexlength: 5 - nonzero: [2, 3] - nonzerolength: 2 - outputs: - toindex: [-1, 0, 1] - tomask: [0, 1, 0, 0, 0] - tononzero: [3, 4] - - error: false - inputs: - fromindex: [0, -1, 1, 2, 3] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [-1, 0] - tomask: [0, 1, 0, 0, 0] - tononzero: [2] - - error: false - inputs: - fromindex: [0, -1, 1, 2, 3] - fromindexlength: 5 - nonzero: [2] - nonzerolength: 1 - outputs: - toindex: [-1, 0] - tomask: [0, 1, 0, 0, 0] - tononzero: [3] - - error: false - inputs: - fromindex: [0, -1, 1, 2, 3] - fromindexlength: 5 - nonzero: [3] - nonzerolength: 1 - outputs: - toindex: [-1, 0] - tomask: [0, 1, 0, 0, 0] - tononzero: [4] - - error: false - inputs: - fromindex: [0, -1, 1, 2] - fromindexlength: 4 - nonzero: [0, 2] - nonzerolength: 2 - outputs: - toindex: [0, -1, 1] - tomask: [0, 1, 0, 0] - tononzero: [0, 3] - - error: false - inputs: - fromindex: [0, -1, 1, 2, -1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [0, -1, -1] - tomask: [0, 1, 0, 0, 1] - tononzero: [0] - - error: false - inputs: - fromindex: [0, -1, 1, 2, -1] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [0, -1, 1, -1] - tomask: [0, 1, 0, 0, 1] - tononzero: [0, 2] - - error: false - inputs: - fromindex: [0, -1, 1, 2, -1] - fromindexlength: 5 - nonzero: [0, 2] - nonzerolength: 2 - outputs: - toindex: [0, -1, 1, -1] - tomask: [0, 1, 0, 0, 1] - tononzero: [0, 3] - - error: false - inputs: - fromindex: [0, -1, 1, 2, -1] - fromindexlength: 5 - nonzero: [0, 1, 2] - nonzerolength: 3 - outputs: - toindex: [0, -1, 1, 2, -1] - tomask: [0, 1, 0, 0, 1] - tononzero: [0, 2, 3] - - error: false - inputs: - fromindex: [0, -1, 1, 2, -1] - fromindexlength: 5 - nonzero: [1, 2] - nonzerolength: 2 - outputs: - toindex: [-1, 0, 1, -1] - tomask: [0, 1, 0, 0, 1] - tononzero: [2, 3] - - error: false - inputs: - fromindex: [0, -1, 1, 2, -1] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [-1, 0, -1] - tomask: [0, 1, 0, 0, 1] - tononzero: [2] - - error: false - inputs: - fromindex: [0, -1, 1, 2, -1] - fromindexlength: 5 - nonzero: [2] - nonzerolength: 1 - outputs: - toindex: [-1, 0, -1] - tomask: [0, 1, 0, 0, 1] - tononzero: [3] - - error: false - inputs: - fromindex: [0, -1, 1, 2, -1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1] - tomask: [0, 1, 0, 0, 1] - tononzero: [] - - error: false - inputs: - fromindex: [0, -1, 1, -1, 2] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [0, -1, -1] - tomask: [0, 1, 0, 1, 0] - tononzero: [0] - - error: false - inputs: - fromindex: [0, -1, 1, -1, 2] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [0, -1, 1, -1] - tomask: [0, 1, 0, 1, 0] - tononzero: [0, 2] - - error: false - inputs: - fromindex: [0, -1, 1, -1, 2] - fromindexlength: 5 - nonzero: [0, 2] - nonzerolength: 2 - outputs: - toindex: [0, -1, -1, 1] - tomask: [0, 1, 0, 1, 0] - tononzero: [0, 4] - - error: false - inputs: - fromindex: [0, -1, 1, -1, 2] - fromindexlength: 5 - nonzero: [0, 1, 2] - nonzerolength: 3 - outputs: - toindex: [0, -1, 1, -1, 2] - tomask: [0, 1, 0, 1, 0] - tononzero: [0, 2, 4] - - error: false - inputs: - fromindex: [0, -1, 1, -1, 2] - fromindexlength: 5 - nonzero: [1, 2] - nonzerolength: 2 - outputs: - toindex: [-1, 0, -1, 1] - tomask: [0, 1, 0, 1, 0] - tononzero: [2, 4] - - error: false - inputs: - fromindex: [0, -1, 1, -1, 2] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [-1, 0, -1] - tomask: [0, 1, 0, 1, 0] - tononzero: [2] - - error: false - inputs: - fromindex: [0, -1, 1, -1, 2] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1] - tomask: [0, 1, 0, 1, 0] - tononzero: [] - - error: false - inputs: - fromindex: [0, -1, 1, -1, 2] - fromindexlength: 5 - nonzero: [2] - nonzerolength: 1 - outputs: - toindex: [-1, -1, 0] - tomask: [0, 1, 0, 1, 0] - tononzero: [4] - - error: false - inputs: - fromindex: [0, -1, 1, -1, -1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [0, -1, -1, -1] - tomask: [0, 1, 0, 1, 1] - tononzero: [0] - - error: false - inputs: - fromindex: [0, -1, 1, -1, -1] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [0, -1, 1, -1, -1] - tomask: [0, 1, 0, 1, 1] - tononzero: [0, 2] - - error: false - inputs: - fromindex: [0, -1, 1, -1, -1] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [-1, 0, -1, -1] - tomask: [0, 1, 0, 1, 1] - tononzero: [2] - - error: false - inputs: - fromindex: [0, -1, 1, -1, -1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1, -1] - tomask: [0, 1, 0, 1, 1] - tononzero: [] - - error: false - inputs: - fromindex: [0, -1, -1, 1, 2] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [0, -1, -1] - tomask: [0, 1, 1, 0, 0] - tononzero: [0] - - error: false - inputs: - fromindex: [0, -1, -1, 1, 2] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [0, -1, -1, 1] - tomask: [0, 1, 1, 0, 0] - tononzero: [0, 3] - - error: false - inputs: - fromindex: [0, -1, -1, 1, 2] - fromindexlength: 5 - nonzero: [0, 2] - nonzerolength: 2 - outputs: - toindex: [0, -1, -1, 1] - tomask: [0, 1, 1, 0, 0] - tononzero: [0, 4] - - error: false - inputs: - fromindex: [0, -1, -1, 1, 2] - fromindexlength: 5 - nonzero: [0, 1, 2] - nonzerolength: 3 - outputs: - toindex: [0, -1, -1, 1, 2] - tomask: [0, 1, 1, 0, 0] - tononzero: [0, 3, 4] - - error: false - inputs: - fromindex: [0, -1, -1, 1, 2] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1] - tomask: [0, 1, 1, 0, 0] - tononzero: [] - - error: false - inputs: - fromindex: [0, -1, -1, 1, 2] - fromindexlength: 5 - nonzero: [1, 2] - nonzerolength: 2 - outputs: - toindex: [-1, -1, 0, 1] - tomask: [0, 1, 1, 0, 0] - tononzero: [3, 4] - - error: false - inputs: - fromindex: [0, -1, -1, 1, 2] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [-1, -1, 0] - tomask: [0, 1, 1, 0, 0] - tononzero: [3] - - error: false - inputs: - fromindex: [0, -1, -1, 1, 2] - fromindexlength: 5 - nonzero: [2] - nonzerolength: 1 - outputs: - toindex: [-1, -1, 0] - tomask: [0, 1, 1, 0, 0] - tononzero: [4] - - error: false - inputs: - fromindex: [0, -1, -1, 1, -1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [0, -1, -1, -1] - tomask: [0, 1, 1, 0, 1] - tononzero: [0] - - error: false - inputs: - fromindex: [0, -1, -1, 1, -1] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [0, -1, -1, 1, -1] - tomask: [0, 1, 1, 0, 1] - tononzero: [0, 3] - - error: false - inputs: - fromindex: [0, -1, -1, 1, -1] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [-1, -1, 0, -1] - tomask: [0, 1, 1, 0, 1] - tononzero: [3] - - error: false - inputs: - fromindex: [0, -1, -1, 1, -1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1, -1] - tomask: [0, 1, 1, 0, 1] - tononzero: [] - - error: false - inputs: - fromindex: [0, -1, -1, -1, 1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [0, -1, -1, -1] - tomask: [0, 1, 1, 1, 0] - tononzero: [0] - - error: false - inputs: - fromindex: [0, -1, -1, -1, 1] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [0, -1, -1, -1, 1] - tomask: [0, 1, 1, 1, 0] - tononzero: [0, 4] - - error: false - inputs: - fromindex: [0, -1, -1, -1, 1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1, -1] - tomask: [0, 1, 1, 1, 0] - tononzero: [] - - error: false - inputs: - fromindex: [0, -1, -1, -1, 1] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [-1, -1, -1, 0] - tomask: [0, 1, 1, 1, 0] - tononzero: [4] - - error: false - inputs: - fromindex: [0, -1, -1, -1, -1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [0, -1, -1, -1, -1] - tomask: [0, 1, 1, 1, 1] - tononzero: [0] - - error: false - inputs: - fromindex: [0, -1, -1, -1, -1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1, -1, -1] - tomask: [0, 1, 1, 1, 1] - tononzero: [] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, 3] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [-1, 0] - tomask: [1, 0, 0, 0, 0] - tononzero: [1] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, 3] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [-1, 0, 1] - tomask: [1, 0, 0, 0, 0] - tononzero: [1, 2] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, 3] - fromindexlength: 5 - nonzero: [0, 2] - nonzerolength: 2 - outputs: - toindex: [-1, 0, 1] - tomask: [1, 0, 0, 0, 0] - tononzero: [1, 3] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, 3] - fromindexlength: 5 - nonzero: [0, 3] - nonzerolength: 2 - outputs: - toindex: [-1, 0, 1] - tomask: [1, 0, 0, 0, 0] - tononzero: [1, 4] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, 3] - fromindexlength: 5 - nonzero: [0, 1, 2] - nonzerolength: 3 - outputs: - toindex: [-1, 0, 1, 2] - tomask: [1, 0, 0, 0, 0] - tononzero: [1, 2, 3] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, 3] - fromindexlength: 5 - nonzero: [0, 1, 3] - nonzerolength: 3 - outputs: - toindex: [-1, 0, 1, 2] - tomask: [1, 0, 0, 0, 0] - tononzero: [1, 2, 4] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, 3] - fromindexlength: 5 - nonzero: [0, 2, 3] - nonzerolength: 3 - outputs: - toindex: [-1, 0, 1, 2] - tomask: [1, 0, 0, 0, 0] - tononzero: [1, 3, 4] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, 3] - fromindexlength: 5 - nonzero: [1, 2, 3] - nonzerolength: 3 - outputs: - toindex: [-1, 0, 1, 2] - tomask: [1, 0, 0, 0, 0] - tononzero: [2, 3, 4] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, 3] - fromindexlength: 5 - nonzero: [1, 2] - nonzerolength: 2 - outputs: - toindex: [-1, 0, 1] - tomask: [1, 0, 0, 0, 0] - tononzero: [2, 3] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, 3] - fromindexlength: 5 - nonzero: [0, 1, 2, 3] - nonzerolength: 4 - outputs: - toindex: [-1, 0, 1, 2, 3] - tomask: [1, 0, 0, 0, 0] - tononzero: [1, 2, 3, 4] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, 3] - fromindexlength: 5 - nonzero: [1, 3] - nonzerolength: 2 - outputs: - toindex: [-1, 0, 1] - tomask: [1, 0, 0, 0, 0] - tononzero: [2, 4] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, 3] - fromindexlength: 5 - nonzero: [2, 3] - nonzerolength: 2 - outputs: - toindex: [-1, 0, 1] - tomask: [1, 0, 0, 0, 0] - tononzero: [3, 4] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, 3] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [-1, 0] - tomask: [1, 0, 0, 0, 0] - tononzero: [2] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, 3] - fromindexlength: 5 - nonzero: [2] - nonzerolength: 1 - outputs: - toindex: [-1, 0] - tomask: [1, 0, 0, 0, 0] - tononzero: [3] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, 3] - fromindexlength: 5 - nonzero: [3] - nonzerolength: 1 - outputs: - toindex: [-1, 0] - tomask: [1, 0, 0, 0, 0] - tononzero: [4] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, 3] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1] - tomask: [1, 0, 0, 0, 0] - tononzero: [] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, -1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [-1, 0, -1] - tomask: [1, 0, 0, 0, 1] - tononzero: [1] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, -1] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [-1, 0, 1, -1] - tomask: [1, 0, 0, 0, 1] - tononzero: [1, 2] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, -1] - fromindexlength: 5 - nonzero: [0, 2] - nonzerolength: 2 - outputs: - toindex: [-1, 0, 1, -1] - tomask: [1, 0, 0, 0, 1] - tononzero: [1, 3] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, -1] - fromindexlength: 5 - nonzero: [1, 2] - nonzerolength: 2 - outputs: - toindex: [-1, 0, 1, -1] - tomask: [1, 0, 0, 0, 1] - tononzero: [2, 3] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, -1] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [-1, 0, -1] - tomask: [1, 0, 0, 0, 1] - tononzero: [2] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, -1] - fromindexlength: 5 - nonzero: [0, 1, 2] - nonzerolength: 3 - outputs: - toindex: [-1, 0, 1, 2, -1] - tomask: [1, 0, 0, 0, 1] - tononzero: [1, 2, 3] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, -1] - fromindexlength: 5 - nonzero: [2] - nonzerolength: 1 - outputs: - toindex: [-1, 0, -1] - tomask: [1, 0, 0, 0, 1] - tononzero: [3] - - error: false - inputs: - fromindex: [-1, 0, 1, 2, -1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1] - tomask: [1, 0, 0, 0, 1] - tononzero: [] - - error: false - inputs: - fromindex: [-1, 0, 1, -1, 2] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [-1, 0, -1] - tomask: [1, 0, 0, 1, 0] - tononzero: [1] - - error: false - inputs: - fromindex: [-1, 0, 1, -1, 2] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [-1, 0, 1, -1] - tomask: [1, 0, 0, 1, 0] - tononzero: [1, 2] - - error: false - inputs: - fromindex: [-1, 0, 1, -1, 2] - fromindexlength: 5 - nonzero: [0, 2] - nonzerolength: 2 - outputs: - toindex: [-1, 0, -1, 1] - tomask: [1, 0, 0, 1, 0] - tononzero: [1, 4] - - error: false - inputs: - fromindex: [-1, 0, 1, -1, 2] - fromindexlength: 5 - nonzero: [0, 1, 2] - nonzerolength: 3 - outputs: - toindex: [-1, 0, 1, -1, 2] - tomask: [1, 0, 0, 1, 0] - tononzero: [1, 2, 4] - - error: false - inputs: - fromindex: [-1, 0, 1, -1, 2] - fromindexlength: 5 - nonzero: [1, 2] - nonzerolength: 2 - outputs: - toindex: [-1, 0, -1, 1] - tomask: [1, 0, 0, 1, 0] - tononzero: [2, 4] - - error: false - inputs: - fromindex: [-1, 0, 1, -1, 2] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [-1, 0, -1] - tomask: [1, 0, 0, 1, 0] - tononzero: [2] - - error: false - inputs: - fromindex: [-1, 0, 1, -1, 2] - fromindexlength: 5 - nonzero: [2] - nonzerolength: 1 - outputs: - toindex: [-1, -1, 0] - tomask: [1, 0, 0, 1, 0] - tononzero: [4] - - error: false - inputs: - fromindex: [-1, 0, 1, -1, 2] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1] - tomask: [1, 0, 0, 1, 0] - tononzero: [] - - error: false - inputs: - fromindex: [-1, 0, 1, -1, -1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [-1, 0, -1, -1] - tomask: [1, 0, 0, 1, 1] - tononzero: [1] - - error: false - inputs: - fromindex: [-1, 0, 1, -1, -1] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [-1, 0, 1, -1, -1] - tomask: [1, 0, 0, 1, 1] - tononzero: [1, 2] - - error: false - inputs: - fromindex: [-1, 0, 1, -1, -1] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [-1, 0, -1, -1] - tomask: [1, 0, 0, 1, 1] - tononzero: [2] - - error: false - inputs: - fromindex: [-1, 0, 1, -1, -1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1, -1] - tomask: [1, 0, 0, 1, 1] - tononzero: [] - - error: false - inputs: - fromindex: [-1, 0, -1, 1, 2] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [-1, 0, -1] - tomask: [1, 0, 1, 0, 0] - tononzero: [1] - - error: false - inputs: - fromindex: [-1, 0, -1, 1, 2] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [-1, 0, -1, 1] - tomask: [1, 0, 1, 0, 0] - tononzero: [1, 3] - - error: false - inputs: - fromindex: [-1, 0, -1, 1, 2] - fromindexlength: 5 - nonzero: [0, 2] - nonzerolength: 2 - outputs: - toindex: [-1, 0, -1, 1] - tomask: [1, 0, 1, 0, 0] - tononzero: [1, 4] - - error: false - inputs: - fromindex: [-1, 0, -1, 1, 2] - fromindexlength: 5 - nonzero: [0, 1, 2] - nonzerolength: 3 - outputs: - toindex: [-1, 0, -1, 1, 2] - tomask: [1, 0, 1, 0, 0] - tononzero: [1, 3, 4] - - error: false - inputs: - fromindex: [-1, 0, -1, 1, 2] - fromindexlength: 5 - nonzero: [1, 2] - nonzerolength: 2 - outputs: - toindex: [-1, -1, 0, 1] - tomask: [1, 0, 1, 0, 0] - tononzero: [3, 4] - - error: false - inputs: - fromindex: [-1, 0, -1, 1, 2] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [-1, -1, 0] - tomask: [1, 0, 1, 0, 0] - tononzero: [3] - - error: false - inputs: - fromindex: [-1, 0, -1, 1, 2] - fromindexlength: 5 - nonzero: [2] - nonzerolength: 1 - outputs: - toindex: [-1, -1, 0] - tomask: [1, 0, 1, 0, 0] - tononzero: [4] - - error: false - inputs: - fromindex: [-1, 0, -1, 1, 2] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1] - tomask: [1, 0, 1, 0, 0] - tononzero: [] - - error: false - inputs: - fromindex: [-1, 0, -1, 1, -1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [-1, 0, -1, -1] - tomask: [1, 0, 1, 0, 1] - tononzero: [1] - - error: false - inputs: - fromindex: [-1, 0, -1, 1, -1] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [-1, 0, -1, 1, -1] - tomask: [1, 0, 1, 0, 1] - tononzero: [1, 3] - - error: false - inputs: - fromindex: [-1, 0, -1, 1, -1] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [-1, -1, 0, -1] - tomask: [1, 0, 1, 0, 1] - tononzero: [3] - - error: false - inputs: - fromindex: [-1, 0, -1, 1, -1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1, -1] - tomask: [1, 0, 1, 0, 1] - tononzero: [] - - error: false - inputs: - fromindex: [-1, 0, -1, -1, 1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [-1, 0, -1, -1] - tomask: [1, 0, 1, 1, 0] - tononzero: [1] - - error: false - inputs: - fromindex: [-1, 0, -1, -1, 1] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [-1, 0, -1, -1, 1] - tomask: [1, 0, 1, 1, 0] - tononzero: [1, 4] - - error: false - inputs: - fromindex: [-1, 0, -1, -1, 1] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [-1, -1, -1, 0] - tomask: [1, 0, 1, 1, 0] - tononzero: [4] - - error: false - inputs: - fromindex: [-1, 0, -1, -1, 1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1, -1] - tomask: [1, 0, 1, 1, 0] - tononzero: [] - - error: false - inputs: - fromindex: [-1, 0, -1, -1, -1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [-1, 0, -1, -1, -1] - tomask: [1, 0, 1, 1, 1] - tononzero: [1] - - error: false - inputs: - fromindex: [-1, 0, -1, -1, -1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1, -1, -1] - tomask: [1, 0, 1, 1, 1] - tononzero: [] - - error: false - inputs: - fromindex: [-1, -1, 0, 1, 2] - fromindexlength: 5 - nonzero: [0, 1, 2] - nonzerolength: 3 - outputs: - toindex: [-1, -1, 0, 1, 2] - tomask: [1, 1, 0, 0, 0] - tononzero: [2, 3, 4] - - error: false - inputs: - fromindex: [-1, -1, 0, 1, 2] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [-1, -1, 0, 1] - tomask: [1, 1, 0, 0, 0] - tononzero: [2, 3] - - error: false - inputs: - fromindex: [-1, -1, 0, 1, 2] - fromindexlength: 5 - nonzero: [0, 2] - nonzerolength: 2 - outputs: - toindex: [-1, -1, 0, 1] - tomask: [1, 1, 0, 0, 0] - tononzero: [2, 4] - - error: false - inputs: - fromindex: [-1, -1, 0, 1, 2] - fromindexlength: 5 - nonzero: [1, 2] - nonzerolength: 2 - outputs: - toindex: [-1, -1, 0, 1] - tomask: [1, 1, 0, 0, 0] - tononzero: [3, 4] - - error: false - inputs: - fromindex: [-1, -1, 0, 1, 2] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [-1, -1, 0] - tomask: [1, 1, 0, 0, 0] - tononzero: [2] - - error: false - inputs: - fromindex: [-1, -1, 0, 1, 2] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [-1, -1, 0] - tomask: [1, 1, 0, 0, 0] - tononzero: [3] - - error: false - inputs: - fromindex: [-1, -1, 0, 1, 2] - fromindexlength: 5 - nonzero: [2] - nonzerolength: 1 - outputs: - toindex: [-1, -1, 0] - tomask: [1, 1, 0, 0, 0] - tononzero: [4] - - error: false - inputs: - fromindex: [-1, -1, 0, 1, 2] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1] - tomask: [1, 1, 0, 0, 0] - tononzero: [] - - error: false - inputs: - fromindex: [-1, -1, 0, 1, -1] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [-1, -1, 0, 1, -1] - tomask: [1, 1, 0, 0, 1] - tononzero: [2, 3] - - error: false - inputs: - fromindex: [-1, -1, 0, 1, -1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [-1, -1, 0, -1] - tomask: [1, 1, 0, 0, 1] - tononzero: [2] - - error: false - inputs: - fromindex: [-1, -1, 0, 1, -1] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [-1, -1, 0, -1] - tomask: [1, 1, 0, 0, 1] - tononzero: [3] - - error: false - inputs: - fromindex: [-1, -1, 0, 1, -1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1, -1] - tomask: [1, 1, 0, 0, 1] - tononzero: [] - - error: false - inputs: - fromindex: [-1, -1, 0, -1, 1] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [-1, -1, 0, -1, 1] - tomask: [1, 1, 0, 1, 0] - tononzero: [2, 4] - - error: false - inputs: - fromindex: [-1, -1, 0, -1, 1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [-1, -1, 0, -1] - tomask: [1, 1, 0, 1, 0] - tononzero: [2] - - error: false - inputs: - fromindex: [-1, -1, 0, -1, 1] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [-1, -1, -1, 0] - tomask: [1, 1, 0, 1, 0] - tononzero: [4] - - error: false - inputs: - fromindex: [-1, -1, 0, -1, 1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1, -1] - tomask: [1, 1, 0, 1, 0] - tononzero: [] - - error: false - inputs: - fromindex: [-1, -1, 0, -1, -1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [-1, -1, 0, -1, -1] - tomask: [1, 1, 0, 1, 1] - tononzero: [2] - - error: false - inputs: - fromindex: [-1, -1, 0, -1, -1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1, -1, -1] - tomask: [1, 1, 0, 1, 1] - tononzero: [] - - error: false - inputs: - fromindex: [-1, -1, -1, 0, 1] - fromindexlength: 5 - nonzero: [0, 1] - nonzerolength: 2 - outputs: - toindex: [-1, -1, -1, 0, 1] - tomask: [1, 1, 1, 0, 0] - tononzero: [3, 4] - - error: false - inputs: - fromindex: [-1, -1, -1, 0, 1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [-1, -1, -1, 0] - tomask: [1, 1, 1, 0, 0] - tononzero: [3] - - error: false - inputs: - fromindex: [-1, -1, -1, 0, 1] - fromindexlength: 5 - nonzero: [1] - nonzerolength: 1 - outputs: - toindex: [-1, -1, -1, 0] - tomask: [1, 1, 1, 0, 0] - tononzero: [4] - - error: false - inputs: - fromindex: [-1, -1, -1, 0, 1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1, -1] - tomask: [1, 1, 1, 0, 0] - tononzero: [] - - error: false - inputs: - fromindex: [-1, -1, -1, 0, -1] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [-1, -1, -1, 0, -1] - tomask: [1, 1, 1, 0, 1] - tononzero: [3] - - error: false - inputs: - fromindex: [-1, -1, -1, 0, -1] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1, -1, -1] - tomask: [1, 1, 1, 0, 1] - tononzero: [] - - error: false - inputs: - fromindex: [-1, -1, -1, -1, 0] - fromindexlength: 5 - nonzero: [0] - nonzerolength: 1 - outputs: - toindex: [-1, -1, -1, -1, 0] - tomask: [1, 1, 1, 1, 0] - tononzero: [4] - - error: false - inputs: - fromindex: [-1, -1, -1, -1, 0] - fromindexlength: 5 - nonzero: [] - nonzerolength: 0 - outputs: - toindex: [-1, -1, -1, -1] - tomask: [1, 1, 1, 1, 0] - tononzero: [] -- name: awkward_IndexedArray_index_of_nulls - tests: - - error: false - inputs: - fromindex: [-1, -1, 0, 1, 2, -1, -1, -1, 3, -1, 4, 5, -1, -1, 6, 7, 8] - lenindex: 17 - parents: [0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4] - starts: [0, 5, 8, 11, 14] - outputs: - toindex: [0, 1, 0, 1, 2, 1, 1, 2] - - error: false - inputs: - fromindex: [-1, -1, 3, 5, 6, -1, -1, -1, -1, 7, 0, -1, 4, -1, 8, 1, 2] - lenindex: 17 - parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 4] - starts: [0, 5, 10, 15, 16] - outputs: - toindex: [0, 1, 0, 1, 2, 3, 1, 3] - - error: false - inputs: - fromindex: [-1, -1, 0, 1, 2] - lenindex: 5 - parents: [0, 0, 0, 0, 0] - starts: [0] - outputs: - toindex: [0, 1] - - error: false - inputs: - fromindex: [0, -1, 3, 5, 6, 1, -1, 4, -1, 7, 2, -1, -1, -1, 8, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1] - lenindex: 25 - parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, - 4, 4, 4] - starts: [0, 5, 10, 15, 20] - outputs: - toindex: [1, 1, 3, 1, 2, 3, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4] - - error: false - inputs: - fromindex: [0, -1, 1, 2, -1, 3, 4, 5] - lenindex: 8 - parents: [0, 0, 0, 0, 0, 0, 0, 0] - starts: [0] - outputs: - toindex: [1, 4] - - error: false - inputs: - fromindex: [0, 1, -1, 2] - lenindex: 4 - parents: [0, 0, 0, 0] - starts: [0] - outputs: - toindex: [2] - - error: false - inputs: - fromindex: [0, 1, -1, -1, 4] - lenindex: 5 - parents: [0, 0, 0, 0, 0] - starts: [0] - outputs: - toindex: [2, 3] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3, -1] - lenindex: 6 - parents: [0, 0, 0, 0, 0, 0] - starts: [0] - outputs: - toindex: [2, 5] - - error: false - inputs: - fromindex: [0, 1, -1, 2, 3, -1, 4, 5, -1, 6, 7, -1] - lenindex: 12 - parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] - starts: [0, 6] - outputs: - toindex: [2, 5, 2, 5] - - error: false - inputs: - fromindex: [0, 1, 2, -1, -1, -1, -1, 7, 8] - lenindex: 9 - parents: [0, 0, 0, 0, 1, 1, 1, 1, 1] - starts: [0, 4] - outputs: - toindex: [3, 0, 1, 2] -- name: awkward_IndexedArray_reduce_next_fix_offsets_64 - tests: - - error: false - inputs: - outindexlength: 6 - starts: [0, 1, 2, 5] - startslength: 4 - outputs: - outoffsets: [0, 1, 2, 5, 6] - - error: false - inputs: - outindexlength: 2 - starts: [0] - startslength: 1 - outputs: - outoffsets: [0, 2] - - error: false - inputs: - outindexlength: 9 - starts: [0, 3, 3, 5, 6] - startslength: 5 - outputs: - outoffsets: [0, 3, 3, 5, 6, 9] - - error: false - inputs: - outindexlength: 6 - starts: [0, 3] - startslength: 2 - outputs: - outoffsets: [0, 3, 6] - - error: false - inputs: - outindexlength: 4 - starts: [0] - startslength: 1 - outputs: - outoffsets: [0, 4] - - error: false - inputs: - outindexlength: 5 - starts: [0] - startslength: 1 - outputs: - outoffsets: [0, 5] - - error: false - inputs: - outindexlength: 8 - starts: [0] - startslength: 1 - outputs: - outoffsets: [0, 8] -- name: awkward_IndexedArray_reduce_next_nonlocal_nextshifts_64 - tests: - - error: false - inputs: - index: [0, 1, 2, -1, 3, -1, 4] - length: 7 - outputs: - nextshifts: [0, 0, 0, 1, 2] - - error: false - inputs: - index: [0, 1, 2, -1, -1, -1, -1, 7, 8] - length: 9 - outputs: - nextshifts: [0, 0, 0, 4, 4] - - error: false - inputs: - index: [0, 1, -1, 2, 3, -1] - length: 6 - outputs: - nextshifts: [0, 0, 1, 1] - - error: false - inputs: - index: [0, 1, -1, 2, 3, 4] - length: 6 - outputs: - nextshifts: [0, 0, 1, 1, 1] - - error: false - inputs: - index: [0, 1, -1, 2, 3, -1, 4] - length: 7 - outputs: - nextshifts: [0, 0, 1, 1, 2] - - error: false - inputs: - index: [0, 1, -1, 2, 3, -1, 4, 5, -1, 6, 7, -1] - length: 12 - outputs: - nextshifts: [0, 0, 1, 1, 2, 2, 3, 3] - - error: false - inputs: - index: [0, 1, -1, -1, 4] - length: 5 - outputs: - nextshifts: [0, 0, 2] - - error: false - inputs: - index: [4, 2, -1, -1, 1, 0, 1] - length: 7 - outputs: - nextshifts: [0, 0, 2, 2, 2] - - error: false - inputs: - index: [-1, -1, 0, 1, 2] - length: 5 - outputs: - nextshifts: [2, 2, 2] - - error: false - inputs: - index: [-1, -1, 0, 1, 2, -1, -1, -1, 3, -1, 4, 5, -1, -1, 6, 7, 8] - length: 17 - outputs: - nextshifts: [2, 2, 2, 5, 6, 6, 8, 8, 8] -- name: awkward_IndexedArray_reduce_next_nonlocal_nextshifts_fromshifts_64 - tests: - - error: false - inputs: - index: [0, 3, 4, 1, -1, 5, 2] - length: 7 - shifts: [0, 0, 1, 0, 0, 1, 0] - outputs: - nextshifts: [0, 0, 1, 0, 2, 1] - - error: false - inputs: - index: [0, 3, 4, 1, -1, 5, 2] - length: 7 - shifts: [0, 1, 1, 0, 1, 1, 0] - outputs: - nextshifts: [0, 1, 1, 0, 2, 1] - - error: false - inputs: - index: [0, -1, 3, 5, 6, 1, -1, 4, -1, 7, 2, -1, -1, -1, 8, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1] - length: 25 - shifts: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0] - outputs: - nextshifts: [0, 1, 1, 1, 1, 2, 3, 3, 6] - - error: false - inputs: - index: [0, -1, 4, 1, 3, 5, 2] - length: 7 - shifts: [0, 1, 1, 0, 1, 1, 0] - outputs: - nextshifts: [0, 2, 1, 2, 2, 1] - - error: false - inputs: - index: [-1, -1, 3, 5, 6, -1, -1, -1, -1, 7, 0, -1, 4, -1, 8, 1, 2] - length: 17 - shifts: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - outputs: - nextshifts: [2, 2, 2, 6, 6, 7, 8, 8, 8] -- name: awkward_ListArray_getitem_next_array_advanced - tests: - - error: false - inputs: - fromadvanced: [0, 1] - fromarray: [0, 0] - fromstarts: [0, 0] - fromstops: [1, 1] - lenarray: 2 - lencontent: 5 - lenstarts: 2 - outputs: - toadvanced: [0, 1] - tocarry: [0, 0] - - error: false - inputs: - fromadvanced: [0] - fromarray: [0] - fromstarts: [0] - fromstops: [2] - lenarray: 1 - lencontent: 4 - lenstarts: 1 - outputs: - toadvanced: [0] - tocarry: [0] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [0, 1, -1, 1] - fromstarts: [0, 0, 0, 0] - fromstops: [3, 3, 3, 3] - lenarray: 4 - lencontent: 6 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [0, 1, 2, 1] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [0, 0, 0, 0] - fromstarts: [0, 3, 3, 3] - fromstops: [3, 6, 6, 6] - lenarray: 4 - lencontent: 6 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [0, 3, 3, 3] - - error: false - inputs: - fromadvanced: [0, 1] - fromarray: [1, 0] - fromstarts: [0, 0] - fromstops: [3, 3] - lenarray: 2 - lencontent: 5 - lenstarts: 2 - outputs: - toadvanced: [0, 1] - tocarry: [1, 0] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [1, 0, 0, 1] - fromstarts: [0, 0, 0, 0] - fromstops: [3, 3, 3, 3] - lenarray: 4 - lencontent: 6 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [1, 0, 0, 1] - - error: false - inputs: - fromadvanced: [0, 1] - fromarray: [0, 0] - fromstarts: [1, 0] - fromstops: [3, 2] - lenarray: 2 - lencontent: 3 - lenstarts: 2 - outputs: - toadvanced: [0, 1] - tocarry: [1, 0] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [0, 1, -1, 1] - fromstarts: [10, 10, 10, 10] - fromstops: [15, 15, 15, 15] - lenarray: 4 - lencontent: 30 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [10, 11, 14, 11] - - error: false - inputs: - fromadvanced: [0] - fromarray: [0] - fromstarts: [1] - fromstops: [3] - lenarray: 1 - lencontent: 3 - lenstarts: 1 - outputs: - toadvanced: [0] - tocarry: [1] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [1, 0, 0, 1] - fromstarts: [10, 10, 10, 10] - fromstops: [15, 15, 15, 15] - lenarray: 4 - lencontent: 30 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [11, 10, 10, 11] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [1, -2, 0, -1] - fromstarts: [10, 10, 10, 10] - fromstops: [15, 15, 15, 15] - lenarray: 4 - lencontent: 30 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [11, 13, 10, 14] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [1, -2, 0, -1] - fromstarts: [10, 0, 0, 5] - fromstops: [15, 5, 5, 10] - lenarray: 4 - lencontent: 30 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [11, 3, 0, 9] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [1, 0, 0, 1] - fromstarts: [0, 15, 15, 15] - fromstops: [5, 20, 20, 20] - lenarray: 4 - lencontent: 30 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [1, 15, 15, 16] - - error: false - inputs: - fromadvanced: [0, 1] - fromarray: [1, 2] - fromstarts: [0, 0] - fromstops: [3, 3] - lenarray: 2 - lencontent: 5 - lenstarts: 2 - outputs: - toadvanced: [0, 1] - tocarry: [1, 2] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [2, 0, 0, 1] - fromstarts: [10, 10, 10, 10] - fromstops: [15, 15, 15, 15] - lenarray: 4 - lencontent: 30 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [12, 10, 10, 11] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [2, 2, 2, 2] - fromstarts: [10, 0, 0, 5] - fromstops: [15, 5, 5, 10] - lenarray: 4 - lencontent: 30 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [12, 2, 2, 7] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [-2, -2, -2, -2] - fromstarts: [10, 10, 10, 10] - fromstops: [15, 15, 15, 15] - lenarray: 4 - lencontent: 30 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [13, 13, 13, 13] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [-2, -2, -2, -2] - fromstarts: [10, 0, 0, 5] - fromstops: [15, 5, 5, 10] - lenarray: 4 - lencontent: 30 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [13, 3, 3, 8] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [1, 0, 0, 1] - fromstarts: [0, 3, 3, 3] - fromstops: [3, 6, 6, 6] - lenarray: 4 - lencontent: 6 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [1, 3, 3, 4] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [1, 0, 0, 1] - fromstarts: [0, 5, 10, 5] - fromstops: [5, 10, 15, 10] - lenarray: 4 - lencontent: 30 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [1, 5, 10, 6] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [0, 1, -1, 1] - fromstarts: [15, 0, 0, 15] - fromstops: [20, 5, 5, 20] - lenarray: 4 - lencontent: 30 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [15, 1, 4, 16] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [0, 1, -1, 1] - fromstarts: [15, 15, 15, 15] - fromstops: [20, 20, 20, 20] - lenarray: 4 - lencontent: 30 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [15, 16, 19, 16] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [1, 0, 0, 1] - fromstarts: [15, 15, 15, 15] - fromstops: [20, 20, 20, 20] - lenarray: 4 - lencontent: 30 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [16, 15, 15, 16] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [-1, -1, -1, -1] - fromstarts: [15, 0, 0, 15] - fromstops: [20, 5, 5, 20] - lenarray: 4 - lencontent: 30 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [19, 4, 4, 19] - - error: false - inputs: - fromadvanced: [0, 1] - fromarray: [-1, 0] - fromstarts: [0, 0] - fromstops: [3, 3] - lenarray: 2 - lencontent: 5 - lenstarts: 2 - outputs: - toadvanced: [0, 1] - tocarry: [2, 0] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [-1, -1, -1, -1] - fromstarts: [0, 0, 0, 0] - fromstops: [3, 3, 3, 3] - lenarray: 4 - lencontent: 6 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [2, 2, 2, 2] - - error: false - inputs: - fromadvanced: [0, 1] - fromarray: [1, 2] - fromstarts: [1, 1] - fromstops: [4, 4] - lenarray: 2 - lencontent: 4 - lenstarts: 2 - outputs: - toadvanced: [0, 1] - tocarry: [2, 3] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [-1, -1, -1, -1] - fromstarts: [0, 3, 3, 3] - fromstops: [3, 6, 6, 6] - lenarray: 4 - lencontent: 6 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [2, 5, 5, 5] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [0, 0, 0, 0] - fromstarts: [3, 0, 0, 3] - fromstops: [6, 3, 3, 6] - lenarray: 4 - lencontent: 6 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [3, 0, 0, 3] - - error: false - inputs: - fromadvanced: [0] - fromarray: [1] - fromstarts: [2] - fromstops: [5] - lenarray: 1 - lencontent: 5 - lenstarts: 1 - outputs: - toadvanced: [0] - tocarry: [3] - - error: false - inputs: - fromadvanced: [0, 1] - fromarray: [-1, 0] - fromstarts: [1, 1] - fromstops: [4, 4] - lenarray: 2 - lencontent: 4 - lenstarts: 2 - outputs: - toadvanced: [0, 1] - tocarry: [3, 1] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [0, 1, -1, 1] - fromstarts: [3, 0, 0, 3] - fromstops: [6, 3, 3, 6] - lenarray: 4 - lencontent: 6 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [3, 1, 2, 4] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [0, 0, 0, 0] - fromstarts: [3, 3, 3, 3] - fromstops: [6, 6, 6, 6] - lenarray: 4 - lencontent: 6 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [3, 3, 3, 3] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [0, 1, -1, 1] - fromstarts: [3, 3, 3, 3] - fromstops: [6, 6, 6, 6] - lenarray: 4 - lencontent: 6 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [3, 4, 5, 4] - - error: false - inputs: - fromadvanced: [0, 1] - fromarray: [1, 1] - fromstarts: [3, 0] - fromstops: [5, 3] - lenarray: 2 - lencontent: 5 - lenstarts: 2 - outputs: - toadvanced: [0, 1] - tocarry: [4, 1] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [1, 1, 0, 0] - fromstarts: [3, 0, 0, 6] - fromstops: [5, 3, 3, 9] - lenarray: 4 - lencontent: 9 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [4, 1, 0, 6] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [-1, -1, -1, -1] - fromstarts: [0, 15, 15, 15] - fromstops: [5, 20, 20, 20] - lenarray: 4 - lencontent: 30 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [4, 19, 19, 19] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [1, -1, 0, 0] - fromstarts: [3, 0, 0, 3] - fromstops: [5, 3, 3, 5] - lenarray: 4 - lencontent: 5 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [4, 2, 0, 3] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [1, 0, 0, 1] - fromstarts: [3, 3, 3, 3] - fromstops: [6, 6, 6, 6] - lenarray: 4 - lencontent: 6 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [4, 3, 3, 4] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [-1, -1, -1, -1] - fromstarts: [0, 5, 10, 5] - fromstops: [5, 10, 15, 10] - lenarray: 4 - lencontent: 30 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [4, 9, 14, 9] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3, 4, 5] - fromarray: [2, 0, 1, 1, 2, 0] - fromstarts: [3, 0, 3, 3, 3, 0] - fromstops: [6, 3, 6, 6, 6, 3] - lenarray: 6 - lencontent: 6 - lenstarts: 6 - outputs: - toadvanced: [0, 1, 2, 3, 4, 5] - tocarry: [5, 0, 4, 4, 5, 0] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [0, 1, -1, 1] - fromstarts: [5, 0, 0, 5] - fromstops: [10, 5, 5, 10] - lenarray: 4 - lencontent: 30 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [5, 1, 4, 6] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [-1, -1, -1, -1] - fromstarts: [3, 0, 0, 3] - fromstops: [6, 3, 3, 6] - lenarray: 4 - lencontent: 6 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [5, 2, 2, 5] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [1, 1, 0, 0] - fromstarts: [6, 0, 0, 6] - fromstops: [9, 3, 3, 9] - lenarray: 4 - lencontent: 9 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [7, 1, 0, 6] - - error: false - inputs: - fromadvanced: [0, 1, 2, 3] - fromarray: [-1, -1, -1, -1] - fromstarts: [5, 0, 0, 5] - fromstops: [10, 5, 5, 10] - lenarray: 4 - lencontent: 30 - lenstarts: 4 - outputs: - toadvanced: [0, 1, 2, 3] - tocarry: [9, 4, 4, 9] -- name: awkward_ListArray_getitem_next_at - tests: - - error: false - inputs: - at: 0 - fromstarts: [] - fromstops: [] - lenstarts: 0 - outputs: - tocarry: [] - - error: false - inputs: - at: 0 - fromstarts: [0] - fromstops: [1] - lenstarts: 1 - outputs: - tocarry: [0] - - error: false - inputs: - at: 0 - fromstarts: [0] - fromstops: [2] - lenstarts: 1 - outputs: - tocarry: [0] - - error: false - inputs: - at: 0 - fromstarts: [0] - fromstops: [3] - lenstarts: 1 - outputs: - tocarry: [0] - - error: false - inputs: - at: -5 - fromstarts: [0] - fromstops: [5] - lenstarts: 1 - outputs: - tocarry: [0] - - error: false - inputs: - at: 0 - fromstarts: [0, 1] - fromstops: [1, 2] - lenstarts: 2 - outputs: - tocarry: [0, 1] - - error: false - inputs: - at: 0 - fromstarts: [0, 1, 2, 3] - fromstops: [1, 2, 3, 4] - lenstarts: 4 - outputs: - tocarry: [0, 1, 2, 3] - - error: false - inputs: - at: 0 - fromstarts: [0, 1, 2, 3, 4] - fromstops: [1, 2, 3, 4, 5] - lenstarts: 5 - outputs: - tocarry: [0, 1, 2, 3, 4] - - error: false - inputs: - at: 0 - fromstarts: [0, 2, 3] - fromstops: [2, 3, 5] - lenstarts: 3 - outputs: - tocarry: [0, 2, 3] - - error: false - inputs: - at: 0 - fromstarts: [0, 3, 5, 6] - fromstops: [3, 5, 6, 10] - lenstarts: 4 - outputs: - tocarry: [0, 3, 5, 6] - - error: false - inputs: - at: 0 - fromstarts: [10] - fromstops: [15] - lenstarts: 1 - outputs: - tocarry: [10] - - error: false - inputs: - at: 1 - fromstarts: [0] - fromstops: [2] - lenstarts: 1 - outputs: - tocarry: [1] - - error: false - inputs: - at: 1 - fromstarts: [0] - fromstops: [3] - lenstarts: 1 - outputs: - tocarry: [1] - - error: false - inputs: - at: -2 - fromstarts: [0] - fromstops: [3] - lenstarts: 1 - outputs: - tocarry: [1] - - error: false - inputs: - at: 1 - fromstarts: [0] - fromstops: [5] - lenstarts: 1 - outputs: - tocarry: [1] - - error: false - inputs: - at: 1 - fromstarts: [10] - fromstops: [15] - lenstarts: 1 - outputs: - tocarry: [11] - - error: false - inputs: - at: 0 - fromstarts: [1] - fromstops: [2] - lenstarts: 1 - outputs: - tocarry: [1] - - error: false - inputs: - at: 0 - fromstarts: [1] - fromstops: [3] - lenstarts: 1 - outputs: - tocarry: [1] - - error: false - inputs: - at: -2 - fromstarts: [10] - fromstops: [15] - lenstarts: 1 - outputs: - tocarry: [13] - - error: false - inputs: - at: 1 - fromstarts: [0, 3] - fromstops: [3, 5] - lenstarts: 2 - outputs: - tocarry: [1, 4] - - error: false - inputs: - at: 1 - fromstarts: [0, 5] - fromstops: [5, 10] - lenstarts: 2 - outputs: - tocarry: [1, 6] - - error: false - inputs: - at: 1 - fromstarts: [15] - fromstops: [20] - lenstarts: 1 - outputs: - tocarry: [16] - - error: false - inputs: - at: -2 - fromstarts: [15] - fromstops: [20] - lenstarts: 1 - outputs: - tocarry: [18] - - error: false - inputs: - at: -1 - fromstarts: [15] - fromstops: [20] - lenstarts: 1 - outputs: - tocarry: [19] - - error: false - inputs: - at: -1 - fromstarts: [0] - fromstops: [3] - lenstarts: 1 - outputs: - tocarry: [2] - - error: false - inputs: - at: 1 - fromstarts: [1] - fromstops: [3] - lenstarts: 1 - outputs: - tocarry: [2] - - error: false - inputs: - at: 1 - fromstarts: [1] - fromstops: [4] - lenstarts: 1 - outputs: - tocarry: [2] - - error: false - inputs: - at: 0 - fromstarts: [2] - fromstops: [3] - lenstarts: 1 - outputs: - tocarry: [2] - - error: false - inputs: - at: 1 - fromstarts: [2] - fromstops: [5] - lenstarts: 1 - outputs: - tocarry: [3] - - error: false - inputs: - at: 0 - fromstarts: [3] - fromstops: [5] - lenstarts: 1 - outputs: - tocarry: [3] - - error: false - inputs: - at: 0 - fromstarts: [3] - fromstops: [6] - lenstarts: 1 - outputs: - tocarry: [3] - - error: false - inputs: - at: 0 - fromstarts: [3, 5, 6] - fromstops: [5, 6, 9] - lenstarts: 3 - outputs: - tocarry: [3, 5, 6] - - error: false - inputs: - at: -1 - fromstarts: [0] - fromstops: [5] - lenstarts: 1 - outputs: - tocarry: [4] - - error: false - inputs: - at: 4 - fromstarts: [0] - fromstops: [5] - lenstarts: 1 - outputs: - tocarry: [4] - - error: false - inputs: - at: 1 - fromstarts: [3] - fromstops: [5] - lenstarts: 1 - outputs: - tocarry: [4] - - error: false - inputs: - at: 1 - fromstarts: [3] - fromstops: [6] - lenstarts: 1 - outputs: - tocarry: [4] - - error: false - inputs: - at: -2 - fromstarts: [3] - fromstops: [6] - lenstarts: 1 - outputs: - tocarry: [4] - - error: false - inputs: - at: -1 - fromstarts: [3, 5, 6] - fromstops: [5, 6, 9] - lenstarts: 3 - outputs: - tocarry: [4, 5, 8] - - error: false - inputs: - at: -1 - fromstarts: [0, 5] - fromstops: [5, 10] - lenstarts: 2 - outputs: - tocarry: [4, 9] - - error: false - inputs: - at: 0 - fromstarts: [5, 10] - fromstops: [10, 15] - lenstarts: 2 - outputs: - tocarry: [5, 10] - - error: false - inputs: - at: -1 - fromstarts: [3] - fromstops: [6] - lenstarts: 1 - outputs: - tocarry: [5] - - error: false - inputs: - at: 0 - fromstarts: [5] - fromstops: [10] - lenstarts: 1 - outputs: - tocarry: [5] - - error: false - inputs: - at: -5 - fromstarts: [5] - fromstops: [10] - lenstarts: 1 - outputs: - tocarry: [5] - - error: false - inputs: - at: 1 - fromstarts: [5, 10] - fromstops: [10, 15] - lenstarts: 2 - outputs: - tocarry: [6, 11] - - error: false - inputs: - at: 1 - fromstarts: [5] - fromstops: [10] - lenstarts: 1 - outputs: - tocarry: [6] - - error: false - inputs: - at: 1 - fromstarts: [6] - fromstops: [10] - lenstarts: 1 - outputs: - tocarry: [7] - - error: false - inputs: - at: 1 - fromstarts: [6] - fromstops: [9] - lenstarts: 1 - outputs: - tocarry: [7] - - error: false - inputs: - at: -2 - fromstarts: [5] - fromstops: [10] - lenstarts: 1 - outputs: - tocarry: [8] - - error: false - inputs: - at: -1 - fromstarts: [5, 10] - fromstops: [10, 15] - lenstarts: 2 - outputs: - tocarry: [9, 14] - - error: false - inputs: - at: -1 - fromstarts: [5] - fromstops: [10] - lenstarts: 1 - outputs: - tocarry: [9] - - error: false - inputs: - at: 4 - fromstarts: [5] - fromstops: [10] - lenstarts: 1 - outputs: - tocarry: [9] -- name: awkward_ListArray_getitem_next_range_counts - tests: - - error: false - inputs: - fromoffsets: [0, 2, 2, 4, 4, 5, 6, 7, 9, 9] - lenstarts: 9 - outputs: - total: [9] - - error: false - inputs: - fromoffsets: [0, 2, 4, 5, 6, 7, 9] - lenstarts: 6 - outputs: - total: [9] -- name: awkward_ListArray_localindex - tests: - - error: false - inputs: - length: 1 - offsets: [0, 1] - outputs: - toindex: [0] - - error: false - inputs: - length: 3 - offsets: [0, 2, 3, 5] - outputs: - toindex: [0, 1, 0, 0, 1] - - error: false - inputs: - length: 4 - offsets: [0, 2, 3, 3, 6] - outputs: - toindex: [0, 1, 0, 0, 1, 2] - - error: false - inputs: - length: 2 - offsets: [0, 2, 3] - outputs: - toindex: [0, 1, 0] - - error: false - inputs: - length: 1 - offsets: [0, 2] - outputs: - toindex: [0, 1] - - error: false - inputs: - length: 4 - offsets: [0, 3, 3, 4, 5] - outputs: - toindex: [0, 1, 2, 0, 0] - - error: false - inputs: - length: 7 - offsets: [0, 3, 3, 5, 6, 10, 10, 13] - outputs: - toindex: [0, 1, 2, 0, 1, 0, 0, 1, 2, 3, 0, 1, 2] - - error: false - inputs: - length: 5 - offsets: [0, 3, 3, 5, 6, 10] - outputs: - toindex: [0, 1, 2, 0, 1, 0, 0, 1, 2, 3] - - error: false - inputs: - length: 6 - offsets: [0, 3, 3, 5, 6, 6, 10] - outputs: - toindex: [0, 1, 2, 0, 1, 0, 0, 1, 2, 3] - - error: false - inputs: - length: 3 - offsets: [0, 3, 3, 5] - outputs: - toindex: [0, 1, 2, 0, 1] - - error: false - inputs: - length: 5 - offsets: [0, 4, 4, 7, 8, 13] - outputs: - toindex: [0, 1, 2, 3, 0, 1, 2, 0, 0, 1, 2, 3, 4] -- name: awkward_ListArray_num - tests: - - error: false - inputs: - fromstarts: [0, 0] - fromstops: [0, 0] - length: 2 - outputs: - tonum: [0, 0] - - error: false - inputs: - fromstarts: [0] - fromstops: [0] - length: 1 - outputs: - tonum: [0] - - error: false - inputs: - fromstarts: [0, 0, 1] - fromstops: [0, 1, 1] - length: 3 - outputs: - tonum: [0, 1, 0] - - error: false - inputs: - fromstarts: [0, 0, 1, 1, 2, 4, 4, 5, 7] - fromstops: [0, 1, 1, 2, 4, 4, 5, 7, 10] - length: 9 - outputs: - tonum: [0, 1, 0, 1, 2, 0, 1, 2, 3] - - error: false - inputs: - fromstarts: [0, 0, 1] - fromstops: [0, 1, 2] - length: 3 - outputs: - tonum: [0, 1, 1] - - error: false - inputs: - fromstarts: [0, 0, 1, 2, 2, 3, 3, 3, 4, 5] - fromstops: [0, 1, 2, 2, 3, 3, 3, 4, 5, 5] - length: 10 - outputs: - tonum: [0, 1, 1, 0, 1, 0, 0, 1, 1, 0] - - error: false - inputs: - fromstarts: [0, 0, 1, 3] - fromstops: [0, 1, 3, 6] - length: 4 - outputs: - tonum: [0, 1, 2, 3] - - error: false - inputs: - fromstarts: [0, 1, 2, 2, 3, 3, 3, 4] - fromstops: [1, 2, 2, 3, 3, 3, 4, 5] - length: 8 - outputs: - tonum: [1, 1, 0, 1, 0, 0, 1, 1] - - error: false - inputs: - fromstarts: [0, 1, 2, 3] - fromstops: [1, 2, 3, 4] - length: 4 - outputs: - tonum: [1, 1, 1, 1] - - error: false - inputs: - fromstarts: [0, 0, 0, 0, 0] - fromstops: [1, 1, 1, 1, 1] - length: 5 - outputs: - tonum: [1, 1, 1, 1, 1] - - error: false - inputs: - fromstarts: [0, 1, 3] - fromstops: [1, 3, 6] - length: 3 - outputs: - tonum: [1, 2, 3] - - error: false - inputs: - fromstarts: [0, 2, 3, 3] - fromstops: [2, 3, 3, 5] - length: 4 - outputs: - tonum: [2, 1, 0, 2] - - error: false - inputs: - fromstarts: [3, 3, 3, 0] - fromstops: [5, 5, 3, 3] - length: 4 - outputs: - tonum: [2, 2, 0, 3] - - error: false - inputs: - fromstarts: [0, 0, 0, 0, 0] - fromstops: [2, 2, 2, 2, 2] - length: 5 - outputs: - tonum: [2, 2, 2, 2, 2] - - error: false - inputs: - fromstarts: [0, 2, 5] - fromstops: [2, 5, 9] - length: 3 - outputs: - tonum: [2, 3, 4] - - error: false - inputs: - fromstarts: [0, 3, 3, 10, 10] - fromstops: [3, 3, 5, 10, 13] - length: 5 - outputs: - tonum: [3, 0, 2, 0, 3] - - error: false - inputs: - fromstarts: [0, 3, 3] - fromstops: [3, 3, 5] - length: 3 - outputs: - tonum: [3, 0, 2] - - error: false - inputs: - fromstarts: [0, 3, 5] - fromstops: [3, 3, 7] - length: 3 - outputs: - tonum: [3, 0, 2] - - error: false - inputs: - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 10] - length: 5 - outputs: - tonum: [3, 0, 2, 1, 4] - - error: false - inputs: - fromstarts: [0, 3, 5, 6] - fromstops: [3, 5, 6, 6] - length: 4 - outputs: - tonum: [3, 2, 1, 0] - - error: false - inputs: - fromstarts: [0, 3, 6] - fromstops: [3, 6, 9] - length: 3 - outputs: - tonum: [3, 3, 3] - - error: false - inputs: - fromstarts: [0, 0, 0, 0, 0] - fromstops: [3, 3, 3, 3, 3] - length: 5 - outputs: - tonum: [3, 3, 3, 3, 3] - - error: false - inputs: - fromstarts: [0, 0, 0, 0, 0] - fromstops: [4, 4, 4, 4, 4] - length: 5 - outputs: - tonum: [4, 4, 4, 4, 4] - - error: false - inputs: - fromstarts: [0, 5, 10] - fromstops: [5, 10, 15] - length: 3 - outputs: - tonum: [5, 5, 5] -- name: awkward_ListArray_rpad_axis1 - tests: - - error: false - inputs: - fromstarts: [0, 3, 4, 5, 8] - fromstops: [3, 3, 6, 8, 9] - length: 5 - target: 4 - outputs: - toindex: [0, 1, 2, -1, -1, -1, -1, -1, 4, 5, -1, -1, 5, 6, 7, -1, 8, -1, -1, - -1] - tostarts: [0, 4, 8, 12, 16] - tostops: [4, 8, 12, 16, 20] - - error: false - inputs: - fromstarts: [0, 3, 4, 5, 8] - fromstops: [3, 3, 6, 8, 9] - length: 5 - target: 3 - outputs: - toindex: [0, 1, 2, -1, -1, -1, 4, 5, -1, 5, 6, 7, 8, -1, -1] - tostarts: [0, 3, 6, 9, 12] - tostops: [3, 6, 9, 12, 15] - - error: false - inputs: - fromstarts: [0, 3, 5] - fromstops: [3, 3, 7] - length: 3 - target: 3 - outputs: - toindex: [0, 1, 2, -1, -1, -1, 5, 6, -1] - tostarts: [0, 3, 6] - tostops: [3, 6, 9] - - error: false - inputs: - fromstarts: [0, 3, 4, 5, 8] - fromstops: [3, 3, 6, 8, 9] - length: 5 - target: 2 - outputs: - toindex: [0, 1, 2, -1, -1, 4, 5, 5, 6, 7, 8, -1] - tostarts: [0, 3, 5, 7, 10] - tostops: [3, 5, 7, 10, 12] - - error: false - inputs: - fromstarts: [0, 3, 4, 5, 8] - fromstops: [3, 3, 6, 8, 9] - length: 5 - target: 1 - outputs: - toindex: [0, 1, 2, -1, 4, 5, 5, 6, 7, 8] - tostarts: [0, 3, 4, 6, 9] - tostops: [3, 4, 6, 9, 10] - - error: false - inputs: - fromstarts: [6, 5, 3, 0] - fromstops: [10, 6, 5, 3] - length: 4 - target: 4 - outputs: - toindex: [6, 7, 8, 9, 5, -1, -1, -1, 3, 4, -1, -1, 0, 1, 2, -1] - tostarts: [0, 4, 8, 12] - tostops: [4, 8, 12, 16] - - error: false - inputs: - fromstarts: [6, 5, 3, 3, 0] - fromstops: [10, 6, 5, 3, 3] - length: 5 - target: 4 - outputs: - toindex: [6, 7, 8, 9, 5, -1, -1, -1, 3, 4, -1, -1, -1, -1, -1, -1, 0, 1, 2, - -1] - tostarts: [0, 4, 8, 12, 16] - tostops: [4, 8, 12, 16, 20] - - error: false - inputs: - fromstarts: [6, 5, 3, 0] - fromstops: [10, 6, 5, 3] - length: 4 - target: 3 - outputs: - toindex: [6, 7, 8, 9, 5, -1, -1, 3, 4, -1, 0, 1, 2] - tostarts: [0, 4, 7, 10] - tostops: [4, 7, 10, 13] - - error: false - inputs: - fromstarts: [6, 5, 3, 3, 0] - fromstops: [10, 6, 5, 3, 3] - length: 5 - target: 3 - outputs: - toindex: [6, 7, 8, 9, 5, -1, -1, 3, 4, -1, -1, -1, -1, 0, 1, 2] - tostarts: [0, 4, 7, 10, 13] - tostops: [4, 7, 10, 13, 16] - - error: false - inputs: - fromstarts: [6, 5, 3, 3, 0] - fromstops: [10, 6, 5, 3, 3] - length: 5 - target: 2 - outputs: - toindex: [6, 7, 8, 9, 5, -1, 3, 4, -1, -1, 0, 1, 2] - tostarts: [0, 4, 6, 8, 10] - tostops: [4, 6, 8, 10, 13] - - error: false - inputs: - fromstarts: [6, 5, 3, 0] - fromstops: [10, 6, 5, 3] - length: 4 - target: 1 - outputs: - toindex: [6, 7, 8, 9, 5, 3, 4, 0, 1, 2] - tostarts: [0, 4, 5, 7] - tostops: [4, 5, 7, 10] -- name: awkward_ListOffsetArray_reduce_local_outoffsets_64 - tests: - - error: false - inputs: - lenparents: 10 - outlength: 1 - parents: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - outputs: - outoffsets: [0, 10] - - error: false - inputs: - lenparents: 1 - outlength: 1 - parents: [0] - outputs: - outoffsets: [0, 1] - - error: false - inputs: - lenparents: 3 - outlength: 3 - parents: [0, 2, 2] - outputs: - outoffsets: [0, 1, 1, 3] - - error: false - inputs: - lenparents: 3 - outlength: 4 - parents: [0, 1, 3] - outputs: - outoffsets: [0, 1, 2, 2, 3] - - error: false - inputs: - lenparents: 3 - outlength: 3 - parents: [0, 1, 1] - outputs: - outoffsets: [0, 1, 3, 3] - - error: false - inputs: - lenparents: 4 - outlength: 3 - parents: [0, 1, 1, 2] - outputs: - outoffsets: [0, 1, 3, 4] - - error: false - inputs: - lenparents: 2 - outlength: 1 - parents: [0, 0] - outputs: - outoffsets: [0, 2] - - error: false - inputs: - lenparents: 6 - outlength: 5 - parents: [0, 0, 2, 2, 3, 4] - outputs: - outoffsets: [0, 2, 2, 4, 5, 6] - - error: false - inputs: - lenparents: 7 - outlength: 5 - parents: [0, 0, 2, 2, 3, 4, 4] - outputs: - outoffsets: [0, 2, 2, 4, 5, 7] - - error: false - inputs: - lenparents: 3 - outlength: 2 - parents: [0, 0, 1] - outputs: - outoffsets: [0, 2, 3] - - error: false - inputs: - lenparents: 4 - outlength: 2 - parents: [0, 0, 1, 1] - outputs: - outoffsets: [0, 2, 4] - - error: false - inputs: - lenparents: 3 - outlength: 1 - parents: [0, 0, 0] - outputs: - outoffsets: [0, 3] - - error: false - inputs: - lenparents: 6 - outlength: 2 - parents: [0, 0, 0, 1, 1, 1] - outputs: - outoffsets: [0, 3, 6] - - error: false - inputs: - lenparents: 4 - outlength: 1 - parents: [0, 0, 0, 0] - outputs: - outoffsets: [0, 4] - - error: false - inputs: - lenparents: 6 - outlength: 3 - parents: [0, 0, 0, 0, 2, 2] - outputs: - outoffsets: [0, 4, 4, 6] - - error: false - inputs: - lenparents: 8 - outlength: 2 - parents: [0, 0, 0, 0, 1, 1, 1, 1] - outputs: - outoffsets: [0, 4, 8] - - error: false - inputs: - lenparents: 5 - outlength: 1 - parents: [0, 0, 0, 0, 0] - outputs: - outoffsets: [0, 5] - - error: false - inputs: - lenparents: 6 - outlength: 1 - parents: [0, 0, 0, 0, 0, 0] - outputs: - outoffsets: [0, 6] - - error: false - inputs: - lenparents: 7 - outlength: 1 - parents: [0, 0, 0, 0, 0, 0, 0] - outputs: - outoffsets: [0, 7] - - error: false - inputs: - lenparents: 8 - outlength: 1 - parents: [0, 0, 0, 0, 0, 0, 0, 0] - outputs: - outoffsets: [0, 8] - - error: false - inputs: - lenparents: 9 - outlength: 1 - parents: [0, 0, 0, 0, 0, 0, 0, 0, 0] - outputs: - outoffsets: [0, 9] -- name: awkward_ListOffsetArray_reduce_nonlocal_findgaps_64 - tests: - - error: false - inputs: - lenparents: 10 - parents: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - outputs: - gaps: [1] - - error: false - inputs: - lenparents: 4 - parents: [0, 0, 0, 0] - outputs: - gaps: [1] - - error: false - inputs: - lenparents: 3 - parents: [0, 0, 0] - outputs: - gaps: [1] - - error: false - inputs: - lenparents: 2 - parents: [0, 0] - outputs: - gaps: [1] - - error: false - inputs: - lenparents: 1 - parents: [0] - outputs: - gaps: [1] - - error: false - inputs: - lenparents: 11 - parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1] - outputs: - gaps: [1, 1] - - error: false - inputs: - lenparents: 13 - parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1] - outputs: - gaps: [1, 1] - - error: false - inputs: - lenparents: 12 - parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] - outputs: - gaps: [1, 1] - - error: false - inputs: - lenparents: 10 - parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1] - outputs: - gaps: [1, 1] - - error: false - inputs: - lenparents: 11 - parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] - outputs: - gaps: [1, 1] - - error: false - inputs: - lenparents: 12 - parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1] - outputs: - gaps: [1, 1] - - error: false - inputs: - lenparents: 8 - parents: [0, 0, 0, 0, 1, 1, 1, 1] - outputs: - gaps: [1, 1] - - error: false - inputs: - lenparents: 6 - parents: [0, 0, 0, 1, 1, 1] - outputs: - gaps: [1, 1] - - error: false - inputs: - lenparents: 5 - parents: [0, 0, 0, 1, 1] - outputs: - gaps: [1, 1] - - error: false - inputs: - lenparents: 4 - parents: [0, 0, 1, 1] - outputs: - gaps: [1, 1] - - error: false - inputs: - lenparents: 3 - parents: [0, 0, 1] - outputs: - gaps: [1, 1] - - error: false - inputs: - lenparents: 6 - parents: [0, 0, 1, 1, 2, 2] - outputs: - gaps: [1, 1, 1] - - error: false - inputs: - lenparents: 3 - parents: [0, 1, 2] - outputs: - gaps: [1, 1, 1] - - error: false - inputs: - lenparents: 8 - parents: [0, 0, 1, 1, 2, 2, 3, 3] - outputs: - gaps: [1, 1, 1, 1] - - error: false - inputs: - lenparents: 7 - parents: [0, 0, 1, 1, 2, 2, 3] - outputs: - gaps: [1, 1, 1, 1] - - error: false - inputs: - lenparents: 6 - parents: [0, 0, 1, 1, 2, 3] - outputs: - gaps: [1, 1, 1, 1] - - error: false - inputs: - lenparents: 5 - parents: [0, 0, 1, 2, 3] - outputs: - gaps: [1, 1, 1, 1] -- name: awkward_ListOffsetArray_reduce_nonlocal_nextshifts_64 - tests: - - error: false - inputs: - length: 3 - maxcount: 5 - nextcarry: [0, 5, 10, 1, 6, 11, 2, 7, 12, 3, 8, 13, 4, 9, 14] - nextlen: 15 - offsets: [0, 5, 10, 15] - parents: [0, 0, 0] - starts: [0] - outputs: - missing: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - nextshifts: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - nummissing: [0, 0, 0, 0, 0] - - error: false - inputs: - length: 2 - maxcount: 3 - nextcarry: [0, 3, 1, 4, 2, 5] - nextlen: 6 - offsets: [0, 3, 6] - parents: [0, 0] - starts: [0] - outputs: - missing: [0, 0, 0, 0, 0, 0] - nextshifts: [0, 0, 0, 0, 0, 0] - nummissing: [0, 0, 0] - - error: false - inputs: - length: 3 - maxcount: 5 - nextcarry: [0, 5, 9, 1, 6, 10, 2, 7, 11, 3, 8, 4] - nextlen: 12 - offsets: [0, 5, 9, 12] - parents: [0, 0, 0] - starts: [0] - outputs: - missing: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - nextshifts: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - nummissing: [0, 0, 0, 1, 2] - - error: false - inputs: - length: 5 - maxcount: 5 - nextcarry: [0, 5, 8, 11, 14, 1, 6, 9, 12, 15, 2, 7, 10, 13, 16, 3, 4] - nextlen: 17 - offsets: [0, 5, 8, 11, 14, 17] - parents: [0, 0, 0, 0, 0] - starts: [0] - outputs: - missing: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - nextshifts: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - nummissing: [0, 0, 0, 4, 4] - - error: false - inputs: - length: 4 - maxcount: 3 - nextcarry: [0, 2, 5, 7, 1, 3, 6, 8, 4] - nextlen: 9 - offsets: [0, 2, 5, 7, 9] - parents: [0, 0, 1, 1] - starts: [0, 2] - outputs: - missing: [0, 0, 0, 0, 1, 0, 0, 0, 0] - nextshifts: [0, 0, 0, 0, 0, 0, 0, 0, 1] - nummissing: [0, 0, 2] - - error: false - inputs: - length: 3 - maxcount: 4 - nextcarry: [0, 2, 3, 1, 4, 5, 6] - nextlen: 7 - offsets: [0, 2, 3, 7] - parents: [0, 0, 0] - starts: [0] - outputs: - missing: [0, 0, 0, 0, 1, 2, 2] - nextshifts: [0, 0, 0, 0, 1, 2, 2] - nummissing: [0, 1, 2, 2] - - error: false - inputs: - length: 10 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 18] - parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1] - starts: [0, 5] - outputs: - missing: [0, 0, 1, 0, 1, 2, 0, 1, 0, 0, 0, 1, 0, 1, 2, 0, 1, 0] - nextshifts: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2] - nummissing: [0, 2, 4] - - error: false - inputs: - length: 11 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 1, 3, 6, 6, 8, 9, 10, 12, 15, 17, 18] - parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1] - starts: [0, 6] - outputs: - missing: [0, 0, 1, 0, 1, 2, 1, 2, 1, 0, 0, 1, 0, 1, 2, 0, 1, 0] - nextshifts: [0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 2, 1, 1, 1, 2, 2] - nummissing: [0, 2, 4] - - error: false - inputs: - length: 11 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 18] - parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1] - starts: [0, 6] - outputs: - missing: [1, 1, 2, 1, 2, 3, 1, 2, 1, 0, 0, 1, 0, 1, 2, 0, 1, 0] - nextshifts: [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 2, 2, 2, 1, 1, 1, 3, 2] - nummissing: [0, 2, 4] - - error: false - inputs: - length: 3 - maxcount: 4 - nextcarry: [0, 3, 1, 4, 2, 5, 6] - nextlen: 7 - offsets: [0, 3, 3, 7] - parents: [0, 0, 0] - starts: [0] - outputs: - missing: [0, 0, 0, 1, 1, 1, 2] - nextshifts: [0, 1, 0, 1, 0, 1, 2] - nummissing: [1, 1, 1, 2] - - error: false - inputs: - length: 4 - maxcount: 3 - nextcarry: [0, 3, 5, 1, 4, 6, 2] - nextlen: 7 - offsets: [0, 3, 5, 5, 7] - parents: [0, 0, 0, 0] - starts: [0] - outputs: - missing: [0, 0, 0, 0, 0, 1, 1] - nextshifts: [0, 0, 1, 0, 0, 1, 0] - nummissing: [1, 1, 3] - - error: false - inputs: - length: 4 - maxcount: 3 - nextcarry: [0, 3, 5, 1, 4, 6, 2] - nextlen: 7 - offsets: [0, 3, 3, 5, 7] - parents: [0, 0, 0, 0] - starts: [0] - outputs: - missing: [0, 0, 0, 1, 1, 1, 1] - nextshifts: [0, 1, 1, 0, 1, 1, 0] - nummissing: [1, 1, 3] - - error: false - inputs: - length: 11 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 18, 18] - parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] - starts: [0, 5] - outputs: - missing: [0, 0, 1, 0, 1, 2, 0, 1, 0, 0, 0, 1, 0, 1, 2, 0, 1, 0] - nextshifts: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2] - nummissing: [1, 3, 5] - - error: false - inputs: - length: 11 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 17, 18] - parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] - starts: [0, 5] - outputs: - missing: [0, 0, 1, 0, 1, 2, 0, 1, 0, 0, 0, 1, 0, 1, 2, 0, 1, 1] - nextshifts: [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2] - nummissing: [1, 3, 5] - - error: false - inputs: - length: 11 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 1, 3, 6, 8, 9, 10, 12, 15, 15, 17, 18] - parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] - starts: [0, 5] - outputs: - missing: [0, 0, 1, 0, 1, 2, 0, 1, 0, 0, 0, 1, 0, 1, 2, 1, 2, 1] - nextshifts: [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2] - nummissing: [1, 3, 5] - - error: false - inputs: - length: 11 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 1, 3, 6, 8, 9, 10, 12, 12, 15, 17, 18] - parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] - starts: [0, 5] - outputs: - missing: [0, 0, 1, 0, 1, 2, 0, 1, 0, 0, 0, 1, 1, 2, 3, 1, 2, 1] - nextshifts: [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3] - nummissing: [1, 3, 5] - - error: false - inputs: - length: 11 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 1, 3, 6, 8, 9, 9, 10, 12, 15, 17, 18] - parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] - starts: [0, 5] - outputs: - missing: [0, 0, 1, 0, 1, 2, 0, 1, 0, 1, 1, 2, 1, 2, 3, 1, 2, 1] - nextshifts: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3] - nummissing: [1, 3, 5] - - error: false - inputs: - length: 12 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 1, 3, 6, 6, 8, 9, 10, 12, 15, 17, 18, 18] - parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] - starts: [0, 6] - outputs: - missing: [0, 0, 1, 0, 1, 2, 1, 2, 1, 0, 0, 1, 0, 1, 2, 0, 1, 0] - nextshifts: [0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 2, 1, 1, 1, 2, 2] - nummissing: [1, 3, 5] - - error: false - inputs: - length: 12 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 1, 3, 6, 6, 8, 9, 10, 12, 15, 17, 17, 18] - parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] - starts: [0, 6] - outputs: - missing: [0, 0, 1, 0, 1, 2, 1, 2, 1, 0, 0, 1, 0, 1, 2, 0, 1, 1] - nextshifts: [0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 2, 1, 1, 1, 2, 2] - nummissing: [1, 3, 5] - - error: false - inputs: - length: 12 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 1, 3, 6, 6, 8, 9, 10, 12, 15, 15, 17, 18] - parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] - starts: [0, 6] - outputs: - missing: [0, 0, 1, 0, 1, 2, 1, 2, 1, 0, 0, 1, 0, 1, 2, 1, 2, 1] - nextshifts: [0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 2, 1, 1, 2, 2, 2] - nummissing: [1, 3, 5] - - error: false - inputs: - length: 12 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 1, 3, 6, 6, 8, 9, 10, 12, 12, 15, 17, 18] - parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] - starts: [0, 6] - outputs: - missing: [0, 0, 1, 0, 1, 2, 1, 2, 1, 0, 0, 1, 1, 2, 3, 1, 2, 1] - nextshifts: [0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 3] - nummissing: [1, 3, 5] - - error: false - inputs: - length: 12 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 1, 3, 6, 6, 8, 9, 9, 10, 12, 15, 17, 18] - parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] - starts: [0, 6] - outputs: - missing: [0, 0, 1, 0, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 3, 1, 2, 1] - nextshifts: [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3] - nummissing: [1, 3, 5] - - error: false - inputs: - length: 12 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 18, 18] - parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] - starts: [0, 6] - outputs: - missing: [1, 1, 2, 1, 2, 3, 1, 2, 1, 0, 0, 1, 0, 1, 2, 0, 1, 0] - nextshifts: [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 2, 2, 2, 1, 1, 1, 3, 2] - nummissing: [1, 3, 5] - - error: false - inputs: - length: 12 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 17, 18] - parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] - starts: [0, 6] - outputs: - missing: [1, 1, 2, 1, 2, 3, 1, 2, 1, 0, 0, 1, 0, 1, 2, 0, 1, 1] - nextshifts: [1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 2, 2, 2, 1, 1, 1, 3, 2] - nummissing: [1, 3, 5] - - error: false - inputs: - length: 12 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 0, 1, 3, 6, 8, 9, 10, 12, 15, 15, 17, 18] - parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] - starts: [0, 6] - outputs: - missing: [1, 1, 2, 1, 2, 3, 1, 2, 1, 0, 0, 1, 0, 1, 2, 1, 2, 1] - nextshifts: [1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 2, 2, 2, 1, 1, 2, 3, 2] - nummissing: [1, 3, 5] - - error: false - inputs: - length: 12 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 0, 1, 3, 6, 8, 9, 10, 12, 12, 15, 17, 18] - parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] - starts: [0, 6] - outputs: - missing: [1, 1, 2, 1, 2, 3, 1, 2, 1, 0, 0, 1, 1, 2, 3, 1, 2, 1] - nextshifts: [1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 2, 2, 2, 1, 2, 2, 3, 3] - nummissing: [1, 3, 5] - - error: false - inputs: - length: 12 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 0, 1, 3, 6, 8, 9, 9, 10, 12, 15, 17, 18] - parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] - starts: [0, 6] - outputs: - missing: [1, 1, 2, 1, 2, 3, 1, 2, 1, 1, 1, 2, 1, 2, 3, 1, 2, 1] - nextshifts: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3] - nummissing: [1, 3, 5] - - error: false - inputs: - length: 12 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 1, 3, 6, 8, 9, 9, 9, 10, 12, 15, 17, 18] - parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1] - starts: [0, 5] - outputs: - missing: [0, 0, 1, 0, 1, 2, 0, 1, 0, 2, 2, 3, 2, 3, 4, 2, 3, 2] - nextshifts: [0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 1, 1, 1, 3, 3, 3, 2, 4] - nummissing: [2, 4, 6] - - error: false - inputs: - length: 13 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 1, 3, 6, 6, 8, 9, 9, 9, 10, 12, 15, 17, 18] - parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1] - starts: [0, 6] - outputs: - missing: [0, 0, 1, 0, 1, 2, 1, 2, 1, 2, 2, 3, 2, 3, 4, 2, 3, 2] - nextshifts: [0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 1, 1, 2, 3, 3, 3, 2, 4] - nummissing: [2, 4, 6] - - error: false - inputs: - length: 13 - maxcount: 3 - nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] - nextlen: 18 - offsets: [0, 0, 1, 3, 6, 8, 9, 9, 9, 10, 12, 15, 17, 18] - parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1] - starts: [0, 6] - outputs: - missing: [1, 1, 2, 1, 2, 3, 1, 2, 1, 2, 2, 3, 2, 3, 4, 2, 3, 2] - nextshifts: [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4] - nummissing: [2, 4, 6] - - error: false - inputs: - length: 9 - maxcount: 4 - nextcarry: [0, 1, 3, 6, 10, 13, 15, 2, 4, 7, 11, 14, 5, 8, 12, 9] - nextlen: 16 - offsets: [0, 0, 1, 3, 6, 10, 13, 15, 16, 16] - parents: [0, 0, 0, 0, 0, 0, 0, 0, 0] - starts: [0] - outputs: - missing: [1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 1, 2, 1] - nextshifts: [1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4] - nummissing: [2, 4, 6, 8] -- name: awkward_ListOffsetArray_reduce_nonlocal_nextstarts_64 - tests: - - error: false - inputs: - nextlen: 18 - nextparents: [0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 1, 1, 1, 4, 4, 4, 2, 5] - outputs: - nextstarts: [0, 10, 16, 5, 13, 17] - - error: false - inputs: - nextlen: 21 - nextparents: [0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 1, 1, 1, 4, 4, 4, 4, 2, 5, 5, 5] - outputs: - nextstarts: [0, 10, 17, 5, 13, 18] - - error: false - inputs: - nextlen: 3 - nextparents: [0, 1, 2] - outputs: - nextstarts: [0, 1, 2] - - error: false - inputs: - nextlen: 5 - nextparents: [0, 0, 1, 2, 3] - outputs: - nextstarts: [0, 2, 3, 4] - - error: false - inputs: - nextlen: 6 - nextparents: [0, 0, 1, 1, 2, 2] - outputs: - nextstarts: [0, 2, 4] - - error: false - inputs: - nextlen: 6 - nextparents: [0, 0, 1, 1, 2, 3] - outputs: - nextstarts: [0, 2, 4, 5] - - error: false - inputs: - nextlen: 8 - nextparents: [0, 0, 1, 1, 2, 2, 3, 3] - outputs: - nextstarts: [0, 2, 4, 6] - - error: false - inputs: - nextlen: 7 - nextparents: [0, 0, 1, 1, 2, 2, 3] - outputs: - nextstarts: [0, 2, 4, 6] - - error: false - inputs: - nextlen: 6 - nextparents: [0, 0, 0, 1, 1, 1] - outputs: - nextstarts: [0, 3] - - error: false - inputs: - nextlen: 5 - nextparents: [0, 0, 0, 1, 1] - outputs: - nextstarts: [0, 3] - - error: false - inputs: - nextlen: 7 - nextparents: [0, 0, 0, 1, 1, 2, 3] - outputs: - nextstarts: [0, 3, 5, 6] - - error: false - inputs: - nextlen: 9 - nextparents: [0, 0, 0, 1, 1, 2, 2, 3, 4] - outputs: - nextstarts: [0, 3, 5, 7, 8] - - error: false - inputs: - nextlen: 7 - nextparents: [0, 0, 0, 1, 1, 1, 2] - outputs: - nextstarts: [0, 3, 6] - - error: false - inputs: - nextlen: 9 - nextparents: [0, 0, 0, 1, 1, 1, 2, 2, 3] + lenparents: 3 + parents: [0, 0, 1] outputs: - nextstarts: [0, 3, 6, 8] + gaps: [1, 1] - error: false inputs: - nextlen: 10 - nextparents: [0, 0, 0, 1, 1, 1, 2, 2, 2, 3] + lenparents: 6 + parents: [0, 0, 1, 1, 2, 2] outputs: - nextstarts: [0, 3, 6, 9] + gaps: [1, 1, 1] - error: false inputs: - nextlen: 12 - nextparents: [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3] + lenparents: 3 + parents: [0, 1, 2] outputs: - nextstarts: [0, 3, 6, 9] + gaps: [1, 1, 1] - error: false inputs: - nextlen: 12 - nextparents: [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4] + lenparents: 8 + parents: [0, 0, 1, 1, 2, 2, 3, 3] outputs: - nextstarts: [0, 3, 6, 9, 11] + gaps: [1, 1, 1, 1] - error: false inputs: - nextlen: 15 - nextparents: [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4] + lenparents: 7 + parents: [0, 0, 1, 1, 2, 2, 3] outputs: - nextstarts: [0, 3, 6, 9, 12] + gaps: [1, 1, 1, 1] - error: false inputs: - nextlen: 15 - nextparents: [0, 5, 5, 1, 6, 6, 2, 7, 7, 3, 8, 8, 4, 9, 9] + lenparents: 6 + parents: [0, 0, 1, 1, 2, 3] outputs: - nextstarts: [0, 3, 6, 9, 12, 1, 4, 7, 10, 13] + gaps: [1, 1, 1, 1] - error: false inputs: - nextlen: 15 - nextparents: [0, 5, 10, 1, 6, 11, 2, 7, 12, 3, 8, 13, 4, 9, 14] + lenparents: 5 + parents: [0, 0, 1, 2, 3] outputs: - nextstarts: [0, 3, 6, 9, 12, 1, 4, 7, 10, 13, 2, 5, 8, 11, 14] + gaps: [1, 1, 1, 1] +- name: awkward_ListOffsetArray_reduce_nonlocal_nextshifts_64 + tests: - error: false inputs: + length: 3 + maxcount: 5 + nextcarry: [0, 5, 10, 1, 6, 11, 2, 7, 12, 3, 8, 13, 4, 9, 14] nextlen: 15 - nextparents: [0, 0, 5, 1, 1, 6, 2, 2, 7, 3, 3, 8, 4, 4, 9] + offsets: [0, 5, 10, 15] + parents: [0, 0, 0] + starts: [0] outputs: - nextstarts: [0, 3, 6, 9, 12, 2, 5, 8, 11, 14] + missing: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + nextshifts: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + nummissing: [0, 0, 0, 0, 0] - error: false inputs: + length: 2 + maxcount: 3 + nextcarry: [0, 3, 1, 4, 2, 5] nextlen: 6 - nextparents: [0, 0, 0, 0, 1, 1] - outputs: - nextstarts: [0, 4] - - error: false - inputs: - nextlen: 9 - nextparents: [0, 0, 0, 0, 1, 1, 1, 2, 2] - outputs: - nextstarts: [0, 4, 7] - - error: false - inputs: - nextlen: 20 - nextparents: [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4] - outputs: - nextstarts: [0, 4, 8, 12, 16] - - error: false - inputs: - nextlen: 20 - nextparents: [0, 0, 5, 5, 1, 1, 6, 6, 2, 2, 7, 7, 3, 3, 8, 8, 4, 4, 9, 9] - outputs: - nextstarts: [0, 4, 8, 12, 16, 2, 6, 10, 14, 18] - - error: false - inputs: - nextlen: 9 - nextparents: [0, 0, 3, 3, 1, 1, 4, 4, 2] + offsets: [0, 3, 6] + parents: [0, 0] + starts: [0] outputs: - nextstarts: [0, 4, 8, 2, 6] + missing: [0, 0, 0, 0, 0, 0] + nextshifts: [0, 0, 0, 0, 0, 0] + nummissing: [0, 0, 0] - error: false inputs: + length: 3 + maxcount: 5 + nextcarry: [0, 5, 9, 1, 6, 10, 2, 7, 11, 3, 8, 4] nextlen: 12 - nextparents: [0, 0, 3, 3, 1, 1, 4, 4, 2, 2, 5, 5] - outputs: - nextstarts: [0, 4, 8, 2, 6, 10] - - error: false - inputs: - nextlen: 15 - nextparents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2] + offsets: [0, 5, 9, 12] + parents: [0, 0, 0] + starts: [0] outputs: - nextstarts: [0, 5, 10] + missing: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + nextshifts: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + nummissing: [0, 0, 0, 1, 2] - error: false inputs: + length: 5 + maxcount: 5 + nextcarry: [0, 5, 8, 11, 14, 1, 6, 9, 12, 15, 2, 7, 10, 13, 16, 3, 4] nextlen: 17 - nextparents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 4] - outputs: - nextstarts: [0, 5, 10, 15, 16] - - error: false - inputs: - nextlen: 25 - nextparents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, - 4, 4, 4, 4] - outputs: - nextstarts: [0, 5, 10, 15, 20] - - error: false - inputs: - nextlen: 9 - nextparents: [0, 0, 0, 3, 3, 1, 1, 4, 2] - outputs: - nextstarts: [0, 5, 8, 3, 7] - - error: false - inputs: - nextlen: 22 - nextparents: [0, 0, 0, 5, 5, 5, 1, 1, 6, 6, 2, 2, 7, 7, 3, 3, 8, 8, 4, 4, 9, - 9] - outputs: - nextstarts: [0, 6, 10, 14, 18, 3, 8, 12, 16, 20] - - error: false - inputs: - nextlen: 16 - nextparents: [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 3] - outputs: - nextstarts: [0, 7, 12, 15] -- name: awkward_ListOffsetArray_reduce_nonlocal_outstartsstops_64 - tests: - - error: false - inputs: - distincts: [0, 0, 0, 0, 0, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1] - gaps: [1, 2, 0] - lendistincts: 15 - outlength: 3 - outputs: - outstarts: [0, 10, 10] - outstops: [5, 10, 15] - - error: false - inputs: - distincts: [0, 0] - gaps: [1] - lendistincts: 2 - outlength: 1 - outputs: - outstarts: [0] - outstops: [2] - - error: false - inputs: - distincts: [0, 0, 0] - gaps: [1] - lendistincts: 3 - outlength: 1 - outputs: - outstarts: [0] - outstops: [3] - - error: false - inputs: - distincts: [0, 0, 0, 1, 1, -1] - gaps: [1, 1] - lendistincts: 6 - outlength: 2 - outputs: - outstarts: [0, 3] - outstops: [3, 5] - - error: false - inputs: - distincts: [0, 0, 0, 1, 1, 1] - gaps: [1, 1] - lendistincts: 6 - outlength: 2 - outputs: - outstarts: [0, 3] - outstops: [3, 6] - - error: false - inputs: - distincts: [0, 0, 0, 1, 1, -1, 2, -1, -1] - gaps: [1, 1, 1] - lendistincts: 9 - outlength: 3 + offsets: [0, 5, 8, 11, 14, 17] + parents: [0, 0, 0, 0, 0] + starts: [0] outputs: - outstarts: [0, 3, 6] - outstops: [3, 5, 7] + missing: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + nextshifts: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + nummissing: [0, 0, 0, 4, 4] - error: false inputs: - distincts: [0, 0, 0, 1, -1, -1, 2, 1, -1, 3, -1, -1] - gaps: [1, 1, 1, 1] - lendistincts: 12 - outlength: 4 + length: 4 + maxcount: 3 + nextcarry: [0, 2, 5, 7, 1, 3, 6, 8, 4] + nextlen: 9 + offsets: [0, 2, 5, 7, 9] + parents: [0, 0, 1, 1] + starts: [0, 2] outputs: - outstarts: [0, 3, 6, 9] - outstops: [3, 4, 8, 10] + missing: [0, 0, 0, 0, 1, 0, 0, 0, 0] + nextshifts: [0, 0, 0, 0, 0, 0, 0, 0, 1] + nummissing: [0, 0, 2] - error: false inputs: - distincts: [0, 0, -1, 1, -1, -1, -1, -1, -1, 2, 1, 0] - gaps: [1, 1, 1, 1] - lendistincts: 12 - outlength: 4 + length: 3 + maxcount: 4 + nextcarry: [0, 2, 3, 1, 4, 5, 6] + nextlen: 7 + offsets: [0, 2, 3, 7] + parents: [0, 0, 0] + starts: [0] outputs: - outstarts: [0, 3, 9, 9] - outstops: [2, 4, 9, 12] + missing: [0, 0, 0, 0, 1, 2, 2] + nextshifts: [0, 0, 0, 0, 1, 2, 2] + nummissing: [0, 1, 2, 2] - error: false inputs: - distincts: [0, 0, 0, 0] - gaps: [1] - lendistincts: 4 - outlength: 1 + length: 10 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 18] + parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1] + starts: [0, 5] outputs: - outstarts: [0] - outstops: [4] + missing: [0, 0, 1, 0, 1, 2, 0, 1, 0, 0, 0, 1, 0, 1, 2, 0, 1, 0] + nextshifts: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2] + nummissing: [0, 2, 4] - error: false inputs: - distincts: [0, 0, 0, -1, 1, 1, 1, 0] - gaps: [1, 1] - lendistincts: 8 - outlength: 2 + length: 11 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 1, 3, 6, 6, 8, 9, 10, 12, 15, 17, 18] + parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1] + starts: [0, 6] outputs: - outstarts: [0, 4] - outstops: [3, 8] + missing: [0, 0, 1, 0, 1, 2, 1, 2, 1, 0, 0, 1, 0, 1, 2, 0, 1, 0] + nextshifts: [0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 2, 1, 1, 1, 2, 2] + nummissing: [0, 2, 4] - error: false inputs: - distincts: [0, 0, 0, 0, 0] - gaps: [1] - lendistincts: 5 - outlength: 1 + length: 11 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 18] + parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1] + starts: [0, 6] outputs: - outstarts: [0] - outstops: [5] + missing: [1, 1, 2, 1, 2, 3, 1, 2, 1, 0, 0, 1, 0, 1, 2, 0, 1, 0] + nextshifts: [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 2, 2, 2, 1, 1, 1, 3, 2] + nummissing: [0, 2, 4] - error: false inputs: - distincts: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, -1] - gaps: [1, 1, 1] - lendistincts: 15 - outlength: 3 + length: 3 + maxcount: 4 + nextcarry: [0, 3, 1, 4, 2, 5, 6] + nextlen: 7 + offsets: [0, 3, 3, 7] + parents: [0, 0, 0] + starts: [0] outputs: - outstarts: [0, 5, 10] - outstops: [5, 10, 14] + missing: [0, 0, 0, 1, 1, 1, 2] + nextshifts: [0, 1, 0, 1, 0, 1, 2] + nummissing: [1, 1, 1, 2] - error: false inputs: - distincts: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2] - gaps: [1, 1, 1] - lendistincts: 15 - outlength: 3 + length: 4 + maxcount: 3 + nextcarry: [0, 3, 5, 1, 4, 6, 2] + nextlen: 7 + offsets: [0, 3, 5, 5, 7] + parents: [0, 0, 0, 0] + starts: [0] outputs: - outstarts: [0, 5, 10] - outstops: [5, 10, 15] + missing: [0, 0, 0, 0, 0, 1, 1] + nextshifts: [0, 0, 1, 0, 0, 1, 0] + nummissing: [1, 1, 3] - error: false inputs: - distincts: [0, 0, 0, 0, 0, 1, -1, -1, -1, -1, 2, 1, 1, 1, 1] - gaps: [1, 1, 1] - lendistincts: 15 - outlength: 3 + length: 4 + maxcount: 3 + nextcarry: [0, 3, 5, 1, 4, 6, 2] + nextlen: 7 + offsets: [0, 3, 3, 5, 7] + parents: [0, 0, 0, 0] + starts: [0] outputs: - outstarts: [0, 5, 10] - outstops: [5, 6, 15] + missing: [0, 0, 0, 1, 1, 1, 1] + nextshifts: [0, 1, 1, 0, 1, 1, 0] + nummissing: [1, 1, 3] - error: false inputs: - distincts: [0, 0, 0, 0, 0, 1, 1, 1, 1, -1, 2, 2, 2, 2, 1] - gaps: [1, 1, 1] - lendistincts: 15 - outlength: 3 + length: 11 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 18, 18] + parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] + starts: [0, 5] outputs: - outstarts: [0, 5, 10] - outstops: [5, 9, 15] + missing: [0, 0, 1, 0, 1, 2, 0, 1, 0, 0, 0, 1, 0, 1, 2, 0, 1, 0] + nextshifts: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2] + nummissing: [1, 3, 5] - error: false inputs: - distincts: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1] - gaps: [1, 1, 0] - lendistincts: 15 - outlength: 3 + length: 11 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 17, 18] + parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] + starts: [0, 5] outputs: - outstarts: [0, 5, 16] - outstops: [5, 10, 16] + missing: [0, 0, 1, 0, 1, 2, 0, 1, 0, 0, 0, 1, 0, 1, 2, 0, 1, 1] + nextshifts: [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2] + nummissing: [1, 3, 5] - error: false inputs: - distincts: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1] - gaps: [1, 1] - lendistincts: 10 - outlength: 2 + length: 11 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 1, 3, 6, 8, 9, 10, 12, 15, 15, 17, 18] + parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] + starts: [0, 5] outputs: - outstarts: [0, 5] - outstops: [5, 10] + missing: [0, 0, 1, 0, 1, 2, 0, 1, 0, 0, 0, 1, 0, 1, 2, 1, 2, 1] + nextshifts: [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2] + nummissing: [1, 3, 5] - error: false inputs: - distincts: [0, 0, 0, -1, -1, -1, 1, 1, -1] - gaps: [1, 2, 0] - lendistincts: 9 - outlength: 3 + length: 11 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 1, 3, 6, 8, 9, 10, 12, 12, 15, 17, 18] + parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] + starts: [0, 5] outputs: - outstarts: [0, 6, 6] - outstops: [3, 6, 8] + missing: [0, 0, 1, 0, 1, 2, 0, 1, 0, 0, 0, 1, 1, 2, 3, 1, 2, 1] + nextshifts: [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3] + nummissing: [1, 3, 5] - error: false inputs: - distincts: [0, 0, 0, -1, -1, -1, 1, 1, 1] - gaps: [1, 1, 1] - lendistincts: 9 - outlength: 3 + length: 11 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 1, 3, 6, 8, 9, 9, 10, 12, 15, 17, 18] + parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] + starts: [0, 5] outputs: - outstarts: [0, 6, 6] - outstops: [3, 6, 9] + missing: [0, 0, 1, 0, 1, 2, 0, 1, 0, 1, 1, 2, 1, 2, 3, 1, 2, 1] + nextshifts: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3] + nummissing: [1, 3, 5] - error: false inputs: - distincts: [0, 0, -1, -1, -1, -1, 1, -1, -1, 2, 1, 0] - gaps: [1, 1, 1, 1] - lendistincts: 12 - outlength: 4 + length: 12 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 1, 3, 6, 6, 8, 9, 10, 12, 15, 17, 18, 18] + parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] + starts: [0, 6] outputs: - outstarts: [0, 6, 6, 9] - outstops: [2, 6, 7, 12] + missing: [0, 0, 1, 0, 1, 2, 1, 2, 1, 0, 0, 1, 0, 1, 2, 0, 1, 0] + nextshifts: [0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 2, 1, 1, 1, 2, 2] + nummissing: [1, 3, 5] - error: false inputs: - distincts: [0, 0, -1, -1, -1, -1, -1, -1, -1, 1, 1, 0] - gaps: [1, 1, 1, 1] - lendistincts: 12 - outlength: 4 + length: 12 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 1, 3, 6, 6, 8, 9, 10, 12, 15, 17, 17, 18] + parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] + starts: [0, 6] outputs: - outstarts: [0, 9, 9, 9] - outstops: [2, 9, 9, 12] + missing: [0, 0, 1, 0, 1, 2, 1, 2, 1, 0, 0, 1, 0, 1, 2, 0, 1, 1] + nextshifts: [0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 2, 1, 1, 1, 2, 2] + nummissing: [1, 3, 5] - error: false inputs: - distincts: [0, 0, 0, -1, -1, -1, -1, -1, -1, 1, 1, 1] - gaps: [1, 1, 1, 1] - lendistincts: 12 - outlength: 4 + length: 12 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 1, 3, 6, 6, 8, 9, 10, 12, 15, 15, 17, 18] + parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] + starts: [0, 6] outputs: - outstarts: [0, 9, 9, 9] - outstops: [3, 9, 9, 12] + missing: [0, 0, 1, 0, 1, 2, 1, 2, 1, 0, 0, 1, 0, 1, 2, 1, 2, 1] + nextshifts: [0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 2, 1, 1, 2, 2, 2] + nummissing: [1, 3, 5] - error: false inputs: - distincts: [] - gaps: [0] - lendistincts: 0 - outlength: 1 + length: 12 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 1, 3, 6, 6, 8, 9, 10, 12, 12, 15, 17, 18] + parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] + starts: [0, 6] outputs: - outstarts: [1] - outstops: [1] -- name: awkward_NumpyArray_getitem_boolean_numtrue - tests: + missing: [0, 0, 1, 0, 1, 2, 1, 2, 1, 0, 0, 1, 1, 2, 3, 1, 2, 1] + nextshifts: [0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 3] + nummissing: [1, 3, 5] - error: false inputs: - fromptr: [0, 0, 0, 0] - length: 4 - stride: 1 + length: 12 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 1, 3, 6, 6, 8, 9, 9, 10, 12, 15, 17, 18] + parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] + starts: [0, 6] outputs: - numtrue: [0] + missing: [0, 0, 1, 0, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 3, 1, 2, 1] + nextshifts: [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3] + nummissing: [1, 3, 5] - error: false inputs: - fromptr: [0, 0, 0] - length: 3 - stride: 1 + length: 12 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 18, 18] + parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] + starts: [0, 6] outputs: - numtrue: [0] + missing: [1, 1, 2, 1, 2, 3, 1, 2, 1, 0, 0, 1, 0, 1, 2, 0, 1, 0] + nextshifts: [1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 2, 2, 2, 1, 1, 1, 3, 2] + nummissing: [1, 3, 5] - error: false inputs: - fromptr: [0, 0] - length: 2 - stride: 1 + length: 12 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 17, 18] + parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] + starts: [0, 6] outputs: - numtrue: [0] + missing: [1, 1, 2, 1, 2, 3, 1, 2, 1, 0, 0, 1, 0, 1, 2, 0, 1, 1] + nextshifts: [1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 2, 2, 2, 1, 1, 1, 3, 2] + nummissing: [1, 3, 5] - error: false inputs: - fromptr: [0] - length: 1 - stride: 1 + length: 12 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 0, 1, 3, 6, 8, 9, 10, 12, 15, 15, 17, 18] + parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] + starts: [0, 6] outputs: - numtrue: [0] + missing: [1, 1, 2, 1, 2, 3, 1, 2, 1, 0, 0, 1, 0, 1, 2, 1, 2, 1] + nextshifts: [1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 2, 2, 2, 1, 1, 2, 3, 2] + nummissing: [1, 3, 5] - error: false inputs: - fromptr: [1, 0, 0, 0] - length: 4 - stride: 1 + length: 12 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 0, 1, 3, 6, 8, 9, 10, 12, 12, 15, 17, 18] + parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] + starts: [0, 6] outputs: - numtrue: [1] -- name: awkward_NumpyArray_reduce_mask_ByteMaskedArray_64 - tests: + missing: [1, 1, 2, 1, 2, 3, 1, 2, 1, 0, 0, 1, 1, 2, 3, 1, 2, 1] + nextshifts: [1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 2, 2, 2, 1, 2, 2, 3, 3] + nummissing: [1, 3, 5] - error: false inputs: - lenparents: 30 - outlength: 15 - parents: [0, 0, 5, 5, 10, 10, 1, 1, 6, 6, 11, 11, 2, 2, 7, 7, 12, 12, 3, 3, - 8, 8, 13, 13, 4, 4, 9, 9, 14, 14] + length: 12 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 0, 1, 3, 6, 8, 9, 9, 10, 12, 15, 17, 18] + parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1] + starts: [0, 6] outputs: - toptr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + missing: [1, 1, 2, 1, 2, 3, 1, 2, 1, 1, 1, 2, 1, 2, 3, 1, 2, 1] + nextshifts: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3] + nummissing: [1, 3, 5] - error: false inputs: - lenparents: 30 - outlength: 10 - parents: [0, 0, 0, 5, 5, 5, 1, 1, 1, 6, 6, 6, 2, 2, 2, 7, 7, 7, 3, 3, 3, 8, - 8, 8, 4, 4, 4, 9, 9, 9] + length: 12 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 1, 3, 6, 8, 9, 9, 9, 10, 12, 15, 17, 18] + parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1] + starts: [0, 5] outputs: - toptr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + missing: [0, 0, 1, 0, 1, 2, 0, 1, 0, 2, 2, 3, 2, 3, 4, 2, 3, 2] + nextshifts: [0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 1, 1, 1, 3, 3, 3, 2, 4] + nummissing: [2, 4, 6] - error: false inputs: - lenparents: 30 - outlength: 6 - parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, - 4, 4, 4, 5, 5, 5, 5, 5] + length: 13 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 1, 3, 6, 6, 8, 9, 9, 9, 10, 12, 15, 17, 18] + parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1] + starts: [0, 6] outputs: - toptr: [0, 0, 0, 0, 0, 0] + missing: [0, 0, 1, 0, 1, 2, 1, 2, 1, 2, 2, 3, 2, 3, 4, 2, 3, 2] + nextshifts: [0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 1, 1, 2, 3, 3, 3, 2, 4] + nummissing: [2, 4, 6] - error: false inputs: - lenparents: 18 - outlength: 6 - parents: [0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 1, 1, 1, 4, 4, 4, 2, 5] + length: 13 + maxcount: 3 + nextcarry: [0, 1, 3, 6, 8, 9, 10, 12, 15, 17, 2, 4, 7, 11, 13, 16, 5, 14] + nextlen: 18 + offsets: [0, 0, 1, 3, 6, 8, 9, 9, 9, 10, 12, 15, 17, 18] + parents: [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1] + starts: [0, 6] outputs: - toptr: [0, 0, 0, 0, 0, 0] + missing: [1, 1, 2, 1, 2, 3, 1, 2, 1, 2, 2, 3, 2, 3, 4, 2, 3, 2] + nextshifts: [1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4] + nummissing: [2, 4, 6] - error: false inputs: - lenparents: 21 - outlength: 6 - parents: [0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 1, 1, 1, 4, 4, 4, 4, 2, 5, 5, 5] + length: 9 + maxcount: 4 + nextcarry: [0, 1, 3, 6, 10, 13, 15, 2, 4, 7, 11, 14, 5, 8, 12, 9] + nextlen: 16 + offsets: [0, 0, 1, 3, 6, 10, 13, 15, 16, 16] + parents: [0, 0, 0, 0, 0, 0, 0, 0, 0] + starts: [0] outputs: - toptr: [0, 0, 0, 0, 0, 0] + missing: [1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 1, 2, 1] + nextshifts: [1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4] + nummissing: [2, 4, 6, 8] +- name: awkward_ListOffsetArray_reduce_nonlocal_nextstarts_64 + tests: - error: false inputs: - lenparents: 20 - outlength: 4 - parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3] + nextlen: 18 + nextparents: [0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 1, 1, 1, 4, 4, 4, 2, 5] outputs: - toptr: [0, 0, 0, 0] + nextstarts: [0, 10, 16, 5, 13, 17] - error: false inputs: - lenparents: 20 - outlength: 5 - parents: [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4] + nextlen: 21 + nextparents: [0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 1, 1, 1, 4, 4, 4, 4, 2, 5, 5, 5] outputs: - toptr: [0, 0, 0, 0, 0] + nextstarts: [0, 10, 17, 5, 13, 18] - error: false inputs: - lenparents: 15 - outlength: 3 - parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2] + nextlen: 3 + nextparents: [0, 1, 2] outputs: - toptr: [0, 0, 0] + nextstarts: [0, 1, 2] - error: false inputs: - lenparents: 12 - outlength: 3 - parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2] + nextlen: 5 + nextparents: [0, 0, 1, 2, 3] outputs: - toptr: [0, 0, 0] + nextstarts: [0, 2, 3, 4] - error: false inputs: - lenparents: 15 - outlength: 5 - parents: [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4] + nextlen: 6 + nextparents: [0, 0, 1, 1, 2, 2] outputs: - toptr: [0, 0, 0, 0, 0] + nextstarts: [0, 2, 4] - error: false inputs: - lenparents: 12 - outlength: 5 - parents: [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4] + nextlen: 6 + nextparents: [0, 0, 1, 1, 2, 3] outputs: - toptr: [0, 0, 0, 0, 0] + nextstarts: [0, 2, 4, 5] - error: false inputs: - lenparents: 9 - outlength: 5 - parents: [0, 0, 0, 1, 1, 2, 2, 3, 4] + nextlen: 8 + nextparents: [0, 0, 1, 1, 2, 2, 3, 3] outputs: - toptr: [0, 0, 0, 0, 0] + nextstarts: [0, 2, 4, 6] - error: false inputs: - lenparents: 10 - outlength: 2 - parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1] + nextlen: 7 + nextparents: [0, 0, 1, 1, 2, 2, 3] outputs: - toptr: [0, 0] + nextstarts: [0, 2, 4, 6] - error: false inputs: - lenparents: 10 - outlength: 4 - parents: [0, 0, 0, 1, 1, 1, 2, 2, 2, 3] + nextlen: 6 + nextparents: [0, 0, 0, 1, 1, 1] outputs: - toptr: [0, 0, 0, 0] + nextstarts: [0, 3] - error: false inputs: - lenparents: 7 - outlength: 4 - parents: [0, 0, 0, 1, 1, 2, 3] + nextlen: 5 + nextparents: [0, 0, 0, 1, 1] outputs: - toptr: [0, 0, 0, 0] + nextstarts: [0, 3] - error: false inputs: - lenparents: 10 - outlength: 4 - parents: [0, 0, 0, 1, 2, 2, 2, 3, 3, 3] + nextlen: 7 + nextparents: [0, 0, 0, 1, 1, 2, 3] outputs: - toptr: [0, 0, 0, 0] + nextstarts: [0, 3, 5, 6] - error: false inputs: - lenparents: 9 - outlength: 5 - parents: [0, 0, 3, 3, 1, 1, 4, 4, 2] + nextlen: 9 + nextparents: [0, 0, 0, 1, 1, 2, 2, 3, 4] outputs: - toptr: [0, 0, 0, 0, 0] + nextstarts: [0, 3, 5, 7, 8] - error: false inputs: - lenparents: 10 - outlength: 3 - parents: [0, 0, 0, 1, 1, 1, 2, 2, 2, 2] + nextlen: 7 + nextparents: [0, 0, 0, 1, 1, 1, 2] outputs: - toptr: [0, 0, 0] + nextstarts: [0, 3, 6] - error: false inputs: - lenparents: 6 - outlength: 3 - parents: [0, 0, 0, 1, 1, 2] + nextlen: 9 + nextparents: [0, 0, 0, 1, 1, 1, 2, 2, 3] outputs: - toptr: [0, 0, 0] + nextstarts: [0, 3, 6, 8] - error: false inputs: - lenparents: 5 - outlength: 1 - parents: [0, 0, 0, 0, 0] + nextlen: 10 + nextparents: [0, 0, 0, 1, 1, 1, 2, 2, 2, 3] outputs: - toptr: [0] + nextstarts: [0, 3, 6, 9] - error: false inputs: - lenparents: 6 - outlength: 3 - parents: [0, 0, 1, 1, 1, 2] + nextlen: 12 + nextparents: [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3] outputs: - toptr: [0, 0, 0] + nextstarts: [0, 3, 6, 9] - error: false inputs: - lenparents: 5 - outlength: 3 - parents: [0, 0, 1, 2, 2] + nextlen: 12 + nextparents: [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4] outputs: - toptr: [0, 0, 0] + nextstarts: [0, 3, 6, 9, 11] - error: false inputs: - lenparents: 6 - outlength: 3 - parents: [0, 1, 1, 2, 2, 2] + nextlen: 15 + nextparents: [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4] outputs: - toptr: [0, 0, 0] + nextstarts: [0, 3, 6, 9, 12] - error: false inputs: - lenparents: 22 - outlength: 8 - parents: [0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 1, 1, 1, 5, 5, 5, 5, 2, 6, 6, 6, 7] + nextlen: 15 + nextparents: [0, 5, 5, 1, 6, 6, 2, 7, 7, 3, 8, 8, 4, 9, 9] outputs: - toptr: [0, 0, 0, 1, 0, 0, 0, 0] + nextstarts: [0, 3, 6, 9, 12, 1, 4, 7, 10, 13] - error: false inputs: - lenparents: 9 - outlength: 5 - parents: [0, 0, 0, 1, 2, 2, 4, 4, 4] + nextlen: 15 + nextparents: [0, 5, 10, 1, 6, 11, 2, 7, 12, 3, 8, 13, 4, 9, 14] outputs: - toptr: [0, 0, 0, 1, 0] + nextstarts: [0, 3, 6, 9, 12, 1, 4, 7, 10, 13, 2, 5, 8, 11, 14] - error: false inputs: - lenparents: 9 - outlength: 8 - parents: [0, 0, 0, 6, 6, 1, 1, 7, 2] + nextlen: 15 + nextparents: [0, 0, 5, 1, 1, 6, 2, 2, 7, 3, 3, 8, 4, 4, 9] outputs: - toptr: [0, 0, 0, 1, 1, 1, 0, 0] + nextstarts: [0, 3, 6, 9, 12, 2, 5, 8, 11, 14] - error: false inputs: - lenparents: 12 - outlength: 9 - parents: [0, 0, 6, 6, 1, 1, 7, 7, 2, 2, 8, 8] + nextlen: 6 + nextparents: [0, 0, 0, 0, 1, 1] outputs: - toptr: [0, 0, 0, 1, 1, 1, 0, 0, 0] + nextstarts: [0, 4] - error: false inputs: - lenparents: 6 - outlength: 4 - parents: [0, 0, 1, 1, 1, 3] + nextlen: 9 + nextparents: [0, 0, 0, 0, 1, 1, 1, 2, 2] outputs: - toptr: [0, 0, 1, 0] + nextstarts: [0, 4, 7] - error: false inputs: - lenparents: 6 - outlength: 4 - parents: [0, 0, 1, 3, 3, 3] + nextlen: 20 + nextparents: [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4] outputs: - toptr: [0, 0, 1, 0] + nextstarts: [0, 4, 8, 12, 16] - error: false inputs: - lenparents: 9 - outlength: 4 - parents: [0, 0, 0, 0, 0, 2, 2, 2, 3] + nextlen: 20 + nextparents: [0, 0, 5, 5, 1, 1, 6, 6, 2, 2, 7, 7, 3, 3, 8, 8, 4, 4, 9, 9] outputs: - toptr: [0, 1, 0, 0] + nextstarts: [0, 4, 8, 12, 16, 2, 6, 10, 14, 18] - error: false inputs: - lenparents: 9 - outlength: 6 - parents: [0, 0, 0, 2, 2, 3, 4, 4, 5] + nextlen: 9 + nextparents: [0, 0, 3, 3, 1, 1, 4, 4, 2] outputs: - toptr: [0, 1, 0, 0, 0, 0] + nextstarts: [0, 4, 8, 2, 6] - error: false inputs: - lenparents: 9 - outlength: 5 - parents: [0, 0, 0, 2, 2, 3, 4, 4, 4] + nextlen: 12 + nextparents: [0, 0, 3, 3, 1, 1, 4, 4, 2, 2, 5, 5] outputs: - toptr: [0, 1, 0, 0, 0] + nextstarts: [0, 4, 8, 2, 6, 10] - error: false inputs: - lenparents: 6 - outlength: 3 - parents: [0, 0, 0, 2, 2, 2] + nextlen: 15 + nextparents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2] outputs: - toptr: [0, 1, 0] + nextstarts: [0, 5, 10] - error: false inputs: - lenparents: 3 - outlength: 3 - parents: [0, 0, 2] + nextlen: 17 + nextparents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 4] outputs: - toptr: [0, 1, 0] + nextstarts: [0, 5, 10, 15, 16] - error: false inputs: - lenparents: 9 - outlength: 7 - parents: [0, 0, 0, 2, 2, 3, 6, 6, 6] + nextlen: 25 + nextparents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, + 4, 4, 4, 4] outputs: - toptr: [0, 1, 0, 0, 1, 1, 0] -- name: awkward_UnionArray_fillna - tests: + nextstarts: [0, 5, 10, 15, 20] - error: false inputs: - fromindex: [-1, -1, -1, -1, -1] - length: 5 + nextlen: 9 + nextparents: [0, 0, 0, 3, 3, 1, 1, 4, 2] outputs: - toindex: [0, 0, 0, 0, 0] + nextstarts: [0, 5, 8, 3, 7] - error: false inputs: - fromindex: [-1, -1, 0, -1, 1, 2, 3, 4, 5, -1, -1, -1] - length: 12 + nextlen: 22 + nextparents: [0, 0, 0, 5, 5, 5, 1, 1, 6, 6, 2, 2, 7, 7, 3, 3, 8, 8, 4, 4, 9, + 9] outputs: - toindex: [0, 0, 0, 0, 1, 2, 3, 4, 5, 0, 0, 0] + nextstarts: [0, 6, 10, 14, 18, 3, 8, 12, 16, 20] - error: false inputs: - fromindex: [-1, 0, 1, -1] - length: 4 + nextlen: 16 + nextparents: [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 3] outputs: - toindex: [0, 0, 1, 0] + nextstarts: [0, 7, 12, 15] +- name: awkward_ListOffsetArray_reduce_nonlocal_outstartsstops_64 + tests: - error: false inputs: - fromindex: [0, -1, 1] - length: 3 + distincts: [0, 0, 0, 0, 0, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1] + gaps: [1, 2, 0] + lendistincts: 15 + outlength: 3 outputs: - toindex: [0, 0, 1] + outstarts: [0, 10, 10] + outstops: [5, 10, 15] - error: false inputs: - fromindex: [0, -1, 1, -1, 2] - length: 5 + distincts: [0, 0] + gaps: [1] + lendistincts: 2 + outlength: 1 outputs: - toindex: [0, 0, 1, 0, 2] + outstarts: [0] + outstops: [2] - error: false inputs: - fromindex: [0, -1, 1, 2] - length: 4 + distincts: [0, 0, 0] + gaps: [1] + lendistincts: 3 + outlength: 1 outputs: - toindex: [0, 0, 1, 2] + outstarts: [0] + outstops: [3] - error: false inputs: - fromindex: [0, 1, -1] - length: 3 + distincts: [0, 0, 0, 1, 1, -1] + gaps: [1, 1] + lendistincts: 6 + outlength: 2 outputs: - toindex: [0, 1, 0] + outstarts: [0, 3] + outstops: [3, 5] - error: false inputs: - fromindex: [0, 1, -1, 2] - length: 4 + distincts: [0, 0, 0, 1, 1, 1] + gaps: [1, 1] + lendistincts: 6 + outlength: 2 outputs: - toindex: [0, 1, 0, 2] + outstarts: [0, 3] + outstops: [3, 6] - error: false inputs: - fromindex: [0, 1, -1, 2, 3, -1, 4] - length: 7 + distincts: [0, 0, 0, 1, 1, -1, 2, -1, -1] + gaps: [1, 1, 1] + lendistincts: 9 + outlength: 3 outputs: - toindex: [0, 1, 0, 2, 3, 0, 4] + outstarts: [0, 3, 6] + outstops: [3, 5, 7] - error: false inputs: - fromindex: [0, 1, 2, -1, -1, -1] - length: 6 + distincts: [0, 0, 0, 1, -1, -1, 2, 1, -1, 3, -1, -1] + gaps: [1, 1, 1, 1] + lendistincts: 12 + outlength: 4 outputs: - toindex: [0, 1, 2, 0, 0, 0] + outstarts: [0, 3, 6, 9] + outstops: [3, 4, 8, 10] - error: false inputs: - fromindex: [0, 1, 2, -1, -1, 3, 4, 5, -1, -1] - length: 10 + distincts: [0, 0, -1, 1, -1, -1, -1, -1, -1, 2, 1, 0] + gaps: [1, 1, 1, 1] + lendistincts: 12 + outlength: 4 outputs: - toindex: [0, 1, 2, 0, 0, 3, 4, 5, 0, 0] + outstarts: [0, 3, 9, 9] + outstops: [2, 4, 9, 12] - error: false inputs: - fromindex: [0, 1, 2, 3, 4, -1, -1] - length: 7 + distincts: [0, 0, 0, 0] + gaps: [1] + lendistincts: 4 + outlength: 1 outputs: - toindex: [0, 1, 2, 3, 4, 0, 0] + outstarts: [0] + outstops: [4] - error: false inputs: - fromindex: [13, 9, 13, 4, 8, 3, 15, -1, 16, 2, 8] - length: 11 + distincts: [0, 0, 0, -1, 1, 1, 1, 0] + gaps: [1, 1] + lendistincts: 8 + outlength: 2 outputs: - toindex: [13, 9, 13, 4, 8, 3, 15, 0, 16, 2, 8] -- name: awkward_UnionArray_filltags - tests: + outstarts: [0, 4] + outstops: [3, 8] - error: false inputs: - base: 0 - fromtags: [0, 0, 0, 1, 1, 1] - length: 6 - totagsoffset: 0 + distincts: [0, 0, 0, 0, 0] + gaps: [1] + lendistincts: 5 + outlength: 1 outputs: - totags: [0, 0, 0, 1, 1, 1] -- name: awkward_UnionArray_project - tests: + outstarts: [0] + outstops: [5] - error: false inputs: - fromindex: [] - fromtags: [] - length: 0 - which: 0 + distincts: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, -1] + gaps: [1, 1, 1] + lendistincts: 15 + outlength: 3 outputs: - lenout: [0] - tocarry: [] + outstarts: [0, 5, 10] + outstops: [5, 10, 14] - error: false inputs: - fromindex: [] - fromtags: [] - length: 0 - which: 1 + distincts: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2] + gaps: [1, 1, 1] + lendistincts: 15 + outlength: 3 outputs: - lenout: [0] - tocarry: [] + outstarts: [0, 5, 10] + outstops: [5, 10, 15] - error: false inputs: - fromindex: [1] - fromtags: [1] - length: 1 - which: 1 + distincts: [0, 0, 0, 0, 0, 1, -1, -1, -1, -1, 2, 1, 1, 1, 1] + gaps: [1, 1, 1] + lendistincts: 15 + outlength: 3 outputs: - lenout: [1] - tocarry: [1] + outstarts: [0, 5, 10] + outstops: [5, 6, 15] - error: false inputs: - fromindex: [0, 0] - fromtags: [1, 1] - length: 2 - which: 1 + distincts: [0, 0, 0, 0, 0, 1, 1, 1, 1, -1, 2, 2, 2, 2, 1] + gaps: [1, 1, 1] + lendistincts: 15 + outlength: 3 outputs: - lenout: [2] - tocarry: [0, 0] + outstarts: [0, 5, 10] + outstops: [5, 9, 15] - error: false inputs: - fromindex: [0, 1] - fromtags: [0, 0] - length: 2 - which: 0 + distincts: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1] + gaps: [1, 1, 0] + lendistincts: 15 + outlength: 3 outputs: - lenout: [2] - tocarry: [0, 1] + outstarts: [0, 5, 16] + outstops: [5, 10, 16] - error: false inputs: - fromindex: [0, 1] - fromtags: [1, 1] - length: 2 - which: 1 + distincts: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1] + gaps: [1, 1] + lendistincts: 10 + outlength: 2 outputs: - lenout: [2] - tocarry: [0, 1] + outstarts: [0, 5] + outstops: [5, 10] - error: false inputs: - fromindex: [2, 3] - fromtags: [0, 0] - length: 2 - which: 0 + distincts: [0, 0, 0, -1, -1, -1, 1, 1, -1] + gaps: [1, 2, 0] + lendistincts: 9 + outlength: 3 outputs: - lenout: [2] - tocarry: [2, 3] + outstarts: [0, 6, 6] + outstops: [3, 6, 8] - error: false inputs: - fromindex: [2, 3] - fromtags: [1, 1] - length: 2 - which: 1 + distincts: [0, 0, 0, -1, -1, -1, 1, 1, 1] + gaps: [1, 1, 1] + lendistincts: 9 + outlength: 3 outputs: - lenout: [2] - tocarry: [2, 3] + outstarts: [0, 6, 6] + outstops: [3, 6, 9] - error: false inputs: - fromindex: [0, 1, 2] - fromtags: [0, 0, 0] - length: 3 - which: 0 + distincts: [0, 0, -1, -1, -1, -1, 1, -1, -1, 2, 1, 0] + gaps: [1, 1, 1, 1] + lendistincts: 12 + outlength: 4 outputs: - lenout: [3] - tocarry: [0, 1, 2] + outstarts: [0, 6, 6, 9] + outstops: [2, 6, 7, 12] - error: false inputs: - fromindex: [0, 1, 2] - fromtags: [1, 1, 1] - length: 3 - which: 1 + distincts: [0, 0, -1, -1, -1, -1, -1, -1, -1, 1, 1, 0] + gaps: [1, 1, 1, 1] + lendistincts: 12 + outlength: 4 outputs: - lenout: [3] - tocarry: [0, 1, 2] + outstarts: [0, 9, 9, 9] + outstops: [2, 9, 9, 12] - error: false inputs: - fromindex: [0, 1, 2, 3, 4] - fromtags: [0, 0, 0, 0, 0] - length: 5 - which: 0 + distincts: [0, 0, 0, -1, -1, -1, -1, -1, -1, 1, 1, 1] + gaps: [1, 1, 1, 1] + lendistincts: 12 + outlength: 4 outputs: - lenout: [5] - tocarry: [0, 1, 2, 3, 4] + outstarts: [0, 9, 9, 9] + outstops: [3, 9, 9, 12] - error: false inputs: - fromindex: [0, 1, 2, 3, 4] - fromtags: [1, 1, 1, 1, 1] - length: 5 - which: 1 + distincts: [] + gaps: [0] + lendistincts: 0 + outlength: 1 outputs: - lenout: [5] - tocarry: [0, 1, 2, 3, 4] -- name: awkward_UnionArray_simplify_one + outstarts: [1] + outstops: [1] +- name: awkward_NumpyArray_reduce_mask_ByteMaskedArray_64 tests: - error: false inputs: - base: 0 - fromindex: [] - fromtags: [] - fromwhich: 0 - length: 0 - towhich: 0 + lenparents: 30 + outlength: 15 + parents: [0, 0, 5, 5, 10, 10, 1, 1, 6, 6, 11, 11, 2, 2, 7, 7, 12, 12, 3, 3, + 8, 8, 13, 13, 4, 4, 9, 9, 14, 14] outputs: - toindex: [] - totags: [] + toptr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - error: false inputs: - base: 0 - fromindex: [0, 0, 0, 0, 0] - fromtags: [1, 1, 1, 1, 1] - fromwhich: 1 - length: 5 - towhich: 0 + lenparents: 30 + outlength: 10 + parents: [0, 0, 0, 5, 5, 5, 1, 1, 1, 6, 6, 6, 2, 2, 2, 7, 7, 7, 3, 3, 3, 8, + 8, 8, 4, 4, 4, 9, 9, 9] outputs: - toindex: [0, 0, 0, 0, 0] - totags: [0, 0, 0, 0, 0] + toptr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] - error: false inputs: - base: 9 - fromindex: [0, 1, 2, 3, 4, 5, 6, 7, 8] - fromtags: [1, 1, 1, 1, 1, 1, 1, 1, 1] - fromwhich: 1 - length: 9 - towhich: 0 + lenparents: 30 + outlength: 6 + parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, + 4, 4, 4, 5, 5, 5, 5, 5] outputs: - toindex: [9, 10, 11, 12, 13, 14, 15, 16, 17] - totags: [0, 0, 0, 0, 0, 0, 0, 0, 0] + toptr: [0, 0, 0, 0, 0, 0] - error: false inputs: - base: 0 - fromindex: [0, 1] - fromtags: [1, 1] - fromwhich: 1 - length: 2 - towhich: 0 + lenparents: 18 + outlength: 6 + parents: [0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 1, 1, 1, 4, 4, 4, 2, 5] outputs: - toindex: [0, 1] - totags: [0, 0] + toptr: [0, 0, 0, 0, 0, 0] - error: false inputs: - base: 0 - fromindex: [0] - fromtags: [1] - fromwhich: 1 - length: 1 - towhich: 0 + lenparents: 21 + outlength: 6 + parents: [0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 1, 1, 1, 4, 4, 4, 4, 2, 5, 5, 5] outputs: - toindex: [0] - totags: [0] + toptr: [0, 0, 0, 0, 0, 0] - error: false inputs: - base: 0 - fromindex: [] - fromtags: [] - fromwhich: 1 - length: 0 - towhich: 0 + lenparents: 20 + outlength: 4 + parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3] outputs: - toindex: [] - totags: [] + toptr: [0, 0, 0, 0] - error: false inputs: - base: 0 - fromindex: [] - fromtags: [] - fromwhich: 1 - length: 0 - towhich: 1 + lenparents: 20 + outlength: 5 + parents: [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4] outputs: - toindex: [] - totags: [] -- name: awkward_localindex - tests: + toptr: [0, 0, 0, 0, 0] - error: false - inputs: {length: 0} + inputs: + lenparents: 15 + outlength: 3 + parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2] outputs: - toindex: [] + toptr: [0, 0, 0] - error: false - inputs: {length: 2} + inputs: + lenparents: 12 + outlength: 3 + parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2] outputs: - toindex: [0, 1] + toptr: [0, 0, 0] - error: false - inputs: {length: 4} + inputs: + lenparents: 15 + outlength: 5 + parents: [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4] outputs: - toindex: [0, 1, 2, 3] + toptr: [0, 0, 0, 0, 0] - error: false - inputs: {length: 5} + inputs: + lenparents: 12 + outlength: 5 + parents: [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4] outputs: - toindex: [0, 1, 2, 3, 4] -- name: awkward_zero_mask - tests: + toptr: [0, 0, 0, 0, 0] - error: false - inputs: {length: 5} + inputs: + lenparents: 9 + outlength: 5 + parents: [0, 0, 0, 1, 1, 2, 2, 3, 4] outputs: - tomask: [0, 0, 0, 0, 0] -- name: awkward_BitMaskedArray_to_IndexedOptionArray - tests: + toptr: [0, 0, 0, 0, 0] + - error: false + inputs: + lenparents: 10 + outlength: 2 + parents: [0, 0, 0, 0, 0, 1, 1, 1, 1, 1] + outputs: + toptr: [0, 0] - error: false inputs: - bitmasklength: 2 - frombitmask: [58, 59] - lsb_order: false - validwhen: false + lenparents: 10 + outlength: 4 + parents: [0, 0, 0, 1, 1, 1, 2, 2, 2, 3] outputs: - toindex: [0, 1, -1, -1, -1, 5, -1, 7, 8, 9, -1, -1, -1, 13, -1, -1] + toptr: [0, 0, 0, 0] - error: false inputs: - bitmasklength: 2 - frombitmask: [58, 59] - lsb_order: true - validwhen: false + lenparents: 7 + outlength: 4 + parents: [0, 0, 0, 1, 1, 2, 3] outputs: - toindex: [0, -1, 2, -1, -1, -1, 6, 7, -1, -1, 10, -1, -1, -1, 14, 15] -- name: awkward_ListArray_getitem_jagged_shrink - tests: + toptr: [0, 0, 0, 0] - error: false inputs: - length: 1 - missing: [0, 0, 0, 0] - slicestarts: [0, 1, 1, 1] - slicestops: [4] + lenparents: 10 + outlength: 4 + parents: [0, 0, 0, 1, 2, 2, 2, 3, 3, 3] outputs: - tocarry: [0, 1, 2, 3] - tolargeoffsets: [0, 4] - tosmalloffsets: [0, 4] + toptr: [0, 0, 0, 0] - error: false inputs: - length: 2 - missing: [0, 0, 0, 0] - slicestarts: [0, 2, 2] - slicestops: [2, 2, 3] + lenparents: 9 + outlength: 5 + parents: [0, 0, 3, 3, 1, 1, 4, 4, 2] outputs: - tocarry: [0, 1] - tolargeoffsets: [0, 2, 2] - tosmalloffsets: [0, 2, 2] + toptr: [0, 0, 0, 0, 0] - error: false inputs: - length: 2 - missing: [0, 0, 0, 0] - slicestarts: [0, 2, 2] - slicestops: [2, 2, 4] + lenparents: 10 + outlength: 3 + parents: [0, 0, 0, 1, 1, 1, 2, 2, 2, 2] outputs: - tocarry: [0, 1] - tolargeoffsets: [0, 2, 2] - tosmalloffsets: [0, 2, 2] + toptr: [0, 0, 0] - error: false inputs: - length: 3 - missing: [0, 0, 0, 0] - slicestarts: [0, 2, 3, 3] - slicestops: [2, 3, 3, 4] + lenparents: 6 + outlength: 3 + parents: [0, 0, 0, 1, 1, 2] outputs: - tocarry: [0, 1, 2] - tolargeoffsets: [0, 2, 3, 3] - tosmalloffsets: [0, 2, 3, 3] + toptr: [0, 0, 0] - error: false inputs: - length: 3 - missing: [0, 0, 0, 0] - slicestarts: [0, 2, 3, 3] - slicestops: [2, 3, 3, 6] + lenparents: 5 + outlength: 1 + parents: [0, 0, 0, 0, 0] outputs: - tocarry: [0, 1, 2] - tolargeoffsets: [0, 2, 3, 3] - tosmalloffsets: [0, 2, 3, 3] -- name: awkward_NumpyArray_getitem_boolean_nonzero - tests: + toptr: [0] - error: false inputs: - fromptr: [0, 0, 0, 0, 4] - length: 1 - stride: 1 + lenparents: 6 + outlength: 3 + parents: [0, 0, 1, 1, 1, 2] outputs: - toptr: [] + toptr: [0, 0, 0] - error: false inputs: - fromptr: [1, 0, 0, 0, 4] - length: 1 - stride: 1 + lenparents: 5 + outlength: 3 + parents: [0, 0, 1, 2, 2] outputs: - toptr: [0] + toptr: [0, 0, 0] - error: false inputs: - fromptr: [0, 0, 0, 3] - length: 1 - stride: 1 + lenparents: 6 + outlength: 3 + parents: [0, 1, 1, 2, 2, 2] outputs: - toptr: [] + toptr: [0, 0, 0] - error: false inputs: - fromptr: [0, 0, 2] - length: 1 - stride: 1 + lenparents: 22 + outlength: 8 + parents: [0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 1, 1, 1, 5, 5, 5, 5, 2, 6, 6, 6, 7] outputs: - toptr: [] + toptr: [0, 0, 0, 1, 0, 0, 0, 0] - error: false inputs: - fromptr: [0, 1] - length: 1 - stride: 1 + lenparents: 9 + outlength: 5 + parents: [0, 0, 0, 1, 2, 2, 4, 4, 4] outputs: - toptr: [] -- name: awkward_Content_getitem_next_missing_jagged_getmaskstartstop - tests: + toptr: [0, 0, 0, 1, 0] - error: false inputs: - index_in: [0, -1] - length: 2 - offsets_in: [0, 1] + lenparents: 9 + outlength: 8 + parents: [0, 0, 0, 6, 6, 1, 1, 7, 2] outputs: - mask_out: [0, -1] - starts_out: [0, 1] - stops_out: [1, 1] + toptr: [0, 0, 0, 1, 1, 1, 0, 0] - error: false inputs: - index_in: [0, -1] - length: 2 - offsets_in: [0, 4] + lenparents: 12 + outlength: 9 + parents: [0, 0, 6, 6, 1, 1, 7, 7, 2, 2, 8, 8] outputs: - mask_out: [0, -1] - starts_out: [0, 4] - stops_out: [4, 4] + toptr: [0, 0, 0, 1, 1, 1, 0, 0, 0] - error: false inputs: - index_in: [0, -1, -1] - length: 3 - offsets_in: [0, 1] + lenparents: 6 + outlength: 4 + parents: [0, 0, 1, 1, 1, 3] outputs: - mask_out: [0, -1, -1] - starts_out: [0, 1, 1] - stops_out: [1, 1, 1] + toptr: [0, 0, 1, 0] - error: false inputs: - index_in: [0, -1, 1] - length: 3 - offsets_in: [0, 1, 2] + lenparents: 6 + outlength: 4 + parents: [0, 0, 1, 3, 3, 3] outputs: - mask_out: [0, -1, 2] - starts_out: [0, 1, 1] - stops_out: [1, 1, 2] + toptr: [0, 0, 1, 0] - error: false inputs: - index_in: [0, -1, 1] - length: 3 - offsets_in: [0, 2, 4] + lenparents: 9 + outlength: 4 + parents: [0, 0, 0, 0, 0, 2, 2, 2, 3] outputs: - mask_out: [0, -1, 2] - starts_out: [0, 2, 2] - stops_out: [2, 2, 4] + toptr: [0, 1, 0, 0] - error: false inputs: - index_in: [0, -1, -1, 1] - length: 4 - offsets_in: [0, 0, 0] + lenparents: 9 + outlength: 6 + parents: [0, 0, 0, 2, 2, 3, 4, 4, 5] outputs: - mask_out: [0, -1, -1, 3] - starts_out: [0, 0, 0, 0] - stops_out: [0, 0, 0, 0] + toptr: [0, 1, 0, 0, 0, 0] - error: false inputs: - index_in: [0, -1, -1, 1] - length: 4 - offsets_in: [0, 1, 2] + lenparents: 9 + outlength: 5 + parents: [0, 0, 0, 2, 2, 3, 4, 4, 4] outputs: - mask_out: [0, -1, -1, 3] - starts_out: [0, 1, 1, 1] - stops_out: [1, 1, 1, 2] + toptr: [0, 1, 0, 0, 0] - error: false inputs: - index_in: [0, -1, 1, -1] - length: 4 - offsets_in: [0, 2, 3] + lenparents: 6 + outlength: 3 + parents: [0, 0, 0, 2, 2, 2] outputs: - mask_out: [0, -1, 2, -1] - starts_out: [0, 2, 2, 3] - stops_out: [2, 2, 3, 3] + toptr: [0, 1, 0] - error: false inputs: - index_in: [0, -1, 1, -1, 2] - length: 5 - offsets_in: [0, 2, 2, 4] + lenparents: 3 + outlength: 3 + parents: [0, 0, 2] outputs: - mask_out: [0, -1, 2, -1, 4] - starts_out: [0, 2, 2, 2, 2] - stops_out: [2, 2, 2, 2, 4] + toptr: [0, 1, 0] - error: false inputs: - index_in: [0, 1, -1, 2] - length: 4 - offsets_in: [0, 0, 0, 0] + lenparents: 9 + outlength: 7 + parents: [0, 0, 0, 2, 2, 3, 6, 6, 6] outputs: - mask_out: [0, 1, -1, 3] - starts_out: [0, 0, 0, 0] - stops_out: [0, 0, 0, 0] + toptr: [0, 1, 0, 0, 1, 1, 0] +- name: awkward_UnionArray_fillna + tests: - error: false inputs: - index_in: [0, 1, -1, 2] - length: 4 - offsets_in: [0, 0, 1, 1] + fromindex: [-1, -1, -1, -1, -1] + length: 5 outputs: - mask_out: [0, 1, -1, 3] - starts_out: [0, 0, 1, 1] - stops_out: [0, 1, 1, 1] + toindex: [0, 0, 0, 0, 0] - error: false inputs: - index_in: [0, -1, 1, 2] - length: 4 - offsets_in: [0, 1, 2, 3] + fromindex: [-1, -1, 0, -1, 1, 2, 3, 4, 5, -1, -1, -1] + length: 12 outputs: - mask_out: [0, -1, 2, 3] - starts_out: [0, 1, 1, 2] - stops_out: [1, 1, 2, 3] + toindex: [0, 0, 0, 0, 1, 2, 3, 4, 5, 0, 0, 0] - error: false inputs: - index_in: [0, 1, -1, 2] + fromindex: [-1, 0, 1, -1] length: 4 - offsets_in: [0, 2, 3, 3] outputs: - mask_out: [0, 1, -1, 3] - starts_out: [0, 2, 3, 3] - stops_out: [2, 3, 3, 3] + toindex: [0, 0, 1, 0] - error: false inputs: - index_in: [0, 1, -1, 2] - length: 4 - offsets_in: [0, 2, 3, 4] + fromindex: [0, -1, 1] + length: 3 outputs: - mask_out: [0, 1, -1, 3] - starts_out: [0, 2, 3, 3] - stops_out: [2, 3, 3, 4] + toindex: [0, 0, 1] - error: false inputs: - index_in: [0, 1, -1, 2] - length: 4 - offsets_in: [0, 2, 3, 5] + fromindex: [0, -1, 1, -1, 2] + length: 5 outputs: - mask_out: [0, 1, -1, 3] - starts_out: [0, 2, 3, 3] - stops_out: [2, 3, 3, 5] + toindex: [0, 0, 1, 0, 2] - error: false inputs: - index_in: [0, -1, 1, 2] + fromindex: [0, -1, 1, 2] length: 4 - offsets_in: [0, 2, 3, 5] outputs: - mask_out: [0, -1, 2, 3] - starts_out: [0, 2, 2, 3] - stops_out: [2, 2, 3, 5] + toindex: [0, 0, 1, 2] - error: false inputs: - index_in: [0, 1, -1, 2] - length: 4 - offsets_in: [0, 2, 3, 6] + fromindex: [0, 1, -1] + length: 3 outputs: - mask_out: [0, 1, -1, 3] - starts_out: [0, 2, 3, 3] - stops_out: [2, 3, 3, 6] + toindex: [0, 1, 0] - error: false inputs: - index_in: [0, 1, -1, 2] + fromindex: [0, 1, -1, 2] length: 4 - offsets_in: [0, 2, 4, 5] outputs: - mask_out: [0, 1, -1, 3] - starts_out: [0, 2, 4, 4] - stops_out: [2, 4, 4, 5] + toindex: [0, 1, 0, 2] - error: false inputs: - index_in: [0, -1, 1, 2] - length: 4 - offsets_in: [0, 3, 3, 4] + fromindex: [0, 1, -1, 2, 3, -1, 4] + length: 7 outputs: - mask_out: [0, -1, 2, 3] - starts_out: [0, 3, 3, 3] - stops_out: [3, 3, 3, 4] + toindex: [0, 1, 0, 2, 3, 0, 4] - error: false inputs: - index_in: [0, 1, -1, 2] - length: 4 - offsets_in: [0, 3, 3, 5] + fromindex: [0, 1, 2, -1, -1, -1] + length: 6 outputs: - mask_out: [0, 1, -1, 3] - starts_out: [0, 3, 3, 3] - stops_out: [3, 3, 3, 5] + toindex: [0, 1, 2, 0, 0, 0] - error: false inputs: - index_in: [0, 1, -1, 2] - length: 4 - offsets_in: [0, 4, 5, 6] + fromindex: [0, 1, 2, -1, -1, 3, 4, 5, -1, -1] + length: 10 outputs: - mask_out: [0, 1, -1, 3] - starts_out: [0, 4, 5, 5] - stops_out: [4, 5, 5, 6] + toindex: [0, 1, 2, 0, 0, 3, 4, 5, 0, 0] - error: false inputs: - index_in: [0, -1, 1, 2] - length: 4 - offsets_in: [0, 4, 5, 6] + fromindex: [0, 1, 2, 3, 4, -1, -1] + length: 7 outputs: - mask_out: [0, -1, 2, 3] - starts_out: [0, 4, 4, 5] - stops_out: [4, 4, 5, 6] + toindex: [0, 1, 2, 3, 4, 0, 0] - error: false inputs: - index_in: [0, -1, 1, 2, -1, 3, 4, 5] - length: 8 - offsets_in: [0, 2, 4, 6, 8, 10, 12] + fromindex: [13, 9, 13, 4, 8, 3, 15, -1, 16, 2, 8] + length: 11 outputs: - mask_out: [0, -1, 2, 3, -1, 5, 6, 7] - starts_out: [0, 2, 2, 4, 6, 6, 8, 10] - stops_out: [2, 2, 4, 6, 6, 8, 10, 12] + toindex: [13, 9, 13, 4, 8, 3, 15, 0, 16, 2, 8] +- name: awkward_UnionArray_filltags + tests: - error: false inputs: - index_in: [0, -1, 1, 2, 3, 4, 5, 6] - length: 8 - offsets_in: [0, 1, 1, 1, 1, 1, 1, 1] + base: 0 + fromtags: [0, 0, 0, 1, 1, 1] + length: 6 + totagsoffset: 0 outputs: - mask_out: [0, -1, 2, 3, 4, 5, 6, 7] - starts_out: [0, 1, 1, 1, 1, 1, 1, 1] - stops_out: [1, 1, 1, 1, 1, 1, 1, 1] -- name: awkward_IndexedArray_getitem_nextcarry_outindex_mask + totags: [0, 0, 0, 1, 1, 1] +- name: awkward_UnionArray_project tests: - error: false inputs: - fromindex: [0] - lencontent: 1 - lenindex: 1 + fromindex: [] + fromtags: [] + length: 0 + which: 0 outputs: - tocarry: [0] - toindex: [0] + lenout: [0] + tocarry: [] - error: false inputs: - fromindex: [0, -1] - lencontent: 1 - lenindex: 2 + fromindex: [] + fromtags: [] + length: 0 + which: 1 outputs: - tocarry: [0] - toindex: [0, -1] + lenout: [0] + tocarry: [] - error: false inputs: - fromindex: [0, -1, -1] - lencontent: 1 - lenindex: 3 + fromindex: [1] + fromtags: [1] + length: 1 + which: 1 outputs: - tocarry: [0] - toindex: [0, -1, -1] + lenout: [1] + tocarry: [1] - error: false inputs: - fromindex: [0, -1, -1, -1, -1] - lencontent: 1 - lenindex: 5 + fromindex: [0, 0] + fromtags: [1, 1] + length: 2 + which: 1 outputs: - tocarry: [0] - toindex: [0, -1, -1, -1, -1] + lenout: [2] + tocarry: [0, 0] - error: false inputs: - fromindex: [0, -1, -1, -1, -1, -1] - lencontent: 1 - lenindex: 6 + fromindex: [0, 1] + fromtags: [0, 0] + length: 2 + which: 0 outputs: - tocarry: [0] - toindex: [0, -1, -1, -1, -1, -1] + lenout: [2] + tocarry: [0, 1] - error: false inputs: - fromindex: [0, -1, 1] - lencontent: 2 - lenindex: 3 + fromindex: [0, 1] + fromtags: [1, 1] + length: 2 + which: 1 outputs: + lenout: [2] tocarry: [0, 1] - toindex: [0, -1, 1] - error: false inputs: - fromindex: [-1, 0, -1] - lencontent: 1 - lenindex: 3 + fromindex: [2, 3] + fromtags: [0, 0] + length: 2 + which: 0 outputs: - tocarry: [0] - toindex: [-1, 0, -1] + lenout: [2] + tocarry: [2, 3] - error: false inputs: - fromindex: [0, -1, -1, 1] - lencontent: 2 - lenindex: 4 + fromindex: [2, 3] + fromtags: [1, 1] + length: 2 + which: 1 outputs: - tocarry: [0, 1] - toindex: [0, -1, -1, 1] + lenout: [2] + tocarry: [2, 3] - error: false inputs: - fromindex: [0, -1, 1, -1] - lencontent: 2 - lenindex: 4 + fromindex: [0, 1, 2] + fromtags: [0, 0, 0] + length: 3 + which: 0 outputs: - tocarry: [0, 1] - toindex: [0, -1, 1, -1] + lenout: [3] + tocarry: [0, 1, 2] - error: false inputs: - fromindex: [0, 1, -1, -1] - lencontent: 2 - lenindex: 4 + fromindex: [0, 1, 2] + fromtags: [1, 1, 1] + length: 3 + which: 1 outputs: - tocarry: [0, 1] - toindex: [0, 1, -1, -1] + lenout: [3] + tocarry: [0, 1, 2] - error: false inputs: - fromindex: [0, -1, -1, -1, 1] - lencontent: 2 - lenindex: 5 + fromindex: [0, 1, 2, 3, 4] + fromtags: [0, 0, 0, 0, 0] + length: 5 + which: 0 outputs: - tocarry: [0, 1] - toindex: [0, -1, -1, -1, 1] + lenout: [5] + tocarry: [0, 1, 2, 3, 4] - error: false inputs: - fromindex: [0, -1, -1, 1, -1] - lencontent: 2 - lenindex: 5 + fromindex: [0, 1, 2, 3, 4] + fromtags: [1, 1, 1, 1, 1] + length: 5 + which: 1 outputs: - tocarry: [0, 1] - toindex: [0, -1, -1, 1, -1] + lenout: [5] + tocarry: [0, 1, 2, 3, 4] +- name: awkward_UnionArray_simplify_one + tests: - error: false inputs: - fromindex: [0, -1, 1, -1, -1] - lencontent: 2 - lenindex: 5 + base: 0 + fromindex: [] + fromtags: [] + fromwhich: 0 + length: 0 + towhich: 0 outputs: - tocarry: [0, 1] - toindex: [0, -1, 1, -1, -1] + toindex: [] + totags: [] - error: false inputs: - fromindex: [0, 1, -1, -1, -1] - lencontent: 2 - lenindex: 5 + base: 0 + fromindex: [0, 0, 0, 0, 0] + fromtags: [1, 1, 1, 1, 1] + fromwhich: 1 + length: 5 + towhich: 0 outputs: - tocarry: [0, 1] - toindex: [0, 1, -1, -1, -1] + toindex: [0, 0, 0, 0, 0] + totags: [0, 0, 0, 0, 0] - error: false inputs: - fromindex: [-1, 0, -1, -1, -1] - lencontent: 1 - lenindex: 5 + base: 9 + fromindex: [0, 1, 2, 3, 4, 5, 6, 7, 8] + fromtags: [1, 1, 1, 1, 1, 1, 1, 1, 1] + fromwhich: 1 + length: 9 + towhich: 0 outputs: - tocarry: [0] - toindex: [-1, 0, -1, -1, -1] + toindex: [9, 10, 11, 12, 13, 14, 15, 16, 17] + totags: [0, 0, 0, 0, 0, 0, 0, 0, 0] - error: false inputs: - fromindex: [-1, 0, -1, -1, 1] - lencontent: 2 - lenindex: 5 + base: 0 + fromindex: [0, 1] + fromtags: [1, 1] + fromwhich: 1 + length: 2 + towhich: 0 outputs: - tocarry: [0, 1] - toindex: [-1, 0, -1, -1, 1] + toindex: [0, 1] + totags: [0, 0] - error: false inputs: - fromindex: [-1, 0, -1, 1, -1] - lencontent: 2 - lenindex: 5 + base: 0 + fromindex: [0] + fromtags: [1] + fromwhich: 1 + length: 1 + towhich: 0 outputs: - tocarry: [0, 1] - toindex: [-1, 0, -1, 1, -1] + toindex: [0] + totags: [0] - error: false inputs: - fromindex: [-1, 0, 1, -1, -1] - lencontent: 2 - lenindex: 5 + base: 0 + fromindex: [] + fromtags: [] + fromwhich: 1 + length: 0 + towhich: 0 + outputs: + toindex: [] + totags: [] + - error: false + inputs: + base: 0 + fromindex: [] + fromtags: [] + fromwhich: 1 + length: 0 + towhich: 1 outputs: - tocarry: [0, 1] - toindex: [-1, 0, 1, -1, -1] + toindex: [] + totags: [] +- name: awkward_localindex + tests: - error: false - inputs: - fromindex: [-1, -1, 0, -1, -1] - lencontent: 1 - lenindex: 5 + inputs: {length: 0} outputs: - tocarry: [0] - toindex: [-1, -1, 0, -1, -1] + toindex: [] - error: false - inputs: - fromindex: [-1, -1, 0, -1, 1] - lencontent: 2 - lenindex: 5 + inputs: {length: 2} outputs: - tocarry: [0, 1] - toindex: [-1, -1, 0, -1, 1] + toindex: [0, 1] - error: false - inputs: - fromindex: [-1, -1, 0, 1, -1] - lencontent: 2 - lenindex: 5 + inputs: {length: 4} outputs: - tocarry: [0, 1] - toindex: [-1, -1, 0, 1, -1] + toindex: [0, 1, 2, 3] - error: false - inputs: - fromindex: [-1, -1, -1, 0, -1] - lencontent: 1 - lenindex: 5 + inputs: {length: 5} outputs: - tocarry: [0] - toindex: [-1, -1, -1, 0, -1] + toindex: [0, 1, 2, 3, 4] +- name: awkward_BitMaskedArray_to_IndexedOptionArray + tests: - error: false inputs: - fromindex: [-1, -1, -1, 0, 1] - lencontent: 2 - lenindex: 5 + bitmasklength: 2 + frombitmask: [58, 59] + lsb_order: false + validwhen: false outputs: - tocarry: [0, 1] - toindex: [-1, -1, -1, 0, 1] + toindex: [0, 1, -1, -1, -1, 5, -1, 7, 8, 9, -1, -1, -1, 13, -1, -1] - error: false inputs: - fromindex: [-1, -1, -1, -1, 0] - lencontent: 1 - lenindex: 5 + bitmasklength: 2 + frombitmask: [58, 59] + lsb_order: true + validwhen: false outputs: - tocarry: [0] - toindex: [-1, -1, -1, -1, 0] + toindex: [0, -1, 2, -1, -1, -1, 6, 7, -1, -1, 10, -1, -1, -1, 14, 15] +- name: awkward_ListArray_getitem_jagged_shrink + tests: - error: false inputs: - fromindex: [0, -1, -1, 1, -1, 2] - lencontent: 3 - lenindex: 6 + length: 1 + missing: [0, 0, 0, 0] + slicestarts: [0, 1, 1, 1] + slicestops: [4] outputs: - tocarry: [0, 1, 2] - toindex: [0, -1, -1, 1, -1, 2] + tocarry: [0, 1, 2, 3] + tolargeoffsets: [0, 4] + tosmalloffsets: [0, 4] - error: false inputs: - fromindex: [0, -1, -1, 1, 2] - lencontent: 3 - lenindex: 5 + length: 2 + missing: [0, 0, 0, 0] + slicestarts: [0, 2, 2] + slicestops: [2, 2, 3] outputs: - tocarry: [0, 1, 2] - toindex: [0, -1, -1, 1, 2] + tocarry: [0, 1] + tolargeoffsets: [0, 2, 2] + tosmalloffsets: [0, 2, 2] - error: false inputs: - fromindex: [0, -1, 1, -1, 2] - lencontent: 3 - lenindex: 5 + length: 2 + missing: [0, 0, 0, 0] + slicestarts: [0, 2, 2] + slicestops: [2, 2, 4] outputs: - tocarry: [0, 1, 2] - toindex: [0, -1, 1, -1, 2] + tocarry: [0, 1] + tolargeoffsets: [0, 2, 2] + tosmalloffsets: [0, 2, 2] - error: false inputs: - fromindex: [0, 1, -1, -1, 2] - lencontent: 3 - lenindex: 5 + length: 3 + missing: [0, 0, 0, 0] + slicestarts: [0, 2, 3, 3] + slicestops: [2, 3, 3, 4] outputs: tocarry: [0, 1, 2] - toindex: [0, 1, -1, -1, 2] + tolargeoffsets: [0, 2, 3, 3] + tosmalloffsets: [0, 2, 3, 3] - error: false inputs: - fromindex: [0, -1, 1, 2] - lencontent: 3 - lenindex: 4 + length: 3 + missing: [0, 0, 0, 0] + slicestarts: [0, 2, 3, 3] + slicestops: [2, 3, 3, 6] outputs: tocarry: [0, 1, 2] - toindex: [0, -1, 1, 2] + tolargeoffsets: [0, 2, 3, 3] + tosmalloffsets: [0, 2, 3, 3] +- name: awkward_Content_getitem_next_missing_jagged_getmaskstartstop + tests: - error: false inputs: - fromindex: [0, 1, -1, 2] - lencontent: 3 - lenindex: 4 + index_in: [0, -1] + length: 2 + offsets_in: [0, 1] outputs: - tocarry: [0, 1, 2] - toindex: [0, 1, -1, 2] + mask_out: [0, -1] + starts_out: [0, 1] + stops_out: [1, 1] - error: false inputs: - fromindex: [0, -1, 1, 2, -1] - lencontent: 3 - lenindex: 5 + index_in: [0, -1] + length: 2 + offsets_in: [0, 4] outputs: - tocarry: [0, 1, 2] - toindex: [0, -1, 1, 2, -1] + mask_out: [0, -1] + starts_out: [0, 4] + stops_out: [4, 4] - error: false inputs: - fromindex: [0, 1, -1, 2, -1] - lencontent: 3 - lenindex: 5 + index_in: [0, -1, -1] + length: 3 + offsets_in: [0, 1] outputs: - tocarry: [0, 1, 2] - toindex: [0, 1, -1, 2, -1] + mask_out: [0, -1, -1] + starts_out: [0, 1, 1] + stops_out: [1, 1, 1] - error: false inputs: - fromindex: [0, 1, 2] - lencontent: 3 - lenindex: 3 + index_in: [0, -1, 1] + length: 3 + offsets_in: [0, 1, 2] outputs: - tocarry: [0, 1, 2] - toindex: [0, 1, 2] + mask_out: [0, -1, 2] + starts_out: [0, 1, 1] + stops_out: [1, 1, 2] - error: false inputs: - fromindex: [0, 1, 2, -1] - lencontent: 3 - lenindex: 4 + index_in: [0, -1, 1] + length: 3 + offsets_in: [0, 2, 4] outputs: - tocarry: [0, 1, 2] - toindex: [0, 1, 2, -1] + mask_out: [0, -1, 2] + starts_out: [0, 2, 2] + stops_out: [2, 2, 4] - error: false inputs: - fromindex: [0, 1, 2, -1, -1] - lencontent: 3 - lenindex: 5 + index_in: [0, -1, -1, 1] + length: 4 + offsets_in: [0, 0, 0] outputs: - tocarry: [0, 1, 2] - toindex: [0, 1, 2, -1, -1] + mask_out: [0, -1, -1, 3] + starts_out: [0, 0, 0, 0] + stops_out: [0, 0, 0, 0] - error: false inputs: - fromindex: [-1, 0, -1, 1, 2] - lencontent: 3 - lenindex: 5 + index_in: [0, -1, -1, 1] + length: 4 + offsets_in: [0, 1, 2] outputs: - tocarry: [0, 1, 2] - toindex: [-1, 0, -1, 1, 2] + mask_out: [0, -1, -1, 3] + starts_out: [0, 1, 1, 1] + stops_out: [1, 1, 1, 2] - error: false inputs: - fromindex: [-1, 0, 1, -1, 2] - lencontent: 3 - lenindex: 5 + index_in: [0, -1, 1, -1] + length: 4 + offsets_in: [0, 2, 3] outputs: - tocarry: [0, 1, 2] - toindex: [-1, 0, 1, -1, 2] + mask_out: [0, -1, 2, -1] + starts_out: [0, 2, 2, 3] + stops_out: [2, 2, 3, 3] - error: false inputs: - fromindex: [-1, 0, 1, 2, -1] - lencontent: 3 - lenindex: 5 + index_in: [0, -1, 1, -1, 2] + length: 5 + offsets_in: [0, 2, 2, 4] outputs: - tocarry: [0, 1, 2] - toindex: [-1, 0, 1, 2, -1] + mask_out: [0, -1, 2, -1, 4] + starts_out: [0, 2, 2, 2, 2] + stops_out: [2, 2, 2, 2, 4] - error: false inputs: - fromindex: [-1, -1, 0, 1, 2] - lencontent: 3 - lenindex: 5 + index_in: [0, 1, -1, 2] + length: 4 + offsets_in: [0, 0, 0, 0] outputs: - tocarry: [0, 1, 2] - toindex: [-1, -1, 0, 1, 2] + mask_out: [0, 1, -1, 3] + starts_out: [0, 0, 0, 0] + stops_out: [0, 0, 0, 0] - error: false inputs: - fromindex: [0, 1, -1, -1, 2, 3] - lencontent: 4 - lenindex: 6 + index_in: [0, 1, -1, 2] + length: 4 + offsets_in: [0, 0, 1, 1] outputs: - tocarry: [0, 1, 2, 3] - toindex: [0, 1, -1, -1, 2, 3] + mask_out: [0, 1, -1, 3] + starts_out: [0, 0, 1, 1] + stops_out: [0, 1, 1, 1] - error: false inputs: - fromindex: [0, -1, 1, 2, -1, 3] - lencontent: 4 - lenindex: 6 + index_in: [0, -1, 1, 2] + length: 4 + offsets_in: [0, 1, 2, 3] outputs: - tocarry: [0, 1, 2, 3] - toindex: [0, -1, 1, 2, -1, 3] + mask_out: [0, -1, 2, 3] + starts_out: [0, 1, 1, 2] + stops_out: [1, 1, 2, 3] - error: false inputs: - fromindex: [0, -1, 1, 2, 3] - lencontent: 4 - lenindex: 5 + index_in: [0, 1, -1, 2] + length: 4 + offsets_in: [0, 2, 3, 3] outputs: - tocarry: [0, 1, 2, 3] - toindex: [0, -1, 1, 2, 3] + mask_out: [0, 1, -1, 3] + starts_out: [0, 2, 3, 3] + stops_out: [2, 3, 3, 3] - error: false inputs: - fromindex: [0, 1, -1, 2, 3] - lencontent: 4 - lenindex: 5 + index_in: [0, 1, -1, 2] + length: 4 + offsets_in: [0, 2, 3, 4] outputs: - tocarry: [0, 1, 2, 3] - toindex: [0, 1, -1, 2, 3] + mask_out: [0, 1, -1, 3] + starts_out: [0, 2, 3, 3] + stops_out: [2, 3, 3, 4] - error: false inputs: - fromindex: [0, 1, 2, -1, 3] - lencontent: 4 - lenindex: 5 + index_in: [0, 1, -1, 2] + length: 4 + offsets_in: [0, 2, 3, 5] outputs: - tocarry: [0, 1, 2, 3] - toindex: [0, 1, 2, -1, 3] + mask_out: [0, 1, -1, 3] + starts_out: [0, 2, 3, 3] + stops_out: [2, 3, 3, 5] - error: false inputs: - fromindex: [0, 1, 2, 3, -1] - lencontent: 4 - lenindex: 5 + index_in: [0, -1, 1, 2] + length: 4 + offsets_in: [0, 2, 3, 5] outputs: - tocarry: [0, 1, 2, 3] - toindex: [0, 1, 2, 3, -1] + mask_out: [0, -1, 2, 3] + starts_out: [0, 2, 2, 3] + stops_out: [2, 2, 3, 5] - error: false inputs: - fromindex: [-1, 0, 1, 2, 3] - lencontent: 4 - lenindex: 5 + index_in: [0, 1, -1, 2] + length: 4 + offsets_in: [0, 2, 3, 6] outputs: - tocarry: [0, 1, 2, 3] - toindex: [-1, 0, 1, 2, 3] + mask_out: [0, 1, -1, 3] + starts_out: [0, 2, 3, 3] + stops_out: [2, 3, 3, 6] - error: false inputs: - fromindex: [0, 1, -1, 2, 3, 4] - lencontent: 5 - lenindex: 6 + index_in: [0, 1, -1, 2] + length: 4 + offsets_in: [0, 2, 4, 5] outputs: - tocarry: [0, 1, 2, 3, 4] - toindex: [0, 1, -1, 2, 3, 4] + mask_out: [0, 1, -1, 3] + starts_out: [0, 2, 4, 4] + stops_out: [2, 4, 4, 5] - error: false inputs: - fromindex: [0, 1, 2, -1, 3, -1, 4] - lencontent: 5 - lenindex: 7 + index_in: [0, -1, 1, 2] + length: 4 + offsets_in: [0, 3, 3, 4] outputs: - tocarry: [0, 1, 2, 3, 4] - toindex: [0, 1, 2, -1, 3, -1, 4] + mask_out: [0, -1, 2, 3] + starts_out: [0, 3, 3, 3] + stops_out: [3, 3, 3, 4] - error: false inputs: - fromindex: [0, 1, 2, -1, 3, 4] - lencontent: 5 - lenindex: 6 + index_in: [0, 1, -1, 2] + length: 4 + offsets_in: [0, 3, 3, 5] outputs: - tocarry: [0, 1, 2, 3, 4] - toindex: [0, 1, 2, -1, 3, 4] + mask_out: [0, 1, -1, 3] + starts_out: [0, 3, 3, 3] + stops_out: [3, 3, 3, 5] - error: false inputs: - fromindex: [0, 1, 2, 3, -1, 4] - lencontent: 5 - lenindex: 6 + index_in: [0, 1, -1, 2] + length: 4 + offsets_in: [0, 4, 5, 6] outputs: - tocarry: [0, 1, 2, 3, 4] - toindex: [0, 1, 2, 3, -1, 4] + mask_out: [0, 1, -1, 3] + starts_out: [0, 4, 5, 5] + stops_out: [4, 5, 5, 6] - error: false inputs: - fromindex: [0, -1, 1, 2, -1, 3, 4, 5] - lencontent: 6 - lenindex: 8 + index_in: [0, -1, 1, 2] + length: 4 + offsets_in: [0, 4, 5, 6] outputs: - tocarry: [0, 1, 2, 3, 4, 5] - toindex: [0, -1, 1, 2, -1, 3, 4, 5] + mask_out: [0, -1, 2, 3] + starts_out: [0, 4, 4, 5] + stops_out: [4, 4, 5, 6] - error: false inputs: - fromindex: [0, 1, -1, 2, 3, 4, -1, 5] - lencontent: 6 - lenindex: 8 + index_in: [0, -1, 1, 2, -1, 3, 4, 5] + length: 8 + offsets_in: [0, 2, 4, 6, 8, 10, 12] outputs: - tocarry: [0, 1, 2, 3, 4, 5] - toindex: [0, 1, -1, 2, 3, 4, -1, 5] + mask_out: [0, -1, 2, 3, -1, 5, 6, 7] + starts_out: [0, 2, 2, 4, 6, 6, 8, 10] + stops_out: [2, 2, 4, 6, 6, 8, 10, 12] - error: false inputs: - fromindex: [0, 1, -1, 2, 3, 4, 5] - lencontent: 6 - lenindex: 7 + index_in: [0, -1, 1, 2, 3, 4, 5, 6] + length: 8 + offsets_in: [0, 1, 1, 1, 1, 1, 1, 1] outputs: - tocarry: [0, 1, 2, 3, 4, 5] - toindex: [0, 1, -1, 2, 3, 4, 5] + mask_out: [0, -1, 2, 3, 4, 5, 6, 7] + starts_out: [0, 1, 1, 1, 1, 1, 1, 1] + stops_out: [1, 1, 1, 1, 1, 1, 1, 1] - name: awkward_reduce_sum_bool tests: - error: false @@ -21210,371 +13509,6 @@ unit-tests: parents: [0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 1, 1, 1, 4, 4, 4, 4, 2, 5, 5, 5] outputs: toptr: [0, 10, 17, 5, 14, 20] -- name: awkward_Identities_from_RegularArray - tests: - - error: false - inputs: - fromlength: 3 - fromptr: [0, 1, 2] - fromwidth: 1 - size: 2 - tolength: 6 - outputs: - toptr: [0, 0, 0, 1, 1, 0, 1, 1, 2, 0, 2, 1] - - error: false - inputs: - fromlength: 2 - fromptr: [0, 1] - fromwidth: 1 - size: 3 - tolength: 6 - outputs: - toptr: [0, 0, 0, 1, 0, 2, 1, 0, 1, 1, 1, 2] - - error: false - inputs: - fromlength: 6 - fromptr: [0, 0, 0, 1, 0, 2, 1, 0, 1, 1, 1, 2, 64] - fromwidth: 2 - size: 5 - tolength: 30 - outputs: - toptr: [0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 1, 0, 0, 1, 1, 0, 1, - 2, 0, 1, 3, 0, 1, 4, 0, 2, 0, 0, 2, 1, 0, 2, 2, 0, 2, 3, 0, 2, 4, 1, 0, 0, - 1, 0, 1, 1, 0, 2, 1, 0, 3, 1, 0, 4, 1, 1, 0, 1, 1, 1, 1, 1, 2, 1, 1, 3, 1, - 1, 4, 1, 2, 0, 1, 2, 1, 1, 2, 2, 1, 2, 3, 1, 2, 4] - - error: false - inputs: - fromlength: 5 - fromptr: [0, 1, 2, 3, 4] - fromwidth: 1 - size: 1 - tolength: 5 - outputs: - toptr: [0, 0, 1, 0, 2, 0, 3, 0, 4, 0] -- name: awkward_Identities_extend - tests: - - error: false - inputs: - fromlength: 5 - fromptr: [0, 1, 2, 3, 4] - tolength: 6 - outputs: - toptr: [0, 1, 2, 3, 4, -1] -- name: awkward_Identities_from_IndexedArray - tests: - - error: false - inputs: - fromindex: [0, 2, 4, 6, 8, 6, 4, 2, 0] - fromlength: 9 - fromptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 0] - fromwidth: 1 - tolength: 10 - outputs: - toptr: [0, -1, 1, -1, 2, -1, 3, -1, 4, -1] - uniquecontents: [0] - - error: false - inputs: - fromindex: [0, 2, 4, 6, 8, 6, 4, 2, 0] - fromlength: 9 - fromptr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 33] - fromwidth: 1 - tolength: 10 - outputs: - toptr: [0, -1, 1, -1, 2, -1, 3, -1, 4, -1] - uniquecontents: [0] - - error: true - inputs: - fromindex: [0, 2, 4, 6, 8, 10, 12, 14, 8] - fromlength: 8 - fromptr: [0, 1, 2, 3, 4, 5, 6, 7, 0, 1121] - fromwidth: 1 - tolength: 10 - outputs: - toptr: [0, -1, 1, -1, 2, -1, 3, -1, 4, -1] - uniquecontents: [10] - - error: false - inputs: - fromindex: [0, 2, 4, 6, 8, 9, 7, 5, 0] - fromlength: 8 - fromptr: [0, 1, 2, 3, 4, 5, 6, 7, 0, 0] - fromwidth: 1 - tolength: 10 - outputs: - toptr: [0, -1, 1, -1, 2, 7, 3, 6, 4, 5] - uniquecontents: [1] - - error: false - inputs: - fromindex: [0, 2, 4, 6, 8, 9, 7, 5, 0] - fromlength: 8 - fromptr: [0, 1, 2, 3, 4, 5, 6, 7, 0, 1121] - fromwidth: 1 - tolength: 10 - outputs: - toptr: [0, -1, 1, -1, 2, 7, 3, 6, 4, 5] - uniquecontents: [1] - - error: false - inputs: - fromindex: [0, 2, 4, 6, 8, 9, 7, 5, 0] - fromlength: 8 - fromptr: [0, 1, 2, 3, 4, 5, 6, 7, 0, 33] - fromwidth: 1 - tolength: 10 - outputs: - toptr: [0, -1, 1, -1, 2, 7, 3, 6, 4, 5] - uniquecontents: [1] -- name: awkward_Identities_from_ListArray - tests: - - error: false - inputs: - fromlength: 2 - fromptr: [0, 1, 52, 689, 0, 0, 0, 9462816, 36, 31448976, 139696378420544, 139696639259584, - 139696403771776, 0, 31450896, 0, 0, 1] - fromstarts: [0, 3] - fromstops: [3, 6] - fromwidth: 1 - tolength: 6 - outputs: - toptr: [0, 0, 0, 1, 0, 2, 1, 0, 1, 1, 1, 2] - uniquecontents: [1] - - error: false - inputs: - fromlength: 6 - fromptr: [0, 0, 0, 1, 0, 2, 1, 0, 1, 1, 1, 2, 112, 609, 1, 9482848, 554, 8883839068790264832, - 34905783353868404, 34906693921735072, 180994362923679872, 462182444343766144, - 285336193991036, 34906698064724368, 180996561946935424, 249079438582496896, - 606301953155399808, 34903482812203652, 253048735686986080, 249044254210392064, - 750417141231255680, 323415181033079424, 4493748295434895360, 38287730780079488, - 253053133733496192, 606579004383428608, 8534607703870052352, 8534888002025686016, - 318067221922581632, 6475715708194208, 179148312916656512, 283266053312416, - 34906695514587536, 181006457551585408, 678355226457596032, 23366284284264828, - 318067221907374976, 5796697388408311808, 1326873538438365952, 1040896181905068928, - 1543046355249791488, 179029552750723488, 283265984631968, 112599246345339264, - 678355226457551488, 285336193991036, 318350827204648064, 34903481872679568, - 6759127497574762, -2995456697800916480, 318067221907374976, -4867826529205020672, - 822470414599782528, 28997958177194052, 106966521293047424, 323133277617718912, - -8182475854850621440, 323166731134371456, 7670194833409640448, 318067221972913280, - 6475715708194208, 7669913358400880640, 117379996172944000, 34906695648804864, - 181014154367860864, 28149130068099728, 179284656654387296, 34929972644417440, - 28151226129056160, 283265979712133, 251092859136777824, 1831277989489023232, - 6479851544118116, 283265979712133, 32658124308747376, 117390956895929456, - 28149155553804312, 184647584722190432, 2783229423035613184, 577, 139696649326096, - 139696649326096, 512, -1, 102738830379188320, 172263115243716960, 318070456065852032, - 529736597770339712, 244886957826769504, 601795166745134208, 837680981231666048, - 244322908332164704, 460501188033774464, 244615335473512832, 604621031971883392, - 244324007856570784, 109221516711035744, 678358426423263616, 117386490096388720, - 244886957826769504, 108932482608663392, 750422638838746752, 172264476956167072, - 964899956842562432, 1106198320650652800, 837680981231666048, 244322908332166752, - 1036970736430220160, 244619733520023936, 1181081784275306752, 172266413818642848, - 1181089223057740032, 244620833031651712, 1397254566389090560, 172266413818642848, - 1397264204194779392, 244621932543279488, 1541369754464946432, 1253130324387561984, - 109235810580300640, 678358426523926912, 117400783747549808, 244902350989558368, - 108932482826770528, 750422638838748288, 172264477174270880, 1901648679570506496, - 1538543884878223616, 1253130324387561984, 109243507245581408, 750422638838748800, - 172264477241379744, 316959945027486336, 108932482927435360, 750422638838749056, - 172264477274934176, 1253130324387561472, 109246805864351072, 678358426607812992, - 117411778863827568] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - fromwidth: 2 - tolength: 30 - outputs: - toptr: [0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 1, 0, 0, 1, 1, 0, 1, - 2, 0, 1, 3, 0, 1, 4, 0, 2, 0, 0, 2, 1, 0, 2, 2, 0, 2, 3, 0, 2, 4, 1, 0, 0, - 1, 0, 1, 1, 0, 2, 1, 0, 3, 1, 0, 4, 1, 1, 0, 1, 1, 1, 1, 1, 2, 1, 1, 3, 1, - 1, 4, 1, 2, 0, 1, 2, 1, 1, 2, 2, 1, 2, 3, 1, 2, 4] - uniquecontents: [1] - - error: false - inputs: - fromlength: 2 - fromptr: [0, 1, 0, 0, 31450464, 0, 33, 0, -1702784904, 32525, 1, 1, 31780992, - 0, 33, 0, -1702784904, 32525] - fromstarts: [0, 3] - fromstops: [3, 6] - fromwidth: 1 - tolength: 6 - outputs: - toptr: [0, 0, 0, 1, 0, 2, 1, 0, 1, 1, 1, 2] - uniquecontents: [1] - - error: false - inputs: - fromlength: 6 - fromptr: [0, 0, 0, 1, 0, 2, 1, 0, 1, 1, 1, 2, 32544784, 31414464, 128, 577, - 0, 0, 0, 9462816, 22, 32221440, 139696379322592, 139696639259584, 139696403771776, - 0, 32405056, 0, 0, 1331377825269678080, 0, 5574867550300, 0, 1365799600250, - 4827858800541171712, 199497875456, 176767883112611968, 179302154352263776, - 179022938558956416, 106963360211534720, 255863382440805248, 227713612647759872, - 530193754446, -2737862018487781888, 8026381506781016064, 555963787628, 98360111197682288, - 7738144514624847872, 8101260377147991040, 6000281549550391296, 4850188023361462272, - 29076998409295, 8895172214018895872, 1737079390208, 2377144139253874, 8214565720482250752, - 10466835301012, 1297599642636125184, 3344892910465808896, 2625927274867, 0, - 3298534884096, 5755943371424512, 0, 0, 0, 0, 0, 0, 0, 139696377463184, 139696377463184, - 139696379310384, 9474016, 0, 139696365674368, 139696377855808, 139696636926256, - 9476448, 9476448, 139696365691968, 8936162018030415872, 7206740183146930176, - 7206740170463254528, 8286772867220117504, -6915994102932409344, 7208138778966263808, - 577, 0, 0, 0, 9462816, 22, 19034720, 139696636992128, 139696639259584, 139696636999808, - 0, 32405600, 0, 0, 8940312665969459200, 0, 433791696948, 7638241307462205440, - 188978561146, 523986010113, 17179869268, 7638241309677609984, 6845607779537798144, - 5624196591024897024, 34746766461007216, 384219220606976, 7021674769048825856, - 7885612965989187584, 7957695015410409472, 8029390805730926592, 7311435031524745216, - 7791348737174347776, 6998707544846000128, 4211540148059459584, 5964135200, - 0, 25769803778, 26882200305683, 9011805111030147072, -8646493463153445888, - 5982030460891602944, 155655662121546240, 34183816507645296, 21380383440896, - 119626865130500608, 2377144139281778, 8214565720482250752, 10582799417464, - 0, 0, 0, 9484816, 9484816, 139696377365168, 0, 0, 0, 0, 139696378484656, 9789280, - 9476448, 9474016, 139696379327296] - fromstarts: [0, 5, 10, 15, 20, 25] - fromstops: [5, 10, 15, 20, 25, 30] - fromwidth: 2 - tolength: 30 - outputs: - toptr: [0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 1, 0, 0, 1, 1, 0, 1, - 2, 0, 1, 3, 0, 1, 4, 0, 2, 0, 0, 2, 1, 0, 2, 2, 0, 2, 3, 0, 2, 4, 1, 0, 0, - 1, 0, 1, 1, 0, 2, 1, 0, 3, 1, 0, 4, 1, 1, 0, 1, 1, 1, 1, 1, 2, 1, 1, 3, 1, - 1, 4, 1, 2, 0, 1, 2, 1, 1, 2, 2, 1, 2, 3, 1, 2, 4] - uniquecontents: [1] - - error: false - inputs: - fromlength: 5 - fromptr: [0, 1, 2, 3, 4, 33, 139696649325552, 33510160, 32, 1601, 1, 9482848, - 1554, -1, 100207977950740592, 246009662229250464, 106963227084325248, 251079514672267904, - 244326464612502144, 106965318716752768, 388440557437190784, 462464078353270400, - 34912380474641524, 693559240328085888, 388438139357692032, 117376697537397872, - 117377797049025648, 323414842790381184, 101617397355775840, 320892966874710016] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 10] - fromwidth: 1 - tolength: 10 - outputs: - toptr: [0, 0, 0, 1, 0, 2, 2, 0, 2, 1, 3, 0, 4, 0, 4, 1, 4, 2, 4, 3] - uniquecontents: [1] - - error: false - inputs: - fromlength: 4 - fromptr: [0, 1, 2, 3, 0, 33, 139696649325552, 33510160, 32, 1601, 1, 9482848, - 1554, -1, 100207977950740592] - fromstarts: [0, 2, 3, 3] - fromstops: [2, 3, 3, 5] - fromwidth: 1 - tolength: 5 - outputs: - toptr: [0, 0, 0, 1, 1, 0, 3, 0, 3, 1] - uniquecontents: [1] - - error: false - inputs: - fromlength: 5 - fromptr: [0, 0, 0, 1, 1, 0, 3, 0, 3, 1, 0, 145, 30731376, 0, 30731760, 0, 0, - 0, 139696391688519, 139696396376934, 0, 0, 0, 4294971398, 0, 30731712, 30709920, - 0, 0, 49, 30731376, 139696386472067, 3, 30731856, 13366, 65, 6998657800502140928, - 6858529724956109824, 8390891402962434048, 7308895142333729792, 7575122936771195904, - 29806, 0, 33, 30731008] - fromstarts: [0, 3, 3, 5, 6] - fromstops: [3, 3, 5, 6, 9] - fromwidth: 2 - tolength: 9 - outputs: - toptr: [0, 0, 0, 0, 0, 1, 0, 0, 2, 1, 0, 0, 1, 0, 1, 3, 0, 0, 3, 1, 0, 3, 1, - 1, 3, 1, 2] - uniquecontents: [1] -- name: awkward_NumpyArray_fill_frombool - tests: - - error: false - inputs: - fromptr: [0, 0, 1] - length: 3 - tooffset: 0 - outputs: - toptr: [0, 0, 1] - - error: false - inputs: - fromptr: [1, 0, 1] - length: 3 - tooffset: 6 - outputs: - toptr: [123, 123, 123, 123, 123, 123, 1, 0, 1] - - error: false - inputs: - fromptr: [1, 0, 1] - length: 3 - tooffset: 3 - outputs: - toptr: [123, 123, 123, 1, 0, 1] - - error: false - inputs: - fromptr: [1] - length: 1 - tooffset: 3 - outputs: - toptr: [123, 123, 123, 1] - - error: false - inputs: - fromptr: [0, 1, 0] - length: 3 - tooffset: 0 - outputs: - toptr: [0, 1, 0] - - error: false - inputs: - fromptr: [0, 1] - length: 2 - tooffset: 0 - outputs: - toptr: [0, 1] - - error: false - inputs: - fromptr: [1, 1, 1, 0, 0] - length: 5 - tooffset: 3 - outputs: - toptr: [123, 123, 123, 1, 1, 1, 0, 0] - - error: false - inputs: - fromptr: [1, 0] - length: 2 - tooffset: 2 - outputs: - toptr: [123, 123, 1, 0] - - error: false - inputs: - fromptr: [1, 0] - length: 2 - tooffset: 0 - outputs: - toptr: [1, 0] - - error: false - inputs: - fromptr: [1, 0, 1] - length: 3 - tooffset: 2 - outputs: - toptr: [123, 123, 1, 0, 1] - - error: false - inputs: - fromptr: [1, 1, 1] - length: 3 - tooffset: 0 - outputs: - toptr: [1, 1, 1] - - error: false - inputs: - fromptr: [0, 0, 0, 1, 1] - length: 5 - tooffset: 5 - outputs: - toptr: [123, 123, 123, 123, 123, 0, 0, 0, 1, 1] - - error: false - inputs: - fromptr: [1, 0, 0, 1, 1] - length: 5 - tooffset: 5 - outputs: - toptr: [123, 123, 123, 123, 123, 1, 0, 0, 1, 1] - - error: false - inputs: - fromptr: [1, 1] - length: 2 - tooffset: 3 - outputs: - toptr: [123, 123, 123, 1, 1] - name: awkward_UnionArray_fillindex_count tests: - error: false @@ -21639,97 +13573,3 @@ unit-tests: outputs: toindex: [123, 123, 123, 5, 123, 123, 6, 123, 123, 123, 7, 123] totags: [123, 123, 123, 0, 123, 123, 0, 123, 123, 123, 0, 123] -- name: awkward_index_carry - tests: - - error: false - inputs: - carry: [2, 3, 32] - fromindex: [0, 0, 0, 0] - lenfromindex: 6 - length: 2 - outputs: - toindex: [0, 0] - - error: false - inputs: - carry: [0, 3, 1, 4, 2, 5, 30] - fromindex: [0, 0, 0, 1, 1, 1] - lenfromindex: 6 - length: 6 - outputs: - toindex: [0, 1, 0, 1, 0, 1] - - error: false - inputs: - carry: [0, 2, 4, 6, 0] - fromindex: [1, 1, 0, 0, 1, 0, 1] - lenfromindex: 8 - length: 4 - outputs: - toindex: [1, 0, 1, 1] - - error: false - inputs: - carry: [4, 5, 32] - fromindex: [0, 0, 0, 0, 1, 1] - lenfromindex: 6 - length: 2 - outputs: - toindex: [1, 1] - - error: false - inputs: - carry: [4, 5, 0] - fromindex: [0, 0, 1, 1, 1, 1] - lenfromindex: 6 - length: 2 - outputs: - toindex: [1, 1] - - error: false - inputs: - carry: [2, 3, 140074615078640] - fromindex: [0, 0, 1, 1] - lenfromindex: 6 - length: 2 - outputs: - toindex: [1, 1] -- name: awkward_index_carry_nocheck - tests: - - error: false - inputs: - carry: [0, 3, 1, 4, 2, 5, 30] - fromindex: [0, 1, 2, 0, 1, 2] - length: 6 - outputs: - toindex: [0, 0, 1, 1, 2, 2] - - error: false - inputs: - carry: [0, 2, 4, 6, 0] - fromindex: [0, 1, 0, 1, 2, 2, 4] - length: 4 - outputs: - toindex: [0, 0, 2, 4] - - error: false - inputs: - carry: [2, 3, 140074615078640] - fromindex: [0, 1, 0, 1] - length: 2 - outputs: - toindex: [0, 1] - - error: false - inputs: - carry: [4, 5, 32] - fromindex: [0, 1, 2, 3, 0, 1] - length: 2 - outputs: - toindex: [0, 1] - - error: false - inputs: - carry: [4, 5, 0] - fromindex: [0, 1, 0, 1, 2, 3] - length: 2 - outputs: - toindex: [2, 3] - - error: false - inputs: - carry: [2, 3, 32] - fromindex: [0, 1, 2, 3] - length: 2 - outputs: - toindex: [2, 3] diff --git a/setup.cfg b/setup.cfg index 44aab294e3..c21188235e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -72,11 +72,11 @@ per-file-ignores = localbuild.py: T, T201, AK1 src/awkward/__init__.py: E402, F401, F403, AK1 awkward/__init__.py: E402, F401, F403, AK1 - src/awkward/_v2/__init__.py: F401, F403 - awkward/_v2/__init__.py: F401, F403 - src/awkward/_v2/operations/__init__.py: F401 - awkward/_v2/operations/__init__.py: F401 - src/awkward/_v2/_connect/numba/*: AK1 + src/awkward/__init__.py: F401, F403 + awkward/__init__.py: F401, F403 + src/awkward/operations/__init__.py: F401 + awkward/operations/__init__.py: F401 + src/awkward/_connect/numba/*: AK1 src/awkward/[!_]*: AK1 src/awkward/_[!v]*: AK1 diff --git a/src/awkward/__init__.py b/src/awkward/__init__.py index eb2ac34034..6c98b8af85 100644 --- a/src/awkward/__init__.py +++ b/src/awkward/__init__.py @@ -1,56 +1,55 @@ # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE -# v2: keep this file, but modify it to only get objects that exist! - # NumPy-like alternatives import awkward.nplike # shims for C++ (now everything is compiled into one 'awkward._ext' module) -import awkward.layout +import awkward._ext + +# Compiled dynamic modules +import awkward._cpu_kernels +import awkward._libawkward + +# layout classes; functionality that used to be in C++ (in Awkward 1.x) +import awkward.index +import awkward.identifier +import awkward.contents +import awkward.record import awkward.types import awkward.forms -import awkward.partition +import awkward._slicing +import awkward._broadcasting +import awkward._typetracer # internal -import awkward._v2 -import awkward._cpu_kernels -import awkward._libawkward import awkward._util +import awkward._lookup # third-party connectors -import awkward._connect._numpy -import awkward._connect._numba -import awkward._connect._numexpr -import awkward._connect._autograd +import awkward._connect.numpy +import awkward._connect.numexpr import awkward.numba # high-level interface -behavior = {} from awkward.highlevel import Array from awkward.highlevel import Record from awkward.highlevel import ArrayBuilder -# third-party jax connectors -import awkward._connect._jax - # behaviors -from awkward.behaviors.mixins import * -from awkward.behaviors.string import * -from awkward.behaviors.categorical import * +import awkward.behaviors.categorical +import awkward.behaviors.mixins +import awkward.behaviors.string + +behavior = {} +awkward.behaviors.string.register(behavior) # noqa: F405 +awkward.behaviors.categorical.register(behavior) # noqa: F405 # operations -from awkward.operations.convert import * -from awkward.operations.describe import * -from awkward.operations.structure import * -from awkward.operations.reducers import * +from awkward.operations import * # version __version__ = awkward._ext.__version__ - -# call C++ startup function -awkward._ext.startup() - -__all__ = [x for x in list(globals()) if not x.startswith("_") and x not in ("numpy",)] +__all__ = [x for x in globals() if not x.startswith("_") and x not in ("numpy",)] def __dir__(): diff --git a/src/awkward/_v2/_broadcasting.py b/src/awkward/_broadcasting.py similarity index 93% rename from src/awkward/_v2/_broadcasting.py rename to src/awkward/_broadcasting.py index 15678cad6d..36ce7557b8 100644 --- a/src/awkward/_v2/_broadcasting.py +++ b/src/awkward/_broadcasting.py @@ -10,21 +10,21 @@ from collections.abc import Sequence import awkward as ak -from awkward._v2.contents.content import Content # noqa: F401 -from awkward._v2.contents.emptyarray import EmptyArray # noqa: F401 -from awkward._v2.contents.numpyarray import NumpyArray # noqa: F401 -from awkward._v2.contents.regulararray import RegularArray # noqa: F401 -from awkward._v2.contents.listarray import ListArray # noqa: F401 -from awkward._v2.contents.listoffsetarray import ListOffsetArray # noqa: F401 -from awkward._v2.contents.recordarray import RecordArray # noqa: F401 -from awkward._v2.contents.indexedarray import IndexedArray # noqa: F401 -from awkward._v2.contents.indexedoptionarray import IndexedOptionArray # noqa: F401 -from awkward._v2.contents.bytemaskedarray import ByteMaskedArray # noqa: F401 -from awkward._v2.contents.bitmaskedarray import BitMaskedArray # noqa: F401 -from awkward._v2.contents.unmaskedarray import UnmaskedArray # noqa: F401 -from awkward._v2.contents.unionarray import UnionArray # noqa: F401 -from awkward._v2.record import Record # noqa: F401 -from awkward._v2.index import ( +from awkward.contents.content import Content # noqa: F401 +from awkward.contents.emptyarray import EmptyArray # noqa: F401 +from awkward.contents.numpyarray import NumpyArray # noqa: F401 +from awkward.contents.regulararray import RegularArray # noqa: F401 +from awkward.contents.listarray import ListArray # noqa: F401 +from awkward.contents.listoffsetarray import ListOffsetArray # noqa: F401 +from awkward.contents.recordarray import RecordArray # noqa: F401 +from awkward.contents.indexedarray import IndexedArray # noqa: F401 +from awkward.contents.indexedoptionarray import IndexedOptionArray # noqa: F401 +from awkward.contents.bytemaskedarray import ByteMaskedArray # noqa: F401 +from awkward.contents.bitmaskedarray import BitMaskedArray # noqa: F401 +from awkward.contents.unmaskedarray import UnmaskedArray # noqa: F401 +from awkward.contents.unionarray import UnionArray # noqa: F401 +from awkward.record import Record # noqa: F401 +from awkward.index import ( Index, # noqa: F401 Index8, # noqa: F401 # IndexU8, # noqa: F401 @@ -92,7 +92,7 @@ def checklength(inputs, options): length = inputs[0].length for x in inputs[1:]: if x.length != length: - raise ak._v2._util.error( + raise ak._util.error( ValueError( "cannot broadcast {} of length {} with {} of length {}{}".format( type(inputs[0]).__name__, @@ -188,13 +188,13 @@ class BroadcastParameterRule(str, enum.Enum): def _parameters_of(obj: Any, default: Any = NO_PARAMETERS) -> Any: """ Args: - obj: #ak._v2.contents.Content that holds parameters, or object - default: value to return if obj is not an #ak._v2.contents.Content + obj: #ak.contents.Content that holds parameters, or object + default: value to return if obj is not an #ak.contents.Content - Return the parameters of an object if it is a #ak._v2.contents.Content; + Return the parameters of an object if it is a #ak.contents.Content; otherwise, return a default value. """ - if isinstance(obj, ak._v2.contents.Content): + if isinstance(obj, ak.contents.Content): return obj._parameters else: return default @@ -205,7 +205,7 @@ def all_or_nothing_parameters_factory( ) -> BroadcastParameterFactory: """ Args: - inputs: sequence of #ak._v2.contents.Content or other objects + inputs: sequence of #ak.contents.Content or other objects Return a callable that creates an appropriately sized list of parameter objects. The parameter objects within this list are built using an "all or nothing rule": @@ -224,9 +224,7 @@ def all_or_nothing_parameters_factory( first_parameters = input_parameters[0] # Ensure all parameters match, or set parameters to None for other_parameters in input_parameters[1:]: - if not ak._v2.forms.form._parameters_equal( - first_parameters, other_parameters - ): + if not ak.forms.form._parameters_equal(first_parameters, other_parameters): break else: parameters = first_parameters @@ -244,7 +242,7 @@ def intersection_parameters_factory( ) -> BroadcastParameterFactory: """ Args: - inputs: sequence of #ak._v2.contents.Content or other objects + inputs: sequence of #ak.contents.Content or other objects Return a callable that creates an appropriately sized list of parameter objects. The parameter objects within this list are built using an "intersection rule": @@ -264,14 +262,14 @@ def intersection_parameters_factory( # If we encounter None-parameters, then we stop early # as there can be no intersection. for parameters in input_parameters: - if ak._v2.forms.form._parameters_is_empty(parameters): + if ak.forms.form._parameters_is_empty(parameters): break else: parameters_to_intersect.append(parameters) # Otherwise, build the intersected parameter dict else: intersected_parameters = functools.reduce( - ak._v2.forms.form._parameters_intersect, parameters_to_intersect + ak.forms.form._parameters_intersect, parameters_to_intersect ) def apply(n_outputs: int) -> list[dict[str, Any] | None]: @@ -287,7 +285,7 @@ def one_to_one_parameters_factory( ) -> BroadcastParameterFactory: """ Args: - inputs: sequence of #ak._v2.contents.Content or other objects + inputs: sequence of #ak.contents.Content or other objects Return a callable that creates an appropriately sized list of parameter objects. The parameter objects within this list are built using a "one-to-one rule": @@ -303,7 +301,7 @@ def one_to_one_parameters_factory( def apply(n_outputs) -> list[dict[str, Any] | None]: if n_outputs != len(inputs): - raise ak._v2._util.error( + raise ak._util.error( ValueError( "cannot follow one-to-one parameter broadcasting rule for actions " "which change the number of outputs." @@ -319,7 +317,7 @@ def none_parameters_factory( ) -> BroadcastParameterFactory: """ Args: - inputs: sequence of #ak._v2.contents.Content or other objects + inputs: sequence of #ak.contents.Content or other objects Return a callable that creates an appropriately sized list of parameter objects. The parameter objects within this list are built using an "all or nothing rule": @@ -397,7 +395,7 @@ def apply_step( try: parameters_factory_impl = BROADCAST_RULE_TO_FACTORY_IMPL[rule] except KeyError: - raise ak._v2._util.error( + raise ak._util.error( ValueError( f"`broadcast_parameters_rule` should be one of {[str(x) for x in BroadcastParameterRule]}, " f"but this routine received `{rule}`" @@ -511,7 +509,7 @@ def continuation(): if length is None: length = tagslist[-1].shape[0] elif length != tagslist[-1].shape[0]: - raise ak._v2._util.error( + raise ak._util.error( ValueError( "cannot broadcast UnionArray of length {} " "with UnionArray of length {}{}".format( @@ -686,7 +684,7 @@ def continuation(): elif x.size == maxsize: nextinputs.append(x.content[: x.length * x.size]) else: - raise ak._v2._util.error( + raise ak._util.error( ValueError( "cannot broadcast RegularArray of size " "{} with RegularArray of size {} {}".format( @@ -825,7 +823,7 @@ def continuation(): for x, p in zip(outcontent, parameters) ) else: - raise ak._v2._util.error( + raise ak._util.error( AssertionError( "unexpected offsets, starts: {}, {}".format( type(offsets), type(starts) @@ -836,7 +834,7 @@ def continuation(): # General list-handling case: the offsets of each list may be different. else: fcns = [ - ak._v2._util.custom_broadcast(x, behavior) + ak._util.custom_broadcast(x, behavior) if isinstance(x, Content) else None for x in inputs @@ -907,7 +905,7 @@ def continuation(): # Any RecordArrays? elif any(isinstance(x, RecordArray) for x in inputs): if not options["allow_records"]: - raise ak._v2._util.error( + raise ak._util.error( ValueError(f"cannot broadcast records {in_function(options)}") ) @@ -917,7 +915,7 @@ def continuation(): if fields is None: fields = x.fields elif set(fields) != set(x.fields): - raise ak._v2._util.error( + raise ak._util.error( ValueError( "cannot broadcast records because fields don't " "match{}:\n {}\n {}".format( @@ -930,7 +928,7 @@ def continuation(): if length is None: length = x.length elif length != x.length: - raise ak._v2._util.error( + raise ak._util.error( ValueError( "cannot broadcast RecordArray of length {} " "with RecordArray of length {}{}".format( @@ -970,7 +968,7 @@ def continuation(): ) else: - raise ak._v2._util.error( + raise ak._util.error( ValueError( "cannot broadcast: {}{}".format( ", ".join(repr(type(x)) for x in inputs), in_function(options) @@ -994,7 +992,7 @@ def continuation(): elif result is None: return continuation() else: - raise ak._v2._util.error(AssertionError(result)) + raise ak._util.error(AssertionError(result)) def broadcast_and_apply( diff --git a/src/awkward/_connect/__init__.py b/src/awkward/_connect/__init__.py index 56b54527f2..3f37305187 100644 --- a/src/awkward/_connect/__init__.py +++ b/src/awkward/_connect/__init__.py @@ -1,3 +1 @@ # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -# v2: replace with src/awkward/_v2/_connect directory. diff --git a/src/awkward/_connect/_autograd.py b/src/awkward/_connect/_autograd.py deleted file mode 100644 index 9d3daaa4df..0000000000 --- a/src/awkward/_connect/_autograd.py +++ /dev/null @@ -1,90 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -# v2: drop, since this is replaced by JAX. (Implement it only if somebody complains.) - -import types - -import awkward as ak - -numpy = ak.nplike.Numpy.instance() - -NEP13Box = None - - -def register(): - import autograd - - # PyLint false positive: https://github.com/PyCQA/pylint/issues/5756 - global NEP13Box # pylint: disable=global-variable-not-assigned - - if NEP13Box is None: - - class NEP13Box(autograd.extend.Box, ak._connect._numpy.NDArrayOperatorsMixin): - def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): - import autograd - - if ( - method != "__call__" - or len(inputs) == 0 - or "out" in kwargs - or ufunc.__class__.__module__ != "numpy" - ): - return NotImplemented - - nextinputs = [] - for x in inputs: - if isinstance(x, NEP13Box): - nextinputs.append( - autograd.numpy.numpy_boxes.ArrayBox( - numpy.asarray(x._value), x._trace, x._node - ) - ) - else: - nextinputs.append(x) - - out = getattr(autograd.numpy, ufunc.__name__)(*nextinputs, **kwargs) - return NEP13Box(ak.layout.NumpyArray(out._value), out._trace, out._node) - - NEP13Box.register(ak.layout.NumpyArray) - - autograd.extend.VSpace.register( - ak.layout.NumpyArray, - lambda x: autograd.numpy.numpy_vspaces.ArrayVSpace(numpy.asarray(x)), - ) - - -def elementwise_grad(fun, argnum=0, *nary_op_args, **nary_op_kwargs): - import autograd - - register() - - gradfun = autograd.elementwise_grad(fun, argnum, *nary_op_args, **nary_op_kwargs) - - def broadcast(*args, **kwargs): - nextargs = [ - ak.operations.convert.to_layout(x, allow_record=True, allow_other=True) - for x in args - ] - - def getfunction(inputs): - if all( - isinstance(x, ak.layout.NumpyArray) - or not isinstance(x, ak.layout.Content) - for x in inputs - ): - return lambda: (ak.layout.NumpyArray(gradfun(*inputs)),) - else: - return None - - behavior = ak._util.behaviorof(*args) - out = ak._util.broadcast_and_apply( - nextargs, getfunction, behavior, pass_depth=False - ) - assert isinstance(out, tuple) and len(out) == 1 - return ak._util.wrap(out[0], behavior) - - return broadcast - - -ak.autograd = types.ModuleType("autograd") -ak.autograd.elementwise_grad = elementwise_grad diff --git a/src/awkward/_connect/_jax/__init__.py b/src/awkward/_connect/_jax/__init__.py deleted file mode 100644 index 67ee505e13..0000000000 --- a/src/awkward/_connect/_jax/__init__.py +++ /dev/null @@ -1,43 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -# v2: replace with deeply rewritten src/awkward/_v2/_connect/jax. - -import types - -import awkward as ak - -checked_version = False - - -def register_and_check(): - global checked_version - try: - import jax - except ModuleNotFoundError: - raise ModuleNotFoundError( - """install the 'jax' package with: - - pip install jax jaxlib --upgrade - -or - - conda install jax jaxlib""" - ) from None - else: - if not checked_version and ak._v2._util.parse_version( - jax.__version__ - ) < ak._v2._util.parse_version("0.2.7"): - raise ImportError( - "Awkward Array can only work with jax 0.2.7 or later " - "(you have version {})".format(jax.__version__) - ) - checked_version = True - register() - - -def register(): - import awkward._connect._jax.jax_utils # noqa: F401 - - -ak.jax = types.ModuleType("jax") -ak.jax.register = register_and_check diff --git a/src/awkward/_connect/_jax/jax_utils.py b/src/awkward/_connect/_jax/jax_utils.py deleted file mode 100644 index 438c7ed7c5..0000000000 --- a/src/awkward/_connect/_jax/jax_utils.py +++ /dev/null @@ -1,320 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -# v2: replace with deeply rewritten src/awkward/_v2/_connect/jax. - -import awkward as ak -import numbers -import json - -import jax -import jax.tree_util - -np = ak.nplike.NumpyMetadata.instance() -numpy = ak.nplike.Numpy.instance() - - -def _find_dataptrs(layout): - def find_nparray_ptrs(node, depth, data_ptrs): - if isinstance(node, ak.layout.NumpyArray): - data_ptrs.append(node.ptr) - - data_ptrs = [] - ak._util.recursive_walk(layout, find_nparray_ptrs, args=(data_ptrs,)) - - return data_ptrs - - -def _find_dataptrs_and_map(layout, jaxtracers, isscalar): - if not isscalar: - data_ptrs = _find_dataptrs(layout) - assert len(jaxtracers) == len(data_ptrs) - map_ptrs_to_tracers = dict(zip(data_ptrs, jaxtracers)) - else: - # Layout is a scalar - data_ptrs = None - map_ptrs_to_tracers = None - - return data_ptrs, map_ptrs_to_tracers - - -def _jaxtracers_getitem(array, where): - if array._isscalar: - raise TypeError("Cannot slice a scalar") - - out = array.layout[where] - - def find_nparray_node_newptr(layout, outlayout): - def find_nparray_node( - node, depth, outlayout, fieldloc, shape, nodenum, nodenum_index - ): - if isinstance(node, ak.layout.NumpyArray): - if node.identities.fieldloc == fieldloc: - nodenum_index.append(nodenum) - else: - nodenum = nodenum + 1 - - outlayout_fieldloc = outlayout.identities.fieldloc - nodenum_index = [] - - ak._util.recursive_walk( - layout, - find_nparray_node, - args=( - outlayout, - outlayout_fieldloc, - numpy.asarray(outlayout.identities).shape, - 0, - nodenum_index, - ), - ) - if len(nodenum_index) == 0: - raise ValueError("Couldn't find the node in new slice") - return nodenum_index[0] - - if not isinstance(out, ak.layout.Content): - - def recurse(outarray, recurse_where): - - # TODO: capture makes this really confusing. A new parameter should - # be used instead if capture is really needed. - if isinstance(recurse_where, (numbers.Integral, str)): - if isinstance(outarray.layout, ak.layout.NumpyArray): - return outarray._tracers[0][recurse_where] - elif isinstance(where, tuple): - return recurse(array[where[:-1]], where[len(where) - 1]) - - else: - raise ValueError(f"Can't slice the array with {where}") - - child = [recurse(array, where)] - return ak.Array._internal_for_jax(out, child, isscalar=True) - - else: - - def fetch_indices_and_fieldloc_layout(outlayout): - if isinstance(outlayout, ak.layout.NumpyArray): - return [ - ( - ( - outlayout.identities.fieldloc, - numpy.asarray(outlayout.identities).shape[1], - ), - numpy.asarray(outlayout.identities), - ) - ] - elif isinstance(outlayout, ak._util.listtypes): - return fetch_indices_and_fieldloc_layout(outlayout.content) - elif isinstance(outlayout, ak._util.indexedtypes): - return fetch_indices_and_fieldloc_layout(outlayout.project()) - elif isinstance(outlayout, ak._util.uniontypes): - raise ValueError(f"Can't differentiate an UnionArray type {outlayout}") - elif isinstance(outlayout, ak._util.recordtypes): - indices = [] - for content in outlayout.contents: - indices = indices + fetch_indices_and_fieldloc_layout(content) - return indices - elif isinstance(outlayout, ak._util.indexedtypes): - return fetch_indices_and_fieldloc_layout(outlayout.content) - elif isinstance(outlayout, ak._util.indexedoptiontypes): - return fetch_indices_and_fieldloc_layout(outlayout.content) - elif isinstance( - outlayout, - ( - ak.layout.BitMaskedArray, - ak.layout.ByteMaskedArray, - ak.layout.UnmaskedArray, - ), - ): - return fetch_indices_and_fieldloc_layout(outlayout.content) - else: - raise NotImplementedError - - def fetch_children_tracer(outlayout, preslice_identities): - if isinstance(outlayout, ak.layout.NumpyArray): - - def find_intersection_indices( - postslice_identities, preslice_identities - ): - multiplier = numpy.append( - numpy.cumprod( - (numpy.max(preslice_identities, axis=0) + 1)[::-1] - )[-2::-1], - 1, - ) - haystack = numpy.sum(preslice_identities * multiplier, axis=1) - needle = numpy.sum(postslice_identities * multiplier, axis=1) - haystack_argsort = numpy.argsort(haystack) - indices = numpy.searchsorted( - haystack, needle, sorter=haystack_argsort - ) - final_indices = haystack_argsort[indices] - return final_indices - - def find_corresponding_identity( - postslice_identities, preslice_identities - ): - for identity in preslice_identities: - if identity[0] == postslice_identities: - return identity[1] - - raise ValueError( - "Couldn't find postslice identities in preslice identities" - ) - - indices = find_intersection_indices( - numpy.asarray(outlayout.identities), - find_corresponding_identity( - ( - outlayout.identities.fieldloc, - numpy.asarray(outlayout.identities).shape[1], - ), - preslice_identities, - ), - ) - if outlayout.ptr in array._map_ptrs_to_tracers: - tracer = array._map_ptrs_to_tracers[outlayout.ptr] - else: - tracer = array._tracers[ - find_nparray_node_newptr(array.layout, outlayout) - ] - return [jax.numpy.take(tracer, indices)] - - elif isinstance(outlayout, ak._util.listtypes): - return fetch_children_tracer(outlayout.content, preslice_identities) - elif isinstance(outlayout, ak._util.uniontypes): - raise ValueError(f"Can't differentiate an UnionArray type {outlayout}") - elif isinstance(outlayout, ak._util.recordtypes): - children = [] - for content in outlayout.contents: - children = children + fetch_children_tracer( - content, preslice_identities - ) - return children - elif isinstance(outlayout, ak._util.indexedtypes): - return fetch_children_tracer(outlayout.content, preslice_identities) - elif isinstance(outlayout, ak._util.indexedoptiontypes): - return fetch_children_tracer(outlayout.content, preslice_identities) - elif isinstance( - outlayout, - ( - ak.layout.BitMaskedArray, - ak.layout.ByteMaskedArray, - ak.layout.UnmaskedArray, - ), - ): - return fetch_children_tracer(outlayout.content, preslice_identities) - else: - raise NotImplementedError( - "fetch_children_tracer not completely implemented yet for {}".format( - outlayout - ) - ) - - children = fetch_children_tracer( - out, fetch_indices_and_fieldloc_layout(array.layout) - ) - out = out.deep_copy() - out.setidentities() - return ak.Array._internal_for_jax(out, children, isscalar=False) - - -def array_ufunc(array, ufunc, method, inputs, kwargs): - for x in inputs: - if isinstance(x, ak.Array) and hasattr(x, "_tracers"): - assert len(x._tracers) == len(array._tracers) - - # ak.Array __add__, etc. map to the NumPy functions, switch to JAX - import numpy - - for name, np_ufunc in numpy.core.umath.__dict__.items(): - if ufunc is np_ufunc: - ufunc = getattr(jax.numpy, name) - - # need to apply the ufunc to the same argument list for each tracer separately - nexttracers = [] - for i in range(len(array._tracers)): - nextinputs = [ - x._tracers[i] if isinstance(x, ak.Array) and hasattr(x, "_tracers") else x - for x in inputs - ] - nexttracers.append(getattr(ufunc, method)(*nextinputs, **kwargs)) - - return ak.Array._internal_for_jax(array.layout, nexttracers, array._isscalar) - - -class AuxData: - def __init__(self, array): - self.array = array - - def __eq__(self, other): - self_form = json.loads(self.array.layout.form.tojson()) - other_form = json.loads(self.array.layout.form.tojson()) - - def form_sweep(input_form, blacklist): - if isinstance(input_form, dict): - return { - k: form_sweep(v, blacklist) - for k, v in input_form.items() - if k not in blacklist - } - else: - return input_form - - self_form = form_sweep(self_form, ["primitive", "format", "itemsize"]) - other_form = form_sweep(self_form, ["primitive", "format", "itemsize"]) - - return self_form == other_form - - -def special_flatten(array): - if isinstance(array, ak.Array) and hasattr(array, "_tracers"): - aux_data, children = AuxData(array), array._tracers - elif isinstance(array, ak.Array): - - def create_databuffers(node, depth, databuffers): - if isinstance(node, ak.layout.NumpyArray): - databuffers.append(node) - - databuffers = [] - ak._util.recursive_walk(array.layout, create_databuffers, args=(databuffers,)) - - array.layout.setidentities() - children = [jax.numpy.asarray(x) for x in databuffers] - aux_data = AuxData(ak.Array._internal_for_jax(array.layout, children)) - else: - raise ValueError( - "Can only differentiate Awkward Arrays, received array of type {}".format( - type(array) - ) - ) - - return children, aux_data - - -def special_unflatten(aux_data, children): - if any(isinstance(x, jax.core.Tracer) for x in children): - return ak.Array._internal_for_jax(aux_data.array.layout, children) - elif all(child is None for child in children): - return None - else: - if aux_data.array._isscalar: - assert len(children) == 1 - # return children[0] - import numpy - - return numpy.ndarray.item(numpy.asarray(children[0])) - children = list(children) - - def function(layout): - if isinstance(layout, ak.layout.NumpyArray): - buffer = children[0] - children.pop(0) - return lambda: ak.layout.NumpyArray(buffer) - - arr = ak._util.recursively_apply( - aux_data.array.layout, function, pass_depth=False - ) - return ak.Array(arr) - - -jax.tree_util.register_pytree_node(ak.Array, special_flatten, special_unflatten) diff --git a/src/awkward/_connect/_numba/__init__.py b/src/awkward/_connect/_numba/__init__.py deleted file mode 100644 index a902621984..0000000000 --- a/src/awkward/_connect/_numba/__init__.py +++ /dev/null @@ -1,108 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -# v2: replace with src/awkward/_v2/_connect/numba/__init__.py. - -import awkward as ak - -checked_version = False - - -def register_and_check(): - global checked_version - try: - import numba - except ModuleNotFoundError: - raise ModuleNotFoundError( - """install the 'numba' package with: - - pip install numba --upgrade - -or - - conda install numba""" - ) from None - else: - if not checked_version and ak._v2._util.parse_version( - numba.__version__ - ) < ak._v2._util.parse_version("0.50"): - raise ImportError( - "Awkward Array can only work with numba 0.50 or later " - "(you have version {})".format(numba.__version__) - ) - checked_version = True - register() - - -def register(): - import numba - import awkward._connect._numba.arrayview - import awkward._connect._numba.layout - import awkward._connect._numba.builder - - if hasattr(ak.numba, "ArrayViewType"): - return - - n = ak.numba - n.ArrayViewType = awkward._connect._numba.arrayview.ArrayViewType - n.ArrayViewModel = awkward._connect._numba.arrayview.ArrayViewModel - n.RecordViewType = awkward._connect._numba.arrayview.RecordViewType - n.RecordViewModel = awkward._connect._numba.arrayview.RecordViewModel - n.ContentType = awkward._connect._numba.layout.ContentType - n.NumpyArrayType = awkward._connect._numba.layout.NumpyArrayType - n.RegularArrayType = awkward._connect._numba.layout.RegularArrayType - n.ListArrayType = awkward._connect._numba.layout.ListArrayType - n.IndexedArrayType = awkward._connect._numba.layout.IndexedArrayType - n.IndexedOptionArrayType = awkward._connect._numba.layout.IndexedOptionArrayType - n.ByteMaskedArrayType = awkward._connect._numba.layout.ByteMaskedArrayType - n.BitMaskedArrayType = awkward._connect._numba.layout.BitMaskedArrayType - n.UnmaskedArrayType = awkward._connect._numba.layout.UnmaskedArrayType - n.RecordArrayType = awkward._connect._numba.layout.RecordArrayType - n.UnionArrayType = awkward._connect._numba.layout.UnionArrayType - n.ArrayBuilderType = awkward._connect._numba.builder.ArrayBuilderType - n.ArrayBuilderModel = awkward._connect._numba.builder.ArrayBuilderModel - - @numba.extending.typeof_impl.register(ak.highlevel.Array) - def typeof_Array(obj, c): - return obj.numba_type - - @numba.extending.typeof_impl.register(ak.highlevel.Record) - def typeof_Record(obj, c): - return obj.numba_type - - @numba.extending.typeof_impl.register(ak.highlevel.ArrayBuilder) - def typeof_ArrayBuilder(obj, c): - return obj.numba_type - - -def repr_behavior(behavior): - return repr(behavior) - - -def castint(context, builder, fromtype, totype, val): - import numba - import llvmlite.ir.types - - if isinstance(fromtype, llvmlite.ir.types.IntType): - if fromtype.width == 8: - fromtype = numba.int8 - elif fromtype.width == 16: - fromtype = numba.int16 - elif fromtype.width == 32: - fromtype = numba.int32 - elif fromtype.width == 64: - fromtype = numba.int64 - if not isinstance(fromtype, numba.types.Integer): - raise AssertionError( - f"unrecognized integer type: {fromtype!r}" - + ak._util.exception_suffix(__file__) - ) - - if fromtype.bitwidth < totype.bitwidth: - if fromtype.signed: - return builder.sext(val, context.get_value_type(totype)) - else: - return builder.zext(val, context.get_value_type(totype)) - elif fromtype.bitwidth > totype.bitwidth: - return builder.trunc(val, context.get_value_type(totype)) - else: - return val diff --git a/src/awkward/_connect/_numba/arrayview.py b/src/awkward/_connect/_numba/arrayview.py deleted file mode 100644 index a0f1a2f6ed..0000000000 --- a/src/awkward/_connect/_numba/arrayview.py +++ /dev/null @@ -1,1890 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -# v2: replace with src/awkward/_v2/_connect/numba/arrayview.py - -import operator - -import numba -import numba.core.typing -import numba.core.typing.ctypes_utils - -import awkward as ak - -np = ak.nplike.NumpyMetadata.instance() - -########## for code that's built up from strings - - -def code_to_function(code, function_name, externals=None, debug=False): - if debug: - print("################### " + function_name) # noqa: T201 - print(code) # noqa: T201 - namespace = {} if externals is None else dict(externals) - exec(code, namespace) - return namespace[function_name] - - -########## Lookup - - -class Lookup: - def __init__(self, layout): - positions = [] - sharedptrs = [] - arrays = [] - tolookup(layout, positions, sharedptrs, arrays) - assert len(positions) == len(sharedptrs) - - def find(x): - for i, array in enumerate(arrays): - if x is array: - return i - - assert isinstance(x, int) - return x - - self.original_positions = positions - self.positions = [find(x) for x in positions] - self.sharedptrs_hold = sharedptrs - self.arrays = arrays - - def arrayptr(x): - if isinstance(x, int): - return x - else: - return x.ctypes.data - - def sharedptr(x): - if x is None: - return -1 - elif x == 0: - return 0 - else: - return x.ptr() - - self.nplike = ak.nplike.of(layout) - - self.arrayptrs = self.nplike.array( - [arrayptr(x) for x in positions], dtype=np.intp - ) - self.sharedptrs = self.nplike.array( - [sharedptr(x) for x in sharedptrs], dtype=np.intp - ) - - def _view_as_array(self): - return self.nplike.vstack( - [self.nplike.arange(len(self.arrayptrs)), self.arrayptrs, self.sharedptrs] - ).T - - -def tolookup(layout, positions, sharedptrs, arrays): - if isinstance(layout, ak.layout.NumpyArray): - return ak._connect._numba.layout.NumpyArrayType.tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance(layout, ak.forms.NumpyForm): - return ak._connect._numba.layout.NumpyArrayType.form_tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance(layout, ak.layout.RegularArray): - return ak._connect._numba.layout.RegularArrayType.tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance(layout, ak.forms.RegularForm): - return ak._connect._numba.layout.RegularArrayType.form_tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance( - layout, - ( - ak.layout.ListArray32, - ak.layout.ListArrayU32, - ak.layout.ListArray64, - ak.layout.ListOffsetArray32, - ak.layout.ListOffsetArrayU32, - ak.layout.ListOffsetArray64, - ), - ): - return ak._connect._numba.layout.ListArrayType.tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance(layout, (ak.forms.ListForm, ak.forms.ListOffsetForm)): - return ak._connect._numba.layout.ListArrayType.form_tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance( - layout, - ( - ak.layout.IndexedArray32, - ak.layout.IndexedArrayU32, - ak.layout.IndexedArray64, - ), - ): - return ak._connect._numba.layout.IndexedArrayType.tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance(layout, ak.forms.IndexedForm): - return ak._connect._numba.layout.IndexedArrayType.form_tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance( - layout, - (ak.layout.IndexedOptionArray32, ak.layout.IndexedOptionArray64), - ): - return ak._connect._numba.layout.IndexedOptionArrayType.tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance(layout, ak.forms.IndexedOptionForm): - return ak._connect._numba.layout.IndexedOptionArrayType.form_tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance(layout, ak.layout.ByteMaskedArray): - return ak._connect._numba.layout.ByteMaskedArrayType.tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance(layout, ak.forms.ByteMaskedForm): - return ak._connect._numba.layout.ByteMaskedArrayType.form_tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance(layout, ak.layout.BitMaskedArray): - return ak._connect._numba.layout.BitMaskedArrayType.tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance(layout, ak.forms.BitMaskedForm): - return ak._connect._numba.layout.BitMaskedArrayType.form_tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance(layout, ak.layout.UnmaskedArray): - return ak._connect._numba.layout.UnmaskedArrayType.tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance(layout, ak.forms.UnmaskedForm): - return ak._connect._numba.layout.UnmaskedArrayType.form_tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance(layout, ak.layout.RecordArray): - return ak._connect._numba.layout.RecordArrayType.tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance(layout, ak.forms.RecordForm): - return ak._connect._numba.layout.RecordArrayType.form_tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance(layout, ak.layout.Record): - return ak._connect._numba.layout.RecordType.tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance( - layout, - ( - ak.layout.UnionArray8_32, - ak.layout.UnionArray8_U32, - ak.layout.UnionArray8_64, - ), - ): - return ak._connect._numba.layout.UnionArrayType.tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance(layout, ak.forms.UnionForm): - return ak._connect._numba.layout.UnionArrayType.form_tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance(layout, ak.layout.VirtualArray): - return ak._connect._numba.layout.VirtualArrayType.tolookup( - layout, positions, sharedptrs, arrays - ) - - elif isinstance(layout, ak.forms.VirtualForm): - return ak._connect._numba.layout.VirtualArrayType.form_tolookup( - layout, positions, sharedptrs, arrays - ) - - else: - raise AssertionError( - f"unrecognized Content or Form type: {type(layout)}" - + ak._util.exception_suffix(__file__) - ) - - -def tonumbatype(form): - if isinstance(form, ak.forms.NumpyForm): - return ak._connect._numba.layout.NumpyArrayType.from_form(form) - - elif isinstance(form, ak.forms.RegularForm): - return ak._connect._numba.layout.RegularArrayType.from_form(form) - - elif isinstance(form, (ak.forms.ListForm, ak.forms.ListOffsetForm)): - return ak._connect._numba.layout.ListArrayType.from_form(form) - - elif isinstance(form, ak.forms.IndexedForm): - return ak._connect._numba.layout.IndexedArrayType.from_form(form) - - elif isinstance(form, ak.forms.IndexedOptionForm): - return ak._connect._numba.layout.IndexedOptionArrayType.from_form(form) - - elif isinstance(form, ak.forms.ByteMaskedForm): - return ak._connect._numba.layout.ByteMaskedArrayType.from_form(form) - - elif isinstance(form, ak.forms.BitMaskedForm): - return ak._connect._numba.layout.BitMaskedArrayType.from_form(form) - - elif isinstance(form, ak.forms.UnmaskedForm): - return ak._connect._numba.layout.UnmaskedArrayType.from_form(form) - - elif isinstance(form, ak.forms.RecordForm): - return ak._connect._numba.layout.RecordArrayType.from_form(form) - - elif isinstance(form, ak.forms.UnionForm): - return ak._connect._numba.layout.UnionArrayType.from_form(form) - - elif isinstance(form, ak.forms.VirtualForm): - return ak._connect._numba.layout.VirtualArrayType.from_form(form) - - else: - raise AssertionError( - f"unrecognized Form type: {type(form)}" - + ak._util.exception_suffix(__file__) - ) - - -@numba.extending.typeof_impl.register(Lookup) -def typeof_Lookup(obj, c): - return LookupType() - - -class LookupType(numba.types.Type): - arraytype = numba.types.Array(numba.intp, 1, "C") - - def __init__(self): - super().__init__(name="ak.LookupType()") - - -@numba.extending.register_model(LookupType) -class LookupModel(numba.core.datamodel.models.StructModel): - def __init__(self, dmm, fe_type): - members = [("arrayptrs", fe_type.arraytype), ("sharedptrs", fe_type.arraytype)] - super().__init__(dmm, fe_type, members) - - -@numba.extending.unbox(LookupType) -def unbox_Lookup(lookuptype, lookupobj, c): - arrayptrs_obj = c.pyapi.object_getattr_string(lookupobj, "arrayptrs") - sharedptrs_obj = c.pyapi.object_getattr_string(lookupobj, "sharedptrs") - - proxyout = c.context.make_helper(c.builder, lookuptype) - proxyout.arrayptrs = c.pyapi.to_native_value( - lookuptype.arraytype, arrayptrs_obj - ).value - proxyout.sharedptrs = c.pyapi.to_native_value( - lookuptype.arraytype, sharedptrs_obj - ).value - - c.pyapi.decref(arrayptrs_obj) - c.pyapi.decref(sharedptrs_obj) - - is_error = numba.core.cgutils.is_not_null(c.builder, c.pyapi.err_occurred()) - return numba.extending.NativeValue(proxyout._getvalue(), is_error) - - -########## ArrayView - - -class ArrayView: - @classmethod - def fromarray(cls, array): - behavior = ak._util.behaviorof(array) - layout = ak.operations.convert.to_layout( - array, - allow_record=False, - allow_other=False, - numpytype=(np.number, bool, np.bool_), - ) - while isinstance(layout, ak.layout.VirtualArray) and isinstance( - layout.generator, ak.layout.SliceGenerator - ): - layout = layout.array - layout = ak.operations.convert.regularize_numpyarray( - layout, allow_empty=False, highlevel=False - ) - - if isinstance(layout, ak.partition.PartitionedArray): - numba_type = None - for part in layout.partitions: - if numba_type is None: - numba_type = ak._connect._numba.layout.typeof(part) - elif numba_type != ak._connect._numba.layout.typeof(part): - raise ValueError( - "partitioned arrays can only be used in Numba if all " - "partitions have the same numba_type" - + ak._util.exception_suffix(__file__) - ) - return PartitionedView( - ak._connect._numba.layout.typeof(part), - behavior, - [Lookup(x) for x in layout.partitions], - ak.nplike.of(layout).asarray(layout.stops, dtype=np.intp), - 0, - len(layout), - (), - ) - - else: - return ArrayView( - ak._connect._numba.layout.typeof(layout), - behavior, - Lookup(layout), - 0, - 0, - len(layout), - (), - ) - - def __init__(self, type, behavior, lookup, pos, start, stop, fields): - self.type = type - self.behavior = behavior - self.lookup = lookup - self.pos = pos - self.start = start - self.stop = stop - self.fields = fields - - def toarray(self): - layout = self.type.tolayout(self.lookup, self.pos, self.fields) - sliced = layout.getitem_range_nowrap(self.start, self.stop) - return ak._util.wrap(sliced, self.behavior) - - -@numba.extending.typeof_impl.register(ArrayView) -def typeof_ArrayView(obj, c): - return ArrayViewType(obj.type, obj.behavior, obj.fields) - - -def wrap(type, viewtype, fields): - if fields is None: - return ArrayViewType(type, viewtype.behavior, viewtype.fields) - else: - return ArrayViewType(type, viewtype.behavior, fields) - - -class ArrayViewType(numba.types.IterableType, numba.types.Sized): - def __init__(self, type, behavior, fields): - super().__init__( - name="ak.ArrayView({}, {}, {})".format( - type.name, - ak._connect._numba.repr_behavior(behavior), - repr(fields), - ) - ) - self.type = type - self.behavior = behavior - self.fields = fields - - @property - def iterator_type(self): - return IteratorType(self) - - -@numba.extending.register_model(ArrayViewType) -class ArrayViewModel(numba.core.datamodel.models.StructModel): - def __init__(self, dmm, fe_type): - members = [ - ("pos", numba.intp), - ("start", numba.intp), - ("stop", numba.intp), - ("arrayptrs", numba.types.CPointer(numba.intp)), - ("sharedptrs", numba.types.CPointer(numba.intp)), - ("pylookup", numba.types.pyobject), - ] - super().__init__(dmm, fe_type, members) - - -@numba.core.imputils.lower_constant(ArrayViewType) -def lower_const_Array(context, builder, viewtype, array): - return lower_const_view(context, builder, viewtype, array._numbaview) - - -def lower_const_view(context, builder, viewtype, view): - lookup = view.lookup - arrayptrs = lookup.arrayptrs - sharedptrs = lookup.sharedptrs - pos = view.pos - start = view.start - stop = view.stop - - arrayptrs_val = context.make_constant_array( - builder, numba.typeof(arrayptrs), arrayptrs - ) - sharedptrs_val = context.make_constant_array( - builder, numba.typeof(sharedptrs), sharedptrs - ) - - proxyout = context.make_helper(builder, viewtype) - proxyout.pos = context.get_constant(numba.intp, pos) - proxyout.start = context.get_constant(numba.intp, start) - proxyout.stop = context.get_constant(numba.intp, stop) - proxyout.arrayptrs = context.make_helper( - builder, numba.typeof(arrayptrs), arrayptrs_val - ).data - proxyout.sharedptrs = context.make_helper( - builder, numba.typeof(sharedptrs), sharedptrs_val - ).data - proxyout.pylookup = context.add_dynamic_addr( - builder, id(lookup), info=str(type(lookup)) - ) - - return proxyout._getvalue() - - -@numba.extending.unbox(ArrayViewType) -def unbox_Array(viewtype, arrayobj, c): - view_obj = c.pyapi.object_getattr_string(arrayobj, "_numbaview") - out = unbox_ArrayView(viewtype, view_obj, c) - c.pyapi.decref(view_obj) - return out - - -def unbox_ArrayView(viewtype, view_obj, c): - lookup_obj = c.pyapi.object_getattr_string(view_obj, "lookup") - pos_obj = c.pyapi.object_getattr_string(view_obj, "pos") - start_obj = c.pyapi.object_getattr_string(view_obj, "start") - stop_obj = c.pyapi.object_getattr_string(view_obj, "stop") - - lookup_val = c.pyapi.to_native_value(LookupType(), lookup_obj).value - lookup_proxy = c.context.make_helper(c.builder, LookupType(), lookup_val) - - proxyout = c.context.make_helper(c.builder, viewtype) - proxyout.pos = c.pyapi.number_as_ssize_t(pos_obj) - proxyout.start = c.pyapi.number_as_ssize_t(start_obj) - proxyout.stop = c.pyapi.number_as_ssize_t(stop_obj) - proxyout.arrayptrs = c.context.make_helper( - c.builder, LookupType.arraytype, lookup_proxy.arrayptrs - ).data - proxyout.sharedptrs = c.context.make_helper( - c.builder, LookupType.arraytype, lookup_proxy.sharedptrs - ).data - proxyout.pylookup = lookup_obj - - c.pyapi.decref(lookup_obj) - c.pyapi.decref(pos_obj) - c.pyapi.decref(start_obj) - c.pyapi.decref(stop_obj) - - if c.context.enable_nrt: - c.context.nrt.decref(c.builder, LookupType(), lookup_val) - - is_error = numba.core.cgutils.is_not_null(c.builder, c.pyapi.err_occurred()) - return numba.extending.NativeValue(proxyout._getvalue(), is_error) - - -@numba.extending.box(ArrayViewType) -def box_Array(viewtype, viewval, c): - arrayview_obj = box_ArrayView(viewtype, viewval, c) - out = c.pyapi.call_method(arrayview_obj, "toarray", ()) - c.pyapi.decref(arrayview_obj) - return out - - -def dict2serializable(obj): - if obj is None: - return None - else: - return tuple(obj.items()) - - -def serializable2dict(obj): - if obj is None: - return None - else: - return dict(obj) - - -def box_ArrayView(viewtype, viewval, c): - serializable2dict_obj = c.pyapi.unserialize( - c.pyapi.serialize_object(serializable2dict) - ) - behavior2_obj = c.pyapi.unserialize( - c.pyapi.serialize_object(dict2serializable(viewtype.behavior)) - ) - behavior_obj = c.pyapi.call_function_objargs( - serializable2dict_obj, (behavior2_obj,) - ) - ArrayView_obj = c.pyapi.unserialize(c.pyapi.serialize_object(ArrayView)) - type_obj = c.pyapi.unserialize(c.pyapi.serialize_object(viewtype.type)) - fields_obj = c.pyapi.unserialize(c.pyapi.serialize_object(viewtype.fields)) - - proxyin = c.context.make_helper(c.builder, viewtype, viewval) - pos_obj = c.pyapi.long_from_ssize_t(proxyin.pos) - start_obj = c.pyapi.long_from_ssize_t(proxyin.start) - stop_obj = c.pyapi.long_from_ssize_t(proxyin.stop) - lookup_obj = proxyin.pylookup - - out = c.pyapi.call_function_objargs( - ArrayView_obj, - (type_obj, behavior_obj, lookup_obj, pos_obj, start_obj, stop_obj, fields_obj), - ) - - c.pyapi.decref(serializable2dict_obj) - c.pyapi.decref(behavior2_obj) - c.pyapi.decref(behavior_obj) - c.pyapi.decref(ArrayView_obj) - c.pyapi.decref(type_obj) - c.pyapi.decref(fields_obj) - c.pyapi.decref(pos_obj) - c.pyapi.decref(start_obj) - c.pyapi.decref(stop_obj) - - return out - - -@numba.core.typing.templates.infer_global(len) -class type_len(numba.core.typing.templates.AbstractTemplate): - def generic(self, args, kwargs): - if len(args) == 1 and len(kwargs) == 0 and isinstance(args[0], ArrayViewType): - return numba.intp(args[0]) - - -@numba.extending.lower_builtin(len, ArrayViewType) -def lower_len(context, builder, sig, args): - proxyin = context.make_helper(builder, sig.args[0], args[0]) - return builder.sub(proxyin.stop, proxyin.start) - - -@numba.core.typing.templates.infer_global(operator.getitem) -class type_getitem(numba.core.typing.templates.AbstractTemplate): - def generic(self, args, kwargs): - if len(args) == 2 and len(kwargs) == 0 and isinstance(args[0], ArrayViewType): - viewtype, wheretype = args - if isinstance(wheretype, numba.types.Integer): - return viewtype.type.getitem_at_check(viewtype)(viewtype, wheretype) - elif ( - isinstance(wheretype, numba.types.SliceType) and not wheretype.has_step - ): - return viewtype.type.getitem_range(viewtype)(viewtype, wheretype) - elif isinstance(wheretype, numba.types.StringLiteral): - return viewtype.type.getitem_field(viewtype, wheretype.literal_value)( - viewtype, wheretype - ) - else: - raise TypeError( - "only an integer, start:stop range, or a *constant* " - "field name string may be used as ak.Array " - "slices in compiled code" + ak._util.exception_suffix(__file__) - ) - - -@numba.extending.lower_builtin(operator.getitem, ArrayViewType, numba.types.Integer) -def lower_getitem_at(context, builder, sig, args): - rettype, (viewtype, wheretype) = sig.return_type, sig.args - viewval, whereval = args - viewproxy = context.make_helper(builder, viewtype, viewval) - return viewtype.type.lower_getitem_at_check( - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - wheretype, - whereval, - True, - True, - ) - - -@numba.extending.lower_builtin(operator.getitem, ArrayViewType, numba.types.slice2_type) -def lower_getitem_range(context, builder, sig, args): - rettype, (viewtype, wheretype) = sig.return_type, sig.args - viewval, whereval = args - viewproxy = context.make_helper(builder, viewtype, viewval) - whereproxy = context.make_helper(builder, wheretype, whereval) - return viewtype.type.lower_getitem_range( - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - whereproxy.start, - whereproxy.stop, - True, - ) - - -@numba.extending.lower_builtin( - operator.getitem, ArrayViewType, numba.types.StringLiteral -) -def lower_getitem_field(context, builder, sig, args): - _, (viewtype, wheretype) = sig.return_type, sig.args - viewval, whereval = args - return viewtype.type.lower_getitem_field( - context, builder, viewtype, viewval, wheretype.literal_value - ) - - -@numba.core.typing.templates.infer_getattr -class type_getattr(numba.core.typing.templates.AttributeTemplate): - key = ArrayViewType - - def generic_resolve(self, viewtype, attr): - if attr == "ndim": - return numba.intp - else: - return viewtype.type.getitem_field(viewtype, attr) - - -@numba.extending.lower_getattr_generic(ArrayViewType) -def lower_getattr_generic(context, builder, viewtype, viewval, attr): - if attr == "ndim": - return context.get_constant(numba.intp, viewtype.type.ndim) - else: - return viewtype.type.lower_getitem_field( - context, builder, viewtype, viewval, attr - ) - - -class IteratorType(numba.types.common.SimpleIteratorType): - def __init__(self, viewtype): - super().__init__( - f"ak.Iterator({viewtype.name})", - viewtype.type.getitem_at_check(viewtype), - ) - self.viewtype = viewtype - - -@numba.core.typing.templates.infer -class type_getiter(numba.core.typing.templates.AbstractTemplate): - key = "getiter" - - def generic(self, args, kwargs): - if len(args) == 1 and len(kwargs) == 0 and isinstance(args[0], ArrayViewType): - return IteratorType(args[0])(args[0]) - - -@numba.core.datamodel.registry.register_default(IteratorType) -class IteratorModel(numba.core.datamodel.models.StructModel): - def __init__(self, dmm, fe_type): - members = [ - ("view", fe_type.viewtype), - ("length", numba.intp), - ("at", numba.types.EphemeralPointer(numba.intp)), - ] - super().__init__(dmm, fe_type, members) - - -@numba.extending.lower_builtin("getiter", ArrayViewType) -def lower_getiter(context, builder, sig, args): - rettype, (viewtype,) = sig.return_type, sig.args - (viewval,) = args - viewproxy = context.make_helper(builder, viewtype, viewval) - proxyout = context.make_helper(builder, rettype) - proxyout.view = viewval - proxyout.length = builder.sub(viewproxy.stop, viewproxy.start) - proxyout.at = numba.core.cgutils.alloca_once_value( - builder, context.get_constant(numba.intp, 0) - ) - if context.enable_nrt: - context.nrt.incref(builder, viewtype, viewval) - return numba.core.imputils.impl_ret_new_ref( - context, builder, rettype, proxyout._getvalue() - ) - - -@numba.extending.lower_builtin("iternext", IteratorType) -@numba.core.imputils.iternext_impl(numba.core.imputils.RefType.BORROWED) -def lower_iternext(context, builder, sig, args, result): - (itertype,) = sig.args - (iterval,) = args - proxyin = context.make_helper(builder, itertype, iterval) - at = builder.load(proxyin.at) - - is_valid = builder.icmp_signed("<", at, proxyin.length) - result.set_valid(is_valid) - - with builder.if_then(is_valid, likely=True): - result.yield_( - lower_getitem_at( - context, - builder, - itertype.yield_type(itertype.viewtype, numba.intp), - (proxyin.view, at), - ) - ) - nextat = numba.core.cgutils.increment_index(builder, at) - builder.store(nextat, proxyin.at) - - -########## RecordView - - -class RecordView: - @classmethod - def fromrecord(cls, record): - behavior = ak._util.behaviorof(record) - layout = ak.operations.convert.to_layout( - record, - allow_record=True, - allow_other=False, - numpytype=(np.number, bool, np.bool_), - ) - assert isinstance(layout, ak.layout.Record) - arraylayout = layout.array - return RecordView( - ArrayView( - ak._connect._numba.layout.typeof(arraylayout), - behavior, - Lookup(arraylayout), - 0, - 0, - len(arraylayout), - (), - ), - layout.at, - ) - - def __init__(self, arrayview, at): - self.arrayview = arrayview - self.at = at - - def torecord(self): - arraylayout = self.arrayview.toarray().layout - return ak._util.wrap( - ak.layout.Record(arraylayout, self.at), self.arrayview.behavior - ) - - -@numba.extending.typeof_impl.register(RecordView) -def typeof_RecordView(obj, c): - return RecordViewType(numba.typeof(obj.arrayview)) - - -class RecordViewType(numba.types.Type): - def __init__(self, arrayviewtype): - super().__init__(name=f"ak.RecordViewType({arrayviewtype.name})") - self.arrayviewtype = arrayviewtype - - @property - def behavior(self): - return self.arrayviewtype.behavior - - @property - def fields(self): - return self.arrayviewtype.fields - - def typer_field(self, key): - return self.arrayviewtype.type.getitem_field_record(self, key) - - def lower_field(self, context, builder, val, key): - return self.arrayviewtype.type.lower_getitem_field_record( - context, builder, self, val, key - ) - - -@numba.extending.register_model(RecordViewType) -class RecordViewModel(numba.core.datamodel.models.StructModel): - def __init__(self, dmm, fe_type): - members = [("arrayview", fe_type.arrayviewtype), ("at", numba.intp)] - super().__init__(dmm, fe_type, members) - - -@numba.core.imputils.lower_constant(RecordViewType) -def lower_const_Record(context, builder, recordviewtype, record): - arrayview_val = lower_const_view( - context, builder, recordviewtype.arrayviewtype, record._numbaview.arrayview - ) - proxyout = context.make_helper(builder, recordviewtype) - proxyout.arrayview = arrayview_val - proxyout.at = context.get_constant(numba.intp, record._layout.at) - return proxyout._getvalue() - - -@numba.extending.unbox(RecordViewType) -def unbox_RecordView(recordviewtype, recordobj, c): - recordview_obj = c.pyapi.object_getattr_string(recordobj, "_numbaview") - arrayview_obj = c.pyapi.object_getattr_string(recordview_obj, "arrayview") - at_obj = c.pyapi.object_getattr_string(recordview_obj, "at") - - arrayview_val = unbox_ArrayView( - recordviewtype.arrayviewtype, arrayview_obj, c - ).value - - proxyout = c.context.make_helper(c.builder, recordviewtype) - proxyout.arrayview = arrayview_val - proxyout.at = c.pyapi.number_as_ssize_t(at_obj) - - c.pyapi.decref(recordview_obj) - c.pyapi.decref(at_obj) - - if c.context.enable_nrt: - c.context.nrt.decref(c.builder, recordviewtype.arrayviewtype, arrayview_val) - - is_error = numba.core.cgutils.is_not_null(c.builder, c.pyapi.err_occurred()) - return numba.extending.NativeValue(proxyout._getvalue(), is_error) - - -@numba.extending.box(RecordViewType) -def box_RecordView(recordviewtype, viewval, c): - RecordView_obj = c.pyapi.unserialize(c.pyapi.serialize_object(RecordView)) - - proxyin = c.context.make_helper(c.builder, recordviewtype, viewval) - arrayview_obj = box_ArrayView(recordviewtype.arrayviewtype, proxyin.arrayview, c) - at_obj = c.pyapi.long_from_ssize_t(proxyin.at) - - recordview_obj = c.pyapi.call_function_objargs( - RecordView_obj, (arrayview_obj, at_obj) - ) - - out = c.pyapi.call_method(recordview_obj, "torecord", ()) - - c.pyapi.decref(RecordView_obj) - c.pyapi.decref(arrayview_obj) - c.pyapi.decref(at_obj) - c.pyapi.decref(recordview_obj) - - return out - - -@numba.core.typing.templates.infer_global(operator.getitem) -class type_getitem_record(numba.core.typing.templates.AbstractTemplate): - def generic(self, args, kwargs): - if len(args) == 2 and len(kwargs) == 0 and isinstance(args[0], RecordViewType): - recordviewtype, wheretype = args - if isinstance(wheretype, numba.types.StringLiteral): - return recordviewtype.arrayviewtype.type.getitem_field_record( - recordviewtype, wheretype.literal_value - )(recordviewtype, wheretype) - else: - raise TypeError( - "only a *constant* field name string may be used as " - "ak.Record slices in compiled code" - + ak._util.exception_suffix(__file__) - ) - - -@numba.extending.lower_builtin( - operator.getitem, RecordViewType, numba.types.StringLiteral -) -def lower_getitem_field_record(context, builder, sig, args): - _, (recordviewtype, wheretype) = sig.return_type, sig.args - recordviewval, whereval = args - return recordviewtype.arrayviewtype.type.lower_getitem_field_record( - context, builder, recordviewtype, recordviewval, wheretype.literal_value - ) - - -@numba.core.typing.templates.infer_getattr -class type_getattr_record(numba.core.typing.templates.AttributeTemplate): - key = RecordViewType - - def generic_resolve(self, recordviewtype, attr): - for methodname, typer, lower in ak._util.numba_methods( - recordviewtype.arrayviewtype.type, recordviewtype.arrayviewtype.behavior - ): - if attr == methodname: - - class type_method(numba.core.typing.templates.AbstractTemplate): - key = methodname - - def generic(self, args, kwargs): - if len(kwargs) == 0: - sig = typer(recordviewtype, args) # noqa: B023 - sig = numba.core.typing.templates.Signature( - sig.return_type, sig.args, recordviewtype - ) - numba.extending.lower_builtin( - methodname, # noqa: B023 - recordviewtype, - *[ - x.literal_type - if isinstance(x, numba.types.Literal) - else x - for x in args - ], - )( - lower # noqa: B023 - ) - return sig - - return numba.types.BoundFunction(type_method, recordviewtype) - - for attrname, typer, _ in ak._util.numba_attrs( - recordviewtype.arrayviewtype.type, recordviewtype.arrayviewtype.behavior - ): - if attr == attrname: - return typer(recordviewtype) - - return recordviewtype.typer_field(attr) - - -@numba.extending.lower_getattr_generic(RecordViewType) -def lower_getattr_generic_record(context, builder, recordviewtype, recordviewval, attr): - for attrname, typer, lower in ak._util.numba_attrs( - recordviewtype.arrayviewtype.type, recordviewtype.arrayviewtype.behavior - ): - if attr == attrname: - return lower( - context, - builder, - typer(recordviewtype)(recordviewtype), - (recordviewval,), - ) - return recordviewtype.lower_field(context, builder, recordviewval, attr) - - -def register_unary_operator(unaryop): - @numba.core.typing.templates.infer_global(unaryop) - class type_binary_operator(numba.core.typing.templates.AbstractTemplate): - def generic(self, args, kwargs): - if len(args) == 1 and len(kwargs) == 0: - behavior = None - - if isinstance(args[0], RecordViewType): - left = args[0].arrayviewtype.type - behavior = args[0].arrayviewtype.behavior - - for typer, lower in ak._util.numba_unaryops( - unaryop, left, behavior - ): - numba.extending.lower_builtin(unaryop, *args)(lower) - return typer(unaryop, args[0]) - - -for unaryop in ( - abs, - operator.inv, - operator.invert, - operator.neg, - operator.not_, - operator.pos, - operator.truth, -): - register_unary_operator(unaryop) - - -def register_binary_operator(binop): - @numba.core.typing.templates.infer_global(binop) - class type_binary_operator(numba.core.typing.templates.AbstractTemplate): - def generic(self, args, kwargs): - if len(args) == 2 and len(kwargs) == 0: - left, right, behavior = None, None, None - - if isinstance(args[0], RecordViewType): - left = args[0].arrayviewtype.type - behavior = args[0].arrayviewtype.behavior - - if isinstance(args[1], RecordViewType): - right = args[1].arrayviewtype.type - if behavior is None: - behavior = args[1].arrayviewtype.behavior - - if left is not None or right is not None: - for typer, lower in ak._util.numba_binops( - binop, left, right, behavior - ): - numba.extending.lower_builtin(binop, *args)(lower) - return typer(binop, args[0], args[1]) - - -for binop in ( - operator.add, - operator.and_, - operator.contains, - operator.eq, - operator.floordiv, - operator.ge, - operator.gt, - operator.le, - operator.lshift, - operator.lt, - operator.mod, - operator.mul, - operator.ne, - operator.or_, - operator.pow, - operator.rshift, - operator.sub, - operator.truediv, - operator.xor, -) + (() if not hasattr(operator, "matmul") else (operator.matmul,)): - register_binary_operator(binop) - - -########## __contains__ - - -@numba.extending.overload(operator.contains) -def overload_contains(obj, element): - if isinstance(obj, (ArrayViewType, RecordViewType)) and ( - (element == numba.types.none) - or (isinstance(element, (numba.types.Number, numba.types.Boolean))) - or ( - isinstance(element, numba.types.Optional) - and isinstance(element.type, (numba.types.Number, numba.types.Boolean)) - ) - ): - statements = [] - - def add_statement(indent, name, arraytype, is_array): - if is_array: - statements.append("for x in " + name + ":") - name = "x" - indent = indent + " " - - if isinstance(arraytype, ak._connect._numba.layout.RecordArrayType): - if arraytype.is_tuple: - for fi, ft in enumerate(arraytype.contenttypes): - add_statement(indent, name + "[" + repr(fi) + "]", ft, False) - else: - for fn, ft in zip(arraytype.recordlookup, arraytype.contenttypes): - add_statement(indent, name + "[" + repr(fn) + "]", ft, False) - - elif arraytype.ndim == 1 and not arraytype.is_recordtype: - if arraytype.is_optiontype: - statements.append( - indent + "if (element is None and {0} is None) or " - "({0} is not None and element == {0}): return True".format(name) - ) - else: - statements.append(indent + f"if element == {name}: return True") - - else: - if arraytype.is_optiontype: - statements.append( - indent + "if (element is None and {0} is None) or " - "({0} is not None and element in {0}): return True".format(name) - ) - else: - statements.append(indent + f"if element in {name}: return True") - - if isinstance(obj, ArrayViewType): - add_statement("", "obj", obj.type, True) - else: - add_statement("", "obj", obj.arrayviewtype.type, False) - - return code_to_function( - """ -def contains_impl(obj, element): - {} - return False""".format( - "\n ".join(statements) - ), - "contains_impl", - ) - - -########## np.array and np.asarray - - -array_supported = ( - numba.types.boolean, - numba.types.int8, - numba.types.int16, - numba.types.int32, - numba.types.int64, - numba.types.uint8, - numba.types.uint16, - numba.types.uint32, - numba.types.uint64, - numba.types.float32, - numba.types.float64, -) - - -@numba.extending.overload(ak.nplike.numpy.array) -def overload_np_array(array, dtype=None): - if isinstance(array, ArrayViewType): - ndim = array.type.ndim - inner_dtype = array.type.inner_dtype - if ndim is not None and inner_dtype in array_supported: - declare_shape = [] - compute_shape = [] - specify_shape = ["len(array)"] - ensure_shape = [] - array_name = "array" - for i in range(ndim - 1): - declare_shape.append(f"shape{i} = -1") - compute_shape.append( - "{}for x{} in {}:".format(" " * i, i, array_name) - ) - compute_shape.append("{} if shape{} == -1:".format(" " * i, i)) - compute_shape.append( - "{0} shape{1} = len(x{1})".format(" " * i, i) - ) - compute_shape.append( - "{0} elif shape{1} != len(x{1}):".format(" " * i, i) - ) - compute_shape.append( - "{} raise ValueError('cannot convert to NumPy because " - "subarray lengths are not regular')".format(" " * i) - ) - specify_shape.append(f"shape{i}") - ensure_shape.append("if shape{0} == -1: shape{0} = 0".format(i)) - array_name = f"x{i}" - - fill_array = [] - index = [] - array_name = "array" - for i in range(ndim): - fill_array.append( - "{0}for i{1}, x{1} in enumerate({2}):".format( - " " * i, i, array_name - ) - ) - index.append(f"i{i}") - array_name = f"x{i}" - - fill_array.append( - "{}out[{}] = x{}".format(" " * ndim, "][".join(index), ndim - 1) - ) - - return code_to_function( - """ -def array_impl(array, dtype=None): - {} - {} - {} - out = numpy.zeros(({}), {}) - {} - return out -""".format( - "\n ".join(declare_shape), - "\n ".join(compute_shape), - "\n ".join(ensure_shape), - ", ".join(specify_shape), - f"numpy.{inner_dtype}" if dtype is None else "dtype", - "\n ".join(fill_array), - ), - "array_impl", - {"numpy": ak.nplike.numpy}, - ) - - -@numba.extending.type_callable(ak.nplike.numpy.asarray) -def type_asarray(context): - def typer(arrayview): - if ( - isinstance(arrayview, ArrayViewType) - and isinstance(arrayview.type, ak._connect._numba.layout.NumpyArrayType) - and arrayview.type.ndim == 1 - and arrayview.type.inner_dtype in array_supported - ): - return numba.types.Array(arrayview.type.inner_dtype, 1, "C") - - return typer - - -@numba.extending.lower_builtin(ak.nplike.numpy.asarray, ArrayViewType) -def lower_asarray(context, builder, sig, args): - rettype, (viewtype,) = sig.return_type, sig.args - (viewval,) = args - viewproxy = context.make_helper(builder, viewtype, viewval) - assert isinstance(viewtype.type, ak._connect._numba.layout.NumpyArrayType) - - whichpos = ak._connect._numba.layout.posat( - context, builder, viewproxy.pos, viewtype.type.ARRAY - ) - arrayptr = ak._connect._numba.layout.getat( - context, builder, viewproxy.arrayptrs, whichpos - ) - - bitwidth = ak._connect._numba.layout.type_bitwidth(rettype.dtype) - itemsize = context.get_constant(numba.intp, bitwidth // 8) - - data = numba.core.cgutils.pointer_add( - builder, - arrayptr, - builder.mul(viewproxy.start, itemsize), - context.get_value_type(numba.types.CPointer(rettype.dtype)), - ) - - shape = context.make_tuple( - builder, - numba.types.UniTuple(numba.types.intp, 1), - (builder.sub(viewproxy.stop, viewproxy.start),), - ) - strides = context.make_tuple( - builder, - numba.types.UniTuple(numba.types.intp, 1), - (itemsize,), - ) - - out = numba.np.arrayobj.make_array(rettype)(context, builder) - numba.np.arrayobj.populate_array( - out, - data=data, - shape=shape, - strides=strides, - itemsize=itemsize, - meminfo=None, - parent=None, - ) - return out._getvalue() - - -########## PartitionedView - - -class PartitionedView: - def __init__(self, type, behavior, lookups, stops, start, stop, fields): - self.type = type - self.behavior = behavior - self.lookups = lookups - self.stops = stops - self.start = start - self.stop = stop - self.fields = fields - - def toarray(self): - output = [] - partition_start = 0 - for partitionid, lookup in enumerate(self.lookups): - partition_stop = self.stops[partitionid] - - if partition_start <= self.start and self.stop <= partition_stop: - layout = self.type.tolayout(lookup, 0, self.fields) - output.append( - layout[self.start - partition_start : self.stop - partition_start] - ) - break - - elif partition_start <= self.start < partition_stop: - layout = self.type.tolayout(lookup, 0, self.fields) - output.append( - layout[ - self.start - partition_start : partition_stop - partition_start - ] - ) - - elif partition_start < self.stop <= partition_stop: - layout = self.type.tolayout(lookup, 0, self.fields) - output.append(layout[0 : self.stop - partition_start]) - break - - elif self.start < partition_start and partition_stop < self.stop: - layout = self.type.tolayout(lookup, 0, self.fields) - output.append(layout[0 : partition_stop - partition_start]) - - partition_start = partition_stop - - return ak._util.wrap( - ak.partition.IrregularlyPartitionedArray(output), self.behavior - ) - - -@numba.extending.typeof_impl.register(PartitionedView) -def typeof_PartitionedView(obj, c): - return PartitionedViewType(obj.type, obj.behavior, obj.fields) - - -class PartitionedViewType(numba.types.IterableType, numba.types.Sized): - stopstype = numba.types.Array(numba.intp, 1, "C") - - def __init__(self, type, behavior, fields): - super().__init__( - name="ak.PartitionedView({}, {}, {})".format( - type.name, - ak._connect._numba.repr_behavior(behavior), - repr(fields), - ) - ) - self.type = type - self.behavior = behavior - self.fields = fields - - @property - def iterator_type(self): - return PartitionedIteratorType(self) - - def toArrayViewType(self): - return ArrayViewType(self.type, self.behavior, self.fields) - - def getitem_field(self, key): - return PartitionedViewType(self.type, self.behavior, self.fields + (key,)) - - def lower_get_localstart(self, context, builder, stops, partitionid): - out = numba.core.cgutils.alloca_once_value( - builder, context.get_constant(numba.intp, 0) - ) - - with builder.if_then( - builder.icmp_signed("!=", partitionid, context.get_constant(numba.intp, 0)) - ): - stopsproxy = context.make_helper(builder, self.stopstype, stops) - newval = numba.np.arrayobj._getitem_array_single_int( - context, - builder, - numba.intp, - self.stopstype, - stopsproxy, - builder.sub(partitionid, context.get_constant(numba.intp, 1)), - ) - builder.store(newval, out) - - return builder.load(out) - - def lower_get_localstop(self, context, builder, stops, partitionid): - stopsproxy = context.make_helper(builder, self.stopstype, stops) - return numba.np.arrayobj._getitem_array_single_int( - context, builder, numba.intp, self.stopstype, stopsproxy, partitionid - ) - - def lower_get_partitionid( - self, context, builder, pyapi, pylookups, partitionid, viewlength - ): - lookup_obj = pyapi.list_getitem(pylookups, partitionid) # borrowed - lookup = pyapi.to_native_value(LookupType(), lookup_obj).value - lookupproxy = context.make_helper(builder, LookupType(), value=lookup) - - viewproxy = context.make_helper(builder, self.toArrayViewType()) - viewproxy.pos = context.get_constant(numba.intp, 0) - viewproxy.start = context.get_constant(numba.intp, 0) - viewproxy.stop = viewlength - viewproxy.arrayptrs = context.make_helper( - builder, LookupType.arraytype, lookupproxy.arrayptrs - ).data - viewproxy.sharedptrs = context.make_helper( - builder, LookupType.arraytype, lookupproxy.sharedptrs - ).data - viewproxy.pylookup = lookup_obj - return viewproxy._getvalue() - - -@numba.extending.register_model(PartitionedViewType) -class PartitionedViewModel(numba.core.datamodel.models.StructModel): - def __init__(self, dmm, fe_type): - members = [ - ("pylookups", numba.types.pyobject), - ("partitionid", numba.types.CPointer(numba.intp)), - ("stops", fe_type.stopstype), - ("view", numba.types.CPointer(fe_type.toArrayViewType())), - ("start", numba.intp), - ("stop", numba.intp), - ] - super().__init__(dmm, fe_type, members) - - -@numba.extending.unbox(PartitionedViewType) -def unbox_PartitionedArray(partviewtype, arrayobj, c): - partview_obj = c.pyapi.object_getattr_string(arrayobj, "_numbaview") - out = unbox_PartitionedView(partviewtype, partview_obj, c) - c.pyapi.decref(partview_obj) - return out - - -def unbox_PartitionedView(partviewtype, partview_obj, c): - lookups_obj = c.pyapi.object_getattr_string(partview_obj, "lookups") - stops_obj = c.pyapi.object_getattr_string(partview_obj, "stops") - start_obj = c.pyapi.object_getattr_string(partview_obj, "start") - stop_obj = c.pyapi.object_getattr_string(partview_obj, "stop") - - proxyout = c.context.make_helper(c.builder, partviewtype) - proxyout.pylookups = lookups_obj - partitionid = c.context.get_constant(numba.intp, 0) - proxyout.partitionid = numba.core.cgutils.alloca_once_value(c.builder, partitionid) - proxyout.stops = c.pyapi.to_native_value(partviewtype.stopstype, stops_obj).value - viewlength = partviewtype.lower_get_localstop( - c.context, c.builder, proxyout.stops, partitionid - ) - proxyout.view = numba.core.cgutils.alloca_once_value( - c.builder, - partviewtype.lower_get_partitionid( - c.context, c.builder, c.pyapi, proxyout.pylookups, partitionid, viewlength - ), - ) - proxyout.start = c.pyapi.number_as_ssize_t(start_obj) - proxyout.stop = c.pyapi.number_as_ssize_t(stop_obj) - - c.pyapi.decref(lookups_obj) - c.pyapi.decref(stops_obj) - c.pyapi.decref(start_obj) - c.pyapi.decref(stop_obj) - - is_error = numba.core.cgutils.is_not_null(c.builder, c.pyapi.err_occurred()) - return numba.extending.NativeValue(proxyout._getvalue(), is_error) - - -@numba.extending.box(PartitionedViewType) -def box_PartitionedArray(partviewtype, partviewval, c): - arrayview_obj = box_PartitionedView(partviewtype, partviewval, c) - out = c.pyapi.call_method(arrayview_obj, "toarray", ()) - c.pyapi.decref(arrayview_obj) - return out - - -def box_PartitionedView(partviewtype, partviewval, c): - serializable2dict_obj = c.pyapi.unserialize( - c.pyapi.serialize_object(serializable2dict) - ) - behavior2_obj = c.pyapi.unserialize( - c.pyapi.serialize_object(dict2serializable(partviewtype.behavior)) - ) - behavior_obj = c.pyapi.call_function_objargs( - serializable2dict_obj, (behavior2_obj,) - ) - PartitionedView_obj = c.pyapi.unserialize(c.pyapi.serialize_object(PartitionedView)) - type_obj = c.pyapi.unserialize(c.pyapi.serialize_object(partviewtype.type)) - fields_obj = c.pyapi.unserialize(c.pyapi.serialize_object(partviewtype.fields)) - - proxyin = c.context.make_helper(c.builder, partviewtype, partviewval) - lookups_obj = proxyin.pylookups - stops_obj = c.pyapi.from_native_value( - partviewtype.stopstype, proxyin.stops, c.env_manager - ) - start_obj = c.pyapi.long_from_ssize_t(proxyin.start) - stop_obj = c.pyapi.long_from_ssize_t(proxyin.stop) - - out = c.pyapi.call_function_objargs( - PartitionedView_obj, - ( - type_obj, - behavior_obj, - lookups_obj, - stops_obj, - start_obj, - stop_obj, - fields_obj, - ), - ) - - c.pyapi.decref(serializable2dict_obj) - c.pyapi.decref(behavior2_obj) - c.pyapi.decref(behavior_obj) - c.pyapi.decref(PartitionedView_obj) - c.pyapi.decref(type_obj) - c.pyapi.decref(fields_obj) - c.pyapi.decref(stops_obj) - c.pyapi.decref(start_obj) - c.pyapi.decref(stop_obj) - - return out - - -@numba.core.typing.templates.infer_global(operator.getitem) -class type_getitem_partitioned(numba.core.typing.templates.AbstractTemplate): - def generic(self, args, kwargs): - if ( - len(args) == 2 - and len(kwargs) == 0 - and isinstance(args[0], PartitionedViewType) - ): - partviewtype, wheretype = args - - if isinstance(wheretype, numba.types.Integer): - arrayviewtype = partviewtype.toArrayViewType() - rettype = partviewtype.type.getitem_at_check(arrayviewtype) - return rettype(partviewtype, wheretype) - - elif ( - isinstance(wheretype, numba.types.SliceType) and not wheretype.has_step - ): - return partviewtype(partviewtype, wheretype) - - elif isinstance(wheretype, numba.types.StringLiteral): - rettype = partviewtype.getitem_field(wheretype.literal_value) - return rettype(partviewtype, wheretype) - - else: - raise TypeError( - "only an integer, start:stop range, or a *constant* " - "field name string may be used as ak.Array " - "slices in compiled code" + ak._util.exception_suffix(__file__) - ) - - -@numba.extending.lower_builtin( - operator.getitem, PartitionedViewType, numba.types.Integer -) -def lower_getitem_at_partitioned(context, builder, sig, args): - rettype, (partviewtype, wheretype) = sig.return_type, sig.args - partviewval, whereval = args - partviewproxy = context.make_helper(builder, partviewtype, partviewval) - - length = builder.sub(partviewproxy.stop, partviewproxy.start) - regular_atval = numba.core.cgutils.alloca_once_value(builder, whereval) - - with builder.if_then( - builder.icmp_signed("<", whereval, context.get_constant(numba.intp, 0)) - ): - builder.store(builder.add(whereval, length), regular_atval) - atval = builder.load(regular_atval) - - with builder.if_then( - builder.or_( - builder.icmp_signed("<", atval, context.get_constant(numba.intp, 0)), - builder.icmp_signed(">=", atval, length), - ) - ): - context.call_conv.return_user_exc( - builder, ValueError, ("slice index out of bounds",) - ) - - localstart = partviewtype.lower_get_localstart( - context, builder, partviewproxy.stops, builder.load(partviewproxy.partitionid) - ) - localstop = partviewtype.lower_get_localstop( - context, builder, partviewproxy.stops, builder.load(partviewproxy.partitionid) - ) - - with builder.if_then( - builder.not_( - builder.and_( - builder.icmp_signed("<=", localstart, atval), - builder.icmp_signed(">", atval, localstop), - ) - ), - likely=False, - ): - - searchsorted_sig = numba.intp(partviewtype.stopstype, wheretype) - searchsorted_args = (partviewproxy.stops, atval) - - def searchsorted_impl(stops, where): - return ak.nplike.numpy.searchsorted(stops, where, side="right") - - partitionid_val = context.compile_internal( - builder, searchsorted_impl, searchsorted_sig, searchsorted_args - ) - builder.store(partitionid_val, partviewproxy.partitionid) - - pyapi = context.get_python_api(builder) - gil = pyapi.gil_ensure() - builder.store( - partviewtype.lower_get_partitionid( - context, - builder, - pyapi, - partviewproxy.pylookups, - builder.load(partviewproxy.partitionid), - builder.sub(localstop, localstart), - ), - partviewproxy.view, - ) - pyapi.gil_release(gil) - - viewtype = partviewtype.toArrayViewType() - viewval = builder.load(partviewproxy.view) - viewproxy = context.make_helper(builder, viewtype, value=viewval) - - reallocalstart = partviewtype.lower_get_localstart( - context, builder, partviewproxy.stops, builder.load(partviewproxy.partitionid) - ) - subatval = builder.sub(atval, reallocalstart) - - return viewtype.type.lower_getitem_at_check( - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - numba.intp, - subatval, - False, - False, - ) - - -@numba.extending.lower_builtin( - operator.getitem, PartitionedViewType, numba.types.slice2_type -) -def lower_getitem_range_partitioned(context, builder, sig, args): - _, (partviewtype, wheretype) = sig.return_type, sig.args - partviewval, whereval = args - - whereproxy = context.make_helper(builder, wheretype, whereval) - start = whereproxy.start - stop = whereproxy.stop - - partviewproxy = context.make_helper(builder, partviewtype, partviewval) - length = builder.sub(partviewproxy.stop, partviewproxy.start) - - regular_start = numba.core.cgutils.alloca_once_value(builder, start) - regular_stop = numba.core.cgutils.alloca_once_value(builder, stop) - - with builder.if_then( - builder.icmp_signed("<", start, context.get_constant(numba.intp, 0)) - ): - builder.store(builder.add(start, length), regular_start) - with builder.if_then( - builder.icmp_signed("<", stop, context.get_constant(numba.intp, 0)) - ): - builder.store(builder.add(stop, length), regular_stop) - - with builder.if_then( - builder.icmp_signed( - "<", builder.load(regular_start), context.get_constant(numba.intp, 0) - ) - ): - builder.store(context.get_constant(numba.intp, 0), regular_start) - with builder.if_then(builder.icmp_signed(">", builder.load(regular_start), length)): - builder.store(length, regular_start) - - with builder.if_then( - builder.icmp_signed( - "<", builder.load(regular_stop), builder.load(regular_start) - ) - ): - builder.store(builder.load(regular_start), regular_stop) - with builder.if_then(builder.icmp_signed(">", builder.load(regular_stop), length)): - builder.store(length, regular_stop) - - proxyout = context.make_helper(builder, partviewtype) - proxyout.pylookups = partviewproxy.pylookups - proxyout.partitionid = numba.core.cgutils.alloca_once_value( - builder, builder.load(partviewproxy.partitionid) - ) - proxyout.stops = partviewproxy.stops - proxyout.view = numba.core.cgutils.alloca_once_value( - builder, builder.load(partviewproxy.view) - ) - proxyout.start = builder.load(regular_start) - proxyout.stop = builder.load(regular_stop) - - if context.enable_nrt: - context.nrt.incref(builder, partviewtype.stopstype, proxyout.stops) - - return proxyout._getvalue() - - -@numba.extending.lower_builtin( - operator.getitem, PartitionedViewType, numba.types.StringLiteral -) -def lower_getitem_field_partitioned(context, builder, sig, args): - _, (partviewtype, _) = sig.return_type, sig.args - partviewval, whereval = args - - if context.enable_nrt: - partviewproxy = context.make_helper(builder, partviewtype, partviewval) - context.nrt.incref(builder, partviewtype.stopstype, partviewproxy.stops) - - return partviewval - - -@numba.core.typing.templates.infer_global(len) -class type_len_partitioned(numba.core.typing.templates.AbstractTemplate): - def generic(self, args, kwargs): - if ( - len(args) == 1 - and len(kwargs) == 0 - and isinstance(args[0], PartitionedViewType) - ): - return numba.intp(args[0]) - - -@numba.extending.lower_builtin(len, PartitionedViewType) -def lower_len_partitioned(context, builder, sig, args): - proxyin = context.make_helper(builder, sig.args[0], args[0]) - return builder.sub(proxyin.stop, proxyin.start) - - -@numba.core.typing.templates.infer_getattr -class type_getattr_partitioned(numba.core.typing.templates.AttributeTemplate): - key = PartitionedViewType - - def generic_resolve(self, partviewtype, attr): - if attr == "ndim": - return numba.intp - else: - return partviewtype.getitem_field(attr) - - -@numba.extending.lower_getattr_generic(PartitionedViewType) -def lower_getattr_generic_partitioned( - context, builder, partviewtype, partviewval, attr -): - if attr == "ndim": - return context.get_constant(numba.intp, partviewtype.type.ndim) - elif context.enable_nrt: - partviewproxy = context.make_helper(builder, partviewtype, partviewval) - context.nrt.incref(builder, partviewtype.stopstype, partviewproxy.stops) - - return partviewval - - -class PartitionedIteratorType(numba.types.common.SimpleIteratorType): - def __init__(self, partviewtype): - super().__init__( - f"ak.PartitionedIterator({partviewtype.name})", - partviewtype.type.getitem_at_check(partviewtype.toArrayViewType()), - ) - self.partviewtype = partviewtype - - -@numba.core.typing.templates.infer -class type_getiter_partitioned(numba.core.typing.templates.AbstractTemplate): - key = "getiter" - - def generic(self, args, kwargs): - if ( - len(args) == 1 - and len(kwargs) == 0 - and isinstance(args[0], PartitionedViewType) - ): - return PartitionedIteratorType(args[0])(args[0]) - - -@numba.core.datamodel.registry.register_default(PartitionedIteratorType) -class PartitionedIteratorModel(numba.core.datamodel.models.StructModel): - def __init__(self, dmm, fe_type): - members = [ - ("partview", fe_type.partviewtype), - ("length", numba.intp), - ("at", numba.types.EphemeralPointer(numba.intp)), - ] - super().__init__(dmm, fe_type, members) - - -@numba.extending.lower_builtin("getiter", PartitionedViewType) -def lower_getiter_partitioned(context, builder, sig, args): - rettype, (partviewtype,) = sig.return_type, sig.args - (partviewval,) = args - partviewproxy = context.make_helper(builder, partviewtype, partviewval) - - partitionid = context.get_constant(numba.intp, 0) - viewlength = partviewtype.lower_get_localstop( - context, builder, partviewproxy.stops, partitionid - ) - - partoutproxy = context.make_helper(builder, partviewtype) - partoutproxy.pylookups = partviewproxy.pylookups - partoutproxy.partitionid = numba.core.cgutils.alloca_once_value( - builder, partitionid - ) - partoutproxy.stops = partviewproxy.stops - - pyapi = context.get_python_api(builder) - gil = pyapi.gil_ensure() - partoutproxy.view = numba.core.cgutils.alloca_once_value( - builder, - partviewtype.lower_get_partitionid( - context, builder, pyapi, partviewproxy.pylookups, partitionid, viewlength - ), - ) - pyapi.gil_release(gil) - - partoutproxy.start = partviewproxy.start - partoutproxy.stop = partviewproxy.stop - - proxyout = context.make_helper(builder, rettype) - proxyout.partview = partoutproxy._getvalue() - proxyout.length = builder.sub(partviewproxy.stop, partviewproxy.start) - proxyout.at = numba.core.cgutils.alloca_once_value( - builder, context.get_constant(numba.intp, 0) - ) - - if context.enable_nrt: - context.nrt.incref(builder, partviewtype.stopstype, partoutproxy.stops) - - return numba.core.imputils.impl_ret_new_ref( - context, builder, rettype, proxyout._getvalue() - ) - - -@numba.extending.lower_builtin("iternext", PartitionedIteratorType) -@numba.core.imputils.iternext_impl(numba.core.imputils.RefType.BORROWED) -def lower_iternext_partitioned(context, builder, sig, args, result): - (itertype,) = sig.args - (iterval,) = args - - proxyin = context.make_helper(builder, itertype, iterval) - partviewproxy = context.make_helper( - builder, itertype.partviewtype, proxyin.partview - ) - at = builder.load(proxyin.at) - - is_valid = builder.icmp_signed("<", at, proxyin.length) - result.set_valid(is_valid) - - with builder.if_then(is_valid, likely=True): - maybestop = itertype.partviewtype.lower_get_localstop( - context, - builder, - partviewproxy.stops, - builder.load(partviewproxy.partitionid), - ) - - with builder.if_then(builder.icmp_signed("==", at, maybestop)): - builder.store( - builder.add( - builder.load(partviewproxy.partitionid), - context.get_constant(numba.intp, 1), - ), - partviewproxy.partitionid, - ) - - localstart = itertype.partviewtype.lower_get_localstart( - context, - builder, - partviewproxy.stops, - builder.load(partviewproxy.partitionid), - ) - localstop = itertype.partviewtype.lower_get_localstop( - context, - builder, - partviewproxy.stops, - builder.load(partviewproxy.partitionid), - ) - - pyapi = context.get_python_api(builder) - gil = pyapi.gil_ensure() - builder.store( - itertype.partviewtype.lower_get_partitionid( - context, - builder, - pyapi, - partviewproxy.pylookups, - builder.load(partviewproxy.partitionid), - builder.sub(localstop, localstart), - ), - partviewproxy.view, - ) - pyapi.gil_release(gil) - - realstart = itertype.partviewtype.lower_get_localstart( - context, - builder, - partviewproxy.stops, - builder.load(partviewproxy.partitionid), - ) - - outview = builder.load(partviewproxy.view) - outviewtype = itertype.partviewtype.toArrayViewType() - outviewproxy = context.make_helper(builder, outviewtype, outview) - - result.yield_( - itertype.partviewtype.type.lower_getitem_at_check( - context, - builder, - itertype.partviewtype.type.getitem_at_check(outviewtype), - outviewtype, - outview, - outviewproxy, - numba.intp, - builder.sub(at, realstart), - False, - False, - ) - ) - - nextat = numba.core.cgutils.increment_index(builder, at) - builder.store(nextat, proxyin.at) diff --git a/src/awkward/_connect/_numba/builder.py b/src/awkward/_connect/_numba/builder.py deleted file mode 100644 index 4e2cdb03cb..0000000000 --- a/src/awkward/_connect/_numba/builder.py +++ /dev/null @@ -1,578 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -# v2: replace with src/awkward/_v2/_connect/numba/builder.py - -import numba -import numba.core.typing -import numba.core.typing.ctypes_utils - -import awkward as ak - -numpy = ak.nplike.Numpy.instance() - -dynamic_addrs = {} - - -def globalstring(context, builder, pyvalue): - import llvmlite.ir.types - - if pyvalue not in dynamic_addrs: - buf = dynamic_addrs[pyvalue] = numpy.array(pyvalue.encode("utf-8") + b"\x00") - context.add_dynamic_addr(builder, buf.ctypes.data, info=f"str({pyvalue!r})") - ptr = context.get_constant(numba.types.uintp, dynamic_addrs[pyvalue].ctypes.data) - return builder.inttoptr(ptr, llvmlite.ir.PointerType(llvmlite.ir.IntType(8))) - - -class ArrayBuilderType(numba.types.Type): - def __init__(self, behavior): - super().__init__( - name="ak.ArrayBuilderType({})".format( - ak._connect._numba.repr_behavior(behavior) - ) - ) - self.behavior = behavior - - -@numba.extending.register_model(ArrayBuilderType) -class ArrayBuilderModel(numba.core.datamodel.models.StructModel): - def __init__(self, dmm, fe_type): - members = [("rawptr", numba.types.voidptr), ("pyptr", numba.types.pyobject)] - super().__init__(dmm, fe_type, members) - - -@numba.core.imputils.lower_constant(ArrayBuilderType) -def lower_const_ArrayBuilder(context, builder, arraybuildertype, arraybuilder): - layout = arraybuilder._layout - rawptr = context.get_constant(numba.intp, arraybuilder._layout._ptr) - proxyout = context.make_helper(builder, arraybuildertype) - proxyout.rawptr = builder.inttoptr( - rawptr, context.get_value_type(numba.types.voidptr) - ) - proxyout.pyptr = context.add_dynamic_addr( - builder, id(layout), info=str(type(layout)) - ) - return proxyout._getvalue() - - -@numba.extending.unbox(ArrayBuilderType) -def unbox_ArrayBuilder(arraybuildertype, arraybuilderobj, c): - inner_obj = c.pyapi.object_getattr_string(arraybuilderobj, "_layout") - rawptr_obj = c.pyapi.object_getattr_string(inner_obj, "_ptr") - - proxyout = c.context.make_helper(c.builder, arraybuildertype) - proxyout.rawptr = c.pyapi.long_as_voidptr(rawptr_obj) - proxyout.pyptr = inner_obj - - c.pyapi.decref(inner_obj) - c.pyapi.decref(rawptr_obj) - - is_error = numba.core.cgutils.is_not_null(c.builder, c.pyapi.err_occurred()) - return numba.extending.NativeValue(proxyout._getvalue(), is_error) - - -@numba.extending.box(ArrayBuilderType) -def box_ArrayBuilder(arraybuildertype, arraybuilderval, c): - ArrayBuilder_obj = c.pyapi.unserialize( - c.pyapi.serialize_object(ak.highlevel.ArrayBuilder) - ) - behavior_obj = c.pyapi.unserialize( - c.pyapi.serialize_object(arraybuildertype.behavior) - ) - - proxyin = c.context.make_helper(c.builder, arraybuildertype, arraybuilderval) - c.pyapi.incref(proxyin.pyptr) - - out = c.pyapi.call_method(ArrayBuilder_obj, "_wrap", (proxyin.pyptr, behavior_obj)) - - c.pyapi.decref(ArrayBuilder_obj) - c.pyapi.decref(behavior_obj) - c.pyapi.decref(proxyin.pyptr) - - return out - - -def call(context, builder, fcn, args): - numbatype = numba.core.typing.ctypes_utils.make_function_type(fcn) - fcntype = context.get_function_pointer_type(numbatype) - fcnval = context.add_dynamic_addr( - builder, numbatype.get_pointer(fcn), info=fcn.name - ) - fcnptr = builder.bitcast(fcnval, fcntype) - err = context.call_function_pointer(builder, fcnptr, args) - with builder.if_then( - builder.icmp_unsigned("!=", err, context.get_constant(numba.uint8, 0)), - likely=False, - ): - context.call_conv.return_user_exc(builder, ValueError, (fcn.name + " failed",)) - - -@numba.core.typing.templates.infer_global(len) -class type_len(numba.core.typing.templates.AbstractTemplate): - def generic(self, args, kwargs): - if ( - len(args) == 1 - and len(kwargs) == 0 - and isinstance(args[0], ArrayBuilderType) - ): - return numba.intp(args[0]) - - -@numba.extending.lower_builtin(len, ArrayBuilderType) -def lower_len(context, builder, sig, args): - (arraybuildertype,) = sig.args - (arraybuilderval,) = args - proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) - result = numba.core.cgutils.alloca_once( - builder, context.get_value_type(numba.int64) - ) - call( - context, - builder, - ak._libawkward.ArrayBuilder_length, - (proxyin.rawptr, result), - ) - return ak._connect._numba.castint( - context, builder, numba.int64, numba.intp, builder.load(result) - ) - - -@numba.core.typing.templates.infer_getattr -class type_methods(numba.core.typing.templates.AttributeTemplate): - key = ArrayBuilderType - - @numba.core.typing.templates.bound_function("clear") - def resolve_clear(self, arraybuildertype, args, kwargs): - if len(args) == 0 and len(kwargs) == 0: - return numba.types.none() - else: - raise TypeError( - "wrong number of arguments for ArrayBuilder.clear" - + ak._util.exception_suffix(__file__) - ) - - @numba.core.typing.templates.bound_function("null") - def resolve_null(self, arraybuildertype, args, kwargs): - if len(args) == 0 and len(kwargs) == 0: - return numba.types.none() - else: - raise TypeError( - "wrong number of arguments for ArrayBuilder.null" - + ak._util.exception_suffix(__file__) - ) - - @numba.core.typing.templates.bound_function("boolean") - def resolve_boolean(self, arraybuildertype, args, kwargs): - if ( - len(args) == 1 - and len(kwargs) == 0 - and isinstance(args[0], numba.types.Boolean) - ): - return numba.types.none(args[0]) - else: - raise TypeError( - "wrong number or types of arguments for ArrayBuilder.boolean" - + ak._util.exception_suffix(__file__) - ) - - @numba.core.typing.templates.bound_function("integer") - def resolve_integer(self, arraybuildertype, args, kwargs): - if ( - len(args) == 1 - and len(kwargs) == 0 - and isinstance(args[0], numba.types.Integer) - ): - return numba.types.none(args[0]) - else: - raise TypeError( - "wrong number or types of arguments for ArrayBuilder.integer" - + ak._util.exception_suffix(__file__) - ) - - @numba.core.typing.templates.bound_function("real") - def resolve_real(self, arraybuildertype, args, kwargs): - if ( - len(args) == 1 - and len(kwargs) == 0 - and isinstance(args[0], (numba.types.Integer, numba.types.Float)) - ): - return numba.types.none(args[0]) - else: - raise TypeError( - "wrong number or types of arguments for ArrayBuilder.real" - + ak._util.exception_suffix(__file__) - ) - - @numba.core.typing.templates.bound_function("begin_list") - def resolve_begin_list(self, arraybuildertype, args, kwargs): - if len(args) == 0 and len(kwargs) == 0: - return numba.types.none() - else: - raise TypeError( - "wrong number of arguments for ArrayBuilder.begin_list" - + ak._util.exception_suffix(__file__) - ) - - @numba.core.typing.templates.bound_function("end_list") - def resolve_end_list(self, arraybuildertype, args, kwargs): - if len(args) == 0 and len(kwargs) == 0: - return numba.types.none() - else: - raise TypeError( - "wrong number of arguments for ArrayBuilder.end_list" - + ak._util.exception_suffix(__file__) - ) - - @numba.core.typing.templates.bound_function("begin_tuple") - def resolve_begin_tuple(self, arraybuildertype, args, kwargs): - if ( - len(args) == 1 - and len(kwargs) == 0 - and isinstance(args[0], numba.types.Integer) - ): - return numba.types.none(args[0]) - else: - raise TypeError( - "wrong number or types of arguments for ArrayBuilder.begin_tuple" - + ak._util.exception_suffix(__file__) - ) - - @numba.core.typing.templates.bound_function("index") - def resolve_index(self, arraybuildertype, args, kwargs): - if ( - len(args) == 1 - and len(kwargs) == 0 - and isinstance(args[0], numba.types.Integer) - ): - return arraybuildertype(args[0]) - else: - raise TypeError( - "wrong number or types of arguments for ArrayBuilder.index" - + ak._util.exception_suffix(__file__) - ) - - @numba.core.typing.templates.bound_function("end_tuple") - def resolve_end_tuple(self, arraybuildertype, args, kwargs): - if len(args) == 0 and len(kwargs) == 0: - return numba.types.none() - else: - raise TypeError( - "wrong number of arguments for ArrayBuilder.end_tuple" - + ak._util.exception_suffix(__file__) - ) - - @numba.core.typing.templates.bound_function("begin_record") - def resolve_begin_record(self, arraybuildertype, args, kwargs): - if len(args) == 0 and len(kwargs) == 0: - return numba.types.none() - elif ( - len(args) == 1 - and len(kwargs) == 0 - and isinstance(args[0], numba.types.StringLiteral) - ): - return numba.types.none(args[0]) - else: - raise TypeError( - "wrong number or types of arguments for ArrayBuilder.begin_record" - + ak._util.exception_suffix(__file__) - ) - - @numba.core.typing.templates.bound_function("field") - def resolve_field(self, arraybuildertype, args, kwargs): - if ( - len(args) == 1 - and len(kwargs) == 0 - and isinstance(args[0], numba.types.StringLiteral) - ): - return arraybuildertype(args[0]) - else: - raise TypeError( - "wrong number or types of arguments for ArrayBuilder.field" - + ak._util.exception_suffix(__file__) - ) - - @numba.core.typing.templates.bound_function("end_record") - def resolve_end_record(self, arraybuildertype, args, kwargs): - if len(args) == 0 and len(kwargs) == 0: - return numba.types.none() - else: - raise TypeError( - "wrong number of arguments for ArrayBuilder.end_record" - + ak._util.exception_suffix(__file__) - ) - - @numba.core.typing.templates.bound_function("append") - def resolve_append(self, arraybuildertype, args, kwargs): - if ( - len(args) == 1 - and len(kwargs) == 0 - and isinstance( - args[0], - ( - numba.types.Boolean, - numba.types.Integer, - numba.types.Float, - ), - ) - ): - return numba.types.none(args[0]) - elif ( - len(args) == 1 - and len(kwargs) == 0 - and isinstance(args[0], numba.types.Optional) - and isinstance( - args[0].type, - (numba.types.Boolean, numba.types.Integer, numba.types.Float), - ) - ): - return numba.types.none(args[0]) - elif ( - len(args) == 1 - and len(kwargs) == 0 - and isinstance(args[0], numba.types.NoneType) - ): - return numba.types.none(args[0]) - else: - raise AssertionError(args[0]) - - -@numba.extending.lower_builtin("clear", ArrayBuilderType) -def lower_clear(context, builder, sig, args): - (arraybuildertype,) = sig.args - (arraybuilderval,) = args - proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) - call(context, builder, ak._libawkward.ArrayBuilder_clear, (proxyin.rawptr,)) - return context.get_dummy_value() - - -@numba.extending.lower_builtin("null", ArrayBuilderType) -def lower_null(context, builder, sig, args): - (arraybuildertype,) = sig.args - (arraybuilderval,) = args - proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) - call(context, builder, ak._libawkward.ArrayBuilder_null, (proxyin.rawptr,)) - return context.get_dummy_value() - - -@numba.extending.lower_builtin("boolean", ArrayBuilderType, numba.types.Boolean) -def lower_boolean(context, builder, sig, args): - arraybuildertype, xtype = sig.args - arraybuilderval, xval = args - proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) - x = builder.zext(xval, context.get_value_type(numba.uint8)) - call(context, builder, ak._libawkward.ArrayBuilder_boolean, (proxyin.rawptr, x)) - return context.get_dummy_value() - - -@numba.extending.lower_builtin("integer", ArrayBuilderType, numba.types.Integer) -def lower_integer(context, builder, sig, args): - arraybuildertype, xtype = sig.args - arraybuilderval, xval = args - proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) - x = ak._connect._numba.castint(context, builder, xtype, numba.int64, xval) - call(context, builder, ak._libawkward.ArrayBuilder_integer, (proxyin.rawptr, x)) - return context.get_dummy_value() - - -@numba.extending.lower_builtin("real", ArrayBuilderType, numba.types.Integer) -@numba.extending.lower_builtin("real", ArrayBuilderType, numba.types.Float) -def lower_real(context, builder, sig, args): - arraybuildertype, xtype = sig.args - arraybuilderval, xval = args - proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) - if isinstance(xtype, numba.types.Integer) and xtype.signed: - x = builder.sitofp(xval, context.get_value_type(numba.types.float64)) - elif isinstance(xtype, numba.types.Integer): - x = builder.uitofp(xval, context.get_value_type(numba.types.float64)) - elif xtype.bitwidth < 64: - x = builder.fpext(xval, context.get_value_type(numba.types.float64)) - elif xtype.bitwidth > 64: - x = builder.fptrunc(xval, context.get_value_type(numba.types.float64)) - else: - x = xval - call(context, builder, ak._libawkward.ArrayBuilder_real, (proxyin.rawptr, x)) - return context.get_dummy_value() - - -@numba.extending.lower_builtin("begin_list", ArrayBuilderType) -def lower_beginlist(context, builder, sig, args): - (arraybuildertype,) = sig.args - (arraybuilderval,) = args - proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) - call(context, builder, ak._libawkward.ArrayBuilder_beginlist, (proxyin.rawptr,)) - return context.get_dummy_value() - - -@numba.extending.lower_builtin("end_list", ArrayBuilderType) -def lower_endlist(context, builder, sig, args): - (arraybuildertype,) = sig.args - (arraybuilderval,) = args - proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) - call(context, builder, ak._libawkward.ArrayBuilder_endlist, (proxyin.rawptr,)) - return context.get_dummy_value() - - -@numba.extending.lower_builtin("begin_tuple", ArrayBuilderType, numba.types.Integer) -def lower_begintuple(context, builder, sig, args): - arraybuildertype, numfieldstype = sig.args - arraybuilderval, numfieldsval = args - proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) - numfields = ak._connect._numba.castint( - context, builder, numfieldstype, numba.int64, numfieldsval - ) - call( - context, - builder, - ak._libawkward.ArrayBuilder_begintuple, - (proxyin.rawptr, numfields), - ) - return context.get_dummy_value() - - -@numba.extending.lower_builtin("index", ArrayBuilderType, numba.types.Integer) -def lower_index(context, builder, sig, args): - arraybuildertype, indextype = sig.args - arraybuilderval, indexval = args - proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) - index = ak._connect._numba.castint( - context, builder, indextype, numba.int64, indexval - ) - call( - context, - builder, - ak._libawkward.ArrayBuilder_index, - (proxyin.rawptr, index), - ) - return arraybuilderval - - -@numba.extending.lower_builtin("end_tuple", ArrayBuilderType) -def lower_endtuple(context, builder, sig, args): - (arraybuildertype,) = sig.args - (arraybuilderval,) = args - proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) - call(context, builder, ak._libawkward.ArrayBuilder_endtuple, (proxyin.rawptr,)) - return context.get_dummy_value() - - -@numba.extending.lower_builtin("begin_record", ArrayBuilderType) -def lower_beginrecord(context, builder, sig, args): - (arraybuildertype,) = sig.args - (arraybuilderval,) = args - proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) - call( - context, - builder, - ak._libawkward.ArrayBuilder_beginrecord, - (proxyin.rawptr,), - ) - return context.get_dummy_value() - - -@numba.extending.lower_builtin( - "begin_record", ArrayBuilderType, numba.types.StringLiteral -) -def lower_beginrecord_field(context, builder, sig, args): - arraybuildertype, nametype = sig.args - arraybuilderval, nameval = args - proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) - name = globalstring(context, builder, nametype.literal_value) - call( - context, - builder, - ak._libawkward.ArrayBuilder_beginrecord_fast, - (proxyin.rawptr, name), - ) - return context.get_dummy_value() - - -@numba.extending.lower_builtin("field", ArrayBuilderType, numba.types.StringLiteral) -def lower_field(context, builder, sig, args): - arraybuildertype, keytype = sig.args - arraybuilderval, keyval = args - proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) - key = globalstring(context, builder, keytype.literal_value) - call( - context, - builder, - ak._libawkward.ArrayBuilder_field_fast, - (proxyin.rawptr, key), - ) - return arraybuilderval - - -@numba.extending.lower_builtin("end_record", ArrayBuilderType) -def lower_endrecord(context, builder, sig, args): - (arraybuildertype,) = sig.args - (arraybuilderval,) = args - proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) - call(context, builder, ak._libawkward.ArrayBuilder_endrecord, (proxyin.rawptr,)) - return context.get_dummy_value() - - -@numba.extending.lower_builtin("append", ArrayBuilderType, numba.types.Boolean) -def lower_append_bool(context, builder, sig, args): - return lower_boolean(context, builder, sig, args) - - -@numba.extending.lower_builtin("append", ArrayBuilderType, numba.types.Integer) -def lower_append_int(context, builder, sig, args): - return lower_integer(context, builder, sig, args) - - -@numba.extending.lower_builtin("append", ArrayBuilderType, numba.types.Float) -def lower_append_float(context, builder, sig, args): - return lower_real(context, builder, sig, args) - - -@numba.extending.lower_builtin("append", ArrayBuilderType, numba.types.Optional) -def lower_append_optional(context, builder, sig, args): - arraybuildertype, opttype = sig.args - arraybuilderval, optval = args - - optproxy = context.make_helper(builder, opttype, optval) - validbit = numba.core.cgutils.as_bool_bit(builder, optproxy.valid) - - with builder.if_else(validbit) as (is_valid, is_not_valid): - with is_valid: - if isinstance(opttype.type, numba.types.Boolean): - lower_boolean( - context, - builder, - numba.types.none(arraybuildertype, opttype.type), - (arraybuilderval, optproxy.data), - ) - elif isinstance(opttype.type, numba.types.Integer): - lower_integer( - context, - builder, - numba.types.none(arraybuildertype, opttype.type), - (arraybuilderval, optproxy.data), - ) - elif isinstance(opttype.type, numba.types.Float): - lower_real( - context, - builder, - numba.types.none(arraybuildertype, opttype.type), - (arraybuilderval, optproxy.data), - ) - else: - raise AssertionError( - repr(opttype.type) + ak._util.exception_suffix(__file__) - ) - - with is_not_valid: - lower_null( - context, - builder, - numba.types.none( - arraybuildertype, - ), - (arraybuilderval,), - ) - - return context.get_dummy_value() - - -@numba.extending.lower_builtin("append", ArrayBuilderType, numba.types.NoneType) -def lower_append_none(context, builder, sig, args): - return lower_null(context, builder, sig.return_type(sig.args[0]), (args[0],)) diff --git a/src/awkward/_connect/_numba/layout.py b/src/awkward/_connect/_numba/layout.py deleted file mode 100644 index 326c30fe5f..0000000000 --- a/src/awkward/_connect/_numba/layout.py +++ /dev/null @@ -1,2929 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -# v2: replace with src/awkward/_v2/_connect/_numba/layout.py - -import json -import ctypes - -import numba - -import awkward as ak - -np = ak.nplike.NumpyMetadata.instance() -numpy = ak.nplike.Numpy.instance() - - -@numba.extending.typeof_impl.register(ak.layout.NumpyArray) -@numba.extending.typeof_impl.register(ak.layout.RegularArray) -@numba.extending.typeof_impl.register(ak.layout.ListArray32) -@numba.extending.typeof_impl.register(ak.layout.ListArrayU32) -@numba.extending.typeof_impl.register(ak.layout.ListArray64) -@numba.extending.typeof_impl.register(ak.layout.ListOffsetArray32) -@numba.extending.typeof_impl.register(ak.layout.ListOffsetArrayU32) -@numba.extending.typeof_impl.register(ak.layout.ListOffsetArray64) -@numba.extending.typeof_impl.register(ak.layout.IndexedArray32) -@numba.extending.typeof_impl.register(ak.layout.IndexedArrayU32) -@numba.extending.typeof_impl.register(ak.layout.IndexedArray64) -@numba.extending.typeof_impl.register(ak.layout.IndexedOptionArray32) -@numba.extending.typeof_impl.register(ak.layout.IndexedOptionArray64) -@numba.extending.typeof_impl.register(ak.layout.ByteMaskedArray) -@numba.extending.typeof_impl.register(ak.layout.BitMaskedArray) -@numba.extending.typeof_impl.register(ak.layout.UnmaskedArray) -@numba.extending.typeof_impl.register(ak.layout.RecordArray) -@numba.extending.typeof_impl.register(ak.layout.UnionArray8_32) -@numba.extending.typeof_impl.register(ak.layout.UnionArray8_U32) -@numba.extending.typeof_impl.register(ak.layout.UnionArray8_64) -@numba.extending.typeof_impl.register(ak.layout.VirtualArray) -@numba.extending.typeof_impl.register(ak.layout.Index8) -@numba.extending.typeof_impl.register(ak.layout.IndexU8) -@numba.extending.typeof_impl.register(ak.layout.Index32) -@numba.extending.typeof_impl.register(ak.layout.IndexU32) -@numba.extending.typeof_impl.register(ak.layout.Index64) -@numba.extending.typeof_impl.register(ak.layout.Record) -def fake_typeof(obj, c): - raise TypeError( - "{} objects cannot be passed directly into Numba-compiled functions; " - "construct a high-level ak.Array or ak.Record instead".format( - type(obj).__name__ - ) - ) - - -def typeof(obj): - if isinstance(obj, ak.layout.NumpyArray): - return typeof_NumpyArray(obj) - - elif isinstance(obj, ak.layout.RegularArray): - return typeof_RegularArray(obj) - - elif isinstance( - obj, - ( - ak.layout.ListArray32, - ak.layout.ListArrayU32, - ak.layout.ListArray64, - ak.layout.ListOffsetArray32, - ak.layout.ListOffsetArrayU32, - ak.layout.ListOffsetArray64, - ), - ): - return typeof_ListArray(obj) - - elif isinstance( - obj, - ( - ak.layout.IndexedArray32, - ak.layout.IndexedArrayU32, - ak.layout.IndexedArray64, - ), - ): - return typeof_IndexedArray(obj) - - elif isinstance( - obj, - ( - ak.layout.IndexedOptionArray32, - ak.layout.IndexedOptionArray64, - ), - ): - return typeof_IndexedOptionArray(obj) - - elif isinstance(obj, ak.layout.ByteMaskedArray): - return typeof_ByteMaskedArray(obj) - - elif isinstance(obj, ak.layout.BitMaskedArray): - return typeof_BitMaskedArray(obj) - - elif isinstance(obj, ak.layout.UnmaskedArray): - return typeof_UnmaskedArray(obj) - - elif isinstance(obj, ak.layout.RecordArray): - return typeof_RecordArray(obj) - - elif isinstance( - obj, - ( - ak.layout.UnionArray8_32, - ak.layout.UnionArray8_U32, - ak.layout.UnionArray8_64, - ), - ): - return typeof_UnionArray(obj) - - elif isinstance(obj, ak.layout.VirtualArray): - return typeof_VirtualArray(obj) - - elif isinstance( - obj, - ( - ak.layout.Identities32, - ak.layout.Identities64, - ), - ): - raise NotImplementedError( - "Awkward Identities are not yet supported for functions compiled by Numba" - ) - - elif isinstance( - obj, - ( - ak.layout.Index8, - ak.layout.IndexU8, - ak.layout.Index32, - ak.layout.IndexU32, - ak.layout.Index64, - ), - ): - raise RuntimeError( - "Awkward Indexes should not be used directly in functions compiled by Numba" - ) - - else: - return numba.typeof(obj) - - -def typeof_NumpyArray(obj): - t = numba.typeof(ak.nplike.of(obj).asarray(obj)) - return NumpyArrayType( - numba.types.Array(t.dtype, t.ndim, "A"), - typeof(obj.identities), - obj.parameters, - ) - - -def typeof_RegularArray(obj): - return RegularArrayType( - typeof(obj.content), - obj.size, - typeof(obj.identities), - obj.parameters, - ) - - -def typeof_ListArray(obj): - return ListArrayType( - numba.typeof(ak.nplike.of(obj.starts).asarray(obj.starts)), - typeof(obj.content), - typeof(obj.identities), - obj.parameters, - ) - - -def typeof_IndexedArray(obj): - return IndexedArrayType( - numba.typeof(ak.nplike.of(obj.index).asarray(obj.index)), - typeof(obj.content), - typeof(obj.identities), - obj.parameters, - ) - - -def typeof_IndexedOptionArray(obj): - return IndexedOptionArrayType( - numba.typeof(ak.nplike.of(obj.index).asarray(obj.index)), - typeof(obj.content), - typeof(obj.identities), - obj.parameters, - ) - - -def typeof_ByteMaskedArray(obj): - return ByteMaskedArrayType( - numba.typeof(ak.nplike.of(obj.mask).asarray(obj.mask)), - typeof(obj.content), - obj.valid_when, - typeof(obj.identities), - obj.parameters, - ) - - -def typeof_BitMaskedArray(obj): - return BitMaskedArrayType( - numba.typeof(ak.nplike.of(obj.mask).asarray(obj.mask)), - typeof(obj.content), - obj.valid_when, - obj.lsb_order, - typeof(obj.identities), - obj.parameters, - ) - - -def typeof_UnmaskedArray(obj): - return UnmaskedArrayType( - typeof(obj.content), typeof(obj.identities), obj.parameters - ) - - -def typeof_RecordArray(obj): - return RecordArrayType( - tuple(typeof(x) for x in obj.contents), - obj.recordlookup, - typeof(obj.identities), - obj.parameters, - ) - - -def typeof_UnionArray(obj): - return UnionArrayType( - numba.typeof(ak.nplike.of(obj.tags).asarray(obj.tags)), - numba.typeof(ak.nplike.of(obj.index).asarray(obj.index)), - tuple(typeof(x) for x in obj.contents), - typeof(obj.identities), - obj.parameters, - ) - - -def typeof_VirtualArray(obj): - if obj.form.form is None: - raise ValueError( - "VirtualArrays without a known 'form' can't be used in Numba" - + ak._util.exception_suffix(__file__) - ) - if obj.form.has_identities: - raise NotImplementedError( - "TODO: identities in VirtualArray" + ak._util.exception_suffix(__file__) - ) - return VirtualArrayType(obj.form.form, numba.none, obj.parameters) - - -class ContentType(numba.types.Type): - @classmethod - def tolookup_identities(cls, layout, positions, sharedptrs, arrays): - if layout.identities is None: - positions.append(-1) - sharedptrs.append(None) - else: - arrays.append(ak.nplike.of(layout.identities).asarray(layout.identities)) - positions.append(arrays[-1]) - sharedptrs.append(None) - - @classmethod - def form_tolookup_identities(cls, form, positions, sharedptrs, arrays): - if not form.has_identities: - positions.append(-1) - sharedptrs.append(None) - else: - arrays.append(None) - positions.append(0) - sharedptrs.append(None) - - @classmethod - def from_form_identities(cls, form): - if not form.has_identities: - return numba.none - else: - raise NotImplementedError( - "TODO: identities in VirtualArray" + ak._util.exception_suffix(__file__) - ) - - @classmethod - def from_form_index(cls, index_string): - if index_string == "i8": - return numba.types.Array(numba.int8, 1, "C") - elif index_string == "u8": - return numba.types.Array(numba.uint8, 1, "C") - elif index_string == "i32": - return numba.types.Array(numba.int32, 1, "C") - elif index_string == "u32": - return numba.types.Array(numba.uint32, 1, "C") - elif index_string == "i64": - return numba.types.Array(numba.int64, 1, "C") - else: - raise AssertionError( - f"unrecognized Form index type: {index_string}" - + ak._util.exception_suffix(__file__) - ) - - def form_fill_identities(self, pos, layout, lookup): - identities = layout.identities - if identities is not None: - lookup.arrayptr[pos + self.IDENTITIES] = ( - ak.nplike.of(identities).asarray(identities).ctypes.data - ) - - def IndexOf(self, arraytype): - if arraytype.dtype.bitwidth == 8 and arraytype.dtype.signed: - return ak.layout.Index8 - elif arraytype.dtype.bitwidth == 8: - return ak.layout.IndexU8 - elif arraytype.dtype.bitwidth == 32 and arraytype.dtype.signed: - return ak.layout.Index32 - elif arraytype.dtype.bitwidth == 32: - return ak.layout.IndexU32 - elif arraytype.dtype.bitwidth == 64 and arraytype.dtype.signed: - return ak.layout.Index64 - else: - raise AssertionError( - f"no Index* type for array: {arraytype}" - + ak._util.exception_suffix(__file__) - ) - - def getitem_at_check(self, viewtype): - typer = ak._util.numba_array_typer(viewtype.type, viewtype.behavior) - if typer is None: - return self.getitem_at(viewtype) - else: - return typer(viewtype) - - def getitem_range(self, viewtype): - return ak._connect._numba.arrayview.wrap(self, viewtype, None) - - def getitem_field(self, viewtype, key): - if self.hasfield(key): - return ak._connect._numba.arrayview.wrap( - self, viewtype, viewtype.fields + (key,) - ) - else: - raise TypeError( - f"array does not have a field with key {key!r}" - + ak._util.exception_suffix(__file__) - ) - - def lower_getitem_at_check( - self, - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - attype, - atval, - wrapneg, - checkbounds, - ): - lower = ak._util.numba_array_lower(viewtype.type, viewtype.behavior) - if lower is not None: - atval = regularize_atval( - context, builder, viewproxy, attype, atval, wrapneg, checkbounds - ) - return lower( - context, builder, rettype, viewtype, viewval, viewproxy, attype, atval - ) - else: - return self.lower_getitem_at( - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - attype, - atval, - wrapneg, - checkbounds, - ) - - def lower_getitem_range( - self, - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - start, - stop, - wrapneg, - ): - length = builder.sub(viewproxy.stop, viewproxy.start) - - regular_start = numba.core.cgutils.alloca_once_value(builder, start) - regular_stop = numba.core.cgutils.alloca_once_value(builder, stop) - - if wrapneg: - with builder.if_then( - builder.icmp_signed("<", start, context.get_constant(numba.intp, 0)) - ): - builder.store(builder.add(start, length), regular_start) - with builder.if_then( - builder.icmp_signed("<", stop, context.get_constant(numba.intp, 0)) - ): - builder.store(builder.add(stop, length), regular_stop) - - with builder.if_then( - builder.icmp_signed( - "<", builder.load(regular_start), context.get_constant(numba.intp, 0) - ) - ): - builder.store(context.get_constant(numba.intp, 0), regular_start) - with builder.if_then( - builder.icmp_signed(">", builder.load(regular_start), length) - ): - builder.store(length, regular_start) - - with builder.if_then( - builder.icmp_signed( - "<", builder.load(regular_stop), builder.load(regular_start) - ) - ): - builder.store(builder.load(regular_start), regular_stop) - with builder.if_then( - builder.icmp_signed(">", builder.load(regular_stop), length) - ): - builder.store(length, regular_stop) - - proxyout = context.make_helper(builder, rettype) - proxyout.pos = viewproxy.pos - proxyout.start = builder.add(viewproxy.start, builder.load(regular_start)) - proxyout.stop = builder.add(viewproxy.start, builder.load(regular_stop)) - proxyout.arrayptrs = viewproxy.arrayptrs - proxyout.sharedptrs = viewproxy.sharedptrs - proxyout.pylookup = viewproxy.pylookup - return proxyout._getvalue() - - def lower_getitem_field(self, context, builder, viewtype, viewval, key): - return viewval - - -def type_bitwidth(numbatype): - if isinstance(numbatype, numba.types.Boolean): - return 8 - else: - return numbatype.bitwidth - - -def posat(context, builder, pos, offset): - return builder.add(pos, context.get_constant(numba.intp, offset)) - - -def getat(context, builder, baseptr, offset, rettype=None): - ptrtype = None - if rettype is not None: - ptrtype = context.get_value_type(numba.types.CPointer(rettype)) - bitwidth = type_bitwidth(rettype) - else: - bitwidth = numba.intp.bitwidth - byteoffset = builder.mul(offset, context.get_constant(numba.intp, bitwidth // 8)) - out = builder.load( - numba.core.cgutils.pointer_add(builder, baseptr, byteoffset, ptrtype) - ) - if rettype is not None and isinstance(rettype, numba.types.Boolean): - return builder.icmp_signed( - "!=", - out, - context.get_constant(numba.int8, 0), - ) - else: - return out - - -def regularize_atval(context, builder, viewproxy, attype, atval, wrapneg, checkbounds): - atval = ak._connect._numba.castint(context, builder, attype, numba.intp, atval) - - if not attype.signed: - wrapneg = False - - if wrapneg or checkbounds: - length = builder.sub(viewproxy.stop, viewproxy.start) - - if wrapneg: - regular_atval = numba.core.cgutils.alloca_once_value(builder, atval) - with builder.if_then( - builder.icmp_signed("<", atval, context.get_constant(numba.intp, 0)) - ): - builder.store(builder.add(atval, length), regular_atval) - atval = builder.load(regular_atval) - - if checkbounds: - with builder.if_then( - builder.or_( - builder.icmp_signed( - "<", atval, context.get_constant(numba.intp, 0) - ), - builder.icmp_signed(">=", atval, length), - ) - ): - context.call_conv.return_user_exc( - builder, ValueError, ("slice index out of bounds",) - ) - - return ak._connect._numba.castint(context, builder, atval.type, numba.intp, atval) - - -class NumpyArrayType(ContentType): - IDENTITIES = 0 - ARRAY = 1 - - @classmethod - def tolookup(cls, layout, positions, sharedptrs, arrays): - array = ak.nplike.of(layout).ascontiguousarray(layout) - assert len(array.shape) == 1 - pos = len(positions) - cls.tolookup_identities(layout, positions, sharedptrs, arrays) - sharedptrs[-1] = layout._persistent_shared_ptr - positions.append(array) - sharedptrs.append(None) - arrays.append(array) - return pos - - @classmethod - def form_tolookup(cls, form, positions, sharedptrs, arrays): - if len(form.inner_shape) != 0: - raise NotImplementedError( - "NumpyForm is multidimensional; TODO: convert to RegularForm," - " just as NumpyArrays are converted to RegularArrays" - + ak._util.exception_suffix(__file__) - ) - pos = len(positions) - cls.form_tolookup_identities(form, positions, sharedptrs, arrays) - sharedptrs[-1] = 0 - positions.append(0) - sharedptrs.append(None) - arrays.append(0) - return pos - - @classmethod - def from_form(cls, form): - if len(form.inner_shape) != 0: - raise NotImplementedError( - "NumpyForm is multidimensional; TODO: convert to RegularForm," - " just as NumpyArrays are converted to RegularArrays" - + ak._util.exception_suffix(__file__) - ) - if form.primitive == "float64": - arraytype = numba.types.Array(numba.float64, 1, "A") - elif form.primitive == "float32": - arraytype = numba.types.Array(numba.float32, 1, "A") - elif form.primitive == "int64": - arraytype = numba.types.Array(numba.int64, 1, "A") - elif form.primitive == "uint64": - arraytype = numba.types.Array(numba.uint64, 1, "A") - elif form.primitive == "int32": - arraytype = numba.types.Array(numba.int32, 1, "A") - elif form.primitive == "uint32": - arraytype = numba.types.Array(numba.uint32, 1, "A") - elif form.primitive == "int16": - arraytype = numba.types.Array(numba.int16, 1, "A") - elif form.primitive == "uint16": - arraytype = numba.types.Array(numba.uint16, 1, "A") - elif form.primitive == "int8": - arraytype = numba.types.Array(numba.int8, 1, "A") - elif form.primitive == "uint8": - arraytype = numba.types.Array(numba.uint8, 1, "A") - elif form.primitive == "bool": - arraytype = numba.types.Array(numba.boolean, 1, "A") - else: - raise ValueError( - f"unrecognized NumpyForm.primitive type: {form.primitive}" - + ak._util.exception_suffix(__file__) - ) - return NumpyArrayType( - arraytype, cls.from_form_identities(form), form.parameters - ) - - def __init__(self, arraytype, identitiestype, parameters): - super().__init__( - name="ak.NumpyArrayType({}, {}, {})".format( - arraytype.name, identitiestype.name, json.dumps(parameters) - ) - ) - self.arraytype = arraytype - self.identitiestype = identitiestype - self.parameters = parameters - - def form_fill(self, pos, layout, lookup): - lookup.sharedptrs_hold[pos] = layout._persistent_shared_ptr - lookup.sharedptrs[pos] = lookup.sharedptrs_hold[pos].ptr() - self.form_fill_identities(pos, layout, lookup) - - lookup.original_positions[pos + self.ARRAY] = ak.nplike.of(layout).asarray( - layout - ) - lookup.arrayptrs[pos + self.ARRAY] = lookup.original_positions[ - pos + self.ARRAY - ].ctypes.data - - def tolayout(self, lookup, pos, fields): - assert fields == () - return ak.layout.NumpyArray( - lookup.original_positions[pos + self.ARRAY], parameters=self.parameters - ) - - def hasfield(self, key): - return False - - def getitem_at(self, viewtype): - return self.arraytype.dtype - - def lower_getitem_at( - self, - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - attype, - atval, - wrapneg, - checkbounds, - ): - whichpos = posat(context, builder, viewproxy.pos, self.ARRAY) - arrayptr = getat(context, builder, viewproxy.arrayptrs, whichpos) - atval = regularize_atval( - context, builder, viewproxy, attype, atval, wrapneg, checkbounds - ) - arraypos = builder.add(viewproxy.start, atval) - return getat(context, builder, arrayptr, arraypos, rettype=rettype) - - @property - def ndim(self): - return self.arraytype.ndim - - @property - def inner_dtype(self): - return self.arraytype.dtype - - @property - def is_optiontype(self): - return False - - @property - def is_recordtype(self): - return False - - -class RegularArrayType(ContentType): - IDENTITIES = 0 - CONTENT = 1 - - @classmethod - def tolookup(cls, layout, positions, sharedptrs, arrays): - pos = len(positions) - cls.tolookup_identities(layout, positions, sharedptrs, arrays) - sharedptrs[-1] = layout._persistent_shared_ptr - positions.append(None) - sharedptrs.append(None) - positions[pos + cls.CONTENT] = ak._connect._numba.arrayview.tolookup( - layout.content, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def form_tolookup(cls, form, positions, sharedptrs, arrays): - pos = len(positions) - cls.form_tolookup_identities(form, positions, sharedptrs, arrays) - sharedptrs[-1] = 0 - positions.append(None) - sharedptrs.append(None) - positions[pos + cls.CONTENT] = ak._connect._numba.arrayview.tolookup( - form.content, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def from_form(cls, form): - return RegularArrayType( - ak._connect._numba.arrayview.tonumbatype(form.content), - form.size, - cls.from_form_identities(form), - form.parameters, - ) - - def __init__(self, contenttype, size, identitiestype, parameters): - super().__init__( - name="ak.RegularArrayType({}, {}, {}, {})".format( - contenttype.name, size, identitiestype.name, json.dumps(parameters) - ) - ) - self.contenttype = contenttype - self.size = size - self.identitiestype = identitiestype - self.parameters = parameters - - def form_fill(self, pos, layout, lookup): - lookup.sharedptrs_hold[pos] = layout._persistent_shared_ptr - lookup.sharedptrs[pos] = lookup.sharedptrs_hold[pos].ptr() - self.form_fill_identities(pos, layout, lookup) - - self.contenttype.form_fill( - lookup.arrayptrs[pos + self.CONTENT], layout.content, lookup - ) - - def tolayout(self, lookup, pos, fields): - content = self.contenttype.tolayout( - lookup, lookup.positions[pos + self.CONTENT], fields - ) - return ak.layout.RegularArray(content, self.size, 0, parameters=self.parameters) - - def hasfield(self, key): - return self.contenttype.hasfield(key) - - def getitem_at(self, viewtype): - return ak._connect._numba.arrayview.wrap(self.contenttype, viewtype, None) - - def lower_getitem_at( - self, - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - attype, - atval, - wrapneg, - checkbounds, - ): - whichpos = posat(context, builder, viewproxy.pos, self.CONTENT) - nextpos = getat(context, builder, viewproxy.arrayptrs, whichpos) - - atval = regularize_atval( - context, builder, viewproxy, attype, atval, wrapneg, checkbounds - ) - - size = context.get_constant(numba.intp, self.size) - start = builder.mul(builder.add(viewproxy.start, atval), size) - stop = builder.add(start, size) - - proxyout = context.make_helper(builder, rettype) - proxyout.pos = nextpos - proxyout.start = start - proxyout.stop = stop - proxyout.arrayptrs = viewproxy.arrayptrs - proxyout.sharedptrs = viewproxy.sharedptrs - proxyout.pylookup = viewproxy.pylookup - return proxyout._getvalue() - - @property - def ndim(self): - return 1 + self.contenttype.ndim - - @property - def inner_dtype(self): - return self.contenttype.inner_dtype - - @property - def is_optiontype(self): - return False - - @property - def is_recordtype(self): - return False - - -class ListArrayType(ContentType): - IDENTITIES = 0 - STARTS = 1 - STOPS = 2 - CONTENT = 3 - - @classmethod - def tolookup(cls, layout, positions, sharedptrs, arrays): - if isinstance( - layout, - ( - ak.layout.ListArray32, - ak.layout.ListArrayU32, - ak.layout.ListArray64, - ), - ): - starts = ak.nplike.of(layout.starts).asarray(layout.starts) - stops = ak.nplike.of(layout.stops).asarray(layout.stops) - elif isinstance( - layout, - ( - ak.layout.ListOffsetArray32, - ak.layout.ListOffsetArrayU32, - ak.layout.ListOffsetArray64, - ), - ): - offsets = ak.nplike.of(layout.offsets).asarray(layout.offsets) - starts = offsets[:-1] - stops = offsets[1:] - - pos = len(positions) - cls.tolookup_identities(layout, positions, sharedptrs, arrays) - sharedptrs[-1] = layout._persistent_shared_ptr - positions.append(starts) - sharedptrs.append(None) - arrays.append(starts) - positions.append(stops) - sharedptrs.append(None) - arrays.append(stops) - positions.append(None) - sharedptrs.append(None) - positions[pos + cls.CONTENT] = ak._connect._numba.arrayview.tolookup( - layout.content, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def form_tolookup(cls, form, positions, sharedptrs, arrays): - pos = len(positions) - cls.form_tolookup_identities(form, positions, sharedptrs, arrays) - sharedptrs[-1] = 0 - positions.append(0) - sharedptrs.append(None) - arrays.append(0) - positions.append(0) - sharedptrs.append(None) - arrays.append(0) - positions.append(None) - sharedptrs.append(None) - positions[pos + cls.CONTENT] = ak._connect._numba.arrayview.tolookup( - form.content, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def from_form(cls, form): - return ListArrayType( - cls.from_form_index( - form.starts if isinstance(form, ak.forms.ListForm) else form.offsets - ), - ak._connect._numba.arrayview.tonumbatype(form.content), - cls.from_form_identities(form), - form.parameters, - ) - - def __init__(self, indextype, contenttype, identitiestype, parameters): - super().__init__( - name="ak.ListArrayType({}, {}, {}, {})".format( - indextype.name, - contenttype.name, - identitiestype.name, - json.dumps(parameters), - ) - ) - self.indextype = indextype - self.contenttype = contenttype - self.identitiestype = identitiestype - self.parameters = parameters - - def form_fill(self, pos, layout, lookup): - lookup.sharedptrs_hold[pos] = layout._persistent_shared_ptr - lookup.sharedptrs[pos] = lookup.sharedptrs_hold[pos].ptr() - self.form_fill_identities(pos, layout, lookup) - - if isinstance( - layout, - ( - ak.layout.ListArray32, - ak.layout.ListArrayU32, - ak.layout.ListArray64, - ), - ): - starts = ak.nplike.of(layout.starts).asarray(layout.starts) - stops = ak.nplike.of(layout.stops).asarray(layout.stops) - elif isinstance( - layout, - ( - ak.layout.ListOffsetArray32, - ak.layout.ListOffsetArrayU32, - ak.layout.ListOffsetArray64, - ), - ): - offsets = ak.nplike.of(layout.offsets).asarray(layout.offsets) - starts = offsets[:-1] - stops = offsets[1:] - - lookup.original_positions[pos + self.STARTS] = starts - lookup.original_positions[pos + self.STOPS] = stops - lookup.arrayptrs[pos + self.STARTS] = starts.ctypes.data - lookup.arrayptrs[pos + self.STOPS] = stops.ctypes.data - - self.contenttype.form_fill( - lookup.arrayptrs[pos + self.CONTENT], layout.content, lookup - ) - - def ListArrayOf(self): - if self.indextype.dtype.bitwidth == 32 and self.indextype.dtype.signed: - return ak.layout.ListArray32 - elif self.indextype.dtype.bitwidth == 32: - return ak.layout.ListArrayU32 - elif self.indextype.dtype.bitwidth == 64 and self.indextype.dtype.signed: - return ak.layout.ListArray64 - else: - raise AssertionError( - f"no ListArray* type for array: {self.indextype}" - + ak._util.exception_suffix(__file__) - ) - - def tolayout(self, lookup, pos, fields): - starts = self.IndexOf(self.indextype)( - lookup.original_positions[pos + self.STARTS] - ) - stops = self.IndexOf(self.indextype)( - lookup.original_positions[pos + self.STOPS] - ) - content = self.contenttype.tolayout( - lookup, lookup.positions[pos + self.CONTENT], fields - ) - return self.ListArrayOf()(starts, stops, content, parameters=self.parameters) - - def hasfield(self, key): - return self.contenttype.hasfield(key) - - def getitem_at(self, viewtype): - return ak._connect._numba.arrayview.wrap(self.contenttype, viewtype, None) - - def lower_getitem_at( - self, - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - attype, - atval, - wrapneg, - checkbounds, - ): - whichpos = posat(context, builder, viewproxy.pos, self.CONTENT) - nextpos = getat(context, builder, viewproxy.arrayptrs, whichpos) - - atval = regularize_atval( - context, builder, viewproxy, attype, atval, wrapneg, checkbounds - ) - - startspos = posat(context, builder, viewproxy.pos, self.STARTS) - startsptr = getat(context, builder, viewproxy.arrayptrs, startspos) - startsarraypos = builder.add(viewproxy.start, atval) - start = getat( - context, builder, startsptr, startsarraypos, rettype=self.indextype.dtype - ) - - stopspos = posat(context, builder, viewproxy.pos, self.STOPS) - stopsptr = getat(context, builder, viewproxy.arrayptrs, stopspos) - stopsarraypos = builder.add(viewproxy.start, atval) - stop = getat( - context, builder, stopsptr, stopsarraypos, rettype=self.indextype.dtype - ) - - proxyout = context.make_helper(builder, rettype) - proxyout.pos = nextpos - proxyout.start = ak._connect._numba.castint( - context, builder, self.indextype.dtype, numba.intp, start - ) - proxyout.stop = ak._connect._numba.castint( - context, builder, self.indextype.dtype, numba.intp, stop - ) - proxyout.arrayptrs = viewproxy.arrayptrs - proxyout.sharedptrs = viewproxy.sharedptrs - proxyout.pylookup = viewproxy.pylookup - return proxyout._getvalue() - - @property - def ndim(self): - return 1 + self.contenttype.ndim - - @property - def inner_dtype(self): - return self.contenttype.inner_dtype - - @property - def is_optiontype(self): - return False - - @property - def is_recordtype(self): - return False - - -class IndexedArrayType(ContentType): - IDENTITIES = 0 - INDEX = 1 - CONTENT = 2 - - @classmethod - def tolookup(cls, layout, positions, sharedptrs, arrays): - pos = len(positions) - cls.tolookup_identities(layout, positions, sharedptrs, arrays) - sharedptrs[-1] = layout._persistent_shared_ptr - arrays.append(ak.nplike.of(layout.index).asarray(layout.index)) - positions.append(arrays[-1]) - sharedptrs.append(None) - positions.append(None) - sharedptrs.append(None) - positions[pos + cls.CONTENT] = ak._connect._numba.arrayview.tolookup( - layout.content, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def form_tolookup(cls, form, positions, sharedptrs, arrays): - pos = len(positions) - cls.form_tolookup_identities(form, positions, sharedptrs, arrays) - sharedptrs[-1] = 0 - arrays.append(0) - positions.append(0) - sharedptrs.append(None) - positions.append(None) - sharedptrs.append(None) - positions[pos + cls.CONTENT] = ak._connect._numba.arrayview.tolookup( - form.content, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def from_form(cls, form): - return IndexedArrayType( - cls.from_form_index(form.index), - ak._connect._numba.arrayview.tonumbatype(form.content), - cls.from_form_identities(form), - form.parameters, - ) - - def __init__(self, indextype, contenttype, identitiestype, parameters): - super().__init__( - name="ak.IndexedArrayType({}, {}, {}, {})".format( - indextype.name, - contenttype.name, - identitiestype.name, - json.dumps(parameters), - ) - ) - self.indextype = indextype - self.contenttype = contenttype - self.identitiestype = identitiestype - self.parameters = parameters - - def form_fill(self, pos, layout, lookup): - lookup.sharedptrs_hold[pos] = layout._persistent_shared_ptr - lookup.sharedptrs[pos] = lookup.sharedptrs_hold[pos].ptr() - self.form_fill_identities(pos, layout, lookup) - - index = ak.nplike.of(layout.index).asarray(layout.index) - lookup.original_positions[pos + self.INDEX] = index - lookup.arrayptrs[pos + self.INDEX] = index.ctypes.data - - self.contenttype.form_fill( - lookup.arrayptrs[pos + self.CONTENT], layout.content, lookup - ) - - def IndexedArrayOf(self): - if self.indextype.dtype.bitwidth == 32 and self.indextype.dtype.signed: - return ak.layout.IndexedArray32 - elif self.indextype.dtype.bitwidth == 32: - return ak.layout.IndexedArrayU32 - elif self.indextype.dtype.bitwidth == 64 and self.indextype.dtype.signed: - return ak.layout.IndexedArray64 - else: - raise AssertionError( - f"no IndexedArray* type for array: {self.indextype}" - + ak._util.exception_suffix(__file__) - ) - - def tolayout(self, lookup, pos, fields): - index = self.IndexOf(self.indextype)( - lookup.original_positions[pos + self.INDEX] - ) - content = self.contenttype.tolayout( - lookup, lookup.positions[pos + self.CONTENT], fields - ) - return self.IndexedArrayOf()(index, content, parameters=self.parameters) - - def hasfield(self, key): - return self.contenttype.hasfield(key) - - def getitem_at(self, viewtype): - viewtype = ak._connect._numba.arrayview.wrap(self.contenttype, viewtype, None) - return self.contenttype.getitem_at_check(viewtype) - - def lower_getitem_at( - self, - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - attype, - atval, - wrapneg, - checkbounds, - ): - whichpos = posat(context, builder, viewproxy.pos, self.CONTENT) - nextpos = getat(context, builder, viewproxy.arrayptrs, whichpos) - - atval = regularize_atval( - context, builder, viewproxy, attype, atval, wrapneg, checkbounds - ) - - indexpos = posat(context, builder, viewproxy.pos, self.INDEX) - indexptr = getat(context, builder, viewproxy.arrayptrs, indexpos) - indexarraypos = builder.add(viewproxy.start, atval) - nextat = getat( - context, builder, indexptr, indexarraypos, rettype=self.indextype.dtype - ) - - nextviewtype = ak._connect._numba.arrayview.wrap( - self.contenttype, viewtype, None - ) - proxynext = context.make_helper(builder, nextviewtype) - proxynext.pos = nextpos - proxynext.start = context.get_constant(numba.intp, 0) - proxynext.stop = builder.add( - ak._connect._numba.castint( - context, builder, self.indextype.dtype, numba.intp, nextat - ), - context.get_constant(numba.intp, 1), - ) - proxynext.arrayptrs = viewproxy.arrayptrs - proxynext.sharedptrs = viewproxy.sharedptrs - proxynext.pylookup = viewproxy.pylookup - - return self.contenttype.lower_getitem_at_check( - context, - builder, - rettype, - nextviewtype, - proxynext._getvalue(), - proxynext, - numba.intp, - nextat, - False, - False, - ) - - @property - def ndim(self): - return self.contenttype.ndim - - @property - def inner_dtype(self): - return self.contenttype.inner_dtype - - @property - def is_optiontype(self): - return False - - @property - def is_recordtype(self): - return self.contenttype.is_recordtype - - -class IndexedOptionArrayType(ContentType): - IDENTITIES = 0 - INDEX = 1 - CONTENT = 2 - - @classmethod - def tolookup(cls, layout, positions, sharedptrs, arrays): - pos = len(positions) - cls.tolookup_identities(layout, positions, sharedptrs, arrays) - sharedptrs[-1] = layout._persistent_shared_ptr - arrays.append(ak.nplike.of(layout.index).asarray(layout.index)) - positions.append(arrays[-1]) - sharedptrs.append(None) - positions.append(None) - sharedptrs.append(None) - positions[pos + cls.CONTENT] = ak._connect._numba.arrayview.tolookup( - layout.content, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def form_tolookup(cls, form, positions, sharedptrs, arrays): - pos = len(positions) - cls.form_tolookup_identities(form, positions, sharedptrs, arrays) - sharedptrs[-1] = 0 - arrays.append(0) - positions.append(0) - sharedptrs.append(None) - positions.append(None) - sharedptrs.append(None) - positions[pos + cls.CONTENT] = ak._connect._numba.arrayview.tolookup( - form.content, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def from_form(cls, form): - return IndexedOptionArrayType( - cls.from_form_index(form.index), - ak._connect._numba.arrayview.tonumbatype(form.content), - cls.from_form_identities(form), - form.parameters, - ) - - def __init__(self, indextype, contenttype, identitiestype, parameters): - super().__init__( - name="ak.IndexedOptionArrayType({}, {}, {}, {})".format( - indextype.name, - contenttype.name, - identitiestype.name, - json.dumps(parameters), - ) - ) - self.indextype = indextype - self.contenttype = contenttype - self.identitiestype = identitiestype - self.parameters = parameters - - def form_fill(self, pos, layout, lookup): - lookup.sharedptrs_hold[pos] = layout._persistent_shared_ptr - lookup.sharedptrs[pos] = lookup.sharedptrs_hold[pos].ptr() - self.form_fill_identities(pos, layout, lookup) - - index = ak.nplike.of(layout.index).asarray(layout.index) - lookup.original_positions[pos + self.INDEX] = index - lookup.arrayptrs[pos + self.INDEX] = index.ctypes.data - - self.contenttype.form_fill( - lookup.arrayptrs[pos + self.CONTENT], layout.content, lookup - ) - - def IndexedOptionArrayOf(self): - if self.indextype.dtype.bitwidth == 32 and self.indextype.dtype.signed: - return ak.layout.IndexedOptionArray32 - elif self.indextype.dtype.bitwidth == 64 and self.indextype.dtype.signed: - return ak.layout.IndexedOptionArray64 - else: - raise AssertionError( - f"no IndexedOptionArray* type for array: {self.indextype}" - + ak._util.exception_suffix(__file__) - ) - - def tolayout(self, lookup, pos, fields): - index = self.IndexOf(self.indextype)( - lookup.original_positions[pos + self.INDEX] - ) - content = self.contenttype.tolayout( - lookup, lookup.positions[pos + self.CONTENT], fields - ) - return self.IndexedOptionArrayOf()(index, content, parameters=self.parameters) - - def hasfield(self, key): - return self.contenttype.hasfield(key) - - def getitem_at(self, viewtype): - viewtype = ak._connect._numba.arrayview.wrap(self.contenttype, viewtype, None) - return numba.types.optional(self.contenttype.getitem_at_check(viewtype)) - - def lower_getitem_at( - self, - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - attype, - atval, - wrapneg, - checkbounds, - ): - whichpos = posat(context, builder, viewproxy.pos, self.CONTENT) - nextpos = getat(context, builder, viewproxy.arrayptrs, whichpos) - - atval = regularize_atval( - context, builder, viewproxy, attype, atval, wrapneg, checkbounds - ) - - indexpos = posat(context, builder, viewproxy.pos, self.INDEX) - indexptr = getat(context, builder, viewproxy.arrayptrs, indexpos) - indexarraypos = builder.add(viewproxy.start, atval) - nextat = getat( - context, builder, indexptr, indexarraypos, rettype=self.indextype.dtype - ) - - output = context.make_helper(builder, rettype) - - with builder.if_else( - builder.icmp_signed( - "<", nextat, context.get_constant(self.indextype.dtype, 0) - ) - ) as (isnone, isvalid): - with isnone: - output.valid = numba.core.cgutils.false_bit - output.data = numba.core.cgutils.get_null_value(output.data.type) - - with isvalid: - nextviewtype = ak._connect._numba.arrayview.wrap( - self.contenttype, viewtype, None - ) - proxynext = context.make_helper(builder, nextviewtype) - proxynext.pos = nextpos - proxynext.start = context.get_constant(numba.intp, 0) - proxynext.stop = builder.add( - ak._connect._numba.castint( - context, builder, self.indextype.dtype, numba.intp, nextat - ), - context.get_constant(numba.intp, 1), - ) - proxynext.arrayptrs = viewproxy.arrayptrs - proxynext.sharedptrs = viewproxy.sharedptrs - proxynext.pylookup = viewproxy.pylookup - - outdata = self.contenttype.lower_getitem_at_check( - context, - builder, - rettype.type, - nextviewtype, - proxynext._getvalue(), - proxynext, - numba.intp, - nextat, - False, - False, - ) - - output.valid = numba.core.cgutils.true_bit - output.data = outdata - - return output._getvalue() - - @property - def ndim(self): - return self.contenttype.ndim - - @property - def inner_dtype(self): - return None - - @property - def is_optiontype(self): - return True - - @property - def is_recordtype(self): - return self.contenttype.is_recordtype - - -class ByteMaskedArrayType(ContentType): - IDENTITIES = 0 - MASK = 1 - CONTENT = 2 - - @classmethod - def tolookup(cls, layout, positions, sharedptrs, arrays): - pos = len(positions) - cls.tolookup_identities(layout, positions, sharedptrs, arrays) - sharedptrs[-1] = layout._persistent_shared_ptr - arrays.append(ak.nplike.of(layout.mask).asarray(layout.mask)) - positions.append(arrays[-1]) - sharedptrs.append(None) - positions.append(None) - sharedptrs.append(None) - positions[pos + cls.CONTENT] = ak._connect._numba.arrayview.tolookup( - layout.content, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def form_tolookup(cls, form, positions, sharedptrs, arrays): - pos = len(positions) - cls.form_tolookup_identities(form, positions, sharedptrs, arrays) - sharedptrs[-1] = 0 - arrays.append(0) - positions.append(0) - sharedptrs.append(None) - positions.append(None) - sharedptrs.append(None) - positions[pos + cls.CONTENT] = ak._connect._numba.arrayview.tolookup( - form.content, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def from_form(cls, form): - return ByteMaskedArrayType( - cls.from_form_index(form.mask), - ak._connect._numba.arrayview.tonumbatype(form.content), - form.valid_when, - cls.from_form_identities(form), - form.parameters, - ) - - def __init__(self, masktype, contenttype, valid_when, identitiestype, parameters): - super().__init__( - name="ak.ByteMaskedArrayType({}, {}, {}, {}, " - "{})".format( - masktype.name, - contenttype.name, - valid_when, - identitiestype.name, - json.dumps(parameters), - ) - ) - self.masktype = masktype - self.contenttype = contenttype - self.valid_when = valid_when - self.identitiestype = identitiestype - self.parameters = parameters - - def form_fill(self, pos, layout, lookup): - lookup.sharedptrs_hold[pos] = layout._persistent_shared_ptr - lookup.sharedptrs[pos] = lookup.sharedptrs_hold[pos].ptr() - self.form_fill_identities(pos, layout, lookup) - - mask = ak.nplike.of(layout.mask).asarray(layout.mask) - lookup.original_positions[pos + self.MASK] = mask - lookup.arrayptrs[pos + self.MASK] = mask.ctypes.data - - self.contenttype.form_fill( - lookup.arrayptrs[pos + self.CONTENT], layout.content, lookup - ) - - def tolayout(self, lookup, pos, fields): - mask = self.IndexOf(self.masktype)(lookup.original_positions[pos + self.MASK]) - content = self.contenttype.tolayout( - lookup, lookup.positions[pos + self.CONTENT], fields - ) - return ak.layout.ByteMaskedArray( - mask, content, self.valid_when, parameters=self.parameters - ) - - def hasfield(self, key): - return self.contenttype.hasfield(key) - - def getitem_at(self, viewtype): - viewtype = ak._connect._numba.arrayview.wrap(self.contenttype, viewtype, None) - return numba.types.optional(self.contenttype.getitem_at_check(viewtype)) - - def lower_getitem_at( - self, - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - attype, - atval, - wrapneg, - checkbounds, - ): - whichpos = posat(context, builder, viewproxy.pos, self.CONTENT) - nextpos = getat(context, builder, viewproxy.arrayptrs, whichpos) - - atval = regularize_atval( - context, builder, viewproxy, attype, atval, wrapneg, checkbounds - ) - - maskpos = posat(context, builder, viewproxy.pos, self.MASK) - maskptr = getat(context, builder, viewproxy.arrayptrs, maskpos) - maskarraypos = builder.add(viewproxy.start, atval) - byte = getat( - context, builder, maskptr, maskarraypos, rettype=self.masktype.dtype - ) - - output = context.make_helper(builder, rettype) - - with builder.if_else( - builder.icmp_signed( - "==", - builder.icmp_signed("!=", byte, context.get_constant(numba.int8, 0)), - context.get_constant(numba.int8, int(self.valid_when)), - ) - ) as (isvalid, isnone): - with isvalid: - nextviewtype = ak._connect._numba.arrayview.wrap( - self.contenttype, viewtype, None - ) - proxynext = context.make_helper(builder, nextviewtype) - proxynext.pos = nextpos - proxynext.start = viewproxy.start - proxynext.stop = viewproxy.stop - proxynext.arrayptrs = viewproxy.arrayptrs - proxynext.sharedptrs = viewproxy.sharedptrs - proxynext.pylookup = viewproxy.pylookup - - outdata = self.contenttype.lower_getitem_at_check( - context, - builder, - rettype.type, - nextviewtype, - proxynext._getvalue(), - proxynext, - numba.intp, - atval, - False, - False, - ) - - output.valid = numba.core.cgutils.true_bit - output.data = outdata - - with isnone: - output.valid = numba.core.cgutils.false_bit - output.data = numba.core.cgutils.get_null_value(output.data.type) - - return output._getvalue() - - @property - def ndim(self): - return self.contenttype.ndim - - @property - def inner_dtype(self): - return None - - @property - def is_optiontype(self): - return True - - @property - def is_recordtype(self): - return self.contenttype.is_recordtype - - -class BitMaskedArrayType(ContentType): - IDENTITIES = 0 - MASK = 1 - CONTENT = 2 - - @classmethod - def tolookup(cls, layout, positions, sharedptrs, arrays): - pos = len(positions) - cls.tolookup_identities(layout, positions, sharedptrs, arrays) - sharedptrs[-1] = layout._persistent_shared_ptr - arrays.append(ak.nplike.of(layout.mask).asarray(layout.mask)) - positions.append(arrays[-1]) - sharedptrs.append(None) - positions.append(None) - sharedptrs.append(None) - positions[pos + cls.CONTENT] = ak._connect._numba.arrayview.tolookup( - layout.content, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def form_tolookup(cls, form, positions, sharedptrs, arrays): - pos = len(positions) - cls.form_tolookup_identities(form, positions, sharedptrs, arrays) - sharedptrs[-1] = 0 - arrays.append(0) - positions.append(0) - sharedptrs.append(None) - positions.append(None) - sharedptrs.append(None) - positions[pos + cls.CONTENT] = ak._connect._numba.arrayview.tolookup( - form.content, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def from_form(cls, form): - return BitMaskedArrayType( - cls.from_form_index(form.mask), - ak._connect._numba.arrayview.tonumbatype(form.content), - form.valid_when, - form.lsb_order, - cls.from_form_identities(form), - form.parameters, - ) - - def __init__( - self, masktype, contenttype, valid_when, lsb_order, identitiestype, parameters - ): - super().__init__( - name="ak.BitMaskedArrayType({}, {}, {}, {}, {}, " - "{})".format( - masktype.name, - contenttype.name, - valid_when, - lsb_order, - identitiestype.name, - json.dumps(parameters), - ) - ) - self.masktype = masktype - self.contenttype = contenttype - self.valid_when = valid_when - self.lsb_order = lsb_order - self.identitiestype = identitiestype - self.parameters = parameters - - def form_fill(self, pos, layout, lookup): - lookup.sharedptrs_hold[pos] = layout._persistent_shared_ptr - lookup.sharedptrs[pos] = lookup.sharedptrs_hold[pos].ptr() - self.form_fill_identities(pos, layout, lookup) - - mask = ak.nplike.of(layout.mask).asarray(layout.mask) - lookup.original_positions[pos + self.MASK] = mask - lookup.arrayptrs[pos + self.MASK] = mask.ctypes.data - - self.contenttype.form_fill( - lookup.arrayptrs[pos + self.CONTENT], layout.content, lookup - ) - - def tolayout(self, lookup, pos, fields): - mask = self.IndexOf(self.masktype)(lookup.original_positions[pos + self.MASK]) - content = self.contenttype.tolayout( - lookup, lookup.positions[pos + self.CONTENT], fields - ) - return ak.layout.BitMaskedArray( - mask, - content, - self.valid_when, - len(content), - self.lsb_order, - parameters=self.parameters, - ) - - def hasfield(self, key): - return self.contenttype.hasfield(key) - - def getitem_at(self, viewtype): - viewtype = ak._connect._numba.arrayview.wrap(self.contenttype, viewtype, None) - return numba.types.optional(self.contenttype.getitem_at_check(viewtype)) - - def lower_getitem_at( - self, - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - attype, - atval, - wrapneg, - checkbounds, - ): - whichpos = posat(context, builder, viewproxy.pos, self.CONTENT) - nextpos = getat(context, builder, viewproxy.arrayptrs, whichpos) - - atval = regularize_atval( - context, builder, viewproxy, attype, atval, wrapneg, checkbounds - ) - bitatval = builder.sdiv(atval, context.get_constant(numba.intp, 8)) - shiftval = ak._connect._numba.castint( - context, - builder, - numba.intp, - numba.uint8, - builder.srem(atval, context.get_constant(numba.intp, 8)), - ) - - maskpos = posat(context, builder, viewproxy.pos, self.MASK) - maskptr = getat(context, builder, viewproxy.arrayptrs, maskpos) - maskarraypos = builder.add(viewproxy.start, bitatval) - byte = getat( - context, builder, maskptr, maskarraypos, rettype=self.masktype.dtype - ) - if self.lsb_order: - # ((byte >> ((uint8_t)shift)) & ((uint8_t)1)) - asbool = builder.and_( - builder.lshr(byte, shiftval), context.get_constant(numba.uint8, 1) - ) - else: - # ((byte << ((uint8_t)shift)) & ((uint8_t)128)) - asbool = builder.and_( - builder.shl(byte, shiftval), context.get_constant(numba.uint8, 128) - ) - - output = context.make_helper(builder, rettype) - - with builder.if_else( - builder.icmp_signed( - "==", - builder.icmp_signed("!=", asbool, context.get_constant(numba.uint8, 0)), - context.get_constant(numba.uint8, int(self.valid_when)), - ) - ) as (isvalid, isnone): - with isvalid: - nextviewtype = ak._connect._numba.arrayview.wrap( - self.contenttype, viewtype, None - ) - proxynext = context.make_helper(builder, nextviewtype) - proxynext.pos = nextpos - proxynext.start = viewproxy.start - proxynext.stop = viewproxy.stop - proxynext.arrayptrs = viewproxy.arrayptrs - proxynext.sharedptrs = viewproxy.sharedptrs - proxynext.pylookup = viewproxy.pylookup - - outdata = self.contenttype.lower_getitem_at_check( - context, - builder, - rettype.type, - nextviewtype, - proxynext._getvalue(), - proxynext, - numba.intp, - atval, - False, - False, - ) - - output.valid = numba.core.cgutils.true_bit - output.data = outdata - - with isnone: - output.valid = numba.core.cgutils.false_bit - output.data = numba.core.cgutils.get_null_value(output.data.type) - - return output._getvalue() - - @property - def ndim(self): - return self.contenttype.ndim - - @property - def inner_dtype(self): - return None - - @property - def is_optiontype(self): - return True - - @property - def is_recordtype(self): - return self.contenttype.is_recordtype - - -class UnmaskedArrayType(ContentType): - IDENTITIES = 0 - CONTENT = 1 - - @classmethod - def tolookup(cls, layout, positions, sharedptrs, arrays): - pos = len(positions) - cls.tolookup_identities(layout, positions, sharedptrs, arrays) - sharedptrs[-1] = layout._persistent_shared_ptr - positions.append(None) - sharedptrs.append(None) - positions[pos + cls.CONTENT] = ak._connect._numba.arrayview.tolookup( - layout.content, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def form_tolookup(cls, form, positions, sharedptrs, arrays): - pos = len(positions) - cls.form_tolookup_identities(form, positions, sharedptrs, arrays) - sharedptrs[-1] = 0 - positions.append(None) - sharedptrs.append(None) - positions[pos + cls.CONTENT] = ak._connect._numba.arrayview.tolookup( - form.content, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def from_form(cls, form): - return UnmaskedArrayType( - ak._connect._numba.arrayview.tonumbatype(form.content), - cls.from_form_identities(form), - form.parameters, - ) - - def __init__(self, contenttype, identitiestype, parameters): - super().__init__( - name="ak.UnmaskedArrayType({}, {}, {})".format( - contenttype.name, identitiestype.name, json.dumps(parameters) - ) - ) - self.contenttype = contenttype - self.identitiestype = identitiestype - self.parameters = parameters - - def form_fill(self, pos, layout, lookup): - lookup.sharedptrs_hold[pos] = layout._persistent_shared_ptr - lookup.sharedptrs[pos] = lookup.sharedptrs_hold[pos].ptr() - self.form_fill_identities(pos, layout, lookup) - - self.contenttype.form_fill( - lookup.arrayptrs[pos + self.CONTENT], layout.content, lookup - ) - - def tolayout(self, lookup, pos, fields): - content = self.contenttype.tolayout( - lookup, lookup.positions[pos + self.CONTENT], fields - ) - return ak.layout.UnmaskedArray(content, parameters=self.parameters) - - def hasfield(self, key): - return self.contenttype.hasfield(key) - - def getitem_at(self, viewtype): - viewtype = ak._connect._numba.arrayview.wrap(self.contenttype, viewtype, None) - return numba.types.optional(self.contenttype.getitem_at_check(viewtype)) - - def lower_getitem_at( - self, - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - attype, - atval, - wrapneg, - checkbounds, - ): - whichpos = posat(context, builder, viewproxy.pos, self.CONTENT) - nextpos = getat(context, builder, viewproxy.arrayptrs, whichpos) - - atval = regularize_atval( - context, builder, viewproxy, attype, atval, wrapneg, checkbounds - ) - - output = context.make_helper(builder, rettype) - - nextviewtype = ak._connect._numba.arrayview.wrap( - self.contenttype, viewtype, None - ) - proxynext = context.make_helper(builder, nextviewtype) - proxynext.pos = nextpos - proxynext.start = viewproxy.start - proxynext.stop = viewproxy.stop - proxynext.arrayptrs = viewproxy.arrayptrs - proxynext.sharedptrs = viewproxy.sharedptrs - proxynext.pylookup = viewproxy.pylookup - - outdata = self.contenttype.lower_getitem_at_check( - context, - builder, - rettype.type, - nextviewtype, - proxynext._getvalue(), - proxynext, - numba.intp, - atval, - False, - False, - ) - - output.valid = numba.core.cgutils.true_bit - output.data = outdata - - return output._getvalue() - - @property - def ndim(self): - return self.contenttype.ndim - - @property - def inner_dtype(self): - return None - - @property - def is_optiontype(self): - return True - - @property - def is_recordtype(self): - return self.contenttype.is_recordtype - - -class RecordArrayType(ContentType): - IDENTITIES = 0 - CONTENTS = 1 - - @classmethod - def tolookup(cls, layout, positions, sharedptrs, arrays): - pos = len(positions) - cls.tolookup_identities(layout, positions, sharedptrs, arrays) - sharedptrs[-1] = layout._persistent_shared_ptr - positions.extend([None] * layout.numfields) - sharedptrs.extend([None] * layout.numfields) - for i, content in enumerate(layout.contents): - positions[pos + cls.CONTENTS + i] = ak._connect._numba.arrayview.tolookup( - content, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def form_tolookup(cls, form, positions, sharedptrs, arrays): - pos = len(positions) - cls.form_tolookup_identities(form, positions, sharedptrs, arrays) - sharedptrs[-1] = 0 - positions.extend([None] * form.numfields) - sharedptrs.extend([None] * form.numfields) - if form.istuple: - for i, (_, content) in enumerate(form.contents.items()): - positions[ - pos + cls.CONTENTS + i - ] = ak._connect._numba.arrayview.tolookup( - content, positions, sharedptrs, arrays - ) - else: - for i, (_, content) in enumerate(form.contents.items()): - positions[ - pos + cls.CONTENTS + i - ] = ak._connect._numba.arrayview.tolookup( - content, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def from_form(cls, form): - contents = [] - if form.istuple: - recordlookup = None - for x in form.contents.values(): - contents.append(ak._connect._numba.arrayview.tonumbatype(x)) - else: - recordlookup = [] - for n, x in form.contents.items(): - contents.append(ak._connect._numba.arrayview.tonumbatype(x)) - recordlookup.append(n) - - return RecordArrayType( - contents, recordlookup, cls.from_form_identities(form), form.parameters - ) - - def __init__(self, contenttypes, recordlookup, identitiestype, parameters): - super().__init__( - name="ak.RecordArrayType(({}{}), ({}), {}, {})".format( - ", ".join(x.name for x in contenttypes), - "," if len(contenttypes) == 1 else "", - "None" if recordlookup is None else repr(tuple(recordlookup)), - identitiestype.name, - json.dumps(parameters), - ) - ) - self.contenttypes = contenttypes - self.recordlookup = recordlookup - self.identitiestype = identitiestype - self.parameters = parameters - - def form_fill(self, pos, layout, lookup): - lookup.sharedptrs_hold[pos] = layout._persistent_shared_ptr - lookup.sharedptrs[pos] = lookup.sharedptrs_hold[pos].ptr() - self.form_fill_identities(pos, layout, lookup) - - if self.recordlookup is None: - for i, contenttype in enumerate(self.contenttypes): - contenttype.form_fill( - lookup.arrayptrs[pos + self.CONTENTS + i], layout.field(i), lookup - ) - else: - for i, contenttype in enumerate(self.contenttypes): - contenttype.form_fill( - lookup.arrayptrs[pos + self.CONTENTS + i], - layout.field(self.recordlookup[i]), - lookup, - ) - - def fieldindex(self, key): - out = -1 - if self.recordlookup is not None: - for i, x in enumerate(self.recordlookup): - if x == key: - out = i - break - if out == -1: - try: - out = int(key) - except ValueError: - return None - if not 0 <= out < len(self.contenttypes): - return None - return out - - def tolayout(self, lookup, pos, fields): - if len(fields) > 0: - index = self.fieldindex(fields[0]) - assert index is not None - return self.contenttypes[index].tolayout( - lookup, lookup.positions[pos + self.CONTENTS + index], fields[1:] - ) - else: - contents = [] - for i, contenttype in enumerate(self.contenttypes): - layout = contenttype.tolayout( - lookup, lookup.positions[pos + self.CONTENTS + i], fields - ) - contents.append(layout) - - if len(contents) == 0: - return ak.layout.RecordArray( - contents, - self.recordlookup, - np.iinfo(np.int64).max, - parameters=self.parameters, - ) - else: - return ak.layout.RecordArray( - contents, self.recordlookup, parameters=self.parameters - ) - - def hasfield(self, key): - return self.fieldindex(key) is not None - - def getitem_at_check(self, viewtype): - out = self.getitem_at(viewtype) - if isinstance(out, ak._connect._numba.arrayview.RecordViewType): - typer = ak._util.numba_record_typer( - out.arrayviewtype.type, out.arrayviewtype.behavior - ) - if typer is not None: - return typer(out) - return out - - def getitem_at(self, viewtype): - if len(viewtype.fields) == 0: - return ak._connect._numba.arrayview.RecordViewType(viewtype) - else: - key = viewtype.fields[0] - index = self.fieldindex(key) - if index is None: - if self.recordlookup is None: - raise ValueError( - "no field {} in tuples with {} fields".format( - repr(key), len(self.contenttypes) - ) - + ak._util.exception_suffix(__file__) - ) - else: - raise ValueError( - "no field {} in records with " - "fields: [{}]".format( - repr(key), ", ".join(repr(x) for x in self.recordlookup) - ) - + ak._util.exception_suffix(__file__) - ) - contenttype = self.contenttypes[index] - subviewtype = ak._connect._numba.arrayview.wrap( - contenttype, viewtype, viewtype.fields[1:] - ) - return contenttype.getitem_at_check(subviewtype) - - def getitem_field(self, viewtype, key): - index = self.fieldindex(key) - if index is None: - if self.recordlookup is None: - raise ValueError( - "no field {} in tuples with {} fields".format( - repr(key), len(self.contenttypes) - ) - + ak._util.exception_suffix(__file__) - ) - else: - raise ValueError( - "no field {} in records with fields: [{}]".format( - repr(key), ", ".join(repr(x) for x in self.recordlookup) - ) - + ak._util.exception_suffix(__file__) - ) - contenttype = self.contenttypes[index] - subviewtype = ak._connect._numba.arrayview.wrap(contenttype, viewtype, None) - return contenttype.getitem_range(subviewtype) - - def getitem_field_record(self, recordviewtype, key): - index = self.fieldindex(key) - if index is None: - if self.recordlookup is None: - raise ValueError( - "no field {} in tuple with {} fields".format( - repr(key), len(self.contenttypes) - ) - + ak._util.exception_suffix(__file__) - ) - else: - raise ValueError( - "no field {} in record with fields: [{}]".format( - repr(key), ", ".join(repr(x) for x in self.recordlookup) - ) - + ak._util.exception_suffix(__file__) - ) - contenttype = self.contenttypes[index] - subviewtype = ak._connect._numba.arrayview.wrap( - contenttype, recordviewtype, None - ) - return contenttype.getitem_at_check(subviewtype) - - def lower_getitem_at_check( - self, - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - attype, - atval, - wrapneg, - checkbounds, - ): - out = self.lower_getitem_at( - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - attype, - atval, - wrapneg, - checkbounds, - ) - baretype = self.getitem_at(viewtype) - if isinstance(baretype, ak._connect._numba.arrayview.RecordViewType): - lower = ak._util.numba_record_lower( - baretype.arrayviewtype.type, baretype.arrayviewtype.behavior - ) - if lower is not None: - return lower(context, builder, rettype(baretype), (out,)) - return out - - def lower_getitem_at( - self, - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - attype, - atval, - wrapneg, - checkbounds, - ): - atval = regularize_atval( - context, builder, viewproxy, attype, atval, wrapneg, checkbounds - ) - - if len(viewtype.fields) == 0: - proxyout = context.make_helper( - builder, ak._connect._numba.arrayview.RecordViewType(viewtype) - ) - proxyout.arrayview = viewval - proxyout.at = atval - return proxyout._getvalue() - - else: - index = self.fieldindex(viewtype.fields[0]) - contenttype = self.contenttypes[index] - - whichpos = posat(context, builder, viewproxy.pos, self.CONTENTS + index) - nextpos = getat(context, builder, viewproxy.arrayptrs, whichpos) - - nextviewtype = ak._connect._numba.arrayview.wrap( - contenttype, viewtype, viewtype.fields[1:] - ) - proxynext = context.make_helper(builder, nextviewtype) - proxynext.pos = nextpos - proxynext.start = viewproxy.start - proxynext.stop = builder.add( - atval, builder.add(viewproxy.start, context.get_constant(numba.intp, 1)) - ) - proxynext.arrayptrs = viewproxy.arrayptrs - proxynext.sharedptrs = viewproxy.sharedptrs - proxynext.pylookup = viewproxy.pylookup - - return contenttype.lower_getitem_at_check( - context, - builder, - rettype, - nextviewtype, - proxynext._getvalue(), - proxynext, - numba.intp, - atval, - False, - False, - ) - - def lower_getitem_field(self, context, builder, viewtype, viewval, key): - viewproxy = context.make_helper(builder, viewtype, viewval) - - index = self.fieldindex(key) - contenttype = self.contenttypes[index] - - whichpos = posat(context, builder, viewproxy.pos, self.CONTENTS + index) - nextpos = getat(context, builder, viewproxy.arrayptrs, whichpos) - - proxynext = context.make_helper(builder, contenttype.getitem_range(viewtype)) - proxynext.pos = nextpos - proxynext.start = viewproxy.start - proxynext.stop = viewproxy.stop - proxynext.arrayptrs = viewproxy.arrayptrs - proxynext.sharedptrs = viewproxy.sharedptrs - proxynext.pylookup = viewproxy.pylookup - - return proxynext._getvalue() - - def lower_getitem_field_record( - self, context, builder, recordviewtype, recordviewval, key - ): - arrayviewtype = recordviewtype.arrayviewtype - recordviewproxy = context.make_helper(builder, recordviewtype, recordviewval) - arrayviewval = recordviewproxy.arrayview - arrayviewproxy = context.make_helper(builder, arrayviewtype, arrayviewval) - - index = self.fieldindex(key) - contenttype = self.contenttypes[index] - - whichpos = posat(context, builder, arrayviewproxy.pos, self.CONTENTS + index) - nextpos = getat(context, builder, arrayviewproxy.arrayptrs, whichpos) - - proxynext = context.make_helper( - builder, contenttype.getitem_range(arrayviewtype) - ) - proxynext.pos = nextpos - proxynext.start = arrayviewproxy.start - proxynext.stop = builder.add( - recordviewproxy.at, - builder.add(arrayviewproxy.start, context.get_constant(numba.intp, 1)), - ) - proxynext.arrayptrs = arrayviewproxy.arrayptrs - proxynext.sharedptrs = arrayviewproxy.sharedptrs - proxynext.pylookup = arrayviewproxy.pylookup - - nextviewtype = ak._connect._numba.arrayview.wrap( - contenttype, arrayviewtype, None - ) - - rettype = self.getitem_field_record(recordviewtype, key) - - return contenttype.lower_getitem_at_check( - context, - builder, - rettype, - nextviewtype, - proxynext._getvalue(), - proxynext, - numba.intp, - recordviewproxy.at, - False, - False, - ) - - @property - def is_tuple(self): - return self.recordlookup is None - - @property - def ndim(self): - return 1 - - @property - def inner_dtype(self): - return None - - @property - def is_optiontype(self): - return False - - @property - def is_recordtype(self): - return True - - -class UnionArrayType(ContentType): - IDENTITIES = 0 - TAGS = 1 - INDEX = 2 - CONTENTS = 3 - - @classmethod - def tolookup(cls, layout, positions, sharedptrs, arrays): - pos = len(positions) - cls.tolookup_identities(layout, positions, sharedptrs, arrays) - sharedptrs[-1] = layout._persistent_shared_ptr - arrays.append(ak.nplike.of(layout.tags).asarray(layout.tags)) - positions.append(arrays[-1]) - sharedptrs.append(None) - arrays.append(ak.nplike.of(layout.index).asarray(layout.index)) - positions.append(arrays[-1]) - sharedptrs.append(None) - positions.extend([None] * layout.numcontents) - sharedptrs.extend([None] * layout.numcontents) - for i, content in enumerate(layout.contents): - positions[pos + cls.CONTENTS + i] = ak._connect._numba.arrayview.tolookup( - content, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def form_tolookup(cls, form, positions, sharedptrs, arrays): - pos = len(positions) - cls.form_tolookup_identities(form, positions, sharedptrs, arrays) - sharedptrs[-1] = 0 - arrays.append(0) - positions.append(0) - sharedptrs.append(None) - arrays.append(0) - positions.append(0) - sharedptrs.append(None) - positions.extend([None] * form.numcontents) - sharedptrs.extend([None] * form.numcontents) - for i, content in enumerate(form.contents): - positions[pos + cls.CONTENTS + i] = ak._connect._numba.arrayview.tolookup( - content, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def from_form(cls, form): - contents = [] - for x in form.contents: - contents.append(ak._connect._numba.arrayview.tonumbatype(x)) - - return UnionArrayType( - cls.from_form_index(form.tags), - cls.from_form_index(form.index), - contents, - cls.from_form_identities(form), - form.parameters, - ) - - def __init__(self, tagstype, indextype, contenttypes, identitiestype, parameters): - super().__init__( - name="ak.UnionArrayType({}, {}, ({}{}), {}, " - "{})".format( - tagstype.name, - indextype.name, - ", ".join(x.name for x in contenttypes), - "," if len(contenttypes) == 1 else "", - identitiestype.name, - json.dumps(parameters), - ) - ) - self.tagstype = tagstype - self.indextype = indextype - self.contenttypes = contenttypes - self.identitiestype = identitiestype - self.parameters = parameters - - def form_fill(self, pos, layout, lookup): - lookup.sharedptrs_hold[pos] = layout._persistent_shared_ptr - lookup.sharedptrs[pos] = lookup.sharedptrs_hold[pos].ptr() - self.form_fill_identities(pos, layout, lookup) - - tags = ak.nplike.of(layout.tags).asarray(layout.tags) - lookup.original_positions[pos + self.TAGS] = tags - lookup.arrayptrs[pos + self.TAGS] = tags.ctypes.data - - index = ak.nplike.of(layout.index).asarray(layout.index) - lookup.original_positions[pos + self.INDEX] = index - lookup.arrayptrs[pos + self.INDEX] = index.ctypes.data - - for i, contenttype in enumerate(self.contenttypes): - contenttype.form_fill( - lookup.arrayptrs[pos + self.CONTENTS + i], layout.content(i), lookup - ) - - def UnionArrayOf(self): - if self.tagstype.dtype.bitwidth == 8 and self.tagstype.dtype.signed: - if self.indextype.dtype.bitwidth == 32 and self.indextype.dtype.signed: - return ak.layout.UnionArray8_32 - elif self.indextype.dtype.bitwidth == 32: - return ak.layout.UnionArray8_U32 - elif self.indextype.dtype.bitwidth == 64 and self.indextype.dtype.signed: - return ak.layout.UnionArray8_64 - else: - raise AssertionError( - f"no UnionArray* type for index array: {self.indextype}" - + ak._util.exception_suffix(__file__) - ) - else: - raise AssertionError( - f"no UnionArray* type for tags array: {self.tagstype}" - + ak._util.exception_suffix(__file__) - ) - - def tolayout(self, lookup, pos, fields): - tags = self.IndexOf(self.tagstype)(lookup.original_positions[pos + self.TAGS]) - index = self.IndexOf(self.indextype)( - lookup.original_positions[pos + self.INDEX] - ) - contents = [] - for i, contenttype in enumerate(self.contenttypes): - layout = contenttype.tolayout( - lookup, lookup.positions[pos + self.CONTENTS + i], fields - ) - contents.append(layout) - return self.UnionArrayOf()(tags, index, contents, parameters=self.parameters) - - def hasfield(self, key): - return any(x.hasfield(key) for x in self.contenttypes) - - def getitem_at(self, viewtype): - if not all(isinstance(x, RecordArrayType) for x in self.contenttypes): - raise TypeError( - "union types cannot be accessed in Numba" - + ak._util.exception_suffix(__file__) - ) - - def getitem_range(self, viewtype): - if not all(isinstance(x, RecordArrayType) for x in self.contenttypes): - raise TypeError( - "union types cannot be accessed in Numba" - + ak._util.exception_suffix(__file__) - ) - - def getitem_field(self, viewtype, key): - if not all(isinstance(x, RecordArrayType) for x in self.contenttypes): - raise TypeError( - "union types cannot be accessed in Numba" - + ak._util.exception_suffix(__file__) - ) - - def lower_getitem_at( - self, - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - attype, - atval, - wrapneg, - checkbounds, - ): - raise NotImplementedError( - type(self).__name__ - + ".lower_getitem_at not implemented" - + ak._util.exception_suffix(__file__) - ) - - def lower_getitem_range( - self, - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - start, - stop, - wrapneg, - ): - raise NotImplementedError( - type(self).__name__ - + ".lower_getitem_range not implemented" - + ak._util.exception_suffix(__file__) - ) - - def lower_getitem_field(self, context, builder, viewtype, viewval, viewproxy, key): - raise NotImplementedError( - type(self).__name__ - + ".lower_getitem_field not implemented" - + ak._util.exception_suffix(__file__) - ) - - @property - def ndim(self): - out = None - for contenttype in self.contenttypes: - if out is None: - out = contenttype.ndim - elif out != contenttype.ndim: - return None - return out - - @property - def inner_dtype(self): - context = numba.core.typing.Context() - return context.unify_types(*[x.inner_dtype for x in self.contenttypes]) - - @property - def is_optiontype(self): - return any(x.is_optiontype for x in self.contents) - - @property - def is_recordtype(self): - if all(x.is_recordtype for x in self.contents): - return True - elif all(not x.is_recordtype for x in self.contents): - return False - else: - return None - - -class VirtualArrayType(ContentType): - IDENTITIES = 0 - PYOBJECT = 1 - ARRAY = 2 - - @classmethod - def tolookup(cls, layout, positions, sharedptrs, arrays): - pos = len(positions) - cls.tolookup_identities(layout, positions, sharedptrs, arrays) - sharedptrs[-1] = layout._persistent_shared_ptr - if layout.form is None: - raise ValueError( - "VirtualArrays without a known 'form' can't be used in Numba" - + ak._util.exception_suffix(__file__) - ) - pyptr = ctypes.py_object(layout) - ctypes.pythonapi.Py_IncRef(pyptr) - voidptr = numpy.frombuffer(pyptr, dtype=np.intp).item() - - positions.append(voidptr) - sharedptrs.append(None) - positions.append(None) - sharedptrs.append(None) - positions[pos + cls.ARRAY] = ak._connect._numba.arrayview.tolookup( - layout.form.form, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def form_tolookup(cls, form, positions, sharedptrs, arrays): - pos = len(positions) - cls.form_tolookup_identities(form, positions, sharedptrs, arrays) - sharedptrs[-1] = 0 - if form.form is None: - raise ValueError( - "VirtualArrays without a known 'form' can't be used in Numba" - + ak._util.exception_suffix(__file__) - ) - positions.append(0) - sharedptrs.append(None) - positions.append(None) - sharedptrs.append(None) - positions[pos + cls.ARRAY] = ak._connect._numba.arrayview.tolookup( - form.form, positions, sharedptrs, arrays - ) - return pos - - @classmethod - def from_form(cls, form): - if form.form is None: - raise ValueError( - "VirtualArrays without a known 'form' can't be used in Numba " - "(including nested)" + ak._util.exception_suffix(__file__) - ) - return VirtualArrayType( - form.form, cls.from_form_identities(form), form.parameters - ) - - def __init__(self, generator_form, identitiestype, parameters): - if generator_form is None: - raise ValueError( - "VirtualArrays without a known 'form' can't be used in Numba" - + ak._util.exception_suffix(__file__) - ) - super().__init__( - name="ak.VirtualArrayType({}, {}, {})".format( - generator_form.tojson(), identitiestype.name, json.dumps(parameters) - ) - ) - self.generator_form = generator_form - self.identitiestype = identitiestype - self.parameters = parameters - - def form_fill(self, pos, layout, lookup): - lookup.sharedptrs_hold[pos] = layout._persistent_shared_ptr - lookup.sharedptrs[pos] = lookup.sharedptrs_hold[pos].ptr() - self.form_fill_identities(pos, layout, lookup) - - pyptr = ctypes.py_object(layout) - ctypes.pythonapi.Py_IncRef(pyptr) - voidptr = numpy.frombuffer(pyptr, dtype=np.intp).item() - - lookup.original_positions[pos + self.PYOBJECT] = voidptr - lookup.arrayptrs[pos + self.PYOBJECT] = voidptr - - def tolayout(self, lookup, pos, fields): - voidptr = ctypes.c_void_p(int(lookup.arrayptrs[pos + self.PYOBJECT])) - pyptr = ctypes.cast(voidptr, ctypes.py_object) - ctypes.pythonapi.Py_IncRef(pyptr) - virtualarray = pyptr.value - return virtualarray - - def hasfield(self, key): - return self.generator_form.haskey(key) - - def getitem_at(self, viewtype): - def getitem_at(form): - if isinstance(form, ak.forms.NumpyForm): - assert len(form.inner_shape) == 0 - if form.primitive == "float64": - return numba.float64 - elif form.primitive == "float32": - return numba.float32 - elif form.primitive == "int64": - return numba.int64 - elif form.primitive == "uint64": - return numba.uint64 - elif form.primitive == "int32": - return numba.int32 - elif form.primitive == "uint32": - return numba.uint32 - elif form.primitive == "int16": - return numba.int16 - elif form.primitive == "uint16": - return numba.uint16 - elif form.primitive == "int8": - return numba.int8 - elif form.primitive == "uint8": - return numba.uint8 - elif form.primitive == "bool": - return numba.boolean - else: - raise ValueError( - "unrecognized NumpyForm.primitive type: {}".format( - form.primitive - ) - + ak._util.exception_suffix(__file__) - ) - - elif isinstance( - form, - ( - ak.forms.RegularForm, - ak.forms.ListForm, - ak.forms.ListOffsetForm, - ), - ): - return form.content - - elif isinstance(form, ak.forms.IndexedForm): - return getitem_at(form.content) - - elif isinstance( - form, - ( - ak.forms.IndexedOptionForm, - ak.forms.ByteMaskedForm, - ak.forms.BitMaskedForm, - ak.forms.UnmaskedForm, - ), - ): - return numba.types.optional(wrap(getitem_at(form.content))) - - elif isinstance(form, ak.forms.RecordForm): - arrayview = wrap(form) - return arrayview.type.getitem_at(arrayview) - - elif isinstance(form, ak.forms.UnionForm): - raise TypeError( - "union types cannot be accessed in Numba" - + ak._util.exception_suffix(__file__) - ) - - elif isinstance(form, ak.forms.VirtualForm): - return getitem_at(form.form) - - else: - raise AssertionError( - f"unrecognized Form type: {type(form)}" - + ak._util.exception_suffix(__file__) - ) - - def wrap(out): - if isinstance(out, ak.forms.Form): - numbatype = ak._connect._numba.arrayview.tonumbatype(out) - return ak._connect._numba.arrayview.wrap(numbatype, viewtype, None) - else: - return out - - return wrap(getitem_at(self.generator_form)) - - def lower_getitem_at( - self, - context, - builder, - rettype, - viewtype, - viewval, - viewproxy, - attype, - atval, - wrapneg, - checkbounds, - ): - pyobjptr = getat( - context, - builder, - viewproxy.arrayptrs, - posat(context, builder, viewproxy.pos, self.PYOBJECT), - ) - arraypos = getat( - context, - builder, - viewproxy.arrayptrs, - posat(context, builder, viewproxy.pos, self.ARRAY), - ) - sharedptr = getat(context, builder, viewproxy.sharedptrs, arraypos) - - numbatype = ak._connect._numba.arrayview.tonumbatype(self.generator_form) - - with builder.if_then( - builder.icmp_signed("==", sharedptr, context.get_constant(numba.intp, 0)), - likely=False, - ): - # only rarely enter Python - pyapi = context.get_python_api(builder) - gil = pyapi.gil_ensure() - - # borrowed references - virtualarray_obj = builder.inttoptr( - pyobjptr, context.get_value_type(numba.types.pyobject) - ) - lookup_obj = viewproxy.pylookup - - # new references - numbatype_obj = pyapi.unserialize(pyapi.serialize_object(numbatype)) - fill_obj = pyapi.object_getattr_string(numbatype_obj, "form_fill") - arraypos_obj = pyapi.long_from_ssize_t(arraypos) - array_obj = pyapi.object_getattr_string(virtualarray_obj, "array") - - # FIXME: memory leak? what about putting this exception after the decrefs? - with builder.if_then( - builder.icmp_signed( - "!=", - pyapi.err_occurred(), - context.get_constant(numba.types.voidptr, 0), - ), - likely=False, - ): - context.call_conv.return_exc(builder) - - # add the materialized array to our Lookup - pyapi.call_function_objargs( - fill_obj, - ( - arraypos_obj, - array_obj, - lookup_obj, - ), - ) - - # FIXME: memory leak? what about putting this exception after the decrefs? - with builder.if_then( - builder.icmp_signed( - "!=", - pyapi.err_occurred(), - context.get_constant(numba.types.voidptr, 0), - ), - likely=False, - ): - context.call_conv.return_exc(builder) - - # decref the new references - pyapi.decref(array_obj) - pyapi.decref(arraypos_obj) - pyapi.decref(fill_obj) - pyapi.decref(numbatype_obj) - - pyapi.gil_release(gil) - - # normally, we just pass on the request to the materialized array - whichpos = posat(context, builder, viewproxy.pos, self.ARRAY) - nextpos = getat(context, builder, viewproxy.arrayptrs, whichpos) - - nextviewtype = ak._connect._numba.arrayview.wrap(numbatype, viewtype, None) - proxynext = context.make_helper(builder, nextviewtype) - proxynext.pos = nextpos - proxynext.start = viewproxy.start - proxynext.stop = viewproxy.stop - proxynext.arrayptrs = viewproxy.arrayptrs - proxynext.sharedptrs = viewproxy.sharedptrs - proxynext.pylookup = viewproxy.pylookup - - return numbatype.lower_getitem_at_check( - context, - builder, - rettype, - nextviewtype, - proxynext._getvalue(), - proxynext, - numba.intp, - atval, - wrapneg, - checkbounds, - ) - - @property - def ndim(self): - return self.generator_form.purelist_depth - - @property - def inner_dtype(self): - return inner_dtype_of_form(self.generator_form) - - @property - def is_optiontype(self): - return optiontype_of_form(self.generator_form) - - @property - def is_recordtype(self): - return recordtype_of_form(self.generator_form) - - -def inner_dtype_of_form(form): - if form is None: - return None - - elif isinstance(form, (ak.forms.NumpyForm,)): - return numba.from_dtype(form.to_numpy()) - - elif isinstance(form, (ak.forms.EmptyForm,)): - return numba.types.float64 - - elif isinstance( - form, - ( - ak.forms.RegularForm, - ak.forms.ListForm, - ak.forms.ListOffsetForm, - ak.forms.IndexedForm, - ), - ): - return inner_dtype_of_form(form.content) - - elif isinstance( - form, - ( - ak.forms.RecordForm, - ak.forms.IndexedOptionForm, - ak.forms.ByteMaskedForm, - ak.forms.BitMaskedForm, - ak.forms.UnmaskedForm, - ), - ): - return None - - elif isinstance(form, ak.forms.UnionForm): - context = numba.core.typing.Context() - return context.unify_types(*[inner_dtype_of_form(x) for x in form.contents]) - - elif isinstance(form, ak.forms.VirtualForm): - return inner_dtype_of_form(form.form) - - else: - raise AssertionError( - f"unrecognized Form type: {type(form)}" - + ak._util.exception_suffix(__file__) - ) - - -def optiontype_of_form(form): - if form is None: - return None - - elif isinstance( - form, - ( - ak.forms.NumpyForm, - ak.forms.EmptyForm, - ak.forms.RegularForm, - ak.forms.ListForm, - ak.forms.ListOffsetForm, - ak.forms.IndexedForm, - ak.forms.RecordForm, - ), - ): - return False - - elif isinstance( - form, - ( - ak.forms.IndexedOptionForm, - ak.forms.ByteMaskedForm, - ak.forms.BitMaskedForm, - ak.forms.UnmaskedForm, - ), - ): - return False - - elif isinstance(form, ak.forms.UnionForm): - return any(optiontype_of_form(x) for x in form.contents) - - elif isinstance(form, ak.forms.VirtualForm): - return optiontype_of_form(form.form) - - else: - raise AssertionError( - f"unrecognized Form type: {type(form)}" - + ak._util.exception_suffix(__file__) - ) - - -def recordtype_of_form(form): - if form is None: - return None - - elif isinstance( - form, - ( - ak.forms.NumpyForm, - ak.forms.EmptyForm, - ak.forms.RegularForm, - ak.forms.ListForm, - ak.forms.ListOffsetForm, - ), - ): - return False - - elif isinstance( - form, - ( - ak.forms.IndexedForm, - ak.forms.IndexedOptionForm, - ak.forms.ByteMaskedForm, - ak.forms.BitMaskedForm, - ak.forms.UnmaskedForm, - ), - ): - return recordtype_of_form(form.content) - - elif isinstance(form, (ak.forms.RecordForm,)): - return True - - elif isinstance(form, ak.forms.UnionForm): - return any(recordtype_of_form(x) for x in form.contents) - - elif isinstance(form, ak.forms.VirtualForm): - return recordtype_of_form(form.form) - - else: - raise AssertionError( - f"unrecognized Form type: {type(form)}" - + ak._util.exception_suffix(__file__) - ) diff --git a/src/awkward/_connect/_numexpr.py b/src/awkward/_connect/_numexpr.py deleted file mode 100644 index 5322ec85d1..0000000000 --- a/src/awkward/_connect/_numexpr.py +++ /dev/null @@ -1,158 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -# v2: replace with src/awkward/_v2/_connect/numexpr.py - -import warnings -import sys -import types - -import awkward as ak - -checked_version = False - - -def import_numexpr(): - global checked_version - try: - import numexpr - except ModuleNotFoundError as err: - raise ModuleNotFoundError( - """install the 'numexpr' package with: - - pip install numexpr --upgrade - -or - - conda install numexpr""" - ) from err - else: - if not checked_version and ak._v2._util.parse_version( - numexpr.__version__ - ) < ak._v2._util.parse_version("2.7.1"): - warnings.warn( - "Awkward Array is only known to work with numexpr 2.7.1 or later" - "(you have version {})".format(numexpr.__version__), - RuntimeWarning, - ) - checked_version = True - return numexpr - - -def getArguments(names, local_dict=None, global_dict=None): - call_frame = sys._getframe(2) - - clear_local_dict = False - if local_dict is None: - local_dict = call_frame.f_locals - clear_local_dict = True - try: - frame_globals = call_frame.f_globals - if global_dict is None: - global_dict = frame_globals - - clear_local_dict = clear_local_dict and frame_globals is not local_dict - - arguments = [] - for name in names: - try: - a = local_dict[name] - except KeyError: - a = global_dict[name] - arguments.append(a) # <--- different from NumExpr - finally: - if clear_local_dict: - local_dict.clear() - - return arguments - - -def evaluate( - expression, local_dict=None, global_dict=None, order="K", casting="safe", **kwargs -): - numexpr = import_numexpr() - - context = numexpr.necompiler.getContext(kwargs, frame_depth=1) - expr_key = (expression, tuple(sorted(context.items()))) - if expr_key not in numexpr.necompiler._names_cache: - numexpr.necompiler._names_cache[expr_key] = numexpr.necompiler.getExprNames( - expression, context - ) - names, ex_uses_vml = numexpr.necompiler._names_cache[expr_key] - arguments = getArguments(names, local_dict, global_dict) - - arrays = [ - ak.operations.convert.to_layout(x, allow_record=True, allow_other=True) - for x in arguments - ] - - def getfunction(inputs): - if all( - isinstance(x, ak.layout.NumpyArray) or not isinstance(x, ak.layout.Content) - for x in inputs - ): - return lambda: ( - ak.layout.NumpyArray( - numexpr.evaluate( - expression, - dict(zip(names, inputs)), - {}, - order=order, - casting=casting, - **kwargs - ) - ), - ) - else: - return None - - behavior = ak._util.behaviorof(*arrays) - out = ak._util.broadcast_and_apply( - arrays, getfunction, behavior, allow_records=False, pass_depth=False - ) - assert isinstance(out, tuple) and len(out) == 1 - return ak._util.wrap(out[0], behavior) - - -evaluate.evaluate = evaluate - - -def re_evaluate(local_dict=None): - numexpr = import_numexpr() - - try: - compiled_ex = numexpr.necompiler._numexpr_last["ex"] # noqa: F841 - except KeyError as err: - raise RuntimeError( - "not a previous evaluate() execution found" - + ak._util.exception_suffix(__file__) - ) from err - names = numexpr.necompiler._numexpr_last["argnames"] - arguments = getArguments(names, local_dict) - - arrays = [ - ak.operations.convert.to_layout(x, allow_record=True, allow_other=True) - for x in arguments - ] - - def getfunction(inputs): - if all( - isinstance(x, ak.layout.NumpyArray) or not isinstance(x, ak.layout.Content) - for x in inputs - ): - return lambda: ( - ak.layout.NumpyArray(numexpr.re_evaluate(dict(zip(names, inputs)))), - ) - else: - return None - - behavior = ak._util.behaviorof(*arrays) - out = ak._util.broadcast_and_apply( - arrays, getfunction, behavior, allow_records=False, pass_depth=False - ) - assert isinstance(out, tuple) and len(out) == 1 - return ak._util.wrap(out[0], behavior) - - -ak.numexpr = types.ModuleType("numexpr") -ak.numexpr.evaluate = evaluate -ak.numexpr.re_evaluate = re_evaluate diff --git a/src/awkward/_connect/_numpy.py b/src/awkward/_connect/_numpy.py deleted file mode 100644 index 7a1a1fc5d5..0000000000 --- a/src/awkward/_connect/_numpy.py +++ /dev/null @@ -1,464 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -# v2: replace with src/awkward/_v2/_connect/numpy.py - -from collections.abc import Iterable - -import numpy - -import awkward as ak - - -def convert_to_array(layout, args, kwargs): - out = ak.operations.convert.to_numpy(layout, allow_missing=False) - if args == () and kwargs == {}: - return out - else: - return numpy.array(out, *args, **kwargs) - - -implemented = {} - - -def _to_rectilinear(arg): - if isinstance(arg, Iterable): - nplike = ak.nplike.of(arg) - return nplike.to_rectilinear(arg, allow_missing=False) - else: - return arg - - -def array_function(func, types, args, kwargs): - function = implemented.get(func) - if function is None: - args = tuple(_to_rectilinear(x) for x in args) - kwargs = {k: _to_rectilinear(v) for k, v in kwargs.items()} - out = func(*args, **kwargs) - nplike = ak.nplike.of(out) - if isinstance(out, nplike.ndarray) and len(out.shape) != 0: - return ak.Array(out) - else: - return out - else: - return function(*args, **kwargs) - - -def implements(numpy_function): - def decorator(function): - implemented[getattr(numpy, numpy_function)] = function - return function - - return decorator - - -def array_ufunc(ufunc, method, inputs, kwargs): - if method != "__call__" or len(inputs) == 0 or "out" in kwargs: - return NotImplemented - - behavior = ak._util.behaviorof(*inputs) - - nextinputs = [] - for x in inputs: - cast_fcn = ak._util.custom_cast(x, behavior) - if cast_fcn is not None: - x = cast_fcn(x) - nextinputs.append( - ak.operations.convert.to_layout(x, allow_record=True, allow_other=True) - ) - inputs = nextinputs - - def adjust(custom, inputs, kwargs): - args = [ - ak._util.wrap(x, behavior) - if isinstance(x, (ak.layout.Content, ak.layout.Record)) - else x - for x in inputs - ] - out = custom(*args, **kwargs) - if not isinstance(out, tuple): - out = (out,) - - return tuple( - x.layout if isinstance(x, (ak.highlevel.Array, ak.highlevel.Record)) else x - for x in out - ) - - def adjust_apply_ufunc(apply_ufunc, ufunc, method, inputs, kwargs): - nextinputs = [ - ak._util.wrap(x, behavior) - if isinstance(x, (ak.layout.Content, ak.layout.Record)) - else x - for x in inputs - ] - - out = apply_ufunc(ufunc, method, nextinputs, kwargs) - - if out is NotImplemented: - return None - else: - if not isinstance(out, tuple): - out = (out,) - out = tuple( - x.layout - if isinstance(x, (ak.highlevel.Array, ak.highlevel.Record)) - else x - for x in out - ) - return lambda: out - - def is_fully_regular(layout): - if ( - isinstance(layout, ak.layout.RegularArray) - and layout.parameter("__record__") is None - and layout.parameter("__array__") is None - ): - if isinstance(layout.content, ak.layout.NumpyArray): - return True - elif isinstance(layout.content, ak.layout.RegularArray): - return is_fully_regular(layout.content) - else: - return False - else: - return False - - def deregulate(layout): - if not is_fully_regular(layout): - return layout - else: - shape = [len(layout)] - node = layout - while isinstance(node, ak.layout.RegularArray): - shape.append(node.size) - node = node.content - if node.format.upper().startswith("M"): - nparray = ak.nplike.of(node).asarray(node.view_int64).view(node.format) - nparray = nparray.reshape(tuple(shape) + nparray.shape[1:]) - return ak.layout.NumpyArray( - nparray, - node.identities, - node.parameters, - ) - else: - nparray = ak.nplike.of(node).asarray(node) - nparray = nparray.reshape(tuple(shape) + nparray.shape[1:]) - return ak.layout.NumpyArray( - nparray, - node.identities, - node.parameters, - ) - - def getfunction(inputs): - signature = [ufunc] - for x in inputs: - if isinstance(x, ak.layout.Content): - record = x.parameter("__record__") - array = x.parameter("__array__") - if record is not None: - signature.append(record) - elif array is not None: - signature.append(array) - elif isinstance(x, ak.layout.NumpyArray): - if x.format.upper().startswith("M"): - signature.append( - ak.nplike.of(x) - .asarray(x.view_int64) - .view(x.format) - .dtype.type - ) - else: - signature.append(ak.nplike.of(x).asarray(x).dtype.type) - else: - signature.append(None) - else: - signature.append(type(x)) - - custom = ak._util.overload(behavior, signature) - if custom is not None: - return lambda: adjust(custom, inputs, kwargs) - - if ufunc is numpy.matmul: - custom_matmul = getfunction_matmul(inputs) - if custom_matmul is not None: - return custom_matmul - - inputs = [deregulate(x) for x in inputs] - - if all( - ( - isinstance(x, ak.layout.NumpyArray) - and not (x.format.upper().startswith("M")) - ) - or not isinstance(x, (ak.layout.Content, ak.partition.PartitionedArray)) - for x in inputs - ): - nplike = ak.nplike.of(*inputs) - result = getattr(ufunc, method)( - *[nplike.asarray(x) for x in inputs], **kwargs - ) - return lambda: (ak.operations.convert.from_numpy(result, highlevel=False),) - elif all( - isinstance(x, ak.layout.NumpyArray) and (x.format.upper().startswith("M")) - for x in inputs - ): - nplike = ak.nplike.of(*inputs) - result = getattr(ufunc, method)( - *[nplike.asarray(x.view_int64).view(x.format) for x in inputs], **kwargs - ) - return lambda: (ak.operations.convert.from_numpy(result, highlevel=False),) - - for x in inputs: - if isinstance(x, ak.layout.Content): - chained_behavior = ak._util.Behavior(ak.behavior, behavior) - apply_ufunc = chained_behavior[numpy.ufunc, x.parameter("__array__")] - if apply_ufunc is not None: - out = adjust_apply_ufunc(apply_ufunc, ufunc, method, inputs, kwargs) - if out is not None: - return out - apply_ufunc = chained_behavior[numpy.ufunc, x.parameter("__record__")] - if apply_ufunc is not None: - out = adjust_apply_ufunc(apply_ufunc, ufunc, method, inputs, kwargs) - if out is not None: - return out - - if all( - x.parameter("__array__") is not None - or x.parameter("__record__") is not None - for x in inputs - if isinstance(x, ak.layout.Content) - ): - custom_types = [] - for x in inputs: - if isinstance(x, ak.layout.Content): - if x.parameter("__array__") is not None: - custom_types.append(x.parameter("__array__")) - elif x.parameter("__record__") is not None: - custom_types.append(x.parameter("__record__")) - else: - custom_types.append(type(x).__name__) - else: - custom_types.append(type(x).__name__) - raise ValueError( - "no overloads for custom types: {}({})".format( - ufunc.__name__, - ", ".join(custom_types), - ) - + ak._util.exception_suffix(__file__) - ) - - return None - - out = ak._util.broadcast_and_apply( - inputs, getfunction, behavior, allow_records=False, pass_depth=False - ) - assert isinstance(out, tuple) and len(out) == 1 - return ak._util.wrap(out[0], behavior) - - -def matmul_for_numba(lefts, rights, dtype): - total_outer = 0 - total_inner = 0 - total_content = 0 - - for A, B in zip(lefts, rights): - first = -1 - for Ai in A: - if first == -1: - first = len(Ai) - elif first != len(Ai): - raise ValueError( - "one of the left matrices in np.matmul is not rectangular" - ) - if first == -1: - first = 0 - rowsA = len(A) - colsA = first - - first = -1 - for Bi in B: - if first == -1: - first = len(Bi) - elif first != len(Bi): - raise ValueError( - "one of the right matrices in np.matmul is not rectangular" - ) - if first == -1: - first = 0 - rowsB = len(B) - colsB = first - - if colsA != rowsB: - raise ValueError( - "one of the pairs of matrices in np.matmul do not match shape: " - "(n \u00d7 k) @ (k \u00d7 m)" - ) - - total_outer += 1 - total_inner += rowsA - total_content += rowsA * colsB - - outer = numpy.empty(total_outer + 1, numpy.int64) - inner = numpy.empty(total_inner + 1, numpy.int64) - content = numpy.zeros(total_content, dtype) - - outer[0] = 0 - inner[0] = 0 - outer_i = 1 - inner_i = 1 - content_i = 0 - for A, B in zip(lefts, rights): - rows = len(A) - cols = 0 - if len(B) > 0: - cols = len(B[0]) - mids = 0 - if len(A) > 0: - mids = len(A[0]) - - for i in range(rows): - for j in range(cols): - for v in range(mids): - pos = content_i + i * cols + j - content[pos] += A[i][v] * B[v][j] - - outer[outer_i] = outer[outer_i - 1] + rows - outer_i += 1 - for _ in range(rows): - inner[inner_i] = inner[inner_i - 1] + cols - inner_i += 1 - content_i += rows * cols - - return outer, inner, content - - -matmul_for_numba.numbafied = None - - -def getfunction_matmul(inputs): - inputs = [ - ak._util.recursively_apply( - x, (lambda _: _), pass_depth=False, numpy_to_regular=True - ) - if isinstance(x, (ak.layout.Content, ak.layout.Record)) - else x - for x in inputs - ] - - if len(inputs) == 2 and all( - isinstance(x, ak._util.listtypes) - and isinstance(x.content, ak._util.listtypes) - and isinstance(x.content.content, ak.layout.NumpyArray) - for x in inputs - ): - ak._connect._numba.register_and_check() - import numba - - if matmul_for_numba.numbafied is None: - matmul_for_numba.numbafied = numba.njit(matmul_for_numba) - - lefts = ak.highlevel.Array(inputs[0]) - rights = ak.highlevel.Array(inputs[1]) - dtype = numpy.asarray(lefts[0:0, 0:0, 0:0] + rights[0:0, 0:0, 0:0]).dtype - - outer, inner, content = matmul_for_numba.numbafied(lefts, rights, dtype) - - return lambda: ( - ak.layout.ListOffsetArray64( - ak.layout.Index64(outer), - ak.layout.ListOffsetArray64( - ak.layout.Index64(inner), - ak.layout.NumpyArray(content), - ), - ), - ) - - else: - return None - - -try: - NDArrayOperatorsMixin = numpy.lib.mixins.NDArrayOperatorsMixin - -except AttributeError: - from numpy.core import umath as um - - def _disables_array_ufunc(obj): - try: - return obj.__array_ufunc__ is None - except AttributeError: - return False - - def _binary_method(ufunc, name): - def func(self, other): - if _disables_array_ufunc(other): - return NotImplemented - return ufunc(self, other) - - func.__name__ = f"__{name}__" - return func - - def _reflected_binary_method(ufunc, name): - def func(self, other): - if _disables_array_ufunc(other): - return NotImplemented - return ufunc(other, self) - - func.__name__ = f"__r{name}__" - return func - - def _inplace_binary_method(ufunc, name): - def func(self, other): - return ufunc(self, other, out=(self,)) - - func.__name__ = f"__i{name}__" - return func - - def _numeric_methods(ufunc, name): - return ( - _binary_method(ufunc, name), - _reflected_binary_method(ufunc, name), - _inplace_binary_method(ufunc, name), - ) - - def _unary_method(ufunc, name): - def func(self): - return ufunc(self) - - func.__name__ = f"__{name}__" - return func - - class NDArrayOperatorsMixin: - __lt__ = _binary_method(um.less, "lt") - __le__ = _binary_method(um.less_equal, "le") - __eq__ = _binary_method(um.equal, "eq") - __ne__ = _binary_method(um.not_equal, "ne") - __gt__ = _binary_method(um.greater, "gt") - __ge__ = _binary_method(um.greater_equal, "ge") - - __add__, __radd__, __iadd__ = _numeric_methods(um.add, "add") - __sub__, __rsub__, __isub__ = _numeric_methods(um.subtract, "sub") - __mul__, __rmul__, __imul__ = _numeric_methods(um.multiply, "mul") - __matmul__, __rmatmul__, __imatmul__ = _numeric_methods(um.matmul, "matmul") - __truediv__, __rtruediv__, __itruediv__ = _numeric_methods( - um.true_divide, "truediv" - ) - __floordiv__, __rfloordiv__, __ifloordiv__ = _numeric_methods( - um.floor_divide, "floordiv" - ) - __mod__, __rmod__, __imod__ = _numeric_methods(um.remainder, "mod") - if hasattr(um, "divmod"): - __divmod__ = _binary_method(um.divmod, "divmod") - __rdivmod__ = _reflected_binary_method(um.divmod, "divmod") - __pow__, __rpow__, __ipow__ = _numeric_methods(um.power, "pow") - __lshift__, __rlshift__, __ilshift__ = _numeric_methods(um.left_shift, "lshift") - __rshift__, __rrshift__, __irshift__ = _numeric_methods( - um.right_shift, "rshift" - ) - __and__, __rand__, __iand__ = _numeric_methods(um.bitwise_and, "and") - __xor__, __rxor__, __ixor__ = _numeric_methods(um.bitwise_xor, "xor") - __or__, __ror__, __ior__ = _numeric_methods(um.bitwise_or, "or") - - __neg__ = _unary_method(um.negative, "neg") - if hasattr(um, "positive"): - __pos__ = _unary_method(um.positive, "pos") - __abs__ = _unary_method(um.absolute, "abs") - __invert__ = _unary_method(um.invert, "invert") diff --git a/src/awkward/_connect/_uproot.py b/src/awkward/_connect/_uproot.py deleted file mode 100644 index 66178dcc8a..0000000000 --- a/src/awkward/_connect/_uproot.py +++ /dev/null @@ -1,44 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -# v2: drop, since this functionality will be replaced by AwkwardForth. - -import json - -# don't import awkward._connect._uproot in awkward/__init__.py! -import uproot - -import awkward as ak - - -def can_optimize(interpretation, form): - if isinstance(interpretation, uproot.interpretation.objects.AsObjects): - jsonform = json.loads(form.tojson(verbose=True)) - if ( - jsonform["class"] == "ListOffsetArray64" - and jsonform["parameters"].get("uproot") - == {"as": "array", "header": True, "speedbump": False} - and jsonform["content"]["class"] == "ListOffsetArray64" - and jsonform["content"]["parameters"].get("uproot") - == {"as": "vector", "header": False} - and jsonform["content"]["content"]["class"] == "NumpyArray" - and jsonform["content"]["content"]["inner_shape"] == [] - and ( - jsonform["content"]["content"].get("primitive") == "float64" - or jsonform["content"]["content"].get("primitive") == "int32" - ) - ): - return True - - return False - - -def basket_array(form, data, byte_offsets, extra): - import awkward._io - - # FIXME: uproot_issue_90 is just a placeholder, to show how it would be done - - return awkward._io.uproot_issue_90( - form, - ak.layout.NumpyArray(data), - ak.layout.Index32(byte_offsets), - ) diff --git a/src/awkward/_v2/_connect/avro.py b/src/awkward/_connect/avro.py similarity index 94% rename from src/awkward/_v2/_connect/avro.py rename to src/awkward/_connect/avro.py index 946ce7d4e3..681b34c0e2 100644 --- a/src/awkward/_v2/_connect/avro.py +++ b/src/awkward/_connect/avro.py @@ -26,7 +26,7 @@ def __init__(self, file, limit_entries, debug_forth=False): try: self.temp_header += self.data.read(numbytes) if not self.check_valid(): - raise ak._v2._util.error( + raise ak._util.error( TypeError("invalid Avro file: first 4 bytes are not b'Obj\x01'") ) pos = 4 @@ -115,10 +115,7 @@ def __init__(self, file, limit_entries, debug_forth=False): break for elem in form_keys: - if "offsets" in elem: - container[elem] = machine.output_Index64(elem) - else: - container[elem] = machine.output_NumpyArray(elem) + container[elem] = machine.output(elem) self.outcontents = (self.form, self.blocks, container) @@ -223,9 +220,9 @@ def rec_exp_json_code( file = {"type": file} if file["type"] == "null": - aform = ak._v2.forms.IndexedOptionForm( + aform = ak.forms.IndexedOptionForm( "i64", - ak._v2.forms.EmptyForm(form_key=f"node{form_next_id+1}"), + ak.forms.EmptyForm(form_key=f"node{form_next_id+1}"), form_key=f"node{form_next_id}", ) declarations.append(f"output node{form_next_id+1}-data uint8 \n") @@ -275,9 +272,7 @@ def rec_exp_json_code( ) aformcont.append(aform) - aform = ak._v2.forms.RecordForm( - aformcont, aformfields, form_key=f"node{temp}" - ) + aform = ak.forms.RecordForm(aformcont, aformfields, form_key=f"node{temp}") return ( aform, @@ -290,9 +285,9 @@ def rec_exp_json_code( ) elif file["type"] == "string": - aform = ak._v2.forms.ListOffsetForm( + aform = ak.forms.ListOffsetForm( "i64", - ak._v2.forms.NumpyForm( + ak.forms.NumpyForm( "uint8", parameters={"__array__": "char"}, form_key=f"node{form_next_id+1}", @@ -329,7 +324,7 @@ def rec_exp_json_code( ) elif file["type"] == "int": - aform = ak._v2.forms.NumpyForm( + aform = ak.forms.NumpyForm( primitive="int32", form_key=f"node{form_next_id}" ) declarations.append(f"output node{form_next_id}-data int32 \n") @@ -355,7 +350,7 @@ def rec_exp_json_code( ) elif file["type"] == "long": - aform = ak._v2.forms.NumpyForm("int64", form_key=f"node{form_next_id}") + aform = ak.forms.NumpyForm("int64", form_key=f"node{form_next_id}") form_keys.append(f"node{form_next_id}-data") declarations.append(f"output node{form_next_id}-data int64 \n") @@ -379,7 +374,7 @@ def rec_exp_json_code( ) elif file["type"] == "float": - aform = ak._v2.forms.NumpyForm("float32", form_key=f"node{form_next_id}") + aform = ak.forms.NumpyForm("float32", form_key=f"node{form_next_id}") declarations.append(f"output node{form_next_id}-data float32 \n") form_keys.append(f"node{form_next_id}-data") @@ -403,7 +398,7 @@ def rec_exp_json_code( ) elif file["type"] == "double": - aform = ak._v2.forms.NumpyForm("float64", form_key=f"node{form_next_id}") + aform = ak.forms.NumpyForm("float64", form_key=f"node{form_next_id}") declarations.append(f"output node{form_next_id}-data float64 \n") form_keys.append(f"node{form_next_id}-data") @@ -427,7 +422,7 @@ def rec_exp_json_code( ) elif file["type"] == "boolean": - aform = ak._v2.forms.NumpyForm("bool", form_key=f"node{form_next_id}") + aform = ak.forms.NumpyForm("bool", form_key=f"node{form_next_id}") declarations.append(f"output node{form_next_id}-data bool\n") form_keys.append(f"node{form_next_id}-data") @@ -455,9 +450,9 @@ def rec_exp_json_code( declarations.append(f"output node{form_next_id}-offsets int64\n") form_keys.append(f"node{form_next_id+1}-data") form_keys.append(f"node{form_next_id}-offsets") - aform = ak._v2.forms.ListOffsetForm( + aform = ak.forms.ListOffsetForm( "i64", - ak._v2.forms.NumpyForm( + ak.forms.NumpyForm( "uint8", form_key=f"node{form_next_id+1}", parameters={"__array__": "byte"}, @@ -584,7 +579,7 @@ def rec_exp_json_code( ) exec_code.append(" endof") - aform = ak._v2.forms.ByteMaskedForm( + aform = ak.forms.ByteMaskedForm( "i8", aform1, True, form_key=f"node{temp}" ) @@ -634,7 +629,7 @@ def rec_exp_json_code( ) exec_code.append("\nendof") - aform = ak._v2.forms.IndexedOptionForm( + aform = ak.forms.IndexedOptionForm( "i64", aform1, form_key=f"node{temp}" ) @@ -704,16 +699,16 @@ def rec_exp_json_code( exec_code.append("\n endof") if null_present: - aform = ak._v2.forms.ByteMaskedForm( + aform = ak.forms.ByteMaskedForm( "i8", - ak._v2.forms.UnionForm( + ak.forms.UnionForm( "i8", "i64", temp_forms, form_key=f"node{union_idx}" ), True, form_key=f"node{mask_idx}", ) else: - aform = ak._v2.forms.UnionForm( + aform = ak.forms.UnionForm( "i8", "i64", aform1, form_key=f"node{mask_idx}" ) @@ -762,8 +757,8 @@ def rec_exp_json_code( elif file["type"] == "fixed": form_keys.append(f"node{form_next_id+1}-data") declarations.append(f"output node{form_next_id+1}-data uint8 \n") - aform = ak._v2.forms.RegularForm( - ak._v2.forms.NumpyForm( + aform = ak.forms.RegularForm( + ak.forms.NumpyForm( "uint8", form_key=f"node{form_next_id+1}", parameters={"__array__": "byte"}, @@ -789,11 +784,11 @@ def rec_exp_json_code( ) elif file["type"] == "enum": - aform = ak._v2.forms.IndexedForm( + aform = ak.forms.IndexedForm( "i64", - ak._v2.forms.ListOffsetForm( + ak.forms.ListOffsetForm( "i64", - ak._v2.forms.NumpyForm( + ak.forms.NumpyForm( "uint8", parameters={"__array__": "char"}, form_key=f"node{form_next_id+2}", @@ -878,9 +873,7 @@ def rec_exp_json_code( exec_code.append("\n" + " " * ind + "loop") exec_code.append("\n" + " " * ind + "1 stream skip") - aform = ak._v2.forms.ListOffsetForm( - "i64", aformtemp, form_key=f"node{temp}" - ) + aform = ak.forms.ListOffsetForm("i64", aformtemp, form_key=f"node{temp}") return ( aform, @@ -918,4 +911,4 @@ def rec_exp_json_code( # exec_code = exec_code+hh # exec_code = exec_code+jj # exec_code = exec_code+kk - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) diff --git a/src/awkward/_v2/_connect/cling.py b/src/awkward/_connect/cling.py similarity index 96% rename from src/awkward/_v2/_connect/cling.py rename to src/awkward/_connect/cling.py index 474858cc43..8bf835eccf 100644 --- a/src/awkward/_v2/_connect/cling.py +++ b/src/awkward/_connect/cling.py @@ -433,44 +433,44 @@ class ArrayBuilder {{ def togenerator(form, flatlist_as_rvec): - if isinstance(form, ak._v2.forms.EmptyForm): + if isinstance(form, ak.forms.EmptyForm): return togenerator(form.toNumpyForm(np.dtype(np.float64)), flatlist_as_rvec) - elif isinstance(form, ak._v2.forms.NumpyForm): + elif isinstance(form, ak.forms.NumpyForm): if len(form.inner_shape) == 0: return NumpyArrayGenerator.from_form(form, flatlist_as_rvec) else: return togenerator(form.toRegularForm(), flatlist_as_rvec) - elif isinstance(form, ak._v2.forms.RegularForm): + elif isinstance(form, ak.forms.RegularForm): return RegularArrayGenerator.from_form(form, flatlist_as_rvec) - elif isinstance(form, (ak._v2.forms.ListForm, ak._v2.forms.ListOffsetForm)): + elif isinstance(form, (ak.forms.ListForm, ak.forms.ListOffsetForm)): return ListArrayGenerator.from_form(form, flatlist_as_rvec) - elif isinstance(form, ak._v2.forms.IndexedForm): + elif isinstance(form, ak.forms.IndexedForm): return IndexedArrayGenerator.from_form(form, flatlist_as_rvec) - elif isinstance(form, ak._v2.forms.IndexedOptionForm): + elif isinstance(form, ak.forms.IndexedOptionForm): return IndexedOptionArrayGenerator.from_form(form, flatlist_as_rvec) - elif isinstance(form, ak._v2.forms.ByteMaskedForm): + elif isinstance(form, ak.forms.ByteMaskedForm): return ByteMaskedArrayGenerator.from_form(form, flatlist_as_rvec) - elif isinstance(form, ak._v2.forms.BitMaskedForm): + elif isinstance(form, ak.forms.BitMaskedForm): return BitMaskedArrayGenerator.from_form(form, flatlist_as_rvec) - elif isinstance(form, ak._v2.forms.UnmaskedForm): + elif isinstance(form, ak.forms.UnmaskedForm): return UnmaskedArrayGenerator.from_form(form, flatlist_as_rvec) - elif isinstance(form, ak._v2.forms.RecordForm): + elif isinstance(form, ak.forms.RecordForm): return RecordArrayGenerator.from_form(form, flatlist_as_rvec) - elif isinstance(form, ak._v2.forms.UnionForm): + elif isinstance(form, ak.forms.UnionForm): return UnionArrayGenerator.from_form(form, flatlist_as_rvec) else: - raise ak._v2._util.error(AssertionError(f"unrecognized Form: {type(form)}")) + raise ak._util.error(AssertionError(f"unrecognized Form: {type(form)}")) class Generator: @@ -479,26 +479,26 @@ def form_from_identifier(cls, form): if not form.has_identifier: return None else: - raise ak._v2._util.error(NotImplementedError("TODO: identifiers in C++")) + raise ak._util.error(NotImplementedError("TODO: identifiers in C++")) def IndexOf(self, arraytype): if arraytype == "int8_t": - return ak._v2.index.Index8 + return ak.index.Index8 elif arraytype == "uint8_t": - return ak._v2.index.IndexU8 + return ak.index.IndexU8 elif arraytype == "int32_t": - return ak._v2.index.Index32 + return ak.index.Index32 elif arraytype == "uint32_t": - return ak._v2.index.IndexU32 + return ak.index.IndexU32 elif arraytype == "int64_t": - return ak._v2.index.Index64 + return ak.index.Index64 elif arraytype == "uint64_t": - return ak._v2.index.IndexU64 + return ak.index.IndexU64 else: - raise ak._v2._util.error(AssertionError(arraytype)) + raise ak._util.error(AssertionError(arraytype)) def class_type_suffix(self, key): - return ak._v2._util.identifier_hash(key) + return ak._util.identifier_hash(key) def _generate_common(self, key): params = [ @@ -552,7 +552,7 @@ def entry(self, length="length", ptrs="ptrs", entry="i"): return f"{self.dataset(length=length, ptrs=ptrs)}[{entry}]" -class NumpyArrayGenerator(Generator, ak._v2._lookup.NumpyLookup): +class NumpyArrayGenerator(Generator, ak._lookup.NumpyLookup): @classmethod def from_form(cls, form, flatlist_as_rvec): return NumpyArrayGenerator( @@ -635,7 +635,7 @@ class {self.class_type()}: public ArrayView {{ compiler(out) -class RegularArrayGenerator(Generator, ak._v2._lookup.RegularLookup): +class RegularArrayGenerator(Generator, ak._lookup.RegularLookup): @classmethod def from_form(cls, form, flatlist_as_rvec): return RegularArrayGenerator( @@ -773,10 +773,10 @@ class {self.class_type()}: public ArrayView {{ compiler(out) -class ListArrayGenerator(Generator, ak._v2._lookup.ListLookup): +class ListArrayGenerator(Generator, ak._lookup.ListLookup): @classmethod def from_form(cls, form, flatlist_as_rvec): - if isinstance(form, ak._v2.forms.ListForm): + if isinstance(form, ak.forms.ListForm): index_string = form.starts else: index_string = form.offsets @@ -797,7 +797,7 @@ def __init__(self, index_type, content, identifier, parameters, flatlist_as_rvec elif index_type == "i64": self.index_type = "int64_t" else: - raise ak._v2._util.error(AssertionError(index_type)) + raise ak._util.error(AssertionError(index_type)) self.content = content # FIXME: satisfy the ContentLookup super-class @@ -931,7 +931,7 @@ class {self.class_type()}: public ArrayView {{ compiler(out) -class IndexedArrayGenerator(Generator, ak._v2._lookup.IndexedLookup): +class IndexedArrayGenerator(Generator, ak._lookup.IndexedLookup): @classmethod def from_form(cls, form, flatlist_as_rvec): return IndexedArrayGenerator( @@ -950,7 +950,7 @@ def __init__(self, index_type, content, identifier, parameters, flatlist_as_rvec elif index_type == "i64": self.indextype = "int64_t" else: - raise ak._v2._util.error(AssertionError(index_type)) + raise ak._util.error(AssertionError(index_type)) self.contenttype = content self.identifier = identifier self.parameters = parameters @@ -1012,7 +1012,7 @@ class {self.class_type()}: public ArrayView {{ compiler(out) -class IndexedOptionArrayGenerator(Generator, ak._v2._lookup.IndexedOptionLookup): +class IndexedOptionArrayGenerator(Generator, ak._lookup.IndexedOptionLookup): @classmethod def from_form(cls, form, flatlist_as_rvec): return IndexedOptionArrayGenerator( @@ -1029,7 +1029,7 @@ def __init__(self, index_type, content, identifier, parameters, flatlist_as_rvec elif index_type == "i64": self.index_type = "int64_t" else: - raise ak._v2._util.error(AssertionError(index_type)) + raise ak._util.error(AssertionError(index_type)) self.contenttype = content self.identifier = identifier self.parameters = parameters @@ -1097,7 +1097,7 @@ class {self.class_type()}: public ArrayView {{ compiler(out) -class ByteMaskedArrayGenerator(Generator, ak._v2._lookup.ByteMaskedLookup): +class ByteMaskedArrayGenerator(Generator, ak._lookup.ByteMaskedLookup): @classmethod def from_form(cls, form, flatlist_as_rvec): return ByteMaskedArrayGenerator( @@ -1179,7 +1179,7 @@ class {self.class_type()}: public ArrayView {{ compiler(out) -class BitMaskedArrayGenerator(Generator, ak._v2._lookup.BitMaskedLookup): +class BitMaskedArrayGenerator(Generator, ak._lookup.BitMaskedLookup): @classmethod def from_form(cls, form, flatlist_as_rvec): return BitMaskedArrayGenerator( @@ -1275,7 +1275,7 @@ class {self.class_type()}: public ArrayView {{ compiler(out) -class UnmaskedArrayGenerator(Generator, ak._v2._lookup.UnmaskedLookup): +class UnmaskedArrayGenerator(Generator, ak._lookup.UnmaskedLookup): @classmethod def from_form(cls, form, flatlist_as_rvec): return UnmaskedArrayGenerator( @@ -1339,7 +1339,7 @@ class {self.class_type()}: public ArrayView {{ compiler(out) -class RecordGenerator(Generator, ak._v2._lookup.RecordLookup): +class RecordGenerator(Generator, ak._lookup.RecordLookup): def __init__(self, contents, fields, parameters, flatlist_as_rvec): self.contents = tuple(contents) self.fields = None if fields is None else tuple(fields) @@ -1424,7 +1424,7 @@ class {self.class_type()}: public RecordView {{ compiler(out) -class RecordArrayGenerator(Generator, ak._v2._lookup.RecordLookup): +class RecordArrayGenerator(Generator, ak._lookup.RecordLookup): @classmethod def from_form(cls, form, flatlist_as_rvec): return RecordArrayGenerator( @@ -1523,7 +1523,7 @@ class {self.class_type()}: public ArrayView {{ compiler(out) -class UnionArrayGenerator(Generator, ak._v2._lookup.UnionLookup): +class UnionArrayGenerator(Generator, ak._lookup.UnionLookup): @classmethod def from_form(cls, form, flatlist_as_rvec): return UnionArrayGenerator( @@ -1543,7 +1543,7 @@ def __init__(self, index_type, contents, identifier, parameters, flatlist_as_rve elif index_type == "i64": self.indextype = "int64_t" else: - raise ak._v2._util.error(AssertionError(index_type)) + raise ak._util.error(AssertionError(index_type)) self.contenttypes = tuple(contents) self.identifier = identifier self.parameters = parameters diff --git a/src/awkward/_v2/_connect/cuda/__init__.py b/src/awkward/_connect/cuda/__init__.py similarity index 94% rename from src/awkward/_v2/_connect/cuda/__init__.py rename to src/awkward/_connect/cuda/__init__.py index a129dac56e..09faa0ca67 100644 --- a/src/awkward/_v2/_connect/cuda/__init__.py +++ b/src/awkward/_connect/cuda/__init__.py @@ -149,7 +149,7 @@ def error_context(self): def import_cupy(name="Awkward Arrays with CUDA"): if cupy is None: - raise awkward._v2._util.error(ModuleNotFoundError(error_message.format(name))) + raise awkward._util.error(ModuleNotFoundError(error_message.format(name))) return cupy @@ -158,7 +158,7 @@ def initialize_cuda_kernels(cupy): global kernel if kernel is None: - import awkward._v2._connect.cuda._kernel_signatures + import awkward._connect.cuda._kernel_signatures cuda_src = f"#define ERROR_BITS {ERROR_BITS}\n#define NO_ERROR {NO_ERROR}" @@ -182,20 +182,20 @@ def initialize_cuda_kernels(cupy): # Pass an empty Raw Module to fetch all template specializations template_specializations = fetch_template_specializations( - awkward._v2._connect.cuda._kernel_signatures.by_signature(None) + awkward._connect.cuda._kernel_signatures.by_signature(None) ) cuda_kernel_templates = cupy.RawModule( code=cuda_src, options=("--std=c++11",), name_expressions=template_specializations, ) - kernel = awkward._v2._connect.cuda._kernel_signatures.by_signature( + kernel = awkward._connect.cuda._kernel_signatures.by_signature( cuda_kernel_templates ) return kernel else: - raise awkward._v2._util.error( + raise awkward._util.error( ModuleNotFoundError(error_message.format("Awkward Arrays with CUDA")) ) @@ -217,7 +217,7 @@ def synchronize_cuda(stream=None): cupy.array(NO_ERROR), [], ) - raise awkward._v2._util.error( + raise awkward._util.error( ValueError( f"{kernel_errors[invoked_kernel.name][int(invocation_index % math.pow(2, ERROR_BITS))]} in compiled CUDA code ({invoked_kernel.name})" ), diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_BitMaskedArray_to_ByteMaskedArray.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_BitMaskedArray_to_ByteMaskedArray.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_BitMaskedArray_to_ByteMaskedArray.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_BitMaskedArray_to_ByteMaskedArray.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_BitMaskedArray_to_IndexedOptionArray.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_BitMaskedArray_to_IndexedOptionArray.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_BitMaskedArray_to_IndexedOptionArray.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_BitMaskedArray_to_IndexedOptionArray.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_getitem_carry.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_getitem_carry.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_getitem_carry.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_getitem_carry.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_getitem_nextcarry.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_getitem_nextcarry.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_getitem_nextcarry.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_getitem_nextcarry.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_getitem_nextcarry_outindex.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_getitem_nextcarry_outindex.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_getitem_nextcarry_outindex.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_getitem_nextcarry_outindex.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_mask.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_mask.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_mask.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_mask.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_overlay_mask.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_overlay_mask.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_overlay_mask.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_overlay_mask.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_reduce_next_64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_reduce_next_64.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_reduce_next_64.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_reduce_next_64.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_reduce_next_nonlocal_nextshifts_64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_reduce_next_nonlocal_nextshifts_64.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_reduce_next_nonlocal_nextshifts_64.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_reduce_next_nonlocal_nextshifts_64.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_toIndexedOptionArray.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_toIndexedOptionArray.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_toIndexedOptionArray.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_ByteMaskedArray_toIndexedOptionArray.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_Content_getitem_next_missing_jagged_getmaskstartstop.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_Content_getitem_next_missing_jagged_getmaskstartstop.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_Content_getitem_next_missing_jagged_getmaskstartstop.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_Content_getitem_next_missing_jagged_getmaskstartstop.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_Identities32_to_Identities64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_Identities32_to_Identities64.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_Identities32_to_Identities64.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_Identities32_to_Identities64.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_Identities_getitem_carry.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_Identities_getitem_carry.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_Identities_getitem_carry.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_Identities_getitem_carry.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_Index_to_Index64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_Index_to_Index64.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_Index_to_Index64.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_Index_to_Index64.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_fill_count.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_fill_count.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_fill_count.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_fill_count.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_flatten_nextcarry.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_flatten_nextcarry.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_flatten_nextcarry.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_flatten_nextcarry.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_getitem_nextcarry.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_getitem_nextcarry.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_getitem_nextcarry.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_getitem_nextcarry.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_getitem_nextcarry_outindex.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_getitem_nextcarry_outindex.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_getitem_nextcarry_outindex.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_getitem_nextcarry_outindex.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_getitem_nextcarry_outindex_mask.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_getitem_nextcarry_outindex_mask.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_getitem_nextcarry_outindex_mask.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_getitem_nextcarry_outindex_mask.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_mask.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_mask.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_mask.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_mask.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_overlay_mask.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_overlay_mask.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_overlay_mask.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_overlay_mask.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_reduce_next_64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_reduce_next_64.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_reduce_next_64.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_reduce_next_64.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_reduce_next_fix_offsets_64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_reduce_next_fix_offsets_64.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_reduce_next_fix_offsets_64.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_reduce_next_fix_offsets_64.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_reduce_next_nonlocal_nextshifts_64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_reduce_next_nonlocal_nextshifts_64.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_reduce_next_nonlocal_nextshifts_64.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_reduce_next_nonlocal_nextshifts_64.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_reduce_next_nonlocal_nextshifts_fromshifts_64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_reduce_next_nonlocal_nextshifts_fromshifts_64.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_reduce_next_nonlocal_nextshifts_fromshifts_64.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_reduce_next_nonlocal_nextshifts_fromshifts_64.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_simplify.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_simplify.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_simplify.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_simplify.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_validity.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_validity.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedArray_validity.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedArray_validity.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedOptionArray_rpad_and_clip_mask_axis1.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedOptionArray_rpad_and_clip_mask_axis1.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_IndexedOptionArray_rpad_and_clip_mask_axis1.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_IndexedOptionArray_rpad_and_clip_mask_axis1.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListArray_compact_offsets.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_ListArray_compact_offsets.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListArray_compact_offsets.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_ListArray_compact_offsets.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListArray_getitem_jagged_expand.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_ListArray_getitem_jagged_expand.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListArray_getitem_jagged_expand.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_ListArray_getitem_jagged_expand.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListArray_getitem_next_array.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_ListArray_getitem_next_array.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListArray_getitem_next_array.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_ListArray_getitem_next_array.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListArray_num.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_ListArray_num.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListArray_num.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_ListArray_num.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListArray_validity.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_ListArray_validity.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListArray_validity.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_ListArray_validity.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_compact_offsets.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_compact_offsets.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_compact_offsets.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_compact_offsets.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_flatten_offsets.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_flatten_offsets.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_flatten_offsets.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_flatten_offsets.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_reduce_global_startstop_64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_reduce_global_startstop_64.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_reduce_global_startstop_64.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_reduce_global_startstop_64.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_rpad_and_clip_axis1.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_rpad_and_clip_axis1.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_rpad_and_clip_axis1.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_rpad_and_clip_axis1.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_rpad_axis1.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_rpad_axis1.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_rpad_axis1.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_ListOffsetArray_rpad_axis1.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_MaskedArray_getitem_next_jagged_project.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_MaskedArray_getitem_next_jagged_project.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_MaskedArray_getitem_next_jagged_project.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_MaskedArray_getitem_next_jagged_project.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_contiguous_init.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_contiguous_init.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_contiguous_init.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_contiguous_init.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_contiguous_next.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_contiguous_next.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_contiguous_next.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_contiguous_next.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_fill_tobool.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_fill_tobool.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_fill_tobool.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_fill_tobool.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_boolean_nonzero.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_boolean_nonzero.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_boolean_nonzero.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_boolean_nonzero.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_array.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_array.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_array.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_array.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_array_advanced.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_array_advanced.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_array_advanced.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_array_advanced.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_at.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_at.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_at.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_at.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_range.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_range.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_range.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_range.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_range_advanced.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_range_advanced.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_range_advanced.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_getitem_next_range_advanced.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_reduce_adjust_starts_64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_reduce_adjust_starts_64.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_reduce_adjust_starts_64.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_reduce_adjust_starts_64.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_reduce_adjust_starts_shifts_64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_reduce_adjust_starts_shifts_64.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_reduce_adjust_starts_shifts_64.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_reduce_adjust_starts_shifts_64.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_reduce_mask_ByteMaskedArray_64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_reduce_mask_ByteMaskedArray_64.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_NumpyArray_reduce_mask_ByteMaskedArray_64.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_NumpyArray_reduce_mask_ByteMaskedArray_64.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_broadcast_tooffsets.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_broadcast_tooffsets.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_broadcast_tooffsets.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_broadcast_tooffsets.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_compact_offsets.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_compact_offsets.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_compact_offsets.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_compact_offsets.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_carry.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_carry.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_carry.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_carry.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_jagged_expand.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_jagged_expand.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_jagged_expand.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_jagged_expand.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_array.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_array.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_array.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_array.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_array_advanced.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_array_advanced.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_array_advanced.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_array_advanced.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_at.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_at.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_at.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_at.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_range.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_range.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_range.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_range.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_range_spreadadvanced.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_range_spreadadvanced.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_range_spreadadvanced.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_getitem_next_range_spreadadvanced.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_localindex.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_localindex.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_localindex.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_localindex.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_num.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_num.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_RegularArray_num.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_RegularArray_num.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_UnionArray_fillna.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_UnionArray_fillna.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_UnionArray_fillna.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_UnionArray_fillna.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_UnionArray_project.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_UnionArray_project.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_UnionArray_project.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_UnionArray_project.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_UnionArray_validity.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_UnionArray_validity.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_UnionArray_validity.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_UnionArray_validity.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_carry_arange.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_carry_arange.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_carry_arange.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_carry_arange.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_combinations.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_combinations.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_combinations.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_combinations.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_content_reduce_zeroparents_64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_content_reduce_zeroparents_64.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_content_reduce_zeroparents_64.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_content_reduce_zeroparents_64.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_index_carry.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_index_carry.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_index_carry.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_index_carry.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_index_carry_nocheck.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_index_carry_nocheck.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_index_carry_nocheck.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_index_carry_nocheck.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_index_rpad_and_clip_axis1.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_index_rpad_and_clip_axis1.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_index_rpad_and_clip_axis1.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_index_rpad_and_clip_axis1.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_localindex.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_localindex.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_localindex.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_localindex.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_missing_repeat.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_missing_repeat.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_missing_repeat.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_missing_repeat.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_new_Identities.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_new_Identities.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_new_Identities.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_new_Identities.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_argmax.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_argmax.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_argmax.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_argmax.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_argmax_bool_64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_argmax_bool_64.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_argmax_bool_64.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_argmax_bool_64.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_argmin.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_argmin.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_argmin.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_argmin.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_argmin_bool_64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_argmin_bool_64.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_argmin_bool_64.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_argmin_bool_64.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_count_64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_count_64.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_count_64.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_count_64.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_countnonzero.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_countnonzero.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_countnonzero.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_countnonzero.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_max.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_max.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_max.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_max.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_min.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_min.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_min.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_min.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_prod_bool.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_prod_bool.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_prod_bool.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_prod_bool.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_sum.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_sum.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_sum.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_sum.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_sum_bool.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_sum_bool.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_sum_bool.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_sum_bool.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_sum_int32_bool_64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_sum_int32_bool_64.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_sum_int32_bool_64.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_sum_int32_bool_64.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_sum_int64_bool_64.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_sum_int64_bool_64.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_reduce_sum_int64_bool_64.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_reduce_sum_int64_bool_64.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_regularize_arrayslice.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_regularize_arrayslice.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_regularize_arrayslice.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_regularize_arrayslice.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_zero_mask.cu b/src/awkward/_connect/cuda/cuda_kernels/awkward_zero_mask.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/awkward_zero_mask.cu rename to src/awkward/_connect/cuda/cuda_kernels/awkward_zero_mask.cu diff --git a/src/awkward/_v2/_connect/cuda/cuda_kernels/cuda_common.cu b/src/awkward/_connect/cuda/cuda_kernels/cuda_common.cu similarity index 100% rename from src/awkward/_v2/_connect/cuda/cuda_kernels/cuda_common.cu rename to src/awkward/_connect/cuda/cuda_kernels/cuda_common.cu diff --git a/src/awkward/_v2/_connect/jax/__init__.py b/src/awkward/_connect/jax/__init__.py similarity index 65% rename from src/awkward/_v2/_connect/jax/__init__.py rename to src/awkward/_connect/jax/__init__.py index 3e963f6e0e..788689a2e7 100644 --- a/src/awkward/_v2/_connect/jax/__init__.py +++ b/src/awkward/_connect/jax/__init__.py @@ -23,18 +23,18 @@ def register_pytrees(): for cls in [ - ak._v2.contents.bitmaskedarray.BitMaskedArray, - ak._v2.contents.bytemaskedarray.ByteMaskedArray, - ak._v2.contents.emptyarray.EmptyArray, - ak._v2.contents.indexedarray.IndexedArray, - ak._v2.contents.indexedoptionarray.IndexedOptionArray, - ak._v2.contents.numpyarray.NumpyArray, - ak._v2.contents.listarray.ListArray, - ak._v2.contents.listoffsetarray.ListOffsetArray, - ak._v2.contents.recordarray.RecordArray, - ak._v2.contents.unionarray.UnionArray, - ak._v2.contents.unmaskedarray.UnmaskedArray, - ak._v2.record.Record, + ak.contents.bitmaskedarray.BitMaskedArray, + ak.contents.bytemaskedarray.ByteMaskedArray, + ak.contents.emptyarray.EmptyArray, + ak.contents.indexedarray.IndexedArray, + ak.contents.indexedoptionarray.IndexedOptionArray, + ak.contents.numpyarray.NumpyArray, + ak.contents.listarray.ListArray, + ak.contents.listoffsetarray.ListOffsetArray, + ak.contents.recordarray.RecordArray, + ak.contents.unionarray.UnionArray, + ak.contents.unmaskedarray.UnmaskedArray, + ak.record.Record, ]: jax.tree_util.register_pytree_node( cls, @@ -42,7 +42,7 @@ def register_pytrees(): cls.jax_unflatten, ) - for cls in [ak._v2.highlevel.Array, ak._v2.highlevel.Record]: + for cls in [ak.highlevel.Array, ak.highlevel.Record]: jax.tree_util.register_pytree_node( cls, cls._jax_flatten, @@ -52,7 +52,7 @@ def register_pytrees(): def import_jax(name="Awkward Arrays with JAX"): if jax is None: - raise ak._v2._util.error(ModuleNotFoundError(error_message.format(name))) + raise ak._util.error(ModuleNotFoundError(error_message.format(name))) global pytrees_registered @@ -67,7 +67,7 @@ def _find_numpyarray_nodes(layout): data_ptrs = [] def find_nparray_ptrs(node, **kwargs): - if isinstance(node, ak._v2.contents.numpyarray.NumpyArray): + if isinstance(node, ak.contents.numpyarray.NumpyArray): data_ptrs.append(node.data) layout.recursively_apply(action=find_nparray_ptrs, return_array=False) @@ -77,10 +77,10 @@ def find_nparray_ptrs(node, **kwargs): def _replace_numpyarray_nodes(layout, buffers): def replace_numpyarray_nodes(node, **kwargs): - if isinstance(node, ak._v2.contents.numpyarray.NumpyArray): + if isinstance(node, ak.contents.numpyarray.NumpyArray): buffer = buffers[0] buffers.pop(0) - return ak._v2.contents.NumpyArray( + return ak.contents.NumpyArray( buffer, layout.identifier, layout.parameters, diff --git a/src/awkward/_v2/_connect/jax/_reducers.py b/src/awkward/_connect/jax/_reducers.py similarity index 78% rename from src/awkward/_v2/_connect/jax/_reducers.py rename to src/awkward/_connect/jax/_reducers.py index 72a067093e..8f35dcc3c1 100644 --- a/src/awkward/_v2/_connect/jax/_reducers.py +++ b/src/awkward/_connect/jax/_reducers.py @@ -1,7 +1,7 @@ # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE import awkward as ak -from awkward._v2._connect.jax import import_jax +from awkward._connect.jax import import_jax np = ak.nplike.NumpyMetadata.instance() @@ -45,7 +45,7 @@ def return_dtype(cls, given_dtype): @classmethod def apply(cls, array, parents, outlength): - raise ak._v2._util.error("Cannot differentiate through argmin") + raise ak._util.error("Cannot differentiate through argmin") class ArgMax(Reducer): @@ -59,7 +59,7 @@ def return_dtype(cls, given_dtype): @classmethod def apply(cls, array, parents, outlength): - raise ak._v2._util.error("Cannot differentiate through argmax") + raise ak._util.error("Cannot differentiate through argmax") class Count(Reducer): @@ -72,7 +72,7 @@ def return_dtype(cls, given_dtype): @classmethod def apply(cls, array, parents, outlength): - raise ak._v2._util.error("Cannot differentiate through count_zero") + raise ak._util.error("Cannot differentiate through count_zero") class CountNonzero(Reducer): @@ -85,7 +85,7 @@ def return_dtype(cls, given_dtype): @classmethod def apply(cls, array, parents, outlength): - raise ak._v2._util.error("Cannot differentiate through count_nonzero") + raise ak._util.error("Cannot differentiate through count_nonzero") class Sum(Reducer): @@ -95,20 +95,20 @@ class Sum(Reducer): @classmethod def apply(cls, array, parents, outlength): - assert isinstance(array, ak._v2.contents.NumpyArray) + assert isinstance(array, ak.contents.NumpyArray) if array.dtype.kind == "M": - raise ak._v2._util.error( + raise ak._util.error( ValueError(f"cannot compute the sum (ak.sum) of {array.dtype!r}") ) result = cls.jax.ops.segment_sum(array.data, parents.data) if array.dtype.kind == "m": - return ak._v2.contents.NumpyArray(array.nplike.asarray(result, array.dtype)) + return ak.contents.NumpyArray(array.nplike.asarray(result, array.dtype)) elif array.dtype.type in (np.complex128, np.complex64): - return ak._v2.contents.NumpyArray(result.view(array.dtype)) + return ak.contents.NumpyArray(result.view(array.dtype)) else: - return ak._v2.contents.NumpyArray(result, nplike=array.nplike) + return ak.contents.NumpyArray(result, nplike=array.nplike) class Prod(Reducer): @@ -117,18 +117,16 @@ class Prod(Reducer): @classmethod def apply(cls, array, parents, outlength): - assert isinstance(array, ak._v2.contents.NumpyArray) + assert isinstance(array, ak.contents.NumpyArray) # See issue https://github.com/google/jax/issues/9296 result = cls.jax.numpy.exp( cls.jax.ops.segment_sum(cls.jax.numpy.log(array.data), parents.data) ) if array.dtype.type in (np.complex128, np.complex64): - return ak._v2.contents.NumpyArray( - result.view(array.dtype), nplike=array.nplike - ) + return ak.contents.NumpyArray(result.view(array.dtype), nplike=array.nplike) else: - return ak._v2.contents.NumpyArray(result, nplike=array.nplike) + return ak.contents.NumpyArray(result, nplike=array.nplike) class Any(Reducer): @@ -141,11 +139,11 @@ def return_dtype(cls, given_dtype): @classmethod def apply(cls, array, parents, outlength): - assert isinstance(array, ak._v2.contents.NumpyArray) + assert isinstance(array, ak.contents.NumpyArray) result = cls.jax.ops.segment_max(array.data, parents.data) result = cls.jax.numpy.asarray(result, dtype=bool) - return ak._v2.contents.NumpyArray(result, nplike=array.nplike) + return ak.contents.NumpyArray(result, nplike=array.nplike) class All(Reducer): @@ -158,11 +156,11 @@ def return_dtype(cls, given_dtype): @classmethod def apply(cls, array, parents, outlength): - assert isinstance(array, ak._v2.contents.NumpyArray) + assert isinstance(array, ak.contents.NumpyArray) result = cls.jax.ops.segment_min(array.data, parents.data) result = cls.jax.numpy.asarray(result, dtype=bool) - return ak._v2.contents.NumpyArray(result, nplike=array.nplike) + return ak.contents.NumpyArray(result, nplike=array.nplike) class Min(Reducer): @@ -197,7 +195,7 @@ def _min_initial(initial, type): @classmethod def apply(cls, array, parents, outlength): - assert isinstance(array, ak._v2.contents.NumpyArray) + assert isinstance(array, ak.contents.NumpyArray) result = cls.jax.ops.segment_min(array.data, parents.data) result = cls.jax.numpy.minimum( @@ -205,12 +203,12 @@ def apply(cls, array, parents, outlength): ) if array.dtype.type in (np.complex128, np.complex64): - return ak._v2.contents.NumpyArray( + return ak.contents.NumpyArray( array.nplike.array(result.view(array.dtype), array.dtype), nplike=array.nplike, ) else: - return ak._v2.contents.NumpyArray(result, nplike=array.nplike) + return ak.contents.NumpyArray(result, nplike=array.nplike) class Max(Reducer): @@ -245,7 +243,7 @@ def _max_initial(initial, type): @classmethod def apply(cls, array, parents, outlength): - assert isinstance(array, ak._v2.contents.NumpyArray) + assert isinstance(array, ak.contents.NumpyArray) result = cls.jax.ops.segment_max(array.data, parents.data) @@ -253,9 +251,9 @@ def apply(cls, array, parents, outlength): result, cls._max_initial(cls.initial, array.dtype) ) if array.dtype.type in (np.complex128, np.complex64): - return ak._v2.contents.NumpyArray( + return ak.contents.NumpyArray( array.nplike.array(result.view(array.dtype), array.dtype), nplike=array.nplike, ) else: - return ak._v2.contents.NumpyArray(result, nplike=array.nplike) + return ak.contents.NumpyArray(result, nplike=array.nplike) diff --git a/src/awkward/_v2/_connect/__init__.py b/src/awkward/_connect/numba/__init__.py similarity index 100% rename from src/awkward/_v2/_connect/__init__.py rename to src/awkward/_connect/numba/__init__.py diff --git a/src/awkward/_v2/_connect/numba/arrayview.py b/src/awkward/_connect/numba/arrayview.py similarity index 92% rename from src/awkward/_v2/_connect/numba/arrayview.py rename to src/awkward/_connect/numba/arrayview.py index d85aef43c4..c53d597e71 100644 --- a/src/awkward/_v2/_connect/numba/arrayview.py +++ b/src/awkward/_connect/numba/arrayview.py @@ -21,41 +21,41 @@ def code_to_function(code, function_name, externals=None, debug=False): def tonumbatype(form): - if isinstance(form, ak._v2.forms.EmptyForm): + if isinstance(form, ak.forms.EmptyForm): return tonumbatype(form.toNumpyForm(np.dtype(np.float64))) - elif isinstance(form, ak._v2.forms.NumpyForm): + elif isinstance(form, ak.forms.NumpyForm): if len(form.inner_shape) == 0: - return ak._v2._connect.numba.layout.NumpyArrayType.from_form(form) + return ak._connect.numba.layout.NumpyArrayType.from_form(form) else: return tonumbatype(form.toRegularForm()) - elif isinstance(form, ak._v2.forms.RegularForm): - return ak._v2._connect.numba.layout.RegularArrayType.from_form(form) + elif isinstance(form, ak.forms.RegularForm): + return ak._connect.numba.layout.RegularArrayType.from_form(form) - elif isinstance(form, (ak._v2.forms.ListForm, ak._v2.forms.ListOffsetForm)): - return ak._v2._connect.numba.layout.ListArrayType.from_form(form) + elif isinstance(form, (ak.forms.ListForm, ak.forms.ListOffsetForm)): + return ak._connect.numba.layout.ListArrayType.from_form(form) - elif isinstance(form, ak._v2.forms.IndexedForm): - return ak._v2._connect.numba.layout.IndexedArrayType.from_form(form) + elif isinstance(form, ak.forms.IndexedForm): + return ak._connect.numba.layout.IndexedArrayType.from_form(form) - elif isinstance(form, ak._v2.forms.IndexedOptionForm): - return ak._v2._connect.numba.layout.IndexedOptionArrayType.from_form(form) + elif isinstance(form, ak.forms.IndexedOptionForm): + return ak._connect.numba.layout.IndexedOptionArrayType.from_form(form) - elif isinstance(form, ak._v2.forms.ByteMaskedForm): - return ak._v2._connect.numba.layout.ByteMaskedArrayType.from_form(form) + elif isinstance(form, ak.forms.ByteMaskedForm): + return ak._connect.numba.layout.ByteMaskedArrayType.from_form(form) - elif isinstance(form, ak._v2.forms.BitMaskedForm): - return ak._v2._connect.numba.layout.BitMaskedArrayType.from_form(form) + elif isinstance(form, ak.forms.BitMaskedForm): + return ak._connect.numba.layout.BitMaskedArrayType.from_form(form) - elif isinstance(form, ak._v2.forms.UnmaskedForm): - return ak._v2._connect.numba.layout.UnmaskedArrayType.from_form(form) + elif isinstance(form, ak.forms.UnmaskedForm): + return ak._connect.numba.layout.UnmaskedArrayType.from_form(form) - elif isinstance(form, ak._v2.forms.RecordForm): - return ak._v2._connect.numba.layout.RecordArrayType.from_form(form) + elif isinstance(form, ak.forms.RecordForm): + return ak._connect.numba.layout.RecordArrayType.from_form(form) - elif isinstance(form, ak._v2.forms.UnionForm): - return ak._v2._connect.numba.layout.UnionArrayType.from_form(form) + elif isinstance(form, ak.forms.UnionForm): + return ak._connect.numba.layout.UnionArrayType.from_form(form) else: raise AssertionError(f"unrecognized Form: {type(form)}") @@ -64,7 +64,7 @@ def tonumbatype(form): ########## Lookup -@numba.extending.typeof_impl.register(ak._v2._lookup.Lookup) +@numba.extending.typeof_impl.register(ak._lookup.Lookup) def typeof_Lookup(obj, c): return LookupType() @@ -104,8 +104,8 @@ def unbox_Lookup(lookuptype, lookupobj, c): class ArrayView: @classmethod def fromarray(cls, array): - behavior = ak._v2._util.behavior_of(array) - layout = ak._v2.operations.to_layout( + behavior = ak._util.behavior_of(array) + layout = ak.operations.to_layout( array, allow_record=False, allow_other=False, @@ -114,7 +114,7 @@ def fromarray(cls, array): return ArrayView( tonumbatype(layout.form), behavior, - ak._v2._lookup.Lookup(layout), + ak._lookup.Lookup(layout), 0, 0, len(layout), @@ -133,7 +133,7 @@ def __init__(self, type, behavior, lookup, pos, start, stop, fields): def toarray(self): layout = self.type.tolayout(self.lookup, self.pos, self.fields) sliced = layout._getitem_range(slice(self.start, self.stop)) - return ak._v2._util.wrap(sliced, self.behavior) + return ak._util.wrap(sliced, self.behavior) @numba.extending.typeof_impl.register(ArrayView) @@ -495,20 +495,20 @@ def lower_iternext(context, builder, sig, args, result): class RecordView: @classmethod def fromrecord(cls, record): - behavior = ak._v2._util.behavior_of(record) - layout = ak._v2.operations.to_layout( + behavior = ak._util.behavior_of(record) + layout = ak.operations.to_layout( record, allow_record=True, allow_other=False, numpytype=(np.number, np.bool_, np.datetime64, np.timedelta64), ) - assert isinstance(layout, ak._v2.record.Record) + assert isinstance(layout, ak.record.Record) arraylayout = layout.array return RecordView( ArrayView( tonumbatype(arraylayout.form), behavior, - ak._v2._lookup.Lookup(arraylayout), + ak._lookup.Lookup(arraylayout), 0, 0, len(arraylayout), @@ -523,8 +523,8 @@ def __init__(self, arrayview, at): def torecord(self): arraylayout = self.arrayview.toarray().layout - return ak._v2._util.wrap( - ak._v2.record.Record(arraylayout, self.at), self.arrayview.behavior + return ak._util.wrap( + ak.record.Record(arraylayout, self.at), self.arrayview.behavior ) @@ -653,7 +653,7 @@ class type_getattr_record(numba.core.typing.templates.AttributeTemplate): key = RecordViewType def generic_resolve(self, recordviewtype, attr): - for methodname, typer, lower in ak._v2._util.numba_methods( + for methodname, typer, lower in ak._util.numba_methods( recordviewtype.arrayviewtype.type, recordviewtype.arrayviewtype.behavior ): if attr == methodname: @@ -683,7 +683,7 @@ def generic(self, args, kwargs): return numba.types.BoundFunction(type_method, recordviewtype) - for attrname, typer, _ in ak._v2._util.numba_attrs( + for attrname, typer, _ in ak._util.numba_attrs( recordviewtype.arrayviewtype.type, recordviewtype.arrayviewtype.behavior ): if attr == attrname: @@ -694,7 +694,7 @@ def generic(self, args, kwargs): @numba.extending.lower_getattr_generic(RecordViewType) def lower_getattr_generic_record(context, builder, recordviewtype, recordviewval, attr): - for attrname, typer, lower in ak._v2._util.numba_attrs( + for attrname, typer, lower in ak._util.numba_attrs( recordviewtype.arrayviewtype.type, recordviewtype.arrayviewtype.behavior ): if attr == attrname: @@ -719,7 +719,7 @@ def generic(self, args, kwargs): left = args[0].arrayviewtype.type behavior = args[0].arrayviewtype.behavior - for typer, lower in ak._v2._util.numba_unaryops( + for typer, lower in ak._util.numba_unaryops( unaryop, left, behavior ): numba.extending.lower_builtin(unaryop, *args)(lower) @@ -755,7 +755,7 @@ def generic(self, args, kwargs): behavior = args[1].arrayviewtype.behavior if left is not None or right is not None: - for typer, lower in ak._v2._util.numba_binops( + for typer, lower in ak._util.numba_binops( binop, left, right, behavior ): numba.extending.lower_builtin(binop, *args)(lower) @@ -808,7 +808,7 @@ def add_statement(indent, name, arraytype, is_array): name = "x" indent = indent + " " - if isinstance(arraytype, ak._v2._connect.numba.layout.RecordArrayType): + if isinstance(arraytype, ak._connect.numba.layout.RecordArrayType): if arraytype.is_tuple: for fi, ft in enumerate(arraytype.contenttypes): add_statement(indent, name + "[" + repr(fi) + "]", ft, False) @@ -945,7 +945,7 @@ def type_asarray(context): def typer(arrayview): if ( isinstance(arrayview, ArrayViewType) - and isinstance(arrayview.type, ak._v2._connect.numba.layout.NumpyArrayType) + and isinstance(arrayview.type, ak._connect.numba.layout.NumpyArrayType) and arrayview.type.ndim == 1 and array_supported(arrayview.type.inner_dtype) ): @@ -959,16 +959,16 @@ def lower_asarray(context, builder, sig, args): rettype, (viewtype,) = sig.return_type, sig.args (viewval,) = args viewproxy = context.make_helper(builder, viewtype, viewval) - assert isinstance(viewtype.type, ak._v2._connect.numba.layout.NumpyArrayType) + assert isinstance(viewtype.type, ak._connect.numba.layout.NumpyArrayType) - whichpos = ak._v2._connect.numba.layout.posat( + whichpos = ak._connect.numba.layout.posat( context, builder, viewproxy.pos, viewtype.type.ARRAY ) - arrayptr = ak._v2._connect.numba.layout.getat( + arrayptr = ak._connect.numba.layout.getat( context, builder, viewproxy.arrayptrs, whichpos ) - bitwidth = ak._v2._connect.numba.layout.type_bitwidth(rettype.dtype) + bitwidth = ak._connect.numba.layout.type_bitwidth(rettype.dtype) itemsize = context.get_constant(numba.intp, bitwidth // 8) data = numba.core.cgutils.pointer_add( diff --git a/src/awkward/_v2/_connect/numba/builder.py b/src/awkward/_connect/numba/builder.py similarity index 95% rename from src/awkward/_v2/_connect/numba/builder.py rename to src/awkward/_connect/numba/builder.py index efe2bbd9e3..c901d49f88 100644 --- a/src/awkward/_v2/_connect/numba/builder.py +++ b/src/awkward/_connect/numba/builder.py @@ -25,7 +25,7 @@ class ArrayBuilderType(numba.types.Type): def __init__(self, behavior): super().__init__( name="ak2.ArrayBuilderType({})".format( - ak._v2._connect.numba.arrayview.repr_behavior(behavior) + ak._connect.numba.arrayview.repr_behavior(behavior) ) ) self.behavior = behavior @@ -71,7 +71,7 @@ def unbox_ArrayBuilder(arraybuildertype, arraybuilderobj, c): @numba.extending.box(ArrayBuilderType) def box_ArrayBuilder(arraybuildertype, arraybuilderval, c): ArrayBuilder_obj = c.pyapi.unserialize( - c.pyapi.serialize_object(ak._v2.highlevel.ArrayBuilder) + c.pyapi.serialize_object(ak.highlevel.ArrayBuilder) ) behavior_obj = c.pyapi.unserialize( c.pyapi.serialize_object(arraybuildertype.behavior) @@ -129,7 +129,7 @@ def lower_len(context, builder, sig, args): ak._libawkward.ArrayBuilder_length, (proxyin.rawptr, result), ) - return ak._v2._connect.numba.layout.castint( + return ak._connect.numba.layout.castint( context, builder, numba.int64, numba.intp, builder.load(result) ) @@ -275,8 +275,8 @@ def resolve_append(self, arraybuildertype, args, kwargs): and isinstance( args[0], ( - ak._v2._connect.numba.arrayview.ArrayViewType, - ak._v2._connect.numba.arrayview.RecordViewType, + ak._connect.numba.arrayview.ArrayViewType, + ak._connect.numba.arrayview.RecordViewType, numba.types.Boolean, numba.types.Integer, numba.types.Float, @@ -307,7 +307,7 @@ def resolve_append(self, arraybuildertype, args, kwargs): isinstance(key, tuple) and len(key) == 3 and key[0] == "__numba_lower__" - and key[1] == ak._v2.highlevel.ArrayBuilder.append + and key[1] == ak.highlevel.ArrayBuilder.append and ( args[0] == key[2] or ( @@ -329,7 +329,7 @@ def resolve_extend(self, arraybuildertype, args, kwargs): if ( len(args) == 1 and len(kwargs) == 0 - and isinstance(args[0], ak._v2._connect.numba.arrayview.ArrayViewType) + and isinstance(args[0], ak._connect.numba.arrayview.ArrayViewType) ): return numba.types.none(args[0]) else: @@ -371,7 +371,7 @@ def lower_integer(context, builder, sig, args): arraybuildertype, xtype = sig.args arraybuilderval, xval = args proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) - x = ak._v2._connect.numba.layout.castint(context, builder, xtype, numba.int64, xval) + x = ak._connect.numba.layout.castint(context, builder, xtype, numba.int64, xval) call(context, builder, ak._libawkward.ArrayBuilder_integer, (proxyin.rawptr, x)) return context.get_dummy_value() @@ -419,7 +419,7 @@ def lower_begintuple(context, builder, sig, args): arraybuildertype, numfieldstype = sig.args arraybuilderval, numfieldsval = args proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) - numfields = ak._v2._connect.numba.layout.castint( + numfields = ak._connect.numba.layout.castint( context, builder, numfieldstype, numba.int64, numfieldsval ) call( @@ -436,7 +436,7 @@ def lower_index(context, builder, sig, args): arraybuildertype, indextype = sig.args arraybuilderval, indexval = args proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) - index = ak._v2._connect.numba.layout.castint( + index = ak._connect.numba.layout.castint( context, builder, indextype, numba.int64, indexval ) call( @@ -513,7 +513,7 @@ def lower_endrecord(context, builder, sig, args): @numba.extending.lower_builtin( - "append", ArrayBuilderType, ak._v2._connect.numba.arrayview.ArrayViewType + "append", ArrayBuilderType, ak._connect.numba.arrayview.ArrayViewType ) def lower_append_array(context, builder, sig, args): arraybuildertype, viewtype = sig.args @@ -530,7 +530,7 @@ def lower_append_array(context, builder, sig, args): @numba.extending.lower_builtin( - "append", ArrayBuilderType, ak._v2._connect.numba.arrayview.RecordViewType + "append", ArrayBuilderType, ak._connect.numba.arrayview.RecordViewType ) def lower_append_record(context, builder, sig, args): arraybuildertype, recordviewtype = sig.args @@ -541,11 +541,11 @@ def lower_append_record(context, builder, sig, args): arrayviewproxy = context.make_helper( builder, recordviewtype.arrayviewtype, recordviewproxy.arrayview ) - atval = ak._v2._connect.numba.layout.castint( + atval = ak._connect.numba.layout.castint( context, builder, numba.intp, numba.int64, recordviewproxy.at ) - sharedptr = ak._v2._connect.numba.layout.getat( + sharedptr = ak._connect.numba.layout.getat( context, builder, arrayviewproxy.sharedptrs, arrayviewproxy.pos ) @@ -631,7 +631,7 @@ def lower_append_none(context, builder, sig, args): @numba.extending.lower_builtin( - "extend", ArrayBuilderType, ak._v2._connect.numba.arrayview.ArrayViewType + "extend", ArrayBuilderType, ak._connect.numba.arrayview.ArrayViewType ) def lower_extend_array(context, builder, sig, args): arraybuildertype, viewtype = sig.args @@ -639,13 +639,13 @@ def lower_extend_array(context, builder, sig, args): viewproxy = context.make_helper(builder, viewtype, viewval) - sharedptr = ak._v2._connect.numba.layout.getat( + sharedptr = ak._connect.numba.layout.getat( context, builder, viewproxy.sharedptrs, viewproxy.pos ) proxyin = context.make_helper(builder, arraybuildertype, arraybuilderval) with numba.core.cgutils.for_range(builder, viewproxy.stop, viewproxy.start) as loop: - atval = ak._v2._connect.numba.layout.castint( + atval = ak._connect.numba.layout.castint( context, builder, numba.intp, numba.int64, loop.index ) call( diff --git a/src/awkward/_v2/_connect/numba/layout.py b/src/awkward/_connect/numba/layout.py similarity index 88% rename from src/awkward/_v2/_connect/numba/layout.py rename to src/awkward/_connect/numba/layout.py index 379711f01a..1db6fa1d1f 100644 --- a/src/awkward/_v2/_connect/numba/layout.py +++ b/src/awkward/_connect/numba/layout.py @@ -10,9 +10,9 @@ numpy = ak.nplike.Numpy.instance() -@numba.extending.typeof_impl.register(ak._v2.contents.Content) -@numba.extending.typeof_impl.register(ak._v2.index.Index) -@numba.extending.typeof_impl.register(ak._v2.record.Record) +@numba.extending.typeof_impl.register(ak.contents.Content) +@numba.extending.typeof_impl.register(ak.index.Index) +@numba.extending.typeof_impl.register(ak.record.Record) def fake_typeof(obj, c): raise TypeError( "{} objects cannot be passed directly into Numba-compiled functions; " @@ -47,33 +47,33 @@ def from_form_index(cls, index_string): def IndexOf(self, arraytype): if arraytype.dtype.bitwidth == 8 and arraytype.dtype.signed: - return ak._v2.index.Index8 + return ak.index.Index8 elif arraytype.dtype.bitwidth == 8: - return ak._v2.index.IndexU8 + return ak.index.IndexU8 elif arraytype.dtype.bitwidth == 32 and arraytype.dtype.signed: - return ak._v2.index.Index32 + return ak.index.Index32 elif arraytype.dtype.bitwidth == 32: - return ak._v2.index.IndexU32 + return ak.index.IndexU32 elif arraytype.dtype.bitwidth == 64: - return ak._v2.index.Index64 + return ak.index.Index64 else: - raise ak._v2._util.error( + raise ak._util.error( AssertionError(f"no Index* type for array: {arraytype}") ) def getitem_at_check(self, viewtype): - typer = ak._v2._util.numba_array_typer(viewtype.type, viewtype.behavior) + typer = ak._util.numba_array_typer(viewtype.type, viewtype.behavior) if typer is None: return self.getitem_at(viewtype) else: return typer(viewtype) def getitem_range(self, viewtype): - return ak._v2._connect.numba.arrayview.wrap(self, viewtype, None) + return ak._connect.numba.arrayview.wrap(self, viewtype, None) def getitem_field(self, viewtype, key): if self.has_field(key): - return ak._v2._connect.numba.arrayview.wrap( + return ak._connect.numba.arrayview.wrap( self, viewtype, viewtype.fields + (key,) ) else: @@ -92,7 +92,7 @@ def lower_getitem_at_check( wrapneg, checkbounds, ): - lower = ak._v2._util.numba_array_lower(viewtype.type, viewtype.behavior) + lower = ak._util.numba_array_lower(viewtype.type, viewtype.behavior) if lower is not None: atval = regularize_atval( context, builder, viewproxy, attype, atval, wrapneg, checkbounds @@ -268,10 +268,10 @@ def regularize_atval(context, builder, viewproxy, attype, atval, wrapneg, checkb return castint(context, builder, atval.type, numba.intp, atval) -class NumpyArrayType(ContentType, ak._v2._lookup.NumpyLookup): +class NumpyArrayType(ContentType, ak._lookup.NumpyLookup): @classmethod def from_form(cls, form): - t = numba.from_dtype(ak._v2.types.numpytype.primitive_to_dtype(form.primitive)) + t = numba.from_dtype(ak.types.numpytype.primitive_to_dtype(form.primitive)) arraytype = numba.types.Array(t, 1, "C") return NumpyArrayType( arraytype, cls.from_form_identifier(form), form.parameters @@ -331,11 +331,11 @@ def is_recordtype(self): return False -class RegularArrayType(ContentType, ak._v2._lookup.RegularLookup): +class RegularArrayType(ContentType, ak._lookup.RegularLookup): @classmethod def from_form(cls, form): return RegularArrayType( - ak._v2._connect.numba.arrayview.tonumbatype(form.content), + ak._connect.numba.arrayview.tonumbatype(form.content), form.size, cls.from_form_identifier(form), form.parameters, @@ -356,7 +356,7 @@ def has_field(self, key): return self.contenttype.has_field(key) def getitem_at(self, viewtype): - return ak._v2._connect.numba.arrayview.wrap(self.contenttype, viewtype, None) + return ak._connect.numba.arrayview.wrap(self.contenttype, viewtype, None) def lower_getitem_at( self, @@ -409,17 +409,17 @@ def is_recordtype(self): return False -class ListArrayType(ContentType, ak._v2._lookup.ListLookup): +class ListArrayType(ContentType, ak._lookup.ListLookup): @classmethod def from_form(cls, form): - if isinstance(form, ak._v2.forms.ListForm): + if isinstance(form, ak.forms.ListForm): index_string = form.starts else: index_string = form.offsets return ListArrayType( cls.from_form_index(index_string), - ak._v2._connect.numba.arrayview.tonumbatype(form.content), + ak._connect.numba.arrayview.tonumbatype(form.content), cls.from_form_identifier(form), form.parameters, ) @@ -442,7 +442,7 @@ def has_field(self, key): return self.contenttype.has_field(key) def getitem_at(self, viewtype): - return ak._v2._connect.numba.arrayview.wrap(self.contenttype, viewtype, None) + return ak._connect.numba.arrayview.wrap(self.contenttype, viewtype, None) def lower_getitem_at( self, @@ -507,12 +507,12 @@ def is_recordtype(self): return False -class IndexedArrayType(ContentType, ak._v2._lookup.IndexedLookup): +class IndexedArrayType(ContentType, ak._lookup.IndexedLookup): @classmethod def from_form(cls, form): return IndexedArrayType( cls.from_form_index(form.index), - ak._v2._connect.numba.arrayview.tonumbatype(form.content), + ak._connect.numba.arrayview.tonumbatype(form.content), cls.from_form_identifier(form), form.parameters, ) @@ -535,9 +535,7 @@ def has_field(self, key): return self.contenttype.has_field(key) def getitem_at(self, viewtype): - viewtype = ak._v2._connect.numba.arrayview.wrap( - self.contenttype, viewtype, None - ) + viewtype = ak._connect.numba.arrayview.wrap(self.contenttype, viewtype, None) return self.contenttype.getitem_at_check(viewtype) def lower_getitem_at( @@ -567,7 +565,7 @@ def lower_getitem_at( context, builder, indexptr, indexarraypos, rettype=self.indextype.dtype ) - nextviewtype = ak._v2._connect.numba.arrayview.wrap( + nextviewtype = ak._connect.numba.arrayview.wrap( self.contenttype, viewtype, None ) proxynext = context.make_helper(builder, nextviewtype) @@ -610,12 +608,12 @@ def is_recordtype(self): return self.contenttype.is_recordtype -class IndexedOptionArrayType(ContentType, ak._v2._lookup.IndexedOptionLookup): +class IndexedOptionArrayType(ContentType, ak._lookup.IndexedOptionLookup): @classmethod def from_form(cls, form): return IndexedOptionArrayType( cls.from_form_index(form.index), - ak._v2._connect.numba.arrayview.tonumbatype(form.content), + ak._connect.numba.arrayview.tonumbatype(form.content), cls.from_form_identifier(form), form.parameters, ) @@ -638,9 +636,7 @@ def has_field(self, key): return self.contenttype.has_field(key) def getitem_at(self, viewtype): - viewtype = ak._v2._connect.numba.arrayview.wrap( - self.contenttype, viewtype, None - ) + viewtype = ak._connect.numba.arrayview.wrap(self.contenttype, viewtype, None) return numba.types.optional(self.contenttype.getitem_at_check(viewtype)) def lower_getitem_at( @@ -682,7 +678,7 @@ def lower_getitem_at( output.data = numba.core.cgutils.get_null_value(output.data.type) with isvalid: - nextviewtype = ak._v2._connect.numba.arrayview.wrap( + nextviewtype = ak._connect.numba.arrayview.wrap( self.contenttype, viewtype, None ) proxynext = context.make_helper(builder, nextviewtype) @@ -730,12 +726,12 @@ def is_recordtype(self): return self.contenttype.is_recordtype -class ByteMaskedArrayType(ContentType, ak._v2._lookup.ByteMaskedLookup): +class ByteMaskedArrayType(ContentType, ak._lookup.ByteMaskedLookup): @classmethod def from_form(cls, form): return ByteMaskedArrayType( cls.from_form_index(form.mask), - ak._v2._connect.numba.arrayview.tonumbatype(form.content), + ak._connect.numba.arrayview.tonumbatype(form.content), form.valid_when, cls.from_form_identifier(form), form.parameters, @@ -761,9 +757,7 @@ def has_field(self, key): return self.contenttype.has_field(key) def getitem_at(self, viewtype): - viewtype = ak._v2._connect.numba.arrayview.wrap( - self.contenttype, viewtype, None - ) + viewtype = ak._connect.numba.arrayview.wrap(self.contenttype, viewtype, None) return numba.types.optional(self.contenttype.getitem_at_check(viewtype)) def lower_getitem_at( @@ -803,7 +797,7 @@ def lower_getitem_at( ) ) as (isvalid, isnone): with isvalid: - nextviewtype = ak._v2._connect.numba.arrayview.wrap( + nextviewtype = ak._connect.numba.arrayview.wrap( self.contenttype, viewtype, None ) proxynext = context.make_helper(builder, nextviewtype) @@ -852,12 +846,12 @@ def is_recordtype(self): return self.contenttype.is_recordtype -class BitMaskedArrayType(ContentType, ak._v2._lookup.BitMaskedLookup): +class BitMaskedArrayType(ContentType, ak._lookup.BitMaskedLookup): @classmethod def from_form(cls, form): return BitMaskedArrayType( cls.from_form_index(form.mask), - ak._v2._connect.numba.arrayview.tonumbatype(form.content), + ak._connect.numba.arrayview.tonumbatype(form.content), form.valid_when, form.lsb_order, cls.from_form_identifier(form), @@ -888,9 +882,7 @@ def has_field(self, key): return self.contenttype.has_field(key) def getitem_at(self, viewtype): - viewtype = ak._v2._connect.numba.arrayview.wrap( - self.contenttype, viewtype, None - ) + viewtype = ak._connect.numba.arrayview.wrap(self.contenttype, viewtype, None) return numba.types.optional(self.contenttype.getitem_at_check(viewtype)) def lower_getitem_at( @@ -949,7 +941,7 @@ def lower_getitem_at( ) ) as (isvalid, isnone): with isvalid: - nextviewtype = ak._v2._connect.numba.arrayview.wrap( + nextviewtype = ak._connect.numba.arrayview.wrap( self.contenttype, viewtype, None ) proxynext = context.make_helper(builder, nextviewtype) @@ -998,11 +990,11 @@ def is_recordtype(self): return self.contenttype.is_recordtype -class UnmaskedArrayType(ContentType, ak._v2._lookup.UnmaskedLookup): +class UnmaskedArrayType(ContentType, ak._lookup.UnmaskedLookup): @classmethod def from_form(cls, form): return UnmaskedArrayType( - ak._v2._connect.numba.arrayview.tonumbatype(form.content), + ak._connect.numba.arrayview.tonumbatype(form.content), cls.from_form_identifier(form), form.parameters, ) @@ -1021,9 +1013,7 @@ def has_field(self, key): return self.contenttype.has_field(key) def getitem_at(self, viewtype): - viewtype = ak._v2._connect.numba.arrayview.wrap( - self.contenttype, viewtype, None - ) + viewtype = ak._connect.numba.arrayview.wrap(self.contenttype, viewtype, None) return numba.types.optional(self.contenttype.getitem_at_check(viewtype)) def lower_getitem_at( @@ -1048,7 +1038,7 @@ def lower_getitem_at( output = context.make_helper(builder, rettype) - nextviewtype = ak._v2._connect.numba.arrayview.wrap( + nextviewtype = ak._connect.numba.arrayview.wrap( self.contenttype, viewtype, None ) proxynext = context.make_helper(builder, nextviewtype) @@ -1093,11 +1083,11 @@ def is_recordtype(self): return self.contenttype.is_recordtype -class RecordArrayType(ContentType, ak._v2._lookup.RecordLookup): +class RecordArrayType(ContentType, ak._lookup.RecordLookup): @classmethod def from_form(cls, form): return RecordArrayType( - [ak._v2._connect.numba.arrayview.tonumbatype(x) for x in form.contents], + [ak._connect.numba.arrayview.tonumbatype(x) for x in form.contents], None if form.is_tuple else form.fields, cls.from_form_identifier(form), form.parameters, @@ -1139,8 +1129,8 @@ def has_field(self, key): def getitem_at_check(self, viewtype): out = self.getitem_at(viewtype) - if isinstance(out, ak._v2._connect.numba.arrayview.RecordViewType): - typer = ak._v2._util.numba_record_typer( + if isinstance(out, ak._connect.numba.arrayview.RecordViewType): + typer = ak._util.numba_record_typer( out.arrayviewtype.type, out.arrayviewtype.behavior ) if typer is not None: @@ -1149,7 +1139,7 @@ def getitem_at_check(self, viewtype): def getitem_at(self, viewtype): if len(viewtype.fields) == 0: - return ak._v2._connect.numba.arrayview.RecordViewType(viewtype) + return ak._connect.numba.arrayview.RecordViewType(viewtype) else: key = viewtype.fields[0] index = self.fieldindex(key) @@ -1167,7 +1157,7 @@ def getitem_at(self, viewtype): ) ) contenttype = self.contenttypes[index] - subviewtype = ak._v2._connect.numba.arrayview.wrap( + subviewtype = ak._connect.numba.arrayview.wrap( contenttype, viewtype, viewtype.fields[1:] ) return contenttype.getitem_at_check(subviewtype) @@ -1188,7 +1178,7 @@ def getitem_field(self, viewtype, key): ) ) contenttype = self.contenttypes[index] - subviewtype = ak._v2._connect.numba.arrayview.wrap(contenttype, viewtype, None) + subviewtype = ak._connect.numba.arrayview.wrap(contenttype, viewtype, None) return contenttype.getitem_range(subviewtype) def getitem_field_record(self, recordviewtype, key): @@ -1207,7 +1197,7 @@ def getitem_field_record(self, recordviewtype, key): ) ) contenttype = self.contenttypes[index] - subviewtype = ak._v2._connect.numba.arrayview.wrap( + subviewtype = ak._connect.numba.arrayview.wrap( contenttype, recordviewtype, None ) return contenttype.getitem_at_check(subviewtype) @@ -1238,8 +1228,8 @@ def lower_getitem_at_check( checkbounds, ) baretype = self.getitem_at(viewtype) - if isinstance(baretype, ak._v2._connect.numba.arrayview.RecordViewType): - lower = ak._v2._util.numba_record_lower( + if isinstance(baretype, ak._connect.numba.arrayview.RecordViewType): + lower = ak._util.numba_record_lower( baretype.arrayviewtype.type, baretype.arrayviewtype.behavior ) if lower is not None: @@ -1265,7 +1255,7 @@ def lower_getitem_at( if len(viewtype.fields) == 0: proxyout = context.make_helper( - builder, ak._v2._connect.numba.arrayview.RecordViewType(viewtype) + builder, ak._connect.numba.arrayview.RecordViewType(viewtype) ) proxyout.arrayview = viewval proxyout.at = atval @@ -1278,7 +1268,7 @@ def lower_getitem_at( whichpos = posat(context, builder, viewproxy.pos, self.CONTENTS + index) nextpos = getat(context, builder, viewproxy.arrayptrs, whichpos) - nextviewtype = ak._v2._connect.numba.arrayview.wrap( + nextviewtype = ak._connect.numba.arrayview.wrap( contenttype, viewtype, viewtype.fields[1:] ) proxynext = context.make_helper(builder, nextviewtype) @@ -1347,7 +1337,7 @@ def lower_getitem_field_record( proxynext.arrayptrs = arrayviewproxy.arrayptrs proxynext.pylookup = arrayviewproxy.pylookup - nextviewtype = ak._v2._connect.numba.arrayview.wrap( + nextviewtype = ak._connect.numba.arrayview.wrap( contenttype, arrayviewtype, None ) @@ -1387,13 +1377,13 @@ def is_recordtype(self): return True -class UnionArrayType(ContentType, ak._v2._lookup.UnionLookup): +class UnionArrayType(ContentType, ak._lookup.UnionLookup): @classmethod def from_form(cls, form): return UnionArrayType( cls.from_form_index(form.tags), cls.from_form_index(form.index), - [ak._v2._connect.numba.arrayview.tonumbatype(x) for x in form.contents], + [ak._connect.numba.arrayview.tonumbatype(x) for x in form.contents], cls.from_form_identifier(form), form.parameters, ) @@ -1501,21 +1491,19 @@ def inner_dtype_of_form(form): if form is None: return None - elif isinstance(form, ak._v2.forms.NumpyForm): - return numba.from_dtype( - ak._v2.types.numpytype.primitive_to_dtype(form.primitive) - ) + elif isinstance(form, ak.forms.NumpyForm): + return numba.from_dtype(ak.types.numpytype.primitive_to_dtype(form.primitive)) - elif isinstance(form, ak._v2.forms.EmptyForm): + elif isinstance(form, ak.forms.EmptyForm): return numba.types.float64 elif isinstance( form, ( - ak._v2.forms.RegularForm, - ak._v2.forms.ListForm, - ak._v2.forms.ListOffsetForm, - ak._v2.forms.IndexedForm, + ak.forms.RegularForm, + ak.forms.ListForm, + ak.forms.ListOffsetForm, + ak.forms.IndexedForm, ), ): return inner_dtype_of_form(form.content) @@ -1523,16 +1511,16 @@ def inner_dtype_of_form(form): elif isinstance( form, ( - ak._v2.forms.RecordForm, - ak._v2.forms.IndexedOptionForm, - ak._v2.forms.ByteMaskedForm, - ak._v2.forms.BitMaskedForm, - ak._v2.forms.UnmaskedForm, + ak.forms.RecordForm, + ak.forms.IndexedOptionForm, + ak.forms.ByteMaskedForm, + ak.forms.BitMaskedForm, + ak.forms.UnmaskedForm, ), ): return None - elif isinstance(form, ak._v2.forms.UnionForm): + elif isinstance(form, ak.forms.UnionForm): context = numba.core.typing.Context() return context.unify_types(*[inner_dtype_of_form(x) for x in form.contents]) @@ -1547,13 +1535,13 @@ def optiontype_of_form(form): elif isinstance( form, ( - ak._v2.forms.NumpyForm, - ak._v2.forms.EmptyForm, - ak._v2.forms.RegularForm, - ak._v2.forms.ListForm, - ak._v2.forms.ListOffsetForm, - ak._v2.forms.IndexedForm, - ak._v2.forms.RecordForm, + ak.forms.NumpyForm, + ak.forms.EmptyForm, + ak.forms.RegularForm, + ak.forms.ListForm, + ak.forms.ListOffsetForm, + ak.forms.IndexedForm, + ak.forms.RecordForm, ), ): return False @@ -1561,15 +1549,15 @@ def optiontype_of_form(form): elif isinstance( form, ( - ak._v2.forms.IndexedOptionForm, - ak._v2.forms.ByteMaskedForm, - ak._v2.forms.BitMaskedForm, - ak._v2.forms.UnmaskedForm, + ak.forms.IndexedOptionForm, + ak.forms.ByteMaskedForm, + ak.forms.BitMaskedForm, + ak.forms.UnmaskedForm, ), ): return False - elif isinstance(form, ak._v2.forms.UnionForm): + elif isinstance(form, ak.forms.UnionForm): return any(optiontype_of_form(x) for x in form.contents) else: @@ -1583,11 +1571,11 @@ def recordtype_of_form(form): elif isinstance( form, ( - ak._v2.forms.NumpyForm, - ak._v2.forms.EmptyForm, - ak._v2.forms.RegularForm, - ak._v2.forms.ListForm, - ak._v2.forms.ListOffsetForm, + ak.forms.NumpyForm, + ak.forms.EmptyForm, + ak.forms.RegularForm, + ak.forms.ListForm, + ak.forms.ListOffsetForm, ), ): return False @@ -1595,19 +1583,19 @@ def recordtype_of_form(form): elif isinstance( form, ( - ak._v2.forms.IndexedForm, - ak._v2.forms.IndexedOptionForm, - ak._v2.forms.ByteMaskedForm, - ak._v2.forms.BitMaskedForm, - ak._v2.forms.UnmaskedForm, + ak.forms.IndexedForm, + ak.forms.IndexedOptionForm, + ak.forms.ByteMaskedForm, + ak.forms.BitMaskedForm, + ak.forms.UnmaskedForm, ), ): return recordtype_of_form(form.content) - elif isinstance(form, (ak._v2.forms.RecordForm,)): + elif isinstance(form, (ak.forms.RecordForm,)): return True - elif isinstance(form, ak._v2.forms.UnionForm): + elif isinstance(form, ak.forms.UnionForm): return any(recordtype_of_form(x) for x in form.contents) else: diff --git a/src/awkward/_v2/_connect/numexpr.py b/src/awkward/_connect/numexpr.py similarity index 73% rename from src/awkward/_v2/_connect/numexpr.py rename to src/awkward/_connect/numexpr.py index 256e01c79e..8a0732a603 100644 --- a/src/awkward/_v2/_connect/numexpr.py +++ b/src/awkward/_connect/numexpr.py @@ -1,7 +1,5 @@ # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE -# v2: replace with src/awkward/_v2/_connect/numexpr.py - import warnings import sys @@ -15,7 +13,7 @@ def import_numexpr(): try: import numexpr except ModuleNotFoundError as err: - raise ak._v2._util.error( + raise ak._util.error( ModuleNotFoundError( """install the 'numexpr' package with: @@ -27,9 +25,9 @@ def import_numexpr(): ) ) from err else: - if not checked_version and ak._v2._util.parse_version( + if not checked_version and ak._util.parse_version( numexpr.__version__ - ) < ak._v2._util.parse_version("2.7.1"): + ) < ak._util.parse_version("2.7.1"): warnings.warn( "Awkward Array is only known to work with numexpr 2.7.1 or later" "(you have version {})".format(numexpr.__version__), @@ -82,18 +80,18 @@ def evaluate( arguments = getArguments(names, local_dict, global_dict) arrays = [ - ak._v2.operations.to_layout(x, allow_record=True, allow_other=True) + ak.operations.to_layout(x, allow_record=True, allow_other=True) for x in arguments ] def action(inputs, **ignore): if all( - isinstance(x, ak._v2.contents.NumpyArray) - or not isinstance(x, ak._v2.contents.Content) + isinstance(x, ak.contents.NumpyArray) + or not isinstance(x, ak.contents.Content) for x in inputs ): return ( - ak._v2.contents.NumpyArray( + ak.contents.NumpyArray( numexpr.evaluate( expression, dict(zip(names, inputs)), @@ -107,12 +105,12 @@ def action(inputs, **ignore): else: return None - behavior = ak._v2._util.behavior_of(*arrays) - out = ak._v2._broadcasting.broadcast_and_apply( + behavior = ak._util.behavior_of(*arrays) + out = ak._broadcasting.broadcast_and_apply( arrays, action, behavior, allow_records=False ) assert isinstance(out, tuple) and len(out) == 1 - return ak._v2._util.wrap(out[0], behavior) + return ak._util.wrap(out[0], behavior) evaluate.evaluate = evaluate @@ -124,42 +122,35 @@ def re_evaluate(local_dict=None): try: compiled_ex = numexpr.necompiler._numexpr_last["ex"] # noqa: F841 except KeyError as err: - raise ak._v2._util.error( + raise ak._util.error( RuntimeError( "not a previous evaluate() execution found" - + ak._v2._util.exception_suffix(__file__) + + ak._util.exception_suffix(__file__) ) ) from err names = numexpr.necompiler._numexpr_last["argnames"] arguments = getArguments(names, local_dict) arrays = [ - ak._v2.operations.to_layout(x, allow_record=True, allow_other=True) + ak.operations.to_layout(x, allow_record=True, allow_other=True) for x in arguments ] def action(inputs, **ignore): if all( - isinstance(x, ak._v2.contents.NumpyArray) - or not isinstance(x, ak._v2.contents.Content) + isinstance(x, ak.contents.NumpyArray) + or not isinstance(x, ak.contents.Content) for x in inputs ): return ( - ak._v2.contents.NumpyArray( - numexpr.re_evaluate(dict(zip(names, inputs))) - ), + ak.contents.NumpyArray(numexpr.re_evaluate(dict(zip(names, inputs)))), ) else: return None - behavior = ak._v2._util.behavior_of(*arrays) - out = ak._v2._broadcasting.broadcast_and_apply( + behavior = ak._util.behavior_of(*arrays) + out = ak._broadcasting.broadcast_and_apply( arrays, action, behavior, allow_records=False ) assert isinstance(out, tuple) and len(out) == 1 - return ak._v2._util.wrap(out[0], behavior) - - -# ak._v2._connect.numexpr = types.ModuleType("numexpr") -# ak._v2._connect.numexpr.evaluate = evaluate -# ak._v2._connect.numexpr.re_evaluate = re_evaluate + return ak._util.wrap(out[0], behavior) diff --git a/src/awkward/_v2/_connect/numpy.py b/src/awkward/_connect/numpy.py similarity index 76% rename from src/awkward/_v2/_connect/numpy.py rename to src/awkward/_connect/numpy.py index 98c9f1e900..c21a1a60a1 100644 --- a/src/awkward/_v2/_connect/numpy.py +++ b/src/awkward/_connect/numpy.py @@ -3,8 +3,8 @@ import numpy import awkward as ak -from awkward._v2._util import numpy_at_least -from awkward._v2.contents.numpyarray import NumpyArray +from awkward._util import numpy_at_least +from awkward.contents.numpyarray import NumpyArray # NumPy 1.13.1 introduced NEP13, without which Awkward ufuncs won't work, which # would be worse than lacking a feature: it would cause unexpected output. @@ -14,75 +14,64 @@ def convert_to_array(layout, args, kwargs): - out = ak._v2.operations.to_numpy(layout, allow_missing=False) + out = ak.operations.to_numpy(layout, allow_missing=False) if args == () and kwargs == {}: return out else: return numpy.array(out, *args, **kwargs) -# implemented = {} +implemented = {} -# def _to_rectilinear(arg): -# if isinstance( -# arg, -# ( -# ak.Array, -# ak.Record, -# ak.ArrayBuilder, -# ak._v2.contents.Content, -# ak._v2.record.Record, -# ak.layout.ArrayBuilder, -# ak.layout.LayoutBuilder32, -# ak.layout.LayoutBuilder64, -# ), -# ): -# nplike = ak.nplike.of(arg) -# return nplike.to_rectilinear(arg) -# else: -# return arg - - -# def array_function(func, types, args, kwargs): -# function = implemented.get(func) -# if function is None: -# args = tuple(_to_rectilinear(x) for x in args) -# kwargs = dict((k, _to_rectilinear(v)) for k, v in kwargs.items()) -# out = func(*args, **kwargs) -# nplike = ak.nplike.of(out) -# if isinstance(out, nplike.ndarray) and len(out.shape) != 0: -# return ak.Array(out) -# else: -# return out -# else: -# return function(*args, **kwargs) +def _to_rectilinear(arg): + if isinstance(arg, tuple): + nplike = ak.nplike.of(*arg) + return tuple(nplike.to_rectilinear(x) for x in arg) + else: + nplike = ak.nplike.of(arg) + nplike.to_rectilinear(arg) + + +def array_function(func, types, args, kwargs): + function = implemented.get(func) + if function is None: + args = tuple(_to_rectilinear(x) for x in args) + kwargs = {k: _to_rectilinear(v) for k, v in kwargs.items()} + out = func(*args, **kwargs) + nplike = ak.nplike.of(out) + if isinstance(out, nplike.ndarray) and len(out.shape) != 0: + return ak.Array(out) + else: + return out + else: + return function(*args, **kwargs) -# def implements(numpy_function): -# def decorator(function): -# implemented[getattr(numpy, numpy_function)] = function -# return function +def implements(numpy_function): + def decorator(function): + implemented[getattr(numpy, numpy_function)] = function + return function -# return decorator + return decorator def _array_ufunc_custom_cast(inputs, behavior): nextinputs = [] for x in inputs: - cast_fcn = ak._v2._util.custom_cast(x, behavior) + cast_fcn = ak._util.custom_cast(x, behavior) if cast_fcn is not None: x = cast_fcn(x) nextinputs.append( - ak._v2.operations.to_layout(x, allow_record=True, allow_other=True) + ak.operations.to_layout(x, allow_record=True, allow_other=True) ) return nextinputs def _array_ufunc_adjust(custom, inputs, kwargs, behavior): args = [ - ak._v2._util.wrap(x, behavior) - if isinstance(x, (ak._v2.contents.Content, ak._v2.record.Record)) + ak._util.wrap(x, behavior) + if isinstance(x, (ak.contents.Content, ak.record.Record)) else x for x in inputs ] @@ -91,17 +80,15 @@ def _array_ufunc_adjust(custom, inputs, kwargs, behavior): out = (out,) return tuple( - x.layout - if isinstance(x, (ak._v2.highlevel.Array, ak._v2.highlevel.Record)) - else x + x.layout if isinstance(x, (ak.highlevel.Array, ak.highlevel.Record)) else x for x in out ) def _array_ufunc_adjust_apply(apply_ufunc, ufunc, method, inputs, kwargs, behavior): nextinputs = [ - ak._v2._util.wrap(x, behavior) - if isinstance(x, (ak._v2.contents.Content, ak._v2.record.Record)) + ak._util.wrap(x, behavior) + if isinstance(x, (ak.contents.Content, ak.record.Record)) else x for x in inputs ] @@ -114,9 +101,7 @@ def _array_ufunc_adjust_apply(apply_ufunc, ufunc, method, inputs, kwargs, behavi if not isinstance(out, tuple): out = (out,) return tuple( - x.layout - if isinstance(x, (ak._v2.highlevel.Array, ak._v2.highlevel.Record)) - else x + x.layout if isinstance(x, (ak.highlevel.Array, ak.highlevel.Record)) else x for x in out ) @@ -124,7 +109,7 @@ def _array_ufunc_adjust_apply(apply_ufunc, ufunc, method, inputs, kwargs, behavi def _array_ufunc_signature(ufunc, inputs): signature = [ufunc] for x in inputs: - if isinstance(x, ak._v2.contents.Content): + if isinstance(x, ak.contents.Content): record, array = x.parameter("__record__"), x.parameter("__array__") if record is not None: signature.append(record) @@ -144,14 +129,14 @@ def array_ufunc(ufunc, method, inputs, kwargs): if method != "__call__" or len(inputs) == 0 or "out" in kwargs: return NotImplemented - behavior = ak._v2._util.behavior_of(*inputs) + behavior = ak._util.behavior_of(*inputs) inputs = _array_ufunc_custom_cast(inputs, behavior) def action(inputs, **ignore): signature = _array_ufunc_signature(ufunc, inputs) - custom = ak._v2._util.overload(behavior, signature) + custom = ak._util.overload(behavior, signature) if custom is not None: return _array_ufunc_adjust(custom, inputs, kwargs, behavior) @@ -161,13 +146,13 @@ def action(inputs, **ignore): return custom_matmul() if all( - isinstance(x, NumpyArray) or not isinstance(x, ak._v2.contents.Content) + isinstance(x, NumpyArray) or not isinstance(x, ak.contents.Content) for x in inputs ): nplike = ak.nplike.of(*inputs) # Broadcast parameters against one another - parameters_factory = ak._v2._broadcasting.intersection_parameters_factory( + parameters_factory = ak._broadcasting.intersection_parameters_factory( inputs ) (parameters,) = parameters_factory(1) @@ -180,7 +165,7 @@ def action(inputs, **ignore): args.append(x) if isinstance(nplike, ak.nplike.Jax): - from awkward._v2._connect.jax import import_jax + from awkward._connect.jax import import_jax jax = import_jax() result = getattr(jax.numpy, ufunc.__name__)(*args, **kwargs) @@ -202,8 +187,8 @@ def action(inputs, **ignore): return (NumpyArray(result, nplike=nplike, parameters=parameters),) for x in inputs: - if isinstance(x, ak._v2.contents.Content): - apply_ufunc = ak._v2._util.custom_ufunc(ufunc, x, behavior) + if isinstance(x, ak.contents.Content): + apply_ufunc = ak._util.custom_ufunc(ufunc, x, behavior) if apply_ufunc is not None: out = _array_ufunc_adjust_apply( apply_ufunc, ufunc, method, inputs, kwargs, behavior @@ -215,11 +200,11 @@ def action(inputs, **ignore): x.parameter("__array__") is not None or x.parameter("__record__") is not None for x in inputs - if isinstance(x, ak._v2.contents.Content) + if isinstance(x, ak.contents.Content) ): error_message = [] for x in inputs: - if isinstance(x, ak._v2.contents.Content): + if isinstance(x, ak.contents.Content): if x.parameter("__array__") is not None: error_message.append(x.parameter("__array__")) elif x.parameter("__record__") is not None: @@ -228,7 +213,7 @@ def action(inputs, **ignore): error_message.append(type(x).__name__) else: error_message.append(type(x).__name__) - raise ak._v2._util.error( + raise ak._util.error( TypeError( "no {}.{} overloads for custom types: {}".format( type(ufunc).__module__, ufunc.__name__, ", ".join(error_message) @@ -238,10 +223,10 @@ def action(inputs, **ignore): return None - if sum(int(isinstance(x, ak._v2.contents.Content)) for x in inputs) == 1: + if sum(int(isinstance(x, ak.contents.Content)) for x in inputs) == 1: where = None for i, x in enumerate(inputs): - if isinstance(x, ak._v2.contents.Content): + if isinstance(x, ak.contents.Content): where = i break assert where is not None @@ -262,13 +247,13 @@ def unary_action(layout, **ignore): ) else: - out = ak._v2._broadcasting.broadcast_and_apply( + out = ak._broadcasting.broadcast_and_apply( inputs, action, behavior, allow_records=False, function_name=ufunc.__name__ ) assert isinstance(out, tuple) and len(out) == 1 out = out[0] - return ak._v2._util.wrap(out, behavior) + return ak._util.wrap(out, behavior) # def matmul_for_numba(lefts, rights, dtype): @@ -282,7 +267,7 @@ def unary_action(layout, **ignore): # if first == -1: # first = len(Ai) # elif first != len(Ai): -# raise ak._v2._util.error(ValueError( +# raise ak._util.error(ValueError( # "one of the left matrices in np.matmul is not rectangular" # )) # if first == -1: @@ -295,7 +280,7 @@ def unary_action(layout, **ignore): # if first == -1: # first = len(Bi) # elif first != len(Bi): -# raise ak._v2._util.error(ValueError( +# raise ak._util.error(ValueError( # "one of the right matrices in np.matmul is not rectangular" # )) # if first == -1: @@ -304,7 +289,7 @@ def unary_action(layout, **ignore): # colsB = first # if colsA != rowsB: -# raise ak._v2._util.error(ValueError( +# raise ak._util.error(ValueError( # u"one of the pairs of matrices in np.matmul do not match shape: " # u"(n \u00d7 k) @ (k \u00d7 m)" # )) @@ -351,42 +336,42 @@ def unary_action(layout, **ignore): def action_for_matmul(inputs): - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) # def action_for_matmul(inputs): # inputs = [ -# ak._v2._util.recursively_apply( +# ak._util.recursively_apply( # x, (lambda _: _), pass_depth=False, numpy_to_regular=True # ) -# if isinstance(x, (ak._v2.contents.Content, ak._v2.record.Record)) +# if isinstance(x, (ak.contents.Content, ak.record.Record)) # else x # for x in inputs # ] # if len(inputs) == 2 and all( -# isinstance(x, ak._v2._util.listtypes) -# and isinstance(x.content, ak._v2._util.listtypes) +# isinstance(x, ak._util.listtypes) +# and isinstance(x.content, ak._util.listtypes) # and isinstance(x.content.content, NumpyArray) # for x in inputs # ): -# ak._v2._connect.numba.register_and_check() +# ak._connect.numba.register_and_check() # import numba # if matmul_for_numba.numbafied is None: # matmul_for_numba.numbafied = numba.njit(matmul_for_numba) -# lefts = ak._v2.highlevel.Array(inputs[0]) -# rights = ak._v2.highlevel.Array(inputs[1]) +# lefts = ak.highlevel.Array(inputs[0]) +# rights = ak.highlevel.Array(inputs[1]) # dtype = numpy.asarray(lefts[0:0, 0:0, 0:0] + rights[0:0, 0:0, 0:0]).dtype # outer, inner, content = matmul_for_numba.numbafied(lefts, rights, dtype) # return lambda: ( -# ak._v2.contents.ListOffsetArray64( -# ak._v2.index.Index64(outer), -# ak._v2.contents.ListOffsetArray64( -# ak._v2.index.Index64(inner), +# ak.contents.ListOffsetArray64( +# ak.index.Index64(outer), +# ak.contents.ListOffsetArray64( +# ak.index.Index64(inner), # NumpyArray(content), # ), # ), diff --git a/src/awkward/_v2/_connect/pyarrow.py b/src/awkward/_connect/pyarrow.py similarity index 87% rename from src/awkward/_v2/_connect/pyarrow.py rename to src/awkward/_connect/pyarrow.py index 585e6bac52..8f5a806c19 100644 --- a/src/awkward/_v2/_connect/pyarrow.py +++ b/src/awkward/_connect/pyarrow.py @@ -26,9 +26,7 @@ """ else: - if ak._v2._util.parse_version(pyarrow.__version__) < ak._v2._util.parse_version( - "7.0.0" - ): + if ak._util.parse_version(pyarrow.__version__) < ak._util.parse_version("7.0.0"): pyarrow = None error_message = "pyarrow 7.0.0 or later required for {0}" @@ -198,7 +196,7 @@ def num_fields(self): pyarrow.duration("ns"): (False, np.dtype("m8[ns]")), } -if not ak._v2._util.numpy_at_least("1.17.0"): +if not ak._util.numpy_at_least("1.17.0"): def packbits(bytearray, lsb_order=True): if lsb_order: @@ -299,18 +297,16 @@ def popbuffers_finalize( assert validbits is None or numpy.all( numpy.frombuffer(validbits, np.uint8)[: len(out) // 8] == 0xFF ) - return ak._v2.contents.UnmaskedArray( + return ak.contents.UnmaskedArray( out, parameters=awkwardarrow_type.mask_parameters ) else: if validbits is None: if generate_bitmasks: - return ak._v2.contents.BitMaskedArray( + return ak.contents.BitMaskedArray( # ceildiv(len(out), 8) = -(len(out) // -8) - ak._v2.index.IndexU8( - numpy.full(-(len(out) // -8), np.uint8(0xFF)) - ), + ak.index.IndexU8(numpy.full(-(len(out) // -8), np.uint8(0xFF))), out, valid_when=True, length=len(out), @@ -318,12 +314,12 @@ def popbuffers_finalize( parameters=awkwardarrow_type.mask_parameters, ) else: - return ak._v2.contents.UnmaskedArray( + return ak.contents.UnmaskedArray( out, parameters=awkwardarrow_type.mask_parameters ) else: - return ak._v2.contents.BitMaskedArray( - ak._v2.index.IndexU8(numpy.frombuffer(validbits, dtype=np.uint8)), + return ak.contents.BitMaskedArray( + ak.index.IndexU8(numpy.frombuffer(validbits, dtype=np.uint8)), out, valid_when=True, length=len(out), @@ -337,10 +333,10 @@ def popbuffers_finalize( validbits = numpy.full(-(len(out) // -8), np.uint8(0xFF)) if validbits is None: - return ak._v2.contents.UnmaskedArray(out) + return ak.contents.UnmaskedArray(out) else: - return ak._v2.contents.BitMaskedArray( - ak._v2.index.IndexU8(numpy.frombuffer(validbits, dtype=np.uint8)), + return ak.contents.BitMaskedArray( + ak.index.IndexU8(numpy.frombuffer(validbits, dtype=np.uint8)), out, valid_when=True, length=len(out), @@ -353,12 +349,10 @@ def form_popbuffers_finalize(out, awkwardarrow_type): isinstance(awkwardarrow_type, AwkwardArrowType) and awkwardarrow_type.mask_type == "UnmaskedArray" ): - return ak._v2.forms.UnmaskedForm( - out, parameters=awkwardarrow_type.mask_parameters - ) + return ak.forms.UnmaskedForm(out, parameters=awkwardarrow_type.mask_parameters) else: - return ak._v2.forms.BitMaskedForm( + return ak.forms.BitMaskedForm( "u8", out, valid_when=True, @@ -375,7 +369,7 @@ def popbuffers(paarray, awkwardarrow_type, storage_type, buffers, generate_bitma ### Beginning of the big if-elif-elif chain! if isinstance(storage_type, pyarrow.lib.PyExtensionType): - raise ak._v2._util.error( + raise ak._util.error( ValueError( "Arrow arrays containing pickled Python objects can't be converted into Awkward Arrays" ) @@ -403,7 +397,7 @@ def popbuffers(paarray, awkwardarrow_type, storage_type, buffers, generate_bitma ) index = masked_index.content.data - if not isinstance(masked_index, ak._v2.contents.UnmaskedArray): + if not isinstance(masked_index, ak.contents.UnmaskedArray): mask = masked_index.mask_as_bool(valid_when=False) if mask.any(): index = numpy.array(index, copy=True) @@ -411,14 +405,14 @@ def popbuffers(paarray, awkwardarrow_type, storage_type, buffers, generate_bitma content = handle_arrow(paarray.dictionary, generate_bitmasks) - parameters = ak._v2._util.merge_parameters( + parameters = ak._util.merge_parameters( mask_parameters(awkwardarrow_type), node_parameters(awkwardarrow_type) ) if parameters is None: parameters = {"__array__": "categorical"} - return ak._v2.contents.IndexedOptionArray( - ak._v2.index.Index(index), + return ak.contents.IndexedOptionArray( + ak.index.Index(index), content, parameters=parameters, ).simplify_optiontype() @@ -434,7 +428,7 @@ def popbuffers(paarray, awkwardarrow_type, storage_type, buffers, generate_bitma # strip the dummy option-type node akcontent = remove_optiontype(akcontent) - out = ak._v2.contents.RegularArray( + out = ak.contents.RegularArray( akcontent, storage_type.list_size, parameters=node_parameters(awkwardarrow_type), @@ -449,13 +443,9 @@ def popbuffers(paarray, awkwardarrow_type, storage_type, buffers, generate_bitma paoffsets = buffers.pop(0) if isinstance(storage_type, pyarrow.lib.LargeListType): - akoffsets = ak._v2.index.Index64( - numpy.frombuffer(paoffsets, dtype=np.int64) - ) + akoffsets = ak.index.Index64(numpy.frombuffer(paoffsets, dtype=np.int64)) else: - akoffsets = ak._v2.index.Index32( - numpy.frombuffer(paoffsets, dtype=np.int32) - ) + akoffsets = ak.index.Index32(numpy.frombuffer(paoffsets, dtype=np.int32)) a, b = to_awkwardarrow_storage_types(storage_type.value_type) akcontent = popbuffers(paarray.values, a, b, buffers, generate_bitmasks) @@ -464,7 +454,7 @@ def popbuffers(paarray, awkwardarrow_type, storage_type, buffers, generate_bitma # strip the dummy option-type node akcontent = remove_optiontype(akcontent) - out = ak._v2.contents.ListOffsetArray( + out = ak.contents.ListOffsetArray( akoffsets, akcontent, parameters=node_parameters(awkwardarrow_type) ) return popbuffers_finalize( @@ -474,14 +464,14 @@ def popbuffers(paarray, awkwardarrow_type, storage_type, buffers, generate_bitma elif isinstance(storage_type, pyarrow.lib.MapType): # FIXME: make a ListOffsetArray of 2-tuples with __array__ == "sorted_map". # (Make sure the keys are sorted). - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) elif isinstance( storage_type, (pyarrow.lib.Decimal128Type, pyarrow.lib.Decimal256Type) ): # Note: Decimal128Type and Decimal256Type are subtypes of FixedSizeBinaryType. # NumPy doesn't support decimal: https://github.com/numpy/numpy/issues/9789 - raise ak._v2._util.error( + raise ak._util.error( ValueError( "Arrow arrays containing pickled Python objects can't be converted into Awkward Arrays" ) @@ -497,8 +487,8 @@ def popbuffers(paarray, awkwardarrow_type, storage_type, buffers, generate_bitma parameters = {"__array__": "bytestring"} sub_parameters = {"__array__": "byte"} - out = ak._v2.contents.RegularArray( - ak._v2.contents.NumpyArray( + out = ak.contents.RegularArray( + ak.contents.NumpyArray( numpy.frombuffer(pacontent, dtype=np.uint8), parameters=sub_parameters, nplike=ak.nplike.Numpy.instance(), @@ -517,13 +507,9 @@ def popbuffers(paarray, awkwardarrow_type, storage_type, buffers, generate_bitma pacontent = buffers.pop(0) if storage_type in _string_like[::2]: - akoffsets = ak._v2.index.Index32( - numpy.frombuffer(paoffsets, dtype=np.int32) - ) + akoffsets = ak.index.Index32(numpy.frombuffer(paoffsets, dtype=np.int32)) else: - akoffsets = ak._v2.index.Index64( - numpy.frombuffer(paoffsets, dtype=np.int64) - ) + akoffsets = ak.index.Index64(numpy.frombuffer(paoffsets, dtype=np.int64)) parameters = node_parameters(awkwardarrow_type) @@ -536,9 +522,9 @@ def popbuffers(paarray, awkwardarrow_type, storage_type, buffers, generate_bitma parameters = {"__array__": "bytestring"} sub_parameters = {"__array__": "byte"} - out = ak._v2.contents.ListOffsetArray( + out = ak.contents.ListOffsetArray( akoffsets, - ak._v2.contents.NumpyArray( + ak.contents.NumpyArray( numpy.frombuffer(pacontent, dtype=np.uint8), parameters=sub_parameters, nplike=ak.nplike.Numpy.instance(), @@ -572,7 +558,7 @@ def popbuffers(paarray, awkwardarrow_type, storage_type, buffers, generate_bitma if awkwardarrow_type is not None and awkwardarrow_type.record_is_tuple: keys = None - out = ak._v2.contents.RecordArray( + out = ak.contents.RecordArray( contents, keys, length=len(paarray), @@ -610,9 +596,9 @@ def popbuffers(paarray, awkwardarrow_type, storage_type, buffers, generate_bitma akcontent = remove_optiontype(akcontent) akcontents.append(akcontent) - out = ak._v2.contents.UnionArray( - ak._v2.index.Index8(nptags), - ak._v2.index.Index32(npindex), + out = ak.contents.UnionArray( + ak.index.Index8(nptags), + ak.index.Index32(npindex), akcontents, parameters=node_parameters(awkwardarrow_type), ) @@ -625,9 +611,9 @@ def popbuffers(paarray, awkwardarrow_type, storage_type, buffers, generate_bitma assert storage_type.num_fields == 0 # This is already an option-type and offsets-corrected, so no popbuffers_finalize. - return ak._v2.contents.IndexedOptionArray( - ak._v2.index.Index64(numpy.full(len(paarray), -1, dtype=np.int64)), - ak._v2.contents.EmptyArray(parameters=node_parameters(awkwardarrow_type)), + return ak.contents.IndexedOptionArray( + ak.index.Index64(numpy.full(len(paarray), -1, dtype=np.int64)), + ak.contents.EmptyArray(parameters=node_parameters(awkwardarrow_type)), parameters=mask_parameters(awkwardarrow_type), ) @@ -638,7 +624,7 @@ def popbuffers(paarray, awkwardarrow_type, storage_type, buffers, generate_bitma bytedata = unpackbits(numpy.frombuffer(bitdata, dtype=np.uint8)) - out = ak._v2.contents.NumpyArray( + out = ak.contents.NumpyArray( bytedata.view(np.bool_), parameters=node_parameters(awkwardarrow_type), nplike=ak.nplike.Numpy.instance(), @@ -658,7 +644,7 @@ def popbuffers(paarray, awkwardarrow_type, storage_type, buffers, generate_bitma if dt is None: dt = storage_type.to_pandas_dtype() - out = ak._v2.contents.NumpyArray( + out = ak.contents.NumpyArray( numpy.frombuffer(data, dtype=dt), parameters=node_parameters(awkwardarrow_type), nplike=ak.nplike.Numpy.instance(), @@ -668,7 +654,7 @@ def popbuffers(paarray, awkwardarrow_type, storage_type, buffers, generate_bitma ) else: - raise ak._v2._util.error( + raise ak._util.error( TypeError(f"unrecognized Arrow array type: {storage_type!r}") ) @@ -677,7 +663,7 @@ def form_popbuffers(awkwardarrow_type, storage_type): ### Beginning of the big if-elif-elif chain! if isinstance(storage_type, pyarrow.lib.PyExtensionType): - raise ak._v2._util.error( + raise ak._util.error( ValueError( "Arrow arrays containing pickled Python objects can't be converted into Awkward Arrays" ) @@ -698,20 +684,20 @@ def form_popbuffers(awkwardarrow_type, storage_type): elif index_type is np.int32: index = "i32" else: - raise ak._v2._util.error( + raise ak._util.error( TypeError(f"unrecognized Arrow DictionaryType index type: {index_type}") ) a, b = to_awkwardarrow_storage_types(storage_type.value_type) content = form_popbuffers(a, b) - parameters = ak._v2._util.merge_parameters( + parameters = ak._util.merge_parameters( mask_parameters(awkwardarrow_type), node_parameters(awkwardarrow_type) ) if parameters is None: parameters = {"__array__": "categorical"} - return ak._v2.forms.IndexedOptionForm( + return ak.forms.IndexedOptionForm( index, content, parameters=parameters, @@ -725,7 +711,7 @@ def form_popbuffers(awkwardarrow_type, storage_type): # strip the dummy option-type node akcontent = form_remove_optiontype(akcontent) - out = ak._v2.forms.RegularForm( + out = ak.forms.RegularForm( akcontent, storage_type.list_size, parameters=node_parameters(awkwardarrow_type), @@ -745,20 +731,20 @@ def form_popbuffers(awkwardarrow_type, storage_type): # strip the dummy option-type node akcontent = form_remove_optiontype(akcontent) - out = ak._v2.forms.ListOffsetForm( + out = ak.forms.ListOffsetForm( akoffsets, akcontent, parameters=node_parameters(awkwardarrow_type) ) return form_popbuffers_finalize(out, awkwardarrow_type) elif isinstance(storage_type, pyarrow.lib.MapType): - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) elif isinstance( storage_type, (pyarrow.lib.Decimal128Type, pyarrow.lib.Decimal256Type) ): # Note: Decimal128Type and Decimal256Type are subtypes of FixedSizeBinaryType. # NumPy doesn't support decimal: https://github.com/numpy/numpy/issues/9789 - raise ak._v2._util.error( + raise ak._util.error( ValueError( "Arrow arrays containing pickled Python objects can't be converted into Awkward Arrays" ) @@ -770,8 +756,8 @@ def form_popbuffers(awkwardarrow_type, storage_type): parameters = {"__array__": "bytestring"} sub_parameters = {"__array__": "byte"} - out = ak._v2.forms.RegularForm( - ak._v2.forms.NumpyForm("uint8", parameters=sub_parameters), + out = ak.forms.RegularForm( + ak.forms.NumpyForm("uint8", parameters=sub_parameters), storage_type.byte_width, parameters=parameters, ) @@ -794,9 +780,9 @@ def form_popbuffers(awkwardarrow_type, storage_type): parameters = {"__array__": "bytestring"} sub_parameters = {"__array__": "byte"} - out = ak._v2.forms.ListOffsetForm( + out = ak.forms.ListOffsetForm( akoffsets, - ak._v2.forms.NumpyForm("uint8", parameters=sub_parameters), + ak.forms.NumpyForm("uint8", parameters=sub_parameters), parameters=parameters, ) return form_popbuffers_finalize(out, awkwardarrow_type) @@ -819,7 +805,7 @@ def form_popbuffers(awkwardarrow_type, storage_type): if awkwardarrow_type is not None and awkwardarrow_type.record_is_tuple: keys = None - out = ak._v2.forms.RecordForm( + out = ak.forms.RecordForm( contents, keys, parameters=node_parameters(awkwardarrow_type), @@ -838,16 +824,16 @@ def form_popbuffers(awkwardarrow_type, storage_type): akcontent = form_remove_optiontype(akcontent) akcontents.append(akcontent) - out = ak._v2.forms.UnionForm( + out = ak.forms.UnionForm( "i8", "i32", akcontents, parameters=node_parameters(awkwardarrow_type) ) return form_popbuffers_finalize(out, awkwardarrow_type) elif storage_type == pyarrow.null(): # This is already an option-type, so no form_popbuffers_finalize. - return ak._v2.forms.IndexedOptionForm( + return ak.forms.IndexedOptionForm( "i64", - ak._v2.forms.EmptyForm(parameters=node_parameters(awkwardarrow_type)), + ak.forms.EmptyForm(parameters=node_parameters(awkwardarrow_type)), parameters=mask_parameters(awkwardarrow_type), ) @@ -856,15 +842,15 @@ def form_popbuffers(awkwardarrow_type, storage_type): if dt is None: dt = np.dtype(storage_type.to_pandas_dtype()) - out = ak._v2.forms.NumpyForm( - ak._v2.types.numpytype.dtype_to_primitive(dt), + out = ak.forms.NumpyForm( + ak.types.numpytype.dtype_to_primitive(dt), parameters=node_parameters(awkwardarrow_type), ) return form_popbuffers_finalize(out, awkwardarrow_type) else: - raise ak._v2._util.error( + raise ak._util.error( TypeError(f"unrecognized Arrow array type: {storage_type!r}") ) @@ -875,11 +861,11 @@ def to_awkwardarrow_type( if use_extensionarray: return AwkwardArrowType( storage_type, - ak._v2._util.direct_Content_subclass_name(mask), - ak._v2._util.direct_Content_subclass_name(node), + ak._util.direct_Content_subclass_name(mask), + ak._util.direct_Content_subclass_name(node), None if mask is None else mask.parameters, None if node is None else node.parameters, - node.is_tuple if isinstance(node, ak._v2.contents.RecordArray) else None, + node.is_tuple if isinstance(node, ak.contents.RecordArray) else None, record_is_scalar, ) else: @@ -888,8 +874,8 @@ def to_awkwardarrow_type( def remove_optiontype(akarray): assert type(akarray).is_OptionType - if isinstance(akarray, ak._v2.contents.IndexedOptionArray): - return ak._v2.contents.IndexedArray( + if isinstance(akarray, ak.contents.IndexedOptionArray): + return ak.contents.IndexedArray( akarray.index, akarray.content, akarray.identifier, akarray.parameters ) else: @@ -898,8 +884,8 @@ def remove_optiontype(akarray): def form_remove_optiontype(akform): assert type(akform).is_OptionType - if isinstance(akform, ak._v2.forms.IndexedOptionForm): - return ak._v2.forms.IndexedForm( + if isinstance(akform, ak.forms.IndexedOptionForm): + return ak.forms.IndexedForm( akform.index, akform.content, akform.has_identifier, @@ -928,7 +914,7 @@ def handle_arrow(obj, generate_bitmasks=False, pass_empty_field=False): if len(layouts) == 1: return layouts[0] else: - return ak._v2.operations.concatenate(layouts, highlevel=False) + return ak.operations.concatenate(layouts, highlevel=False) elif isinstance(obj, pyarrow.lib.RecordBatch): if pass_empty_field and list(obj.schema.names) == [""]: @@ -982,7 +968,7 @@ def handle_arrow(obj, generate_bitmasks=False, pass_empty_field=False): else: contents.append(layout) - out = ak._v2.contents.RecordArray( + out = ak.contents.RecordArray( contents, obj.schema.names, length=len(obj), @@ -996,13 +982,11 @@ def handle_arrow(obj, generate_bitmasks=False, pass_empty_field=False): record_mask = numpy.zeros(len(out), dtype=np.bool_) if record_is_optiontype and record_mask is None: - return ak._v2.contents.UnmaskedArray( - out, parameters=optiontype_parameters - ) + return ak.contents.UnmaskedArray(out, parameters=optiontype_parameters) elif record_is_optiontype: - return ak._v2.contents.ByteMaskedArray( - ak._v2.index.Index8(record_mask), + return ak.contents.ByteMaskedArray( + ak.index.Index8(record_mask), out, valid_when=False, parameters=optiontype_parameters, @@ -1015,7 +999,7 @@ def handle_arrow(obj, generate_bitmasks=False, pass_empty_field=False): batches = obj.combine_chunks().to_batches() if len(batches) == 0: # FIXME: create a zero-length array with the right type - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) elif len(batches) == 1: return handle_arrow(batches[0], generate_bitmasks, pass_empty_field) else: @@ -1024,7 +1008,7 @@ def handle_arrow(obj, generate_bitmasks=False, pass_empty_field=False): for batch in batches if len(batch) > 0 ] - return ak._v2.operations.concatenate(arrays, highlevel=False) + return ak.operations.concatenate(arrays, highlevel=False) elif ( isinstance(obj, Iterable) @@ -1041,13 +1025,13 @@ def handle_arrow(obj, generate_bitmasks=False, pass_empty_field=False): if len(chunks) == 1: return chunks[0] else: - return ak._v2.operations.concatenate(chunks, highlevel=False) + return ak.operations.concatenate(chunks, highlevel=False) elif isinstance(obj, Iterable) and len(obj) == 0: - return ak._v2.contents.RecordArray([], [], length=0) + return ak.contents.RecordArray([], [], length=0) else: - raise ak._v2._util.error(TypeError(f"unrecognized Arrow type: {type(obj)}")) + raise ak._util.error(TypeError(f"unrecognized Arrow type: {type(obj)}")) def form_handle_arrow(schema, pass_empty_field=False): @@ -1094,12 +1078,12 @@ def form_handle_arrow(schema, pass_empty_field=False): else: forms.append(akform) - out = ak._v2.forms.RecordForm( + out = ak.forms.RecordForm( forms, list(schema.names), parameters=recordtype_parameters ) if record_is_optiontype: - return ak._v2.forms.ByteMaskedForm( + return ak.forms.ByteMaskedForm( "i8", out, valid_when=False, parameters=optiontype_parameters ) diff --git a/src/awkward/_v2/_connect/numba/__init__.py b/src/awkward/_connect/rdataframe/__init__.py similarity index 100% rename from src/awkward/_v2/_connect/numba/__init__.py rename to src/awkward/_connect/rdataframe/__init__.py diff --git a/src/awkward/_v2/_connect/rdataframe/from_rdataframe.py b/src/awkward/_connect/rdataframe/from_rdataframe.py similarity index 88% rename from src/awkward/_v2/_connect/rdataframe/from_rdataframe.py rename to src/awkward/_connect/rdataframe/from_rdataframe.py index 4bd8a91067..3d82ca9e49 100644 --- a/src/awkward/_v2/_connect/rdataframe/from_rdataframe.py +++ b/src/awkward/_connect/rdataframe/from_rdataframe.py @@ -2,14 +2,14 @@ import awkward as ak -import awkward._v2._lookup # noqa: E402 -import awkward._v2._connect.cling # noqa: E402 +import awkward._lookup # noqa: E402 +import awkward._connect.cling # noqa: E402 import ROOT import cppyy import ctypes import os -from awkward._v2.types.numpytype import primitive_to_dtype +from awkward.types.numpytype import primitive_to_dtype cpp_type_of = { "bool": "bool", @@ -56,9 +56,9 @@ def from_rdataframe(data_frame, columns): def form_dtype(form): - if isinstance(form, ak._v2.forms.NumpyForm) and form.inner_shape == (): + if isinstance(form, ak.forms.NumpyForm) and form.inner_shape == (): return primitive_to_dtype(form.primitive) - elif isinstance(form, ak._v2.forms.ListOffsetForm): + elif isinstance(form, ak.forms.ListOffsetForm): return form_dtype(form.content) def empty_buffers(cpp_buffers_self, names_nbytes): @@ -159,7 +159,7 @@ def cpp_fill_function(depth): else: # Convert the C++ vectors to Awkward arrays form_str = ROOT.awkward.type_to_form[col_type](0) - form = ak._v2.forms.from_json(form_str) + form = ak.forms.from_json(form_str) list_depth = form.purelist_depth form_dtype_name = form_dtype(form).name @@ -169,7 +169,7 @@ def cpp_fill_function(depth): CppBuffers = cppyy.gbl.awkward.CppBuffers[col_type] cpp_buffers_self = CppBuffers(result_ptrs[col]) - if isinstance(form, ak._v2.forms.NumpyForm): + if isinstance(form, ak.forms.NumpyForm): NumpyBuilder = cppyy.gbl.awkward.LayoutBuilder.Numpy[data_type] builder = NumpyBuilder() @@ -183,8 +183,8 @@ def cpp_fill_function(depth): buffers = empty_buffers(cpp_buffers_self, names_nbytes) cpp_buffers_self.to_char_buffers[builder_type](builder) - elif isinstance(form, ak._v2.forms.ListOffsetForm): - if isinstance(form.content, ak._v2.forms.NumpyForm): + elif isinstance(form, ak.forms.ListOffsetForm): + if isinstance(form.content, ak.forms.NumpyForm): # NOTE: list_depth == 2 or 1 if its the list of strings list_depth = 2 @@ -208,22 +208,20 @@ def cpp_fill_function(depth): ) fill_from_func[builder_type, col_type](builder, result_ptrs[col]) else: - raise ak._v2._util.error( - AssertionError(f"unrecognized Form: {type(form)}") - ) + raise ak._util.error(AssertionError(f"unrecognized Form: {type(form)}")) names_nbytes = cpp_buffers_self.names_nbytes[builder_type](builder) buffers = empty_buffers(cpp_buffers_self, names_nbytes) cpp_buffers_self.to_char_buffers[builder_type](builder) - array = ak._v2.from_buffers( + array = ak.from_buffers( form, builder.length(), buffers, ) if col == "awkward_index_": - contents_index = ak._v2.index.Index64( + contents_index = ak.index.Index64( array.layout.to_numpy(allow_missing=True) ) else: @@ -232,15 +230,15 @@ def cpp_fill_function(depth): for col, content in awkward_contents.items(): # wrap Awkward array in IndexedArray only if needed if contents_index is not None and len(contents_index) < len(content): - array = ak._v2._util.wrap( - ak._v2.contents.IndexedArray(contents_index, content), + array = ak._util.wrap( + ak.contents.IndexedArray(contents_index, content), highlevel=True, ) contents[col] = array.layout else: contents[col] = content - return ak._v2._util.wrap( - ak._v2.contents.RecordArray(list(contents.values()), list(contents.keys())), + return ak._util.wrap( + ak.contents.RecordArray(list(contents.values()), list(contents.keys())), highlevel=True, ) diff --git a/src/awkward/_v2/_connect/rdataframe/to_rdataframe.py b/src/awkward/_connect/rdataframe/to_rdataframe.py similarity index 88% rename from src/awkward/_v2/_connect/rdataframe/to_rdataframe.py rename to src/awkward/_connect/rdataframe/to_rdataframe.py index f984ecbb1c..49c4d2672c 100644 --- a/src/awkward/_v2/_connect/rdataframe/to_rdataframe.py +++ b/src/awkward/_connect/rdataframe/to_rdataframe.py @@ -2,8 +2,8 @@ import awkward as ak -import awkward._v2._lookup # noqa: E402 -import awkward._v2._connect.cling # noqa: E402 +import awkward._lookup # noqa: E402 +import awkward._connect.cling # noqa: E402 import ROOT import threading @@ -47,7 +47,7 @@ def class_type(self): for key, value in self.generators.items(): class_type_suffix = class_type_suffix + "_" + key + "_" + value.class_type() - key = ak._v2._util.identifier_hash(class_type_suffix) + key = ak._util.identifier_hash(class_type_suffix) return f"AwkwardArrayDataSource_{key}" @@ -64,24 +64,20 @@ def data_frame(self, layouts): k = 0 for key in layouts: - self.generators[key] = ak._v2._connect.cling.togenerator( + self.generators[key] = ak._connect.cling.togenerator( layouts[key].form, flatlist_as_rvec=self.flatlist_as_rvec ) - self.lookups[key] = ak._v2._lookup.Lookup( - layouts[key], self.generators[key] - ) + self.lookups[key] = ak._lookup.Lookup(layouts[key], self.generators[key]) self.generators[key].generate(ROOT.gInterpreter.Declare) self.entry_types[key] = self.generators[key].entry_type() if self.entry_types[key] == "bool": - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) - if isinstance( - self.generators[key], ak._v2._connect.cling.NumpyArrayGenerator - ): + if isinstance(self.generators[key], ak._connect.cling.NumpyArrayGenerator): pass elif isinstance( - self.generators[key], ak._v2._connect.cling.ListArrayGenerator + self.generators[key], ak._connect.cling.ListArrayGenerator ) and ( self.generators[key].is_string or ( @@ -91,30 +87,30 @@ def data_frame(self, layouts): ): pass elif isinstance( - self.generators[key], ak._v2._connect.cling.RegularArrayGenerator + self.generators[key], ak._connect.cling.RegularArrayGenerator ) and ( self.generators[key].flatlist_as_rvec and self.generators[key].is_flatlist ): pass elif isinstance( - self.generators[key], ak._v2._connect.cling.IndexedOptionArrayGenerator + self.generators[key], ak._connect.cling.IndexedOptionArrayGenerator ): pass elif isinstance( - self.generators[key], ak._v2._connect.cling.IndexedArrayGenerator + self.generators[key], ak._connect.cling.IndexedArrayGenerator ): pass elif isinstance( - self.generators[key], ak._v2._connect.cling.ByteMaskedArrayGenerator + self.generators[key], ak._connect.cling.ByteMaskedArrayGenerator ): pass elif isinstance( - self.generators[key], ak._v2._connect.cling.BitMaskedArrayGenerator + self.generators[key], ak._connect.cling.BitMaskedArrayGenerator ): pass elif isinstance( - self.generators[key], ak._v2._connect.cling.UnmaskedArrayGenerator + self.generators[key], ak._connect.cling.UnmaskedArrayGenerator ): pass else: diff --git a/src/awkward/_io.py b/src/awkward/_io.py deleted file mode 100644 index c93d790a07..0000000000 --- a/src/awkward/_io.py +++ /dev/null @@ -1,14 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -# v2: drop this file, but the from_json functionality must be available somehow. -# (uproot_issue_90 will not be ported; it will be replaced by AwkwardForth.) - -from awkward._ext import fromjson -from awkward._ext import uproot_issue_90 - - -__all__ = ["fromjson", "uproot_issue_90"] - - -def __dir__(): - return __all__ diff --git a/src/awkward/_v2/_lookup.py b/src/awkward/_lookup.py similarity index 86% rename from src/awkward/_v2/_lookup.py rename to src/awkward/_lookup.py index d709d192fd..9e73fdad13 100644 --- a/src/awkward/_v2/_lookup.py +++ b/src/awkward/_lookup.py @@ -25,51 +25,47 @@ def arrayptr(x): def tolookup(layout, positions): - if isinstance(layout, ak._v2.contents.EmptyArray): + if isinstance(layout, ak.contents.EmptyArray): return tolookup(layout.toNumpyArray(np.dtype(np.float64)), positions) - elif isinstance(layout, ak._v2.contents.NumpyArray): + elif isinstance(layout, ak.contents.NumpyArray): if len(layout.shape) == 1: return NumpyLookup.tolookup(layout, positions) else: return tolookup(layout.toRegularArray(), positions) - elif isinstance(layout, ak._v2.contents.RegularArray): + elif isinstance(layout, ak.contents.RegularArray): return RegularLookup.tolookup(layout, positions) - elif isinstance( - layout, (ak._v2.contents.ListArray, ak._v2.contents.ListOffsetArray) - ): + elif isinstance(layout, (ak.contents.ListArray, ak.contents.ListOffsetArray)): return ListLookup.tolookup(layout, positions) - elif isinstance(layout, ak._v2.contents.IndexedArray): + elif isinstance(layout, ak.contents.IndexedArray): return IndexedLookup.tolookup(layout, positions) - elif isinstance(layout, ak._v2.contents.IndexedOptionArray): + elif isinstance(layout, ak.contents.IndexedOptionArray): return IndexedOptionLookup.tolookup(layout, positions) - elif isinstance(layout, ak._v2.contents.ByteMaskedArray): + elif isinstance(layout, ak.contents.ByteMaskedArray): return ByteMaskedLookup.tolookup(layout, positions) - elif isinstance(layout, ak._v2.contents.BitMaskedArray): + elif isinstance(layout, ak.contents.BitMaskedArray): return BitMaskedLookup.tolookup(layout, positions) - elif isinstance(layout, ak._v2.contents.UnmaskedArray): + elif isinstance(layout, ak.contents.UnmaskedArray): return UnmaskedLookup.tolookup(layout, positions) - elif isinstance(layout, ak._v2.contents.RecordArray): + elif isinstance(layout, ak.contents.RecordArray): return RecordLookup.tolookup(layout, positions) - elif isinstance(layout, ak._v2.record.Record): + elif isinstance(layout, ak.record.Record): return RecordLookup.tolookup(layout, positions) - elif isinstance(layout, ak._v2.contents.UnionArray): + elif isinstance(layout, ak.contents.UnionArray): return UnionLookup.tolookup(layout, positions) else: - raise ak._v2._util.error( - AssertionError(f"unrecognized Content: {type(layout)}") - ) + raise ak._util.error(AssertionError(f"unrecognized Content: {type(layout)}")) class ContentLookup: @@ -95,7 +91,7 @@ def tolookup(cls, layout, positions): def tolayout(self, lookup, pos, fields): assert lookup.positions[pos + self.IDENTIFIER] == -1 assert fields == () - return ak._v2.contents.NumpyArray( + return ak.contents.NumpyArray( lookup.positions[pos + self.ARRAY], parameters=self.parameters ) @@ -119,7 +115,7 @@ def tolayout(self, lookup, pos, fields): content = self.contenttype.tolayout( lookup, lookup.positions[pos + self.CONTENT], fields ) - return ak._v2.contents.RegularArray( + return ak.contents.RegularArray( content, self.size, lookup.positions[pos + self.ZEROS_LENGTH], @@ -150,9 +146,7 @@ def tolayout(self, lookup, pos, fields): content = self.contenttype.tolayout( lookup, lookup.positions[pos + self.CONTENT], fields ) - return ak._v2.contents.ListArray( - starts, stops, content, parameters=self.parameters - ) + return ak.contents.ListArray(starts, stops, content, parameters=self.parameters) class IndexedLookup(ContentLookup): @@ -175,7 +169,7 @@ def tolayout(self, lookup, pos, fields): content = self.contenttype.tolayout( lookup, lookup.positions[pos + self.CONTENT], fields ) - return ak._v2.contents.IndexedArray(index, content, parameters=self.parameters) + return ak.contents.IndexedArray(index, content, parameters=self.parameters) class IndexedOptionLookup(ContentLookup): @@ -198,7 +192,7 @@ def tolayout(self, lookup, pos, fields): content = self.contenttype.tolayout( lookup, lookup.positions[pos + self.CONTENT], fields ) - return ak._v2.contents.IndexedOptionArray( + return ak.contents.IndexedOptionArray( index, content, parameters=self.parameters ) @@ -223,7 +217,7 @@ def tolayout(self, lookup, pos, fields): content = self.contenttype.tolayout( lookup, lookup.positions[pos + self.CONTENT], fields ) - return ak._v2.contents.ByteMaskedArray( + return ak.contents.ByteMaskedArray( mask, content, self.valid_when, parameters=self.parameters ) @@ -250,7 +244,7 @@ def tolayout(self, lookup, pos, fields): content = self.contenttype.tolayout( lookup, lookup.positions[pos + self.CONTENT], fields ) - return ak._v2.contents.BitMaskedArray( + return ak.contents.BitMaskedArray( mask, content, self.valid_when, @@ -277,7 +271,7 @@ def tolayout(self, lookup, pos, fields): content = self.contenttype.tolayout( lookup, lookup.positions[pos + self.CONTENT], fields ) - return ak._v2.contents.UnmaskedArray(content, parameters=self.parameters) + return ak.contents.UnmaskedArray(content, parameters=self.parameters) class RecordLookup(ContentLookup): @@ -311,7 +305,7 @@ def tolayout(self, lookup, pos, fields): ) contents.append(layout) - return ak._v2.contents.RecordArray( + return ak.contents.RecordArray( contents, self.fields, lookup.positions[pos + self.LENGTH], @@ -346,6 +340,4 @@ def tolayout(self, lookup, pos, fields): lookup, lookup.positions[pos + self.CONTENTS + i], fields ) contents.append(layout) - return ak._v2.contents.UnionArray( - tags, index, contents, parameters=self.parameters - ) + return ak.contents.UnionArray(tags, index, contents, parameters=self.parameters) diff --git a/src/awkward/_v2/_prettyprint.py b/src/awkward/_prettyprint.py similarity index 82% rename from src/awkward/_v2/_prettyprint.py rename to src/awkward/_prettyprint.py index 69efdd8947..be90072491 100644 --- a/src/awkward/_v2/_prettyprint.py +++ b/src/awkward/_prettyprint.py @@ -34,34 +34,34 @@ def alternate(length): is_identifier = re.compile(r"^[A-Za-z_][A-Za-z_0-9]*$") -# avoid recursion in which ak._v2.Array.__getitem__ calls prettyprint -# to form an error string: private reimplementation of ak._v2.Array.__getitem__ +# avoid recursion in which ak.Array.__getitem__ calls prettyprint +# to form an error string: private reimplementation of ak.Array.__getitem__ def get_at(data, index): out = data._layout._getitem_at(index) - if isinstance(out, ak._v2.contents.NumpyArray): + if isinstance(out, ak.contents.NumpyArray): array_param = out.parameter("__array__") if array_param == "byte": - return ak._v2._util.tobytes(out.raw(numpy)) + return ak._util.tobytes(out.raw(numpy)) elif array_param == "char": - return ak._v2._util.tobytes(out.raw(numpy)).decode(errors="surrogateescape") - if isinstance(out, (ak._v2.contents.Content, ak._v2.record.Record)): - return ak._v2._util.wrap(out, data._behavior) + return ak._util.tobytes(out.raw(numpy)).decode(errors="surrogateescape") + if isinstance(out, (ak.contents.Content, ak.record.Record)): + return ak._util.wrap(out, data._behavior) else: return out def get_field(data, field): out = data._layout._getitem_field(field) - if isinstance(out, ak._v2.contents.NumpyArray): + if isinstance(out, ak.contents.NumpyArray): array_param = out.parameter("__array__") if array_param == "byte": - return ak._v2._util.tobytes(out.raw(numpy)) + return ak._util.tobytes(out.raw(numpy)) elif array_param == "char": - return ak._v2._util.tobytes(out.raw(numpy)).decode(errors="surrogateescape") - if isinstance(out, (ak._v2.contents.Content, ak._v2.record.Record)): - return ak._v2._util.wrap(out, data._behavior) + return ak._util.tobytes(out.raw(numpy)).decode(errors="surrogateescape") + if isinstance(out, (ak.contents.Content, ak.record.Record)): + return ak._util.wrap(out, data._behavior) else: return out @@ -69,7 +69,7 @@ def get_field(data, field): def valuestr_horiz(data, limit_cols): original_limit_cols = limit_cols - if isinstance(data, ak._v2.highlevel.Array): + if isinstance(data, ak.highlevel.Array): front, back = ["["], ["]"] limit_cols -= 2 @@ -90,10 +90,9 @@ def valuestr_horiz(data, limit_cols): cols_taken, strs = valuestr_horiz(current, limit_cols - for_comma) if ( - ak._v2.highlevel.Record in current.__class__.__bases__ - or ak._v2.highlevel.Array in current.__class__.__bases__ - and not type(current).__repr__ - is ak._v2.highlevel.Array.__repr__ + ak.highlevel.Record in current.__class__.__bases__ + or ak.highlevel.Array in current.__class__.__bases__ + and not type(current).__repr__ is ak.highlevel.Array.__repr__ ): strs = type(current).__repr__(current) @@ -109,10 +108,9 @@ def valuestr_horiz(data, limit_cols): cols_taken, strs = valuestr_horiz(current, limit_cols - 2) if ( - ak._v2.highlevel.Record in current.__class__.__bases__ - or ak._v2.highlevel.Array in current.__class__.__bases__ - and not type(current).__repr__ - is ak._v2.highlevel.Array.__repr__ + ak.highlevel.Record in current.__class__.__bases__ + or ak.highlevel.Array in current.__class__.__bases__ + and not type(current).__repr__ is ak.highlevel.Array.__repr__ ): strs = type(current).__repr__(current) @@ -135,7 +133,7 @@ def valuestr_horiz(data, limit_cols): limit_cols += 5 # credit the ", ..." return original_limit_cols - limit_cols, front + back - elif isinstance(data, ak._v2.highlevel.Record): + elif isinstance(data, ak.highlevel.Record): is_tuple = data.layout.is_tuple front = ["("] if is_tuple else ["{"] @@ -211,7 +209,7 @@ def valuestr(data, limit_rows, limit_cols): _, strs = valuestr_horiz(data, limit_cols) return "".join(strs) - elif isinstance(data, ak._v2.highlevel.Array): + elif isinstance(data, ak.highlevel.Array): front, back = [], [] which = 0 for forward, index in alternate(len(data)): @@ -241,7 +239,7 @@ def valuestr(data, limit_rows, limit_cols): return "\n".join(out) - elif isinstance(data, ak._v2.highlevel.Record): + elif isinstance(data, ak.highlevel.Record): is_tuple = data.layout.is_tuple front = [] @@ -287,4 +285,4 @@ def valuestr(data, limit_rows, limit_cols): return "\n".join(out) else: - raise ak._v2._util.error(AssertionError(type(data))) + raise ak._util.error(AssertionError(type(data))) diff --git a/src/awkward/_v2/_reducers.py b/src/awkward/_reducers.py similarity index 91% rename from src/awkward/_v2/_reducers.py rename to src/awkward/_reducers.py index 09e5aa45e6..6358b691f9 100644 --- a/src/awkward/_v2/_reducers.py +++ b/src/awkward/_reducers.py @@ -10,7 +10,7 @@ class Reducer: @classmethod def highlevel_function(cls): - return getattr(ak._v2.operations, cls.name) + return getattr(ak.operations, cls.name) @classmethod def return_dtype(cls, given_dtype): @@ -47,7 +47,7 @@ def return_dtype(cls, given_dtype): @classmethod def apply(cls, array, parents, outlength): - assert isinstance(array, ak._v2.contents.NumpyArray) + assert isinstance(array, ak.contents.NumpyArray) dtype = cls.maybe_other_type(array.dtype) result = array.nplike.empty(outlength, dtype=np.int64) if array.dtype.type in (np.complex128, np.complex64): @@ -82,7 +82,7 @@ def apply(cls, array, parents, outlength): outlength, ) ) - return ak._v2.contents.NumpyArray(result) + return ak.contents.NumpyArray(result) class ArgMax(Reducer): @@ -96,7 +96,7 @@ def return_dtype(cls, given_dtype): @classmethod def apply(cls, array, parents, outlength): - assert isinstance(array, ak._v2.contents.NumpyArray) + assert isinstance(array, ak.contents.NumpyArray) dtype = cls.maybe_other_type(array.dtype) result = array.nplike.empty(outlength, dtype=np.int64) if array.dtype.type in (np.complex128, np.complex64): @@ -131,7 +131,7 @@ def apply(cls, array, parents, outlength): outlength, ) ) - return ak._v2.contents.NumpyArray(result) + return ak.contents.NumpyArray(result) class Count(Reducer): @@ -144,7 +144,7 @@ def return_dtype(cls, given_dtype): @classmethod def apply(cls, array, parents, outlength): - assert isinstance(array, ak._v2.contents.NumpyArray) + assert isinstance(array, ak.contents.NumpyArray) result = array.nplike.empty(outlength, dtype=np.int64) assert parents.nplike is array.nplike array._handle_error( @@ -157,7 +157,7 @@ def apply(cls, array, parents, outlength): outlength, ) ) - return ak._v2.contents.NumpyArray(result) + return ak.contents.NumpyArray(result) class CountNonzero(Reducer): @@ -170,7 +170,7 @@ def return_dtype(cls, given_dtype): @classmethod def apply(cls, array, parents, outlength): - assert isinstance(array, ak._v2.contents.NumpyArray) + assert isinstance(array, ak.contents.NumpyArray) dtype = np.dtype(np.int64) if array.dtype.kind.upper() == "M" else array.dtype result = array.nplike.empty(outlength, dtype=np.int64) if array.dtype.type in (np.complex128, np.complex64): @@ -205,7 +205,7 @@ def apply(cls, array, parents, outlength): outlength, ) ) - return ak._v2.contents.NumpyArray(result) + return ak.contents.NumpyArray(result) class Sum(Reducer): @@ -214,9 +214,9 @@ class Sum(Reducer): @classmethod def apply(cls, array, parents, outlength): - assert isinstance(array, ak._v2.contents.NumpyArray) + assert isinstance(array, ak.contents.NumpyArray) if array.dtype.kind == "M": - raise ak._v2._util.error( + raise ak._util.error( ValueError(f"cannot compute the sum (ak.sum) of {array.dtype!r}") ) else: @@ -261,7 +261,7 @@ def apply(cls, array, parents, outlength): ) ) else: - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) elif array.dtype.type in (np.complex128, np.complex64): assert parents.nplike is array.nplike array._handle_error( @@ -296,11 +296,11 @@ def apply(cls, array, parents, outlength): ) if array.dtype.kind == "m": - return ak._v2.contents.NumpyArray(array.nplike.asarray(result, array.dtype)) + return ak.contents.NumpyArray(array.nplike.asarray(result, array.dtype)) elif array.dtype.type in (np.complex128, np.complex64): - return ak._v2.contents.NumpyArray(result.view(array.dtype)) + return ak.contents.NumpyArray(result.view(array.dtype)) else: - return ak._v2.contents.NumpyArray(result) + return ak.contents.NumpyArray(result) class Prod(Reducer): @@ -309,9 +309,9 @@ class Prod(Reducer): @classmethod def apply(cls, array, parents, outlength): - assert isinstance(array, ak._v2.contents.NumpyArray) + assert isinstance(array, ak.contents.NumpyArray) if array.dtype.kind.upper() == "M": - raise ak._v2._util.error( + raise ak._util.error( ValueError(f"cannot compute the product (ak.prod) of {array.dtype!r}") ) result = array.nplike.empty( @@ -367,9 +367,9 @@ def apply(cls, array, parents, outlength): ) ) if array.dtype.type in (np.complex128, np.complex64): - return ak._v2.contents.NumpyArray(result.view(array.dtype)) + return ak.contents.NumpyArray(result.view(array.dtype)) else: - return ak._v2.contents.NumpyArray(result) + return ak.contents.NumpyArray(result) class Any(Reducer): @@ -382,7 +382,7 @@ def return_dtype(cls, given_dtype): @classmethod def apply(cls, array, parents, outlength): - assert isinstance(array, ak._v2.contents.NumpyArray) + assert isinstance(array, ak.contents.NumpyArray) dtype = cls.maybe_other_type(array.dtype) result = array.nplike.empty(outlength, dtype=np.bool_) if array.dtype.type in (np.complex128, np.complex64): @@ -417,7 +417,7 @@ def apply(cls, array, parents, outlength): outlength, ) ) - return ak._v2.contents.NumpyArray(result) + return ak.contents.NumpyArray(result) class All(Reducer): @@ -430,7 +430,7 @@ def return_dtype(cls, given_dtype): @classmethod def apply(cls, array, parents, outlength): - assert isinstance(array, ak._v2.contents.NumpyArray) + assert isinstance(array, ak.contents.NumpyArray) dtype = cls.maybe_other_type(array.dtype) result = array.nplike.empty(outlength, dtype=np.bool_) if array.dtype.type in (np.complex128, np.complex64): @@ -465,7 +465,7 @@ def apply(cls, array, parents, outlength): outlength, ) ) - return ak._v2.contents.NumpyArray(result) + return ak.contents.NumpyArray(result) class Min(Reducer): @@ -500,7 +500,7 @@ def _min_initial(initial, type): @classmethod def apply(cls, array, parents, outlength): - assert isinstance(array, ak._v2.contents.NumpyArray) + assert isinstance(array, ak.contents.NumpyArray) dtype = cls.maybe_other_type(array.dtype) result = array.nplike.empty( cls.maybe_double_length(array.dtype.type, outlength), dtype=dtype @@ -556,11 +556,11 @@ def apply(cls, array, parents, outlength): ) ) if array.dtype.type in (np.complex128, np.complex64): - return ak._v2.contents.NumpyArray( + return ak.contents.NumpyArray( array.nplike.array(result.view(array.dtype), array.dtype) ) else: - return ak._v2.contents.NumpyArray(array.nplike.array(result, array.dtype)) + return ak.contents.NumpyArray(array.nplike.array(result, array.dtype)) class Max(Reducer): @@ -595,7 +595,7 @@ def _max_initial(initial, type): @classmethod def apply(cls, array, parents, outlength): - assert isinstance(array, ak._v2.contents.NumpyArray) + assert isinstance(array, ak.contents.NumpyArray) dtype = cls.maybe_other_type(array.dtype) result = array.nplike.empty( cls.maybe_double_length(array.dtype.type, outlength), dtype=dtype @@ -651,8 +651,8 @@ def apply(cls, array, parents, outlength): ) ) if array.dtype.type in (np.complex128, np.complex64): - return ak._v2.contents.NumpyArray( + return ak.contents.NumpyArray( array.nplike.array(result.view(array.dtype), array.dtype) ) else: - return ak._v2.contents.NumpyArray(array.nplike.array(result, array.dtype)) + return ak.contents.NumpyArray(array.nplike.array(result, array.dtype)) diff --git a/src/awkward/_v2/_slicing.py b/src/awkward/_slicing.py similarity index 73% rename from src/awkward/_v2/_slicing.py rename to src/awkward/_slicing.py index 357aab2217..c12b828ff4 100644 --- a/src/awkward/_v2/_slicing.py +++ b/src/awkward/_slicing.py @@ -1,7 +1,6 @@ # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE import awkward as ak -from awkward._v2.tmp_for_testing import v1_to_v2 np = ak.nplike.NumpyMetadata.instance() @@ -29,7 +28,7 @@ def prepare_advanced_indexing(items): broadcastable = [] n_awkward_contents = 0 for item in items: - if isinstance(item, ak._v2.contents.Content): + if isinstance(item, ak.contents.Content): n_awkward_contents += 1 if ( isinstance( @@ -37,8 +36,8 @@ def prepare_advanced_indexing(items): ( slice, list, # of strings - ak._v2.contents.ListOffsetArray, - ak._v2.contents.IndexedOptionArray, + ak.contents.ListOffsetArray, + ak.contents.IndexedOptionArray, ), ) or ak._util.isstr(item) @@ -53,7 +52,7 @@ def prepare_advanced_indexing(items): # Now ensure that we don't have mixed Awkward-NumPy style indexing if n_awkward_contents > 1 or (n_awkward_contents == 1 and len(broadcastable) != 0): - raise ak._v2._util.error( + raise ak._util.error( ValueError( "cannot mix Awkward slicing (using an array with missing or variable-length lists in the slice) with " "NumPy advanced slicing (using more than one broadcastable array or integer in the slice), " @@ -77,21 +76,21 @@ def prepare_advanced_indexing(items): if len(x.shape) == 0: prepared.append(int(x)) elif issubclass(x.dtype.type, np.int64): - prepared.append(ak._v2.index.Index64(x.reshape(-1))) + prepared.append(ak.index.Index64(x.reshape(-1))) prepared[-1].metadata["shape"] = x.shape elif issubclass(x.dtype.type, np.integer): - prepared.append(ak._v2.index.Index64(x.astype(np.int64).reshape(-1))) + prepared.append(ak.index.Index64(x.astype(np.int64).reshape(-1))) prepared[-1].metadata["shape"] = x.shape elif issubclass(x.dtype.type, (np.bool_, bool)): if len(x.shape) == 1: - current = ak._v2.index.Index64(nplike.nonzero(x)[0]) + current = ak.index.Index64(nplike.nonzero(x)[0]) prepared.append(current) prepared[-1].metadata["shape"] = current.data.shape else: for w in nplike.nonzero(x): - prepared.append(ak._v2.index.Index64(w)) + prepared.append(ak.index.Index64(w)) else: - raise ak._v2._util.error( + raise ak._util.error( TypeError( "array slice must be an array of integers or booleans, not\n\n {}".format( repr(x).replace("\n", "\n ") @@ -108,7 +107,7 @@ def prepare_advanced_indexing(items): it = iter(prepared) # Find an array for item in it: - if isinstance(item, ak._v2.index.Index): + if isinstance(item, ak.index.Index): break # Then find a separator for item in it: @@ -116,8 +115,8 @@ def prepare_advanced_indexing(items): break # Now error if we find another array for item in it: - if isinstance(item, ak._v2.index.Index): - raise ak._v2._util.error( + if isinstance(item, ak.index.Index): + raise ak._util.error( ValueError( "NumPy advanced indexing with array indices separated by None " "(np.newaxis), Ellipsis, or slice are not permitted with Awkward Arrays" @@ -145,21 +144,18 @@ def normalise_item(item, nplike): elif isinstance(item, ak.highlevel.Array): return normalise_item(item.layout, nplike) - elif isinstance(item, ak.layout.Content): - return normalise_item(v1_to_v2(item), nplike) - - elif isinstance(item, ak._v2.highlevel.Array): + elif isinstance(item, ak.highlevel.Array): return normalise_item(item.layout, nplike) - elif isinstance(item, ak._v2.contents.EmptyArray): + elif isinstance(item, ak.contents.EmptyArray): return normalise_item(item.toNumpyArray(np.int64), nplike) - elif isinstance(item, ak._v2.contents.NumpyArray): + elif isinstance(item, ak.contents.NumpyArray): return item.data - elif isinstance(item, ak._v2.contents.Content): + elif isinstance(item, ak.contents.Content): out = normalise_item_bool_to_int(normalise_item_nested(item)) - if isinstance(out, ak._v2.contents.NumpyArray): + if isinstance(out, ak.contents.NumpyArray): return out.data else: return out @@ -171,7 +167,7 @@ def normalise_item(item, nplike): return list(item) elif ak._util.is_sized_iterable(item): - layout = ak._v2.operations.to_layout(item) + layout = ak.operations.to_layout(item) as_array = layout.maybe_to_array(layout.nplike) if as_array is None: return normalise_item(layout, nplike) @@ -179,7 +175,7 @@ def normalise_item(item, nplike): return as_array else: - raise ak._v2._util.error( + raise ak._util.error( TypeError( "only integers, slices (`:`), ellipsis (`...`), np.newaxis (`None`), " "integer/boolean arrays (possibly with variable-length nested " @@ -196,35 +192,35 @@ def normalise_items(where, nplike): def normalise_item_RegularArray_toListOffsetArray64(item): - if isinstance(item, ak._v2.contents.RegularArray): + if isinstance(item, ak.contents.RegularArray): next = item.toListOffsetArray64() - return ak._v2.contents.ListOffsetArray( + return ak.contents.ListOffsetArray( next.offsets, normalise_item_RegularArray_toListOffsetArray64(next.content), identifier=item.identifier, parameters=item.parameters, ) - elif isinstance(item, ak._v2.contents.NumpyArray): + elif isinstance(item, ak.contents.NumpyArray): return item else: - raise ak._v2._util.error(AssertionError(type(item))) + raise ak._util.error(AssertionError(type(item))) def normalise_item_nested(item): - if isinstance(item, ak._v2.contents.EmptyArray): + if isinstance(item, ak.contents.EmptyArray): # policy: unknown -> int return normalise_item_nested(item.toNumpyArray(np.int64)) - elif isinstance(item, ak._v2.contents.NumpyArray) and issubclass( + elif isinstance(item, ak.contents.NumpyArray) and issubclass( item.dtype.type, (bool, np.bool_, np.integer) ): if issubclass(item.dtype.type, (bool, np.bool_, np.int64)): next = item else: - next = ak._v2.contents.NumpyArray( + next = ak.contents.NumpyArray( item.data.astype(np.int64), identifier=item.identifier, parameters=item.parameters, @@ -236,9 +232,9 @@ def normalise_item_nested(item): elif isinstance( item, - ak._v2.contents.ListOffsetArray, + ak.contents.ListOffsetArray, ) and issubclass(item.offsets.dtype.type, np.int64): - return ak._v2.contents.ListOffsetArray( + return ak.contents.ListOffsetArray( item.offsets, normalise_item_nested(item.content), identifier=item.identifier, @@ -248,9 +244,9 @@ def normalise_item_nested(item): elif isinstance( item, ( - ak._v2.contents.ListOffsetArray, - ak._v2.contents.ListArray, - ak._v2.contents.RegularArray, + ak.contents.ListOffsetArray, + ak.contents.ListArray, + ak.contents.RegularArray, ), ): next = item.toListOffsetArray64(False) @@ -259,20 +255,20 @@ def normalise_item_nested(item): elif isinstance( item, ( - ak._v2.contents.IndexedArray, - ak._v2.contents.IndexedOptionArray, - ak._v2.contents.ByteMaskedArray, - ak._v2.contents.BitMaskedArray, - ak._v2.contents.UnmaskedArray, + ak.contents.IndexedArray, + ak.contents.IndexedOptionArray, + ak.contents.ByteMaskedArray, + ak.contents.BitMaskedArray, + ak.contents.UnmaskedArray, ), ) and isinstance( item.content, ( - ak._v2.contents.IndexedArray, - ak._v2.contents.IndexedOptionArray, - ak._v2.contents.ByteMaskedArray, - ak._v2.contents.BitMaskedArray, - ak._v2.contents.UnmaskedArray, + ak.contents.IndexedArray, + ak.contents.IndexedOptionArray, + ak.contents.ByteMaskedArray, + ak.contents.BitMaskedArray, + ak.contents.UnmaskedArray, ), ): next = item.simplify_optiontype() @@ -280,25 +276,25 @@ def normalise_item_nested(item): elif isinstance( item, - ak._v2.contents.IndexedArray, + ak.contents.IndexedArray, ): next = item.project() return normalise_item_nested(next) elif isinstance( item, - ak._v2.contents.IndexedOptionArray, + ak.contents.IndexedOptionArray, ): nextindex = item.index.data.astype(np.int64) # this ALWAYS copies nonnull = nextindex >= 0 - projected = item.content._carry(ak._v2.index.Index64(nextindex[nonnull]), False) + projected = item.content._carry(ak.index.Index64(nextindex[nonnull]), False) # content has been projected; index must agree nextindex[nonnull] = item.nplike.arange(projected.length, dtype=np.int64) - return ak._v2.contents.IndexedOptionArray( - ak._v2.index.Index64(nextindex, nplike=item.nplike), + return ak.contents.IndexedOptionArray( + ak.index.Index64(nextindex, nplike=item.nplike), normalise_item_nested(projected), identifier=item.identifier, parameters=item.parameters, @@ -307,16 +303,16 @@ def normalise_item_nested(item): elif isinstance( item, ( - ak._v2.contents.ByteMaskedArray, - ak._v2.contents.BitMaskedArray, - ak._v2.contents.UnmaskedArray, + ak.contents.ByteMaskedArray, + ak.contents.BitMaskedArray, + ak.contents.UnmaskedArray, ), ): is_valid = item.mask_as_bool(valid_when=True) positions_where_valid = item.nplike.index_nplike.nonzero(is_valid)[0] nextcontent = normalise_item_nested( - item.content._carry(ak._v2.index.Index64(positions_where_valid), False) + item.content._carry(ak.index.Index64(positions_where_valid), False) ) nextindex = item.nplike.index_nplike.full(is_valid.shape[0], -1, np.int64) @@ -324,17 +320,17 @@ def normalise_item_nested(item): positions_where_valid.shape[0], dtype=np.int64 ) - return ak._v2.contents.IndexedOptionArray( - ak._v2.index.Index64(nextindex, nplike=item.nplike), + return ak.contents.IndexedOptionArray( + ak.index.Index64(nextindex, nplike=item.nplike), nextcontent, identifier=item.identifier, parameters=item.parameters, ) - elif isinstance(item, ak._v2.contents.UnionArray): + elif isinstance(item, ak.contents.UnionArray): attempt = item.simplify_uniontype() - if isinstance(attempt, ak._v2.contents.UnionArray): - raise ak._v2._util.error( + if isinstance(attempt, ak.contents.UnionArray): + raise ak._util.error( TypeError( "irreducible unions (different types at the same level in an array) can't be used as slices" ) @@ -342,11 +338,11 @@ def normalise_item_nested(item): return normalise_item_nested(attempt) - elif isinstance(item, ak._v2.contents.RecordArray): - raise ak._v2._util.error(TypeError("record arrays can't be used as slices")) + elif isinstance(item, ak.contents.RecordArray): + raise ak._util.error(TypeError("record arrays can't be used as slices")) else: - raise ak._v2._util.error( + raise ak._util.error( TypeError( "only integers, slices (`:`), ellipsis (`...`), np.newaxis (`None`), " "integer/boolean arrays (possibly with variable-length nested " @@ -360,8 +356,8 @@ def normalise_item_nested(item): def normalise_item_bool_to_int(item): # actually convert leaf-node booleans to integers if ( - isinstance(item, ak._v2.contents.ListOffsetArray) - and isinstance(item.content, ak._v2.contents.NumpyArray) + isinstance(item, ak.contents.ListOffsetArray) + and isinstance(item.content, ak.contents.NumpyArray) and issubclass(item.content.dtype.type, (bool, np.bool_)) ): if item.nplike.known_data or item.nplike.known_shape: @@ -380,23 +376,23 @@ def normalise_item_bool_to_int(item): else: nextoffsets = item.offsets nextcontent = item.nplike.empty( - (ak._v2._typetracer.UnknownLength,), dtype=np.int64 + (ak._typetracer.UnknownLength,), dtype=np.int64 ) - return ak._v2.contents.ListOffsetArray( - ak._v2.index.Index64(nextoffsets), - ak._v2.contents.NumpyArray(nextcontent, nplike=item.nplike), + return ak.contents.ListOffsetArray( + ak.index.Index64(nextoffsets), + ak.contents.NumpyArray(nextcontent, nplike=item.nplike), ) elif ( - isinstance(item, ak._v2.contents.ListOffsetArray) - and isinstance(item.content, ak._v2.contents.IndexedOptionArray) - and isinstance(item.content.content, ak._v2.contents.NumpyArray) + isinstance(item, ak.contents.ListOffsetArray) + and isinstance(item.content, ak.contents.IndexedOptionArray) + and isinstance(item.content.content, ak.contents.NumpyArray) and issubclass(item.content.content.dtype.type, (bool, np.bool_)) ): if item.nplike.known_data or item.nplike.known_shape: if isinstance(item.nplike, ak.nplike.Jax): - raise ak._v2._util.error( + raise ak._util.error( "This slice is not supported for JAX differentiation." ) # missing values as any integer other than -1 are extremely rare @@ -438,34 +434,34 @@ def normalise_item_bool_to_int(item): nextoffsets = item.offsets outindex = item.content.index nextcontent = item.nplike.empty( - (ak._v2._typetracer.UnknownLength,), dtype=np.int64 + (ak._typetracer.UnknownLength,), dtype=np.int64 ) - return ak._v2.contents.ListOffsetArray( - ak._v2.index.Index64(nextoffsets, nplike=item.nplike), - ak._v2.contents.IndexedOptionArray( - ak._v2.index.Index(outindex, nplike=item.nplike), - ak._v2.contents.NumpyArray(nextcontent, nplike=item.nplike), + return ak.contents.ListOffsetArray( + ak.index.Index64(nextoffsets, nplike=item.nplike), + ak.contents.IndexedOptionArray( + ak.index.Index(outindex, nplike=item.nplike), + ak.contents.NumpyArray(nextcontent, nplike=item.nplike), ), ) - elif isinstance(item, ak._v2.contents.ListOffsetArray): - return ak._v2.contents.ListOffsetArray( + elif isinstance(item, ak.contents.ListOffsetArray): + return ak.contents.ListOffsetArray( item.offsets, normalise_item_bool_to_int(item.content) ) - elif isinstance(item, ak._v2.contents.IndexedOptionArray): - if isinstance(item.content, ak._v2.contents.ListOffsetArray): - return ak._v2.contents.IndexedOptionArray( + elif isinstance(item, ak.contents.IndexedOptionArray): + if isinstance(item.content, ak.contents.ListOffsetArray): + return ak.contents.IndexedOptionArray( item.index, normalise_item_bool_to_int(item.content) ) - if isinstance(item.content, ak._v2.contents.NumpyArray) and issubclass( + if isinstance(item.content, ak.contents.NumpyArray) and issubclass( item.content.dtype.type, (bool, np.bool_) ): if item.nplike.known_data or item.nplike.known_shape: if isinstance(item.nplike, ak.nplike.Jax): - raise ak._v2._util.error( + raise ak._util.error( "This slice is not supported for JAX differentiation." ) # missing values as any integer other than -1 are extremely rare @@ -499,32 +495,32 @@ def normalise_item_bool_to_int(item): else: outindex = item.index nextcontent = item.nplike.empty( - (ak._v2._typetracer.UnknownLength,), dtype=np.int64 + (ak._typetracer.UnknownLength,), dtype=np.int64 ) - return ak._v2.contents.IndexedOptionArray( - ak._v2.index.Index(outindex, nplike=item.nplike), - ak._v2.contents.NumpyArray(nextcontent, nplike=item.nplike), + return ak.contents.IndexedOptionArray( + ak.index.Index(outindex, nplike=item.nplike), + ak.contents.NumpyArray(nextcontent, nplike=item.nplike), ) else: - return ak._v2.contents.IndexedOptionArray( + return ak.contents.IndexedOptionArray( item.index, normalise_item_bool_to_int(item.content) ) - elif isinstance(item, ak._v2.contents.NumpyArray): + elif isinstance(item, ak.contents.NumpyArray): assert item.data.shape == (item.length,) return item else: - raise ak._v2._util.error(AssertionError(type(item))) + raise ak._util.error(AssertionError(type(item))) def getitem_next_array_wrap(outcontent, shape, outer_length=0): for i in range(len(shape))[::-1]: length = shape[i - 1] if i > 0 else outer_length size = shape[i] - if isinstance(size, ak._v2._typetracer.UnknownLengthType): + if isinstance(size, ak._typetracer.UnknownLengthType): size = 1 - outcontent = ak._v2.contents.RegularArray(outcontent, size, length, None, None) + outcontent = ak.contents.RegularArray(outcontent, size, length, None, None) return outcontent diff --git a/src/awkward/_typeparser/__init__.py b/src/awkward/_typeparser/__init__.py deleted file mode 100644 index f984e6f07c..0000000000 --- a/src/awkward/_typeparser/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -# v2: no change; keep this file. diff --git a/src/awkward/_typeparser/generated_parser.py b/src/awkward/_typeparser/generated_parser.py deleted file mode 100644 index 3c8b888385..0000000000 --- a/src/awkward/_typeparser/generated_parser.py +++ /dev/null @@ -1,2567 +0,0 @@ -# The file was automatically generated by Lark v0.11.1 -__version__ = "0.11.1" - -# -# -# Lark Stand-alone Generator Tool -# ---------------------------------- -# Generates a stand-alone LALR(1) parser with a standard lexer -# -# Git: https://github.com/erezsh/lark -# Author: Erez Shinan (erezshin@gmail.com) -# -# -# >>> LICENSE -# -# This tool and its generated code use a separate license from Lark, -# and are subject to the terms of the Mozilla Public License, v. 2.0. -# If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. -# -# If you wish to purchase a commercial license for this tool and its -# generated code, you may contact me via email or otherwise. -# -# If MPL2 is incompatible with your free or open-source project, -# contact me and we'll work it out. -# -# - -from io import open - - - -class LarkError(Exception): - pass - - -class GrammarError(LarkError): - pass - - -class ParseError(LarkError): - pass - - -class LexError(LarkError): - pass - - -class UnexpectedEOF(ParseError): - def __init__(self, expected): - self.expected = expected - - message = ("Unexpected end-of-input. Expected one of: \n\t* %s\n" % '\n\t* '.join(x.name for x in self.expected)) - super(UnexpectedEOF, self).__init__(message) - - -class UnexpectedInput(LarkError): - #-- - pos_in_stream = None - - def get_context(self, text, span=40): - #-- - pos = self.pos_in_stream - start = max(pos - span, 0) - end = pos + span - if not isinstance(text, bytes): - before = text[start:pos].rsplit('\n', 1)[-1] - after = text[pos:end].split('\n', 1)[0] - return before + after + '\n' + ' ' * len(before.expandtabs()) + '^\n' - else: - before = text[start:pos].rsplit(b'\n', 1)[-1] - after = text[pos:end].split(b'\n', 1)[0] - return (before + after + b'\n' + b' ' * len(before.expandtabs()) + b'^\n').decode("ascii", "backslashreplace") - - def match_examples(self, parse_fn, examples, token_type_match_fallback=False, use_accepts=False): - #-- - assert self.state is not None, "Not supported for this exception" - - if isinstance(examples, dict): - examples = examples.items() - - candidate = (None, False) - for i, (label, example) in enumerate(examples): - assert not isinstance(example, STRING_TYPE) - - for j, malformed in enumerate(example): - try: - parse_fn(malformed) - except UnexpectedInput as ut: - if ut.state == self.state: - if use_accepts and ut.accepts != self.accepts: - logger.debug("Different accepts with same state[%d]: %s != %s at example [%s][%s]" % - (self.state, self.accepts, ut.accepts, i, j)) - continue - try: - if ut.token == self.token: ## - - logger.debug("Exact Match at example [%s][%s]" % (i, j)) - return label - - if token_type_match_fallback: - ## - - if (ut.token.type == self.token.type) and not candidate[-1]: - logger.debug("Token Type Fallback at example [%s][%s]" % (i, j)) - candidate = label, True - - except AttributeError: - pass - if not candidate[0]: - logger.debug("Same State match at example [%s][%s]" % (i, j)) - candidate = label, False - - return candidate[0] - - -class UnexpectedCharacters(LexError, UnexpectedInput): - def __init__(self, seq, lex_pos, line, column, allowed=None, considered_tokens=None, state=None, token_history=None): - self.line = line - self.column = column - self.pos_in_stream = lex_pos - self.state = state - - self.allowed = allowed - self.considered_tokens = considered_tokens - - if isinstance(seq, bytes): - _s = seq[lex_pos:lex_pos+1].decode("ascii", "backslashreplace") - else: - _s = seq[lex_pos] - - message = "No terminal defined for %r at line %d col %d" % (_s, line, column) - message += '\n\n' + self.get_context(seq) - if allowed: - message += '\nExpecting: %s\n' % allowed - if token_history: - message += '\nPrevious tokens: %s\n' % ', '.join(repr(t) for t in token_history) - - super(UnexpectedCharacters, self).__init__(message) - - -class UnexpectedToken(ParseError, UnexpectedInput): - #-- - def __init__(self, token, expected, considered_rules=None, state=None, puppet=None): - self.line = getattr(token, 'line', '?') - self.column = getattr(token, 'column', '?') - self.pos_in_stream = getattr(token, 'pos_in_stream', None) - self.state = state - - self.token = token - self.expected = expected ## - - self.considered_rules = considered_rules - self.puppet = puppet - - ## - - ## - - self.accepts = puppet and puppet.accepts() - - message = ("Unexpected token %r at line %s, column %s.\n" - "Expected one of: \n\t* %s\n" - % (token, self.line, self.column, '\n\t* '.join(self.accepts or self.expected))) - - super(UnexpectedToken, self).__init__(message) - - -class VisitError(LarkError): - #-- - def __init__(self, rule, obj, orig_exc): - self.obj = obj - self.orig_exc = orig_exc - - message = 'Error trying to process rule "%s":\n\n%s' % (rule, orig_exc) - super(VisitError, self).__init__(message) - -import sys, re -import logging -logger = logging.getLogger("lark") -logger.addHandler(logging.StreamHandler()) -## - -logger.setLevel(logging.CRITICAL) - - -def classify(seq, key=None, value=None): - d = {} - for item in seq: - k = key(item) if (key is not None) else item - v = value(item) if (value is not None) else item - if k in d: - d[k].append(v) - else: - d[k] = [v] - return d - - -def _deserialize(data, namespace, memo): - if isinstance(data, dict): - if '__type__' in data: ## - - class_ = namespace[data['__type__']] - return class_.deserialize(data, memo) - elif '@' in data: - return memo[data['@']] - return {key:_deserialize(value, namespace, memo) for key, value in data.items()} - elif isinstance(data, list): - return [_deserialize(value, namespace, memo) for value in data] - return data - - -class Serialize(object): - #-- - - def memo_serialize(self, types_to_memoize): - memo = SerializeMemoizer(types_to_memoize) - return self.serialize(memo), memo.serialize() - - def serialize(self, memo=None): - if memo and memo.in_types(self): - return {'@': memo.memoized.get(self)} - - fields = getattr(self, '__serialize_fields__') - res = {f: _serialize(getattr(self, f), memo) for f in fields} - res['__type__'] = type(self).__name__ - postprocess = getattr(self, '_serialize', None) - if postprocess: - postprocess(res, memo) - return res - - @classmethod - def deserialize(cls, data, memo): - namespace = getattr(cls, '__serialize_namespace__', {}) - namespace = {c.__name__:c for c in namespace} - - fields = getattr(cls, '__serialize_fields__') - - if '@' in data: - return memo[data['@']] - - inst = cls.__new__(cls) - for f in fields: - try: - setattr(inst, f, _deserialize(data[f], namespace, memo)) - except KeyError as e: - raise KeyError("Cannot find key for class", cls, e) - postprocess = getattr(inst, '_deserialize', None) - if postprocess: - postprocess() - return inst - - -class SerializeMemoizer(Serialize): - #-- - - __serialize_fields__ = 'memoized', - - def __init__(self, types_to_memoize): - self.types_to_memoize = tuple(types_to_memoize) - self.memoized = Enumerator() - - def in_types(self, value): - return isinstance(value, self.types_to_memoize) - - def serialize(self): - return _serialize(self.memoized.reversed(), None) - - @classmethod - def deserialize(cls, data, namespace, memo): - return _deserialize(data, namespace, memo) - - -try: - STRING_TYPE = basestring -except NameError: ## - - STRING_TYPE = str - - -import types -from functools import wraps, partial -from contextlib import contextmanager - -Str = type(u'') -try: - classtype = types.ClassType ## - -except AttributeError: - classtype = type ## - - - -def smart_decorator(f, create_decorator): - if isinstance(f, types.FunctionType): - return wraps(f)(create_decorator(f, True)) - - elif isinstance(f, (classtype, type, types.BuiltinFunctionType)): - return wraps(f)(create_decorator(f, False)) - - elif isinstance(f, types.MethodType): - return wraps(f)(create_decorator(f.__func__, True)) - - elif isinstance(f, partial): - ## - - return wraps(f.func)(create_decorator(lambda *args, **kw: f(*args[1:], **kw), True)) - - else: - return create_decorator(f.__func__.__call__, True) - - -try: - import regex -except ModuleNotFoundError: - regex = None - -import sre_parse -import sre_constants -categ_pattern = re.compile(r'\\p{[A-Za-z_]+}') - -def get_regexp_width(expr): - if regex: - ## - - ## - - ## - - regexp_final = re.sub(categ_pattern, 'A', expr) - else: - if re.search(categ_pattern, expr): - raise ImportError('`regex` module must be installed in order to use Unicode categories.', expr) - regexp_final = expr - try: - return [int(x) for x in sre_parse.parse(regexp_final).getwidth()] - except sre_constants.error: - raise ValueError(expr) - - -from collections import OrderedDict - - -class Meta: - def __init__(self): - self.empty = True - - -class Tree(object): - #-- - def __init__(self, data, children, meta=None): - self.data = data - self.children = children - self._meta = meta - - @property - def meta(self): - if self._meta is None: - self._meta = Meta() - return self._meta - - def __repr__(self): - return 'Tree(%r, %r)' % (self.data, self.children) - - def _pretty_label(self): - return self.data - - def _pretty(self, level, indent_str): - if len(self.children) == 1 and not isinstance(self.children[0], Tree): - return [indent_str*level, self._pretty_label(), '\t', '%s' % (self.children[0],), '\n'] - - l = [indent_str*level, self._pretty_label(), '\n'] - for n in self.children: - if isinstance(n, Tree): - l += n._pretty(level+1, indent_str) - else: - l += [indent_str*(level+1), '%s' % (n,), '\n'] - - return l - - def pretty(self, indent_str=' '): - #-- - return ''.join(self._pretty(0, indent_str)) - - def __eq__(self, other): - try: - return self.data == other.data and self.children == other.children - except AttributeError: - return False - - def __ne__(self, other): - return not (self == other) - - def __hash__(self): - return hash((self.data, tuple(self.children))) - - def iter_subtrees(self): - #-- - queue = [self] - subtrees = OrderedDict() - for subtree in queue: - subtrees[id(subtree)] = subtree - queue += [c for c in reversed(subtree.children) - if isinstance(c, Tree) and id(c) not in subtrees] - - del queue - return reversed(list(subtrees.values())) - - def find_pred(self, pred): - #-- - return filter(pred, self.iter_subtrees()) - - def find_data(self, data): - #-- - return self.find_pred(lambda t: t.data == data) - - -from inspect import getmembers, getmro - - -class Discard(Exception): - #-- - pass - -## - - - -class _Decoratable: - #-- - - @classmethod - def _apply_decorator(cls, decorator, **kwargs): - mro = getmro(cls) - assert mro[0] is cls - libmembers = {name for _cls in mro[1:] for name, _ in getmembers(_cls)} - for name, value in getmembers(cls): - - ## - - if name.startswith('_') or (name in libmembers and name not in cls.__dict__): - continue - if not callable(value): - continue - - ## - - if hasattr(cls.__dict__[name], 'vargs_applied') or hasattr(value, 'vargs_applied'): - continue - - static = isinstance(cls.__dict__[name], (staticmethod, classmethod)) - setattr(cls, name, decorator(value, static=static, **kwargs)) - return cls - - def __class_getitem__(cls, _): - return cls - - -class Transformer(_Decoratable): - #-- - __visit_tokens__ = True ## - - - def __init__(self, visit_tokens=True): - self.__visit_tokens__ = visit_tokens - - def _call_userfunc(self, tree, new_children=None): - ## - - children = new_children if new_children is not None else tree.children - try: - f = getattr(self, tree.data) - except AttributeError: - return self.__default__(tree.data, children, tree.meta) - else: - try: - wrapper = getattr(f, 'visit_wrapper', None) - if wrapper is not None: - return f.visit_wrapper(f, tree.data, children, tree.meta) - else: - return f(children) - except (GrammarError, Discard): - raise - except Exception as e: - raise VisitError(tree.data, tree, e) - - def _call_userfunc_token(self, token): - try: - f = getattr(self, token.type) - except AttributeError: - return self.__default_token__(token) - else: - try: - return f(token) - except (GrammarError, Discard): - raise - except Exception as e: - raise VisitError(token.type, token, e) - - def _transform_children(self, children): - for c in children: - try: - if isinstance(c, Tree): - yield self._transform_tree(c) - elif self.__visit_tokens__ and isinstance(c, Token): - yield self._call_userfunc_token(c) - else: - yield c - except Discard: - pass - - def _transform_tree(self, tree): - children = list(self._transform_children(tree.children)) - return self._call_userfunc(tree, children) - - def transform(self, tree): - #-- - return self._transform_tree(tree) - - def __mul__(self, other): - #-- - return TransformerChain(self, other) - - def __default__(self, data, children, meta): - #-- - return Tree(data, children, meta) - - def __default_token__(self, token): - #-- - return token - - -class InlineTransformer(Transformer): ## - - def _call_userfunc(self, tree, new_children=None): - ## - - children = new_children if new_children is not None else tree.children - try: - f = getattr(self, tree.data) - except AttributeError: - return self.__default__(tree.data, children, tree.meta) - else: - return f(*children) - - -class TransformerChain(object): - def __init__(self, *transformers): - self.transformers = transformers - - def transform(self, tree): - for t in self.transformers: - tree = t.transform(tree) - return tree - - def __mul__(self, other): - return TransformerChain(*self.transformers + (other,)) - - -class Transformer_InPlace(Transformer): - #-- - def _transform_tree(self, tree): ## - - return self._call_userfunc(tree) - - def transform(self, tree): - for subtree in tree.iter_subtrees(): - subtree.children = list(self._transform_children(subtree.children)) - - return self._transform_tree(tree) - - -class Transformer_NonRecursive(Transformer): - #-- - - def transform(self, tree): - ## - - rev_postfix = [] - q = [tree] - while q: - t = q.pop() - rev_postfix.append(t) - if isinstance(t, Tree): - q += t.children - - ## - - stack = [] - for x in reversed(rev_postfix): - if isinstance(x, Tree): - size = len(x.children) - if size: - args = stack[-size:] - del stack[-size:] - else: - args = [] - stack.append(self._call_userfunc(x, args)) - else: - stack.append(x) - - t ,= stack ## - - return t - - -class Transformer_InPlaceRecursive(Transformer): - #-- - def _transform_tree(self, tree): - tree.children = list(self._transform_children(tree.children)) - return self._call_userfunc(tree) - - -## - - -class VisitorBase: - def _call_userfunc(self, tree): - return getattr(self, tree.data, self.__default__)(tree) - - def __default__(self, tree): - #-- - return tree - - def __class_getitem__(cls, _): - return cls - - -class Visitor(VisitorBase): - #-- - - def visit(self, tree): - #-- - for subtree in tree.iter_subtrees(): - self._call_userfunc(subtree) - return tree - - def visit_topdown(self,tree): - #-- - for subtree in tree.iter_subtrees_topdown(): - self._call_userfunc(subtree) - return tree - - -class Visitor_Recursive(VisitorBase): - #-- - - def visit(self, tree): - #-- - for child in tree.children: - if isinstance(child, Tree): - self.visit(child) - - self._call_userfunc(tree) - return tree - - def visit_topdown(self,tree): - #-- - self._call_userfunc(tree) - - for child in tree.children: - if isinstance(child, Tree): - self.visit_topdown(child) - - return tree - - -def visit_children_decor(func): - #-- - @wraps(func) - def inner(cls, tree): - values = cls.visit_children(tree) - return func(cls, values) - return inner - - -class Interpreter(_Decoratable): - #-- - - def visit(self, tree): - f = getattr(self, tree.data) - wrapper = getattr(f, 'visit_wrapper', None) - if wrapper is not None: - return f.visit_wrapper(f, tree.data, tree.children, tree.meta) - else: - return f(tree) - - def visit_children(self, tree): - return [self.visit(child) if isinstance(child, Tree) else child - for child in tree.children] - - def __getattr__(self, name): - return self.__default__ - - def __default__(self, tree): - return self.visit_children(tree) - - -## - - -def _apply_decorator(obj, decorator, **kwargs): - try: - _apply = obj._apply_decorator - except AttributeError: - return decorator(obj, **kwargs) - else: - return _apply(decorator, **kwargs) - - -def _inline_args__func(func): - @wraps(func) - def create_decorator(_f, with_self): - if with_self: - def f(self, children): - return _f(self, *children) - else: - def f(self, children): - return _f(*children) - return f - - return smart_decorator(func, create_decorator) - - -def inline_args(obj): ## - - return _apply_decorator(obj, _inline_args__func) - - -def _visitor_args_func_dec(func, visit_wrapper=None, static=False): - def create_decorator(_f, with_self): - if with_self: - def f(self, *args, **kwargs): - return _f(self, *args, **kwargs) - else: - def f(self, *args, **kwargs): - return _f(*args, **kwargs) - return f - - if static: - f = wraps(func)(create_decorator(func, False)) - else: - f = smart_decorator(func, create_decorator) - f.vargs_applied = True - f.visit_wrapper = visit_wrapper - return f - - -def _vargs_inline(f, _data, children, _meta): - return f(*children) -def _vargs_meta_inline(f, _data, children, meta): - return f(meta, *children) -def _vargs_meta(f, _data, children, meta): - return f(children, meta) ## - -def _vargs_tree(f, data, children, meta): - return f(Tree(data, children, meta)) - - -def v_args(inline=False, meta=False, tree=False, wrapper=None): - #-- - if tree and (meta or inline): - raise ValueError("Visitor functions cannot combine 'tree' with 'meta' or 'inline'.") - - func = None - if meta: - if inline: - func = _vargs_meta_inline - else: - func = _vargs_meta - elif inline: - func = _vargs_inline - elif tree: - func = _vargs_tree - - if wrapper is not None: - if func is not None: - raise ValueError("Cannot use 'wrapper' along with 'tree', 'meta' or 'inline'.") - func = wrapper - - def _visitor_args_dec(obj): - return _apply_decorator(obj, _visitor_args_func_dec, visit_wrapper=func) - return _visitor_args_dec - - - -class Indenter: - def __init__(self): - self.paren_level = None - self.indent_level = None - assert self.tab_len > 0 - - def handle_NL(self, token): - if self.paren_level > 0: - return - - yield token - - indent_str = token.rsplit('\n', 1)[1] ## - - indent = indent_str.count(' ') + indent_str.count('\t') * self.tab_len - - if indent > self.indent_level[-1]: - self.indent_level.append(indent) - yield Token.new_borrow_pos(self.INDENT_type, indent_str, token) - else: - while indent < self.indent_level[-1]: - self.indent_level.pop() - yield Token.new_borrow_pos(self.DEDENT_type, indent_str, token) - - assert indent == self.indent_level[-1], '%s != %s' % (indent, self.indent_level[-1]) - - def _process(self, stream): - for token in stream: - if token.type == self.NL_type: - for t in self.handle_NL(token): - yield t - else: - yield token - - if token.type in self.OPEN_PAREN_types: - self.paren_level += 1 - elif token.type in self.CLOSE_PAREN_types: - self.paren_level -= 1 - assert self.paren_level >= 0 - - while len(self.indent_level) > 1: - self.indent_level.pop() - yield Token(self.DEDENT_type, '') - - assert self.indent_level == [0], self.indent_level - - def process(self, stream): - self.paren_level = 0 - self.indent_level = [0] - return self._process(stream) - - ## - - @property - def always_accept(self): - return (self.NL_type,) - - - -class Symbol(Serialize): - __slots__ = ('name',) - - is_term = NotImplemented - - def __init__(self, name): - self.name = name - - def __eq__(self, other): - assert isinstance(other, Symbol), other - return self.is_term == other.is_term and self.name == other.name - - def __ne__(self, other): - return not (self == other) - - def __hash__(self): - return hash(self.name) - - def __repr__(self): - return '%s(%r)' % (type(self).__name__, self.name) - - fullrepr = property(__repr__) - - -class Terminal(Symbol): - __serialize_fields__ = 'name', 'filter_out' - - is_term = True - - def __init__(self, name, filter_out=False): - self.name = name - self.filter_out = filter_out - - @property - def fullrepr(self): - return '%s(%r, %r)' % (type(self).__name__, self.name, self.filter_out) - - -class NonTerminal(Symbol): - __serialize_fields__ = 'name', - - is_term = False - - -class RuleOptions(Serialize): - __serialize_fields__ = 'keep_all_tokens', 'expand1', 'priority', 'template_source', 'empty_indices' - - def __init__(self, keep_all_tokens=False, expand1=False, priority=None, template_source=None, empty_indices=()): - self.keep_all_tokens = keep_all_tokens - self.expand1 = expand1 - self.priority = priority - self.template_source = template_source - self.empty_indices = empty_indices - - def __repr__(self): - return 'RuleOptions(%r, %r, %r, %r)' % ( - self.keep_all_tokens, - self.expand1, - self.priority, - self.template_source - ) - - -class Rule(Serialize): - #-- - __slots__ = ('origin', 'expansion', 'alias', 'options', 'order', '_hash') - - __serialize_fields__ = 'origin', 'expansion', 'order', 'alias', 'options' - __serialize_namespace__ = Terminal, NonTerminal, RuleOptions - - def __init__(self, origin, expansion, order=0, alias=None, options=None): - self.origin = origin - self.expansion = expansion - self.alias = alias - self.order = order - self.options = options or RuleOptions() - self._hash = hash((self.origin, tuple(self.expansion))) - - def _deserialize(self): - self._hash = hash((self.origin, tuple(self.expansion))) - - def __str__(self): - return '<%s : %s>' % (self.origin.name, ' '.join(x.name for x in self.expansion)) - - def __repr__(self): - return 'Rule(%r, %r, %r, %r)' % (self.origin, self.expansion, self.alias, self.options) - - def __hash__(self): - return self._hash - - def __eq__(self, other): - if not isinstance(other, Rule): - return False - return self.origin == other.origin and self.expansion == other.expansion - - - -from copy import copy - - -class Pattern(Serialize): - - def __init__(self, value, flags=()): - self.value = value - self.flags = frozenset(flags) - - def __repr__(self): - return repr(self.to_regexp()) - - ## - - def __hash__(self): - return hash((type(self), self.value, self.flags)) - - def __eq__(self, other): - return type(self) == type(other) and self.value == other.value and self.flags == other.flags - - def to_regexp(self): - raise NotImplementedError() - - def _get_flags(self, value): - for f in self.flags: - value = f'(?{f}:{value})' - return value - - -class PatternStr(Pattern): - __serialize_fields__ = 'value', 'flags' - - type = "str" - - def to_regexp(self): - return self._get_flags(re.escape(self.value)) - - @property - def min_width(self): - return len(self.value) - max_width = min_width - - -class PatternRE(Pattern): - __serialize_fields__ = 'value', 'flags', '_width' - - type = "re" - - def to_regexp(self): - return self._get_flags(self.value) - - _width = None - def _get_width(self): - if self._width is None: - self._width = get_regexp_width(self.to_regexp()) - return self._width - - @property - def min_width(self): - return self._get_width()[0] - - @property - def max_width(self): - return self._get_width()[1] - - -class TerminalDef(Serialize): - __serialize_fields__ = 'name', 'pattern', 'priority' - __serialize_namespace__ = PatternStr, PatternRE - - def __init__(self, name, pattern, priority=1): - assert isinstance(pattern, Pattern), pattern - self.name = name - self.pattern = pattern - self.priority = priority - - def __repr__(self): - return '%s(%r, %r)' % (type(self).__name__, self.name, self.pattern) - - -class Token(Str): - #-- - __slots__ = ('type', 'pos_in_stream', 'value', 'line', 'column', 'end_line', 'end_column', 'end_pos') - - def __new__(cls, type_, value, pos_in_stream=None, line=None, column=None, end_line=None, end_column=None, end_pos=None): - try: - self = super(Token, cls).__new__(cls, value) - except UnicodeDecodeError: - value = value.decode('latin1') - self = super(Token, cls).__new__(cls, value) - - self.type = type_ - self.pos_in_stream = pos_in_stream - self.value = value - self.line = line - self.column = column - self.end_line = end_line - self.end_column = end_column - self.end_pos = end_pos - return self - - def update(self, type_=None, value=None): - return Token.new_borrow_pos( - type_ if type_ is not None else self.type, - value if value is not None else self.value, - self - ) - - @classmethod - def new_borrow_pos(cls, type_, value, borrow_t): - return cls(type_, value, borrow_t.pos_in_stream, borrow_t.line, borrow_t.column, borrow_t.end_line, borrow_t.end_column, borrow_t.end_pos) - - def __reduce__(self): - return (self.__class__, (self.type, self.value, self.pos_in_stream, self.line, self.column)) - - def __repr__(self): - return 'Token(%r, %r)' % (self.type, self.value) - - def __deepcopy__(self, memo): - return Token(self.type, self.value, self.pos_in_stream, self.line, self.column) - - def __eq__(self, other): - if isinstance(other, Token) and self.type != other.type: - return False - - return Str.__eq__(self, other) - - __hash__ = Str.__hash__ - - -class LineCounter: - __slots__ = 'char_pos', 'line', 'column', 'line_start_pos', 'newline_char' - - def __init__(self, newline_char): - self.newline_char = newline_char - self.char_pos = 0 - self.line = 1 - self.column = 1 - self.line_start_pos = 0 - - def feed(self, token, test_newline=True): - #-- - if test_newline: - newlines = token.count(self.newline_char) - if newlines: - self.line += newlines - self.line_start_pos = self.char_pos + token.rindex(self.newline_char) + 1 - - self.char_pos += len(token) - self.column = self.char_pos - self.line_start_pos + 1 - - -class UnlessCallback: - def __init__(self, mres): - self.mres = mres - - def __call__(self, t): - for mre, type_from_index in self.mres: - m = mre.match(t.value) - if m: - t.type = type_from_index[m.lastindex] - break - return t - - -class CallChain: - def __init__(self, callback1, callback2, cond): - self.callback1 = callback1 - self.callback2 = callback2 - self.cond = cond - - def __call__(self, t): - t2 = self.callback1(t) - return self.callback2(t) if self.cond(t2) else t2 - - -def _create_unless(terminals, g_regex_flags, re_, use_bytes): - tokens_by_type = classify(terminals, lambda t: type(t.pattern)) - assert len(tokens_by_type) <= 2, tokens_by_type.keys() - embedded_strs = set() - callback = {} - for retok in tokens_by_type.get(PatternRE, []): - unless = [] - for strtok in tokens_by_type.get(PatternStr, []): - if strtok.priority > retok.priority: - continue - s = strtok.pattern.value - m = re_.match(retok.pattern.to_regexp(), s, g_regex_flags) - if m and m.group(0) == s: - unless.append(strtok) - if strtok.pattern.flags <= retok.pattern.flags: - embedded_strs.add(strtok) - if unless: - callback[retok.name] = UnlessCallback(build_mres(unless, g_regex_flags, re_, match_whole=True, use_bytes=use_bytes)) - - terminals = [t for t in terminals if t not in embedded_strs] - return terminals, callback - - -def _build_mres(terminals, max_size, g_regex_flags, match_whole, re_, use_bytes): - ## - - ## - - ## - - postfix = '$' if match_whole else '' - mres = [] - while terminals: - pattern = u'|'.join(u'(?P<%s>%s)' % (t.name, t.pattern.to_regexp() + postfix) for t in terminals[:max_size]) - if use_bytes: - pattern = pattern.encode('latin-1') - try: - mre = re_.compile(pattern, g_regex_flags) - except AssertionError: ## - - return _build_mres(terminals, max_size//2, g_regex_flags, match_whole, re_, use_bytes) - - mres.append((mre, {i: n for n, i in mre.groupindex.items()})) - terminals = terminals[max_size:] - return mres - - -def build_mres(terminals, g_regex_flags, re_, use_bytes, match_whole=False): - return _build_mres(terminals, len(terminals), g_regex_flags, match_whole, re_, use_bytes) - - -def _regexp_has_newline(r): - #-- - return '\n' in r or '\\n' in r or '\\s' in r or '[^' in r or ('(?s' in r and '.' in r) - - -class Lexer(object): - #-- - lex = NotImplemented - - def make_lexer_state(self, text): - line_ctr = LineCounter(b'\n' if isinstance(text, bytes) else '\n') - return LexerState(text, line_ctr) - - -class TraditionalLexer(Lexer): - - def __init__(self, conf): - terminals = list(conf.tokens) - assert all(isinstance(t, TerminalDef) for t in terminals), terminals - - self.re = conf.re_module - - if not conf.skip_validation: - ## - - for t in terminals: - try: - self.re.compile(t.pattern.to_regexp(), conf.g_regex_flags) - except self.re.error: - raise LexError("Cannot compile token %s: %s" % (t.name, t.pattern)) - - if t.pattern.min_width == 0: - raise LexError("Lexer does not allow zero-width terminals. (%s: %s)" % (t.name, t.pattern)) - - assert set(conf.ignore) <= {t.name for t in terminals} - - ## - - self.newline_types = frozenset(t.name for t in terminals if _regexp_has_newline(t.pattern.to_regexp())) - self.ignore_types = frozenset(conf.ignore) - - terminals.sort(key=lambda x: (-x.priority, -x.pattern.max_width, -len(x.pattern.value), x.name)) - self.terminals = terminals - self.user_callbacks = conf.callbacks - self.g_regex_flags = conf.g_regex_flags - self.use_bytes = conf.use_bytes - - self._mres = None - - def _build(self): - terminals, self.callback = _create_unless(self.terminals, self.g_regex_flags, self.re, self.use_bytes) - assert all(self.callback.values()) - - for type_, f in self.user_callbacks.items(): - if type_ in self.callback: - ## - - self.callback[type_] = CallChain(self.callback[type_], f, lambda t: t.type == type_) - else: - self.callback[type_] = f - - self._mres = build_mres(terminals, self.g_regex_flags, self.re, self.use_bytes) - - @property - def mres(self): - if self._mres is None: - self._build() - return self._mres - - def match(self, text, pos): - for mre, type_from_index in self.mres: - m = mre.match(text, pos) - if m: - return m.group(0), type_from_index[m.lastindex] - - def lex(self, state, _parser_state): - with suppress(EOFError): - while True: - yield self.next_token(state) - - def next_token(self, lex_state): - line_ctr = lex_state.line_ctr - while line_ctr.char_pos < len(lex_state.text): - res = self.match(lex_state.text, line_ctr.char_pos) - if not res: - allowed = {v for m, tfi in self.mres for v in tfi.values()} - self.ignore_types - if not allowed: - allowed = {""} - raise UnexpectedCharacters(lex_state.text, line_ctr.char_pos, line_ctr.line, line_ctr.column, - allowed=allowed, token_history=lex_state.last_token and [lex_state.last_token]) - - value, type_ = res - - if type_ not in self.ignore_types: - t = Token(type_, value, line_ctr.char_pos, line_ctr.line, line_ctr.column) - line_ctr.feed(value, type_ in self.newline_types) - t.end_line = line_ctr.line - t.end_column = line_ctr.column - t.end_pos = line_ctr.char_pos - if t.type in self.callback: - t = self.callback[t.type](t) - if not isinstance(t, Token): - raise ValueError("Callbacks must return a token (returned %r)" % t) - lex_state.last_token = t - return t - else: - if type_ in self.callback: - t2 = Token(type_, value, line_ctr.char_pos, line_ctr.line, line_ctr.column) - self.callback[type_](t2) - line_ctr.feed(value, type_ in self.newline_types) - - ## - - raise EOFError(self) - - -class LexerState: - __slots__ = 'text', 'line_ctr', 'last_token' - - def __init__(self, text, line_ctr, last_token=None): - self.text = text - self.line_ctr = line_ctr - self.last_token = last_token - - def __copy__(self): - return type(self)(self.text, copy(self.line_ctr), self.last_token) - - -class ContextualLexer(Lexer): - - def __init__(self, conf, states, always_accept=()): - terminals = list(conf.tokens) - tokens_by_name = {} - for t in terminals: - assert t.name not in tokens_by_name, t - tokens_by_name[t.name] = t - - trad_conf = copy(conf) - trad_conf.tokens = terminals - - lexer_by_tokens = {} - self.lexers = {} - for state, accepts in states.items(): - key = frozenset(accepts) - try: - lexer = lexer_by_tokens[key] - except KeyError: - accepts = set(accepts) | set(conf.ignore) | set(always_accept) - state_tokens = [tokens_by_name[n] for n in accepts if n and n in tokens_by_name] - lexer_conf = copy(trad_conf) - lexer_conf.tokens = state_tokens - lexer = TraditionalLexer(lexer_conf) - lexer_by_tokens[key] = lexer - - self.lexers[state] = lexer - - assert trad_conf.tokens is terminals - self.root_lexer = TraditionalLexer(trad_conf) - - def make_lexer_state(self, text): - return self.root_lexer.make_lexer_state(text) - - def lex(self, lexer_state, parser_state): - try: - while True: - lexer = self.lexers[parser_state.position] - yield lexer.next_token(lexer_state) - except EOFError: - pass - except UnexpectedCharacters as e: - ## - - ## - - token = self.root_lexer.next_token(lexer_state) - raise UnexpectedToken(token, e.allowed, state=parser_state.position) - - -class LexerThread: - #-- - - def __init__(self, lexer, text): - self.lexer = lexer - self.state = lexer.make_lexer_state(text) - - def lex(self, parser_state): - return self.lexer.lex(self.state, parser_state) - - - -class LexerConf(Serialize): - __serialize_fields__ = 'tokens', 'ignore', 'g_regex_flags', 'use_bytes' - __serialize_namespace__ = TerminalDef, - - def __init__(self, tokens, re_module, ignore=(), postlex=None, callbacks=None, g_regex_flags=0, skip_validation=False, use_bytes=False): - self.tokens = tokens ## - - self.ignore = ignore - self.postlex = postlex - self.callbacks = callbacks or {} - self.g_regex_flags = g_regex_flags - self.re_module = re_module - self.skip_validation = skip_validation - self.use_bytes = use_bytes - - -from functools import partial, wraps -from itertools import repeat, product - - -class ExpandSingleChild: - def __init__(self, node_builder): - self.node_builder = node_builder - - def __call__(self, children): - if len(children) == 1: - return children[0] - else: - return self.node_builder(children) - - -class PropagatePositions: - def __init__(self, node_builder): - self.node_builder = node_builder - - def __call__(self, children): - res = self.node_builder(children) - - ## - - if isinstance(res, Tree): - res_meta = res.meta - for c in children: - if isinstance(c, Tree): - child_meta = c.meta - if not child_meta.empty: - res_meta.line = child_meta.line - res_meta.column = child_meta.column - res_meta.start_pos = child_meta.start_pos - res_meta.empty = False - break - elif isinstance(c, Token): - res_meta.line = c.line - res_meta.column = c.column - res_meta.start_pos = c.pos_in_stream - res_meta.empty = False - break - - for c in reversed(children): - if isinstance(c, Tree): - child_meta = c.meta - if not child_meta.empty: - res_meta.end_line = child_meta.end_line - res_meta.end_column = child_meta.end_column - res_meta.end_pos = child_meta.end_pos - res_meta.empty = False - break - elif isinstance(c, Token): - res_meta.end_line = c.end_line - res_meta.end_column = c.end_column - res_meta.end_pos = c.end_pos - res_meta.empty = False - break - - return res - - -class ChildFilter: - def __init__(self, to_include, append_none, node_builder): - self.node_builder = node_builder - self.to_include = to_include - self.append_none = append_none - - def __call__(self, children): - filtered = [] - - for i, to_expand, add_none in self.to_include: - if add_none: - filtered += [None] * add_none - if to_expand: - filtered += children[i].children - else: - filtered.append(children[i]) - - if self.append_none: - filtered += [None] * self.append_none - - return self.node_builder(filtered) - - -class ChildFilterLALR(ChildFilter): - #-- - - def __call__(self, children): - filtered = [] - for i, to_expand, add_none in self.to_include: - if add_none: - filtered += [None] * add_none - if to_expand: - if filtered: - filtered += children[i].children - else: ## - - filtered = children[i].children - else: - filtered.append(children[i]) - - if self.append_none: - filtered += [None] * self.append_none - - return self.node_builder(filtered) - - -class ChildFilterLALR_NoPlaceholders(ChildFilter): - #-- - def __init__(self, to_include, node_builder): - self.node_builder = node_builder - self.to_include = to_include - - def __call__(self, children): - filtered = [] - for i, to_expand in self.to_include: - if to_expand: - if filtered: - filtered += children[i].children - else: ## - - filtered = children[i].children - else: - filtered.append(children[i]) - return self.node_builder(filtered) - - -def _should_expand(sym): - return not sym.is_term and sym.name.startswith('_') - - -def maybe_create_child_filter(expansion, keep_all_tokens, ambiguous, _empty_indices): - ## - - if _empty_indices: - assert _empty_indices.count(False) == len(expansion) - s = ''.join(str(int(b)) for b in _empty_indices) - empty_indices = [len(ones) for ones in s.split('0')] - assert len(empty_indices) == len(expansion)+1, (empty_indices, len(expansion)) - else: - empty_indices = [0] * (len(expansion)+1) - - to_include = [] - nones_to_add = 0 - for i, sym in enumerate(expansion): - nones_to_add += empty_indices[i] - if keep_all_tokens or not (sym.is_term and sym.filter_out): - to_include.append((i, _should_expand(sym), nones_to_add)) - nones_to_add = 0 - - nones_to_add += empty_indices[len(expansion)] - - if _empty_indices or len(to_include) < len(expansion) or any(to_expand for i, to_expand,_ in to_include): - if _empty_indices or ambiguous: - return partial(ChildFilter if ambiguous else ChildFilterLALR, to_include, nones_to_add) - else: - ## - - return partial(ChildFilterLALR_NoPlaceholders, [(i, x) for i,x,_ in to_include]) - - -class AmbiguousExpander: - #-- - def __init__(self, to_expand, tree_class, node_builder): - self.node_builder = node_builder - self.tree_class = tree_class - self.to_expand = to_expand - - def __call__(self, children): - def _is_ambig_tree(t): - return hasattr(t, 'data') and t.data == '_ambig' - - ## - - ## - - ## - - ## - - ambiguous = [] - for i, child in enumerate(children): - if _is_ambig_tree(child): - if i in self.to_expand: - ambiguous.append(i) - - to_expand = [j for j, grandchild in enumerate(child.children) if _is_ambig_tree(grandchild)] - child.expand_kids_by_index(*to_expand) - - if not ambiguous: - return self.node_builder(children) - - expand = [iter(child.children) if i in ambiguous else repeat(child) for i, child in enumerate(children)] - return self.tree_class('_ambig', [self.node_builder(list(f[0])) for f in product(zip(*expand))]) - - -def maybe_create_ambiguous_expander(tree_class, expansion, keep_all_tokens): - to_expand = [i for i, sym in enumerate(expansion) - if keep_all_tokens or ((not (sym.is_term and sym.filter_out)) and _should_expand(sym))] - if to_expand: - return partial(AmbiguousExpander, to_expand, tree_class) - - -class AmbiguousIntermediateExpander: - #-- - - def __init__(self, tree_class, node_builder): - self.node_builder = node_builder - self.tree_class = tree_class - - def __call__(self, children): - def _is_iambig_tree(child): - return hasattr(child, 'data') and child.data == '_iambig' - - def _collapse_iambig(children): - #-- - - ## - - ## - - if children and _is_iambig_tree(children[0]): - iambig_node = children[0] - result = [] - for grandchild in iambig_node.children: - collapsed = _collapse_iambig(grandchild.children) - if collapsed: - for child in collapsed: - child.children += children[1:] - result += collapsed - else: - new_tree = self.tree_class('_inter', grandchild.children + children[1:]) - result.append(new_tree) - return result - - collapsed = _collapse_iambig(children) - if collapsed: - processed_nodes = [self.node_builder(c.children) for c in collapsed] - return self.tree_class('_ambig', processed_nodes) - - return self.node_builder(children) - - -def ptb_inline_args(func): - @wraps(func) - def f(children): - return func(*children) - return f - - -def inplace_transformer(func): - @wraps(func) - def f(children): - ## - - tree = Tree(func.__name__, children) - return func(tree) - return f - - -def apply_visit_wrapper(func, name, wrapper): - if wrapper is _vargs_meta or wrapper is _vargs_meta_inline: - raise NotImplementedError("Meta args not supported for internal transformer") - - @wraps(func) - def f(children): - return wrapper(func, name, children, None) - return f - - -class ParseTreeBuilder: - def __init__(self, rules, tree_class, propagate_positions=False, ambiguous=False, maybe_placeholders=False): - self.tree_class = tree_class - self.propagate_positions = propagate_positions - self.ambiguous = ambiguous - self.maybe_placeholders = maybe_placeholders - - self.rule_builders = list(self._init_builders(rules)) - - def _init_builders(self, rules): - for rule in rules: - options = rule.options - keep_all_tokens = options.keep_all_tokens - expand_single_child = options.expand1 - - wrapper_chain = list(filter(None, [ - (expand_single_child and not rule.alias) and ExpandSingleChild, - maybe_create_child_filter(rule.expansion, keep_all_tokens, self.ambiguous, options.empty_indices if self.maybe_placeholders else None), - self.propagate_positions and PropagatePositions, - self.ambiguous and maybe_create_ambiguous_expander(self.tree_class, rule.expansion, keep_all_tokens), - self.ambiguous and partial(AmbiguousIntermediateExpander, self.tree_class) - ])) - - yield rule, wrapper_chain - - def create_callback(self, transformer=None): - callbacks = {} - - for rule, wrapper_chain in self.rule_builders: - - user_callback_name = rule.alias or rule.options.template_source or rule.origin.name - try: - f = getattr(transformer, user_callback_name) - ## - - wrapper = getattr(f, 'visit_wrapper', None) - if wrapper is not None: - f = apply_visit_wrapper(f, user_callback_name, wrapper) - else: - if isinstance(transformer, InlineTransformer): - f = ptb_inline_args(f) - elif isinstance(transformer, Transformer_InPlace): - f = inplace_transformer(f) - except AttributeError: - f = partial(self.tree_class, user_callback_name) - - for w in wrapper_chain: - f = w(f) - - if rule in callbacks: - raise GrammarError("Rule '%s' already exists" % (rule,)) - - callbacks[rule] = f - - return callbacks - - - -class LALR_Parser(object): - def __init__(self, parser_conf, debug=False): - analysis = LALR_Analyzer(parser_conf, debug=debug) - analysis.compute_lalr() - callbacks = parser_conf.callbacks - - self._parse_table = analysis.parse_table - self.parser_conf = parser_conf - self.parser = _Parser(analysis.parse_table, callbacks, debug) - - @classmethod - def deserialize(cls, data, memo, callbacks, debug=False): - inst = cls.__new__(cls) - inst._parse_table = IntParseTable.deserialize(data, memo) - inst.parser = _Parser(inst._parse_table, callbacks, debug) - return inst - - def serialize(self, memo): - return self._parse_table.serialize(memo) - - def parse(self, *args): - return self.parser.parse(*args) - - -class ParseConf: - __slots__ = 'parse_table', 'callbacks', 'start', 'start_state', 'end_state', 'states' - - def __init__(self, parse_table, callbacks, start): - self.parse_table = parse_table - - self.start_state = self.parse_table.start_states[start] - self.end_state = self.parse_table.end_states[start] - self.states = self.parse_table.states - - self.callbacks = callbacks - self.start = start - - -class ParserState: - __slots__ = 'parse_conf', 'lexer', 'state_stack', 'value_stack' - - def __init__(self, parse_conf, lexer, state_stack=None, value_stack=None): - self.parse_conf = parse_conf - self.lexer = lexer - self.state_stack = state_stack or [self.parse_conf.start_state] - self.value_stack = value_stack or [] - - @property - def position(self): - return self.state_stack[-1] - - def __copy__(self): - return type(self)( - self.parse_conf, - self.lexer, ## - - copy(self.state_stack), - deepcopy(self.value_stack), - ) - - def copy(self): - return copy(self) - - def feed_token(self, token, is_end=False): - state_stack = self.state_stack - value_stack = self.value_stack - states = self.parse_conf.states - end_state = self.parse_conf.end_state - callbacks = self.parse_conf.callbacks - - while True: - state = state_stack[-1] - try: - action, arg = states[state][token.type] - except KeyError: - expected = {s for s in states[state].keys() if s.isupper()} - raise UnexpectedToken(token, expected, state=state, puppet=None) - - assert arg != end_state - - if action is Shift: - ## - - assert not is_end - state_stack.append(arg) - value_stack.append(token) - return - else: - ## - - rule = arg - size = len(rule.expansion) - if size: - s = value_stack[-size:] - del state_stack[-size:] - del value_stack[-size:] - else: - s = [] - - value = callbacks[rule](s) - - _action, new_state = states[state_stack[-1]][rule.origin.name] - assert _action is Shift - state_stack.append(new_state) - value_stack.append(value) - - if is_end and state_stack[-1] == end_state: - return value_stack[-1] - -class _Parser: - def __init__(self, parse_table, callbacks, debug=False): - self.parse_table = parse_table - self.callbacks = callbacks - self.debug = debug - - def parse(self, lexer, start, value_stack=None, state_stack=None): - parse_conf = ParseConf(self.parse_table, self.callbacks, start) - parser_state = ParserState(parse_conf, lexer, state_stack, value_stack) - return self.parse_from_state(parser_state) - - def parse_from_state(self, state): - ## - - try: - token = None - for token in state.lexer.lex(state): - state.feed_token(token) - - token = Token.new_borrow_pos('$END', '', token) if token else Token('$END', '', 0, 1, 1) - return state.feed_token(token, True) - except UnexpectedInput as e: - try: - e.puppet = ParserPuppet(self, state, state.lexer) - except NameError: - pass - raise e - except Exception as e: - if self.debug: - print("") - print("STATE STACK DUMP") - print("----------------") - for i, s in enumerate(state.state_stack): - print('%d)' % i , s) - print("") - - raise - - -class Action: - def __init__(self, name): - self.name = name - def __str__(self): - return self.name - def __repr__(self): - return str(self) - -Shift = Action('Shift') -Reduce = Action('Reduce') - - -class ParseTable: - def __init__(self, states, start_states, end_states): - self.states = states - self.start_states = start_states - self.end_states = end_states - - def serialize(self, memo): - tokens = Enumerator() - rules = Enumerator() - - states = { - state: {tokens.get(token): ((1, arg.serialize(memo)) if action is Reduce else (0, arg)) - for token, (action, arg) in actions.items()} - for state, actions in self.states.items() - } - - return { - 'tokens': tokens.reversed(), - 'states': states, - 'start_states': self.start_states, - 'end_states': self.end_states, - } - - @classmethod - def deserialize(cls, data, memo): - tokens = data['tokens'] - states = { - state: {tokens[token]: ((Reduce, Rule.deserialize(arg, memo)) if action==1 else (Shift, arg)) - for token, (action, arg) in actions.items()} - for state, actions in data['states'].items() - } - return cls(states, data['start_states'], data['end_states']) - - -class IntParseTable(ParseTable): - - @classmethod - def from_ParseTable(cls, parse_table): - enum = list(parse_table.states) - state_to_idx = {s:i for i,s in enumerate(enum)} - int_states = {} - - for s, la in parse_table.states.items(): - la = {k:(v[0], state_to_idx[v[1]]) if v[0] is Shift else v - for k,v in la.items()} - int_states[ state_to_idx[s] ] = la - - - start_states = {start:state_to_idx[s] for start, s in parse_table.start_states.items()} - end_states = {start:state_to_idx[s] for start, s in parse_table.end_states.items()} - return cls(int_states, start_states, end_states) - - - -def get_frontend(parser, lexer): - if parser=='lalr': - if lexer is None: - raise ValueError('The LALR parser requires use of a lexer') - elif lexer == 'standard': - return LALR_TraditionalLexer - elif lexer == 'contextual': - return LALR_ContextualLexer - elif issubclass(lexer, Lexer): - class CustomLexerWrapper(Lexer): - def __init__(self, lexer_conf): - self.lexer = lexer(lexer_conf) - def lex(self, lexer_state, parser_state): - return self.lexer.lex(lexer_state.text) - - class LALR_CustomLexerWrapper(LALR_WithLexer): - def __init__(self, lexer_conf, parser_conf, options=None): - super(LALR_CustomLexerWrapper, self).__init__(lexer_conf, parser_conf, options=options) - def init_lexer(self): - future_interface = getattr(lexer, '__future_interface__', False) - if future_interface: - self.lexer = lexer(self.lexer_conf) - else: - self.lexer = CustomLexerWrapper(self.lexer_conf) - - return LALR_CustomLexerWrapper - else: - raise ValueError('Unknown lexer: %s' % lexer) - elif parser=='earley': - if lexer=='standard': - return Earley - elif lexer=='dynamic': - return XEarley - elif lexer=='dynamic_complete': - return XEarley_CompleteLex - elif lexer=='contextual': - raise ValueError('The Earley parser does not support the contextual parser') - else: - raise ValueError('Unknown lexer: %s' % lexer) - elif parser == 'cyk': - if lexer == 'standard': - return CYK - else: - raise ValueError('CYK parser requires using standard parser.') - else: - raise ValueError('Unknown parser: %s' % parser) - - -class _ParserFrontend(Serialize): - def _parse(self, start, input, *args): - if start is None: - start = self.start - if len(start) > 1: - raise ValueError("Lark initialized with more than 1 possible start rule. Must specify which start rule to parse", start) - start ,= start - return self.parser.parse(input, start, *args) - - -def _get_lexer_callbacks(transformer, terminals): - result = {} - for terminal in terminals: - callback = getattr(transformer, terminal.name, None) - if callback is not None: - result[terminal.name] = callback - return result - -class PostLexConnector: - def __init__(self, lexer, postlexer): - self.lexer = lexer - self.postlexer = postlexer - - def make_lexer_state(self, text): - return self.lexer.make_lexer_state(text) - - def lex(self, lexer_state, parser_state): - i = self.lexer.lex(lexer_state, parser_state) - return self.postlexer.process(i) - - -class WithLexer(_ParserFrontend): - lexer = None - parser = None - lexer_conf = None - start = None - - __serialize_fields__ = 'parser', 'lexer_conf', 'start' - __serialize_namespace__ = LexerConf, - - def __init__(self, lexer_conf, parser_conf, options=None): - self.lexer_conf = lexer_conf - self.start = parser_conf.start - self.postlex = lexer_conf.postlex - - @classmethod - def deserialize(cls, data, memo, callbacks, options): - inst = super(WithLexer, cls).deserialize(data, memo) - - inst.postlex = options.postlex - inst.parser = LALR_Parser.deserialize(inst.parser, memo, callbacks, options.debug) - - terminals = [item for item in memo.values() if isinstance(item, TerminalDef)] - inst.lexer_conf.callbacks = _get_lexer_callbacks(options.transformer, terminals) - inst.lexer_conf.re_module = regex if options.regex else re - inst.lexer_conf.use_bytes = options.use_bytes - inst.lexer_conf.g_regex_flags = options.g_regex_flags - inst.lexer_conf.skip_validation = True - inst.init_lexer() - - return inst - - def _serialize(self, data, memo): - data['parser'] = data['parser'].serialize(memo) - - def make_lexer(self, text): - lexer = self.lexer - if self.postlex: - lexer = PostLexConnector(self.lexer, self.postlex) - return LexerThread(lexer, text) - - def parse(self, text, start=None): - return self._parse(start, self.make_lexer(text)) - - def init_traditional_lexer(self): - self.lexer = TraditionalLexer(self.lexer_conf) - -class LALR_WithLexer(WithLexer): - def __init__(self, lexer_conf, parser_conf, options=None): - debug = options.debug if options else False - self.parser = LALR_Parser(parser_conf, debug=debug) - WithLexer.__init__(self, lexer_conf, parser_conf, options) - - self.init_lexer() - - def init_lexer(self, **kw): - raise NotImplementedError() - -class LALR_TraditionalLexer(LALR_WithLexer): - def init_lexer(self): - self.init_traditional_lexer() - -class LALR_ContextualLexer(LALR_WithLexer): - def init_lexer(self): - states = {idx:list(t.keys()) for idx, t in self.parser._parse_table.states.items()} - always_accept = self.postlex.always_accept if self.postlex else () - self.lexer = ContextualLexer(self.lexer_conf, states, always_accept=always_accept) - - - - -class LarkOptions(Serialize): - #-- - OPTIONS_DOC = """ - **=== General Options ===** - - start - The start symbol. Either a string, or a list of strings for multiple possible starts (Default: "start") - debug - Display debug information and extra warnings. Use only when debugging (default: False) - When used with Earley, it generates a forest graph as "sppf.png", if 'dot' is installed. - transformer - Applies the transformer to every parse tree (equivalent to applying it after the parse, but faster) - propagate_positions - Propagates (line, column, end_line, end_column) attributes into all tree branches. - maybe_placeholders - When True, the ``[]`` operator returns ``None`` when not matched. - - When ``False``, ``[]`` behaves like the ``?`` operator, and returns no value at all. - (default= ``False``. Recommended to set to ``True``) - cache - Cache the results of the Lark grammar analysis, for x2 to x3 faster loading. LALR only for now. - - - When ``False``, does nothing (default) - - When ``True``, caches to a temporary file in the local directory - - When given a string, caches to the path pointed by the string - regex - When True, uses the ``regex`` module instead of the stdlib ``re``. - g_regex_flags - Flags that are applied to all terminals (both regex and strings) - keep_all_tokens - Prevent the tree builder from automagically removing "punctuation" tokens (default: False) - tree_class - Lark will produce trees comprised of instances of this class instead of the default ``lark.Tree``. - - **=== Algorithm Options ===** - - parser - Decides which parser engine to use. Accepts "earley" or "lalr". (Default: "earley"). - (there is also a "cyk" option for legacy) - lexer - Decides whether or not to use a lexer stage - - - "auto" (default): Choose for me based on the parser - - "standard": Use a standard lexer - - "contextual": Stronger lexer (only works with parser="lalr") - - "dynamic": Flexible and powerful (only with parser="earley") - - "dynamic_complete": Same as dynamic, but tries *every* variation of tokenizing possible. - ambiguity - Decides how to handle ambiguity in the parse. Only relevant if parser="earley" - - - "resolve": The parser will automatically choose the simplest derivation - (it chooses consistently: greedy for tokens, non-greedy for rules) - - "explicit": The parser will return all derivations wrapped in "_ambig" tree nodes (i.e. a forest). - - "forest": The parser will return the root of the shared packed parse forest. - - **=== Misc. / Domain Specific Options ===** - - postlex - Lexer post-processing (Default: None) Only works with the standard and contextual lexers. - priority - How priorities should be evaluated - auto, none, normal, invert (Default: auto) - lexer_callbacks - Dictionary of callbacks for the lexer. May alter tokens during lexing. Use with caution. - use_bytes - Accept an input of type ``bytes`` instead of ``str`` (Python 3 only). - edit_terminals - A callback for editing the terminals before parse. - import_paths - A List of either paths or loader functions to specify from where grammars are imported - source_path - Override the source of from where the grammar was loaded. Useful for relative imports and unconventional grammar loading - - **=== End Options ===** - """ - if __doc__: - __doc__ += OPTIONS_DOC - - - ## - - ## - - ## - - ## - - ## - - ## - - ## - - ## - - _defaults = { - 'debug': False, - 'keep_all_tokens': False, - 'tree_class': None, - 'cache': False, - 'postlex': None, - 'parser': 'earley', - 'lexer': 'auto', - 'transformer': None, - 'start': 'start', - 'priority': 'auto', - 'ambiguity': 'auto', - 'regex': False, - 'propagate_positions': False, - 'lexer_callbacks': {}, - 'maybe_placeholders': False, - 'edit_terminals': None, - 'g_regex_flags': 0, - 'use_bytes': False, - 'import_paths': [], - 'source_path': None, - } - - def __init__(self, options_dict): - o = dict(options_dict) - - options = {} - for name, default in self._defaults.items(): - if name in o: - value = o.pop(name) - if isinstance(default, bool) and name not in ('cache', 'use_bytes'): - value = bool(value) - else: - value = default - - options[name] = value - - if isinstance(options['start'], STRING_TYPE): - options['start'] = [options['start']] - - self.__dict__['options'] = options - - assert self.parser in ('earley', 'lalr', 'cyk', None) - - if self.parser == 'earley' and self.transformer: - raise ValueError('Cannot specify an embedded transformer when using the Earley algorithm.' - 'Please use your transformer on the resulting parse tree, or use a different algorithm (i.e. LALR)') - - if o: - raise ValueError("Unknown options: %s" % o.keys()) - - def __getattr__(self, name): - try: - return self.options[name] - except KeyError as e: - raise AttributeError(e) - - def __setattr__(self, name, value): - assert name in self.options - self.options[name] = value - - def serialize(self, memo): - return self.options - - @classmethod - def deserialize(cls, data, memo): - return cls(data) - - -## - -## - -_LOAD_ALLOWED_OPTIONS = {'postlex', 'transformer', 'use_bytes', 'debug', 'g_regex_flags', 'regex', 'propagate_positions', 'tree_class'} - -_VALID_PRIORITY_OPTIONS = ('auto', 'normal', 'invert', None) -_VALID_AMBIGUITY_OPTIONS = ('auto', 'resolve', 'explicit', 'forest') - - -class Lark(Serialize): - #-- - def __init__(self, grammar, **options): - self.options = LarkOptions(options) - - ## - - use_regex = self.options.regex - if use_regex: - if regex: - re_module = regex - else: - raise ImportError('`regex` module must be installed if calling `Lark(regex=True)`.') - else: - re_module = re - - ## - - if self.options.source_path is None: - try: - self.source_path = grammar.name - except AttributeError: - self.source_path = '' - else: - self.source_path = self.options.source_path - - ## - - try: - read = grammar.read - except AttributeError: - pass - else: - grammar = read() - - assert isinstance(grammar, STRING_TYPE) - self.source_grammar = grammar - if self.options.use_bytes: - if not isascii(grammar): - raise ValueError("Grammar must be ascii only, when use_bytes=True") - - cache_fn = None - if self.options.cache: - if self.options.parser != 'lalr': - raise NotImplementedError("cache only works with parser='lalr' for now") - if isinstance(self.options.cache, STRING_TYPE): - cache_fn = self.options.cache - else: - if self.options.cache is not True: - raise ValueError("cache argument must be bool or str") - unhashable = ('transformer', 'postlex', 'lexer_callbacks', 'edit_terminals') - from . import __version__ - options_str = ''.join(k+str(v) for k, v in options.items() if k not in unhashable) - s = grammar + options_str + __version__ - md5 = hashlib.md5(s.encode()).hexdigest() - cache_fn = tempfile.gettempdir() + '/.lark_cache_%s.tmp' % md5 - - if FS.exists(cache_fn): - logger.debug('Loading grammar from cache: %s', cache_fn) - ## - - for name in (set(options) - _LOAD_ALLOWED_OPTIONS): - del options[name] - with FS.open(cache_fn, 'rb') as f: - self._load(f, **options) - return - - if self.options.lexer == 'auto': - if self.options.parser == 'lalr': - self.options.lexer = 'contextual' - elif self.options.parser == 'earley': - self.options.lexer = 'dynamic' - elif self.options.parser == 'cyk': - self.options.lexer = 'standard' - else: - assert False, self.options.parser - lexer = self.options.lexer - assert lexer in ('standard', 'contextual', 'dynamic', 'dynamic_complete') or issubclass(lexer, Lexer) - - if self.options.ambiguity == 'auto': - if self.options.parser == 'earley': - self.options.ambiguity = 'resolve' - else: - disambig_parsers = ['earley', 'cyk'] - assert self.options.parser in disambig_parsers, ( - 'Only %s supports disambiguation right now') % ', '.join(disambig_parsers) - - if self.options.priority == 'auto': - self.options.priority = 'normal' - - if self.options.priority not in _VALID_PRIORITY_OPTIONS: - raise ValueError("invalid priority option: %r. Must be one of %r" % (self.options.priority, _VALID_PRIORITY_OPTIONS)) - assert self.options.ambiguity not in ('resolve__antiscore_sum', ), 'resolve__antiscore_sum has been replaced with the option priority="invert"' - if self.options.ambiguity not in _VALID_AMBIGUITY_OPTIONS: - raise ValueError("invalid ambiguity option: %r. Must be one of %r" % (self.options.ambiguity, _VALID_AMBIGUITY_OPTIONS)) - - ## - - self.grammar = load_grammar(grammar, self.source_path, self.options.import_paths, self.options.keep_all_tokens) - - if self.options.postlex is not None: - terminals_to_keep = set(self.options.postlex.always_accept) - else: - terminals_to_keep = set() - - ## - - self.terminals, self.rules, self.ignore_tokens = self.grammar.compile(self.options.start, terminals_to_keep) - - if self.options.edit_terminals: - for t in self.terminals: - self.options.edit_terminals(t) - - self._terminals_dict = {t.name: t for t in self.terminals} - - ## - - ## - - if self.options.priority == 'invert': - for rule in self.rules: - if rule.options.priority is not None: - rule.options.priority = -rule.options.priority - ## - - ## - - ## - - elif self.options.priority is None: - for rule in self.rules: - if rule.options.priority is not None: - rule.options.priority = None - - ## - - lexer_callbacks = (_get_lexer_callbacks(self.options.transformer, self.terminals) - if self.options.transformer - else {}) - lexer_callbacks.update(self.options.lexer_callbacks) - - self.lexer_conf = LexerConf(self.terminals, re_module, self.ignore_tokens, self.options.postlex, lexer_callbacks, self.options.g_regex_flags, use_bytes=self.options.use_bytes) - - if self.options.parser: - self.parser = self._build_parser() - elif lexer: - self.lexer = self._build_lexer() - - if cache_fn: - logger.debug('Saving grammar to cache: %s', cache_fn) - with FS.open(cache_fn, 'wb') as f: - self.save(f) - - if __doc__: - __doc__ += "\n\n" + LarkOptions.OPTIONS_DOC - - __serialize_fields__ = 'parser', 'rules', 'options' - - def _build_lexer(self): - return TraditionalLexer(self.lexer_conf) - - def _prepare_callbacks(self): - self.parser_class = get_frontend(self.options.parser, self.options.lexer) - self._callbacks = None - ## - - if self.options.ambiguity != 'forest': - self._parse_tree_builder = ParseTreeBuilder( - self.rules, - self.options.tree_class or Tree, - self.options.propagate_positions, - self.options.parser != 'lalr' and self.options.ambiguity == 'explicit', - self.options.maybe_placeholders - ) - self._callbacks = self._parse_tree_builder.create_callback(self.options.transformer) - - def _build_parser(self): - self._prepare_callbacks() - parser_conf = ParserConf(self.rules, self._callbacks, self.options.start) - return self.parser_class(self.lexer_conf, parser_conf, options=self.options) - - def save(self, f): - #-- - data, m = self.memo_serialize([TerminalDef, Rule]) - pickle.dump({'data': data, 'memo': m}, f, protocol=pickle.HIGHEST_PROTOCOL) - - @classmethod - def load(cls, f): - #-- - inst = cls.__new__(cls) - return inst._load(f) - - def _load(self, f, **kwargs): - if isinstance(f, dict): - d = f - else: - d = pickle.load(f) - memo = d['memo'] - data = d['data'] - - assert memo - memo = SerializeMemoizer.deserialize(memo, {'Rule': Rule, 'TerminalDef': TerminalDef}, {}) - options = dict(data['options']) - if (set(kwargs) - _LOAD_ALLOWED_OPTIONS) & set(LarkOptions._defaults): - raise ValueError("Some options are not allowed when loading a Parser: {}" - .format(set(kwargs) - _LOAD_ALLOWED_OPTIONS)) - options.update(kwargs) - self.options = LarkOptions.deserialize(options, memo) - self.rules = [Rule.deserialize(r, memo) for r in data['rules']] - self.source_path = '' - self._prepare_callbacks() - self.parser = self.parser_class.deserialize( - data['parser'], - memo, - self._callbacks, - self.options, ## - - ) - self.terminals = self.parser.lexer_conf.tokens - self._terminals_dict = {t.name: t for t in self.terminals} - return self - - @classmethod - def _load_from_dict(cls, data, memo, **kwargs): - inst = cls.__new__(cls) - return inst._load({'data': data, 'memo': memo}, **kwargs) - - @classmethod - def open(cls, grammar_filename, rel_to=None, **options): - #-- - if rel_to: - basepath = os.path.dirname(rel_to) - grammar_filename = os.path.join(basepath, grammar_filename) - with open(grammar_filename, encoding='utf8') as f: - return cls(f, **options) - - @classmethod - def open_from_package(cls, package, grammar_path, search_paths=("",), **options): - #-- - package = FromPackageLoader(package, search_paths) - full_path, text = package(None, grammar_path) - options.setdefault('source_path', full_path) - options.setdefault('import_paths', []) - options['import_paths'].append(package) - return cls(text, **options) - - def __repr__(self): - return 'Lark(open(%r), parser=%r, lexer=%r, ...)' % (self.source_path, self.options.parser, self.options.lexer) - - - def lex(self, text): - #-- - if not hasattr(self, 'lexer'): - self.lexer = self._build_lexer() - stream = self.lexer.lex(text) - if self.options.postlex: - return self.options.postlex.process(stream) - return stream - - def get_terminal(self, name): - #-- - return self._terminals_dict[name] - - def parse(self, text, start=None, on_error=None): - #-- - - try: - return self.parser.parse(text, start=start) - except UnexpectedInput as e: - if on_error is None: - raise - - while True: - if isinstance(e, UnexpectedCharacters): - s = e.puppet.lexer_state.state - p = s.line_ctr.char_pos - - if not on_error(e): - raise e - - if isinstance(e, UnexpectedCharacters): - ## - - if p == s.line_ctr.char_pos: - s.line_ctr.feed(s.text[p:p+1]) - - try: - return e.puppet.resume_parse() - except UnexpectedToken as e2: - if isinstance(e, UnexpectedToken) and e.token.type == e2.token.type == '$END' and e.puppet == e2.puppet: - ## - - raise e2 - e = e2 - except UnexpectedCharacters as e2: - e = e2 - - @property - def source(self): - warn("Lark.source attribute has been renamed to Lark.source_path", DeprecationWarning) - return self.source_path - - @source.setter - def source(self, value): - self.source_path = value - - @property - def grammar_source(self): - warn("Lark.grammar_source attribute has been renamed to Lark.source_grammar", DeprecationWarning) - return self.source_grammar - - @grammar_source.setter - def grammar_source(self, value): - self.source_grammar = value - - - -import pickle, zlib, base64 -DATA = ( -{'parser': {'parser': {'tokens': {0: 'RSQB', 1: 'COMMA', 2: 'option_parm', 3: 'option_highlevel', 4: 'VAR', 5: 'record_highlevel', 6: 'predefined_typestr', 7: 'LPAR', 8: 'LSQB', 9: 'record_tuple', 10: 'UNKNOWN', 11: 'HARDCODED', 12: 'UNQUOTED_STRING', 13: 'listtype', 14: 'input', 15: 'list_single', 16: 'UNION', 17: 'STRUCT', 18: 'option_single', 19: 'QMARK', 20: 'regular_outparm', 21: 'union_parm', 22: 'regular_inparm', 23: 'LBRACE', 24: 'uniontype', 25: 'TUPLE', 26: 'TYPE', 27: 'record', 28: 'unknown', 29: 'list_parm', 30: 'optiontype', 31: 'union_single', 32: 'CATEGORICAL', 33: 'record_dict', 34: 'categories', 35: 'regular', 36: 'number', 37: 'OPTION', 38: 'record_tuple_param', 39: 'record_struct', 40: 'SIGNED_NUMBER', 41: 'primitive', 42: 'PARAMETERS', 43: 'def_option', 44: '$END', 45: 'RBRACE', 46: 'RPAR', 47: 'STAR', 48: '__union_single_star_0', 49: 'start', 50: '__record_struct_star_2', 51: 'COLON', 52: '__ANON_1', 53: 'string', 54: 'options', 55: '__record_dict_star_1', 56: 'TRUE', 57: 'NULL', 58: 'list_obj', 59: 'FALSE', 60: 'dict_obj', 61: 'json', 62: '__list_obj_star_3', 63: 'pair', 64: '__ANON_0', 65: '__dict_obj_star_4', 66: 'EQUAL'}, 'states': {0: {0: (1, {'@': 29}), 1: (1, {'@': 29})}, 1: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 7: (0, 90), 8: (0, 85), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 14: (0, 163), 15: (0, 162), 16: (0, 146), 17: (0, 192), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 37: (0, 23), 38: (0, 74), 39: (0, 8), 40: (0, 30), 41: (0, 48)}, 2: {1: (0, 3)}, 3: {42: (0, 193), 43: (0, 113)}, 4: {0: (1, {'@': 30}), 1: (1, {'@': 30}), 44: (1, {'@': 30}), 45: (1, {'@': 30}), 8: (1, {'@': 30}), 46: (1, {'@': 30})}, 5: {47: (0, 182)}, 6: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 7: (0, 90), 8: (0, 85), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 16: (0, 146), 17: (0, 192), 14: (0, 13), 19: (0, 142), 18: (0, 143), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 37: (0, 23), 38: (0, 74), 39: (0, 8), 40: (0, 30), 41: (0, 48)}, 7: {8: (0, 101)}, 8: {0: (1, {'@': 31}), 1: (1, {'@': 31}), 44: (1, {'@': 31}), 45: (1, {'@': 31}), 8: (1, {'@': 31}), 46: (1, {'@': 31})}, 9: {0: (1, {'@': 32}), 1: (1, {'@': 32}), 44: (1, {'@': 32}), 45: (1, {'@': 32}), 8: (1, {'@': 32}), 46: (1, {'@': 32})}, 10: {0: (0, 77), 1: (0, 179)}, 11: {42: (0, 193), 43: (0, 93)}, 12: {45: (1, {'@': 33}), 1: (1, {'@': 33})}, 13: {48: (0, 10), 1: (0, 164), 0: (0, 83)}, 14: {45: (1, {'@': 34}), 1: (1, {'@': 34})}, 15: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 7: (0, 90), 8: (0, 85), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 16: (0, 146), 17: (0, 192), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 14: (0, 153), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 37: (0, 23), 49: (0, 65), 38: (0, 74), 39: (0, 8), 40: (0, 30), 41: (0, 48)}, 16: {0: (1, {'@': 35}), 1: (1, {'@': 35}), 44: (1, {'@': 35}), 45: (1, {'@': 35}), 8: (1, {'@': 35}), 46: (1, {'@': 35})}, 17: {0: (1, {'@': 36}), 1: (1, {'@': 36}), 44: (1, {'@': 36}), 45: (1, {'@': 36}), 8: (1, {'@': 36}), 46: (1, {'@': 36})}, 18: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 7: (0, 90), 8: (0, 85), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 16: (0, 146), 17: (0, 192), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 14: (0, 72), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 37: (0, 23), 38: (0, 74), 39: (0, 8), 40: (0, 30), 41: (0, 48)}, 19: {0: (1, {'@': 37}), 1: (1, {'@': 37}), 44: (1, {'@': 37}), 45: (1, {'@': 37}), 8: (1, {'@': 37}), 46: (1, {'@': 37})}, 20: {45: (1, {'@': 38}), 1: (1, {'@': 38}), 0: (1, {'@': 38})}, 21: {0: (0, 75), 1: (0, 33), 50: (0, 104)}, 22: {0: (1, {'@': 39}), 1: (1, {'@': 39}), 44: (1, {'@': 39}), 45: (1, {'@': 39}), 8: (1, {'@': 39}), 46: (1, {'@': 39})}, 23: {8: (0, 1)}, 24: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 7: (0, 90), 8: (0, 85), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 16: (0, 146), 17: (0, 192), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 14: (0, 145), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 37: (0, 23), 38: (0, 74), 39: (0, 8), 40: (0, 30), 41: (0, 48)}, 25: {0: (1, {'@': 40}), 1: (1, {'@': 40}), 44: (1, {'@': 40}), 45: (1, {'@': 40}), 8: (1, {'@': 40}), 46: (1, {'@': 40})}, 26: {0: (1, {'@': 41}), 1: (1, {'@': 41}), 44: (1, {'@': 41}), 45: (1, {'@': 41}), 8: (1, {'@': 41}), 46: (1, {'@': 41})}, 27: {51: (0, 140)}, 28: {0: (1, {'@': 42}), 1: (1, {'@': 42}), 45: (1, {'@': 42})}, 29: {0: (1, {'@': 43}), 1: (1, {'@': 43}), 44: (1, {'@': 43}), 45: (1, {'@': 43}), 8: (1, {'@': 43}), 46: (1, {'@': 43})}, 30: {47: (1, {'@': 44}), 0: (1, {'@': 44}), 1: (1, {'@': 44}), 45: (1, {'@': 44})}, 31: {0: (0, 107)}, 32: {0: (1, {'@': 45}), 1: (1, {'@': 45}), 45: (1, {'@': 45})}, 33: {52: (0, 61), 53: (0, 67)}, 34: {0: (1, {'@': 46}), 1: (1, {'@': 46}), 45: (1, {'@': 46})}, 35: {54: (0, 118), 8: (0, 183), 0: (1, {'@': 47}), 1: (1, {'@': 47}), 44: (1, {'@': 47}), 45: (1, {'@': 47}), 46: (1, {'@': 47})}, 36: {8: (0, 18)}, 37: {55: (0, 81), 45: (0, 45), 1: (0, 115)}, 38: {0: (1, {'@': 48}), 1: (1, {'@': 48}), 44: (1, {'@': 48}), 45: (1, {'@': 48}), 8: (1, {'@': 48}), 46: (1, {'@': 48})}, 39: {0: (1, {'@': 49}), 1: (1, {'@': 49}), 45: (1, {'@': 49})}, 40: {51: (0, 68)}, 41: {0: (0, 43)}, 42: {0: (1, {'@': 50}), 1: (1, {'@': 50}), 45: (1, {'@': 50})}, 43: {0: (1, {'@': 51}), 1: (1, {'@': 51}), 44: (1, {'@': 51}), 45: (1, {'@': 51}), 8: (1, {'@': 51}), 46: (1, {'@': 51})}, 44: {0: (1, {'@': 52}), 1: (1, {'@': 52}), 45: (1, {'@': 52})}, 45: {0: (1, {'@': 53}), 1: (1, {'@': 53}), 44: (1, {'@': 53}), 45: (1, {'@': 53}), 8: (1, {'@': 53}), 46: (1, {'@': 53})}, 46: {0: (1, {'@': 54}), 1: (1, {'@': 54})}, 47: {0: (1, {'@': 55}), 1: (1, {'@': 55}), 44: (1, {'@': 55}), 45: (1, {'@': 55}), 8: (1, {'@': 55}), 46: (1, {'@': 55})}, 48: {0: (1, {'@': 56}), 1: (1, {'@': 56}), 44: (1, {'@': 56}), 45: (1, {'@': 56}), 8: (1, {'@': 56}), 46: (1, {'@': 56})}, 49: {1: (0, 98)}, 50: {23: (0, 173), 56: (0, 66), 57: (0, 34), 58: (0, 42), 59: (0, 121), 60: (0, 39), 8: (0, 125), 61: (0, 46), 52: (0, 61), 53: (0, 100), 36: (0, 28), 40: (0, 30)}, 51: {47: (0, 122)}, 52: {8: (0, 6)}, 53: {0: (1, {'@': 57}), 1: (1, {'@': 57}), 44: (1, {'@': 57}), 45: (1, {'@': 57}), 8: (1, {'@': 57}), 46: (1, {'@': 57})}, 54: {23: (0, 173), 56: (0, 66), 61: (0, 12), 57: (0, 34), 58: (0, 42), 59: (0, 121), 60: (0, 39), 8: (0, 125), 52: (0, 61), 53: (0, 100), 36: (0, 28), 40: (0, 30)}, 55: {47: (0, 24)}, 56: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 7: (0, 90), 8: (0, 85), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 16: (0, 146), 17: (0, 192), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 14: (0, 37), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 37: (0, 23), 38: (0, 74), 39: (0, 8), 40: (0, 30), 41: (0, 48)}, 57: {53: (0, 27), 52: (0, 61)}, 58: {0: (1, {'@': 58}), 1: (1, {'@': 58}), 45: (1, {'@': 58})}, 59: {0: (1, {'@': 59}), 1: (1, {'@': 59}), 44: (1, {'@': 59}), 45: (1, {'@': 59}), 8: (1, {'@': 59}), 46: (1, {'@': 59})}, 60: {53: (0, 88), 52: (0, 61)}, 61: {0: (1, {'@': 60}), 1: (1, {'@': 60}), 45: (1, {'@': 60}), 51: (1, {'@': 60})}, 62: {0: (1, {'@': 61}), 1: (1, {'@': 61}), 44: (1, {'@': 61}), 45: (1, {'@': 61}), 8: (1, {'@': 61}), 46: (1, {'@': 61})}, 63: {62: (0, 117), 1: (0, 50), 0: (0, 44)}, 64: {48: (0, 160), 1: (0, 164), 46: (0, 167)}, 65: {}, 66: {0: (1, {'@': 62}), 1: (1, {'@': 62}), 45: (1, {'@': 62})}, 67: {0: (1, {'@': 63}), 1: (1, {'@': 63})}, 68: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 7: (0, 90), 8: (0, 85), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 16: (0, 146), 17: (0, 192), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 37: (0, 23), 38: (0, 74), 39: (0, 8), 40: (0, 30), 14: (0, 20), 41: (0, 48)}, 69: {0: (0, 59)}, 70: {45: (1, {'@': 64}), 1: (1, {'@': 64})}, 71: {0: (1, {'@': 65}), 1: (1, {'@': 65}), 44: (1, {'@': 65}), 45: (1, {'@': 65}), 8: (1, {'@': 65}), 46: (1, {'@': 65})}, 72: {48: (0, 186), 1: (0, 164), 0: (0, 82)}, 73: {0: (1, {'@': 66}), 1: (1, {'@': 66}), 45: (1, {'@': 66})}, 74: {0: (1, {'@': 67}), 1: (1, {'@': 67}), 44: (1, {'@': 67}), 45: (1, {'@': 67}), 8: (1, {'@': 67}), 46: (1, {'@': 67})}, 75: {1: (0, 52)}, 76: {0: (1, {'@': 68}), 1: (1, {'@': 68}), 44: (1, {'@': 68}), 45: (1, {'@': 68}), 8: (1, {'@': 68}), 46: (1, {'@': 68})}, 77: {1: (0, 169)}, 78: {51: (0, 56)}, 79: {42: (0, 193), 43: (0, 41)}, 80: {0: (1, {'@': 69}), 1: (1, {'@': 69}), 44: (1, {'@': 69}), 45: (1, {'@': 69}), 8: (1, {'@': 69}), 46: (1, {'@': 69})}, 81: {45: (0, 99), 1: (0, 57)}, 82: {1: (0, 79)}, 83: {1: (0, 94)}, 84: {0: (0, 138), 1: (0, 179)}, 85: {36: (0, 110), 40: (0, 30), 4: (0, 5)}, 86: {0: (1, {'@': 70}), 1: (1, {'@': 70}), 44: (1, {'@': 70}), 45: (1, {'@': 70}), 8: (1, {'@': 70}), 46: (1, {'@': 70})}, 87: {0: (0, 123), 55: (0, 106), 1: (0, 115)}, 88: {0: (1, {'@': 71}), 1: (1, {'@': 71})}, 89: {0: (1, {'@': 72}), 1: (1, {'@': 72}), 44: (1, {'@': 72}), 45: (1, {'@': 72}), 8: (1, {'@': 72}), 46: (1, {'@': 72})}, 90: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 14: (0, 64), 7: (0, 90), 8: (0, 85), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 16: (0, 146), 17: (0, 192), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 37: (0, 23), 38: (0, 74), 39: (0, 8), 40: (0, 30), 41: (0, 48)}, 91: {8: (0, 170)}, 92: {48: (0, 84), 1: (0, 164), 0: (0, 156)}, 93: {0: (0, 62)}, 94: {42: (0, 193), 43: (0, 189)}, 95: {54: (0, 26), 8: (0, 183), 0: (1, {'@': 73}), 1: (1, {'@': 73}), 44: (1, {'@': 73}), 45: (1, {'@': 73}), 46: (1, {'@': 73})}, 96: {0: (0, 71)}, 97: {63: (0, 14), 53: (0, 102), 52: (0, 61)}, 98: {8: (0, 181)}, 99: {0: (1, {'@': 74}), 1: (1, {'@': 74}), 44: (1, {'@': 74}), 45: (1, {'@': 74}), 8: (1, {'@': 74}), 46: (1, {'@': 74})}, 100: {0: (1, {'@': 75}), 1: (1, {'@': 75}), 45: (1, {'@': 75})}, 101: {64: (0, 126)}, 102: {51: (0, 54)}, 103: {0: (0, 89)}, 104: {0: (0, 49), 1: (0, 60)}, 105: {0: (1, {'@': 76})}, 106: {0: (0, 168), 1: (0, 57)}, 107: {0: (1, {'@': 77}), 1: (1, {'@': 77}), 44: (1, {'@': 77}), 45: (1, {'@': 77}), 8: (1, {'@': 77}), 46: (1, {'@': 77})}, 108: {0: (1, {'@': 78}), 1: (1, {'@': 78}), 44: (1, {'@': 78}), 45: (1, {'@': 78}), 8: (1, {'@': 78}), 46: (1, {'@': 78})}, 109: {0: (0, 9)}, 110: {47: (0, 161)}, 111: {42: (0, 193), 43: (0, 109)}, 112: {52: (0, 61), 63: (0, 70), 53: (0, 102)}, 113: {0: (0, 185)}, 114: {0: (1, {'@': 79}), 1: (1, {'@': 79}), 44: (1, {'@': 79}), 45: (1, {'@': 79}), 8: (1, {'@': 79}), 46: (1, {'@': 79})}, 115: {53: (0, 40), 52: (0, 61)}, 116: {1: (0, 112), 65: (0, 120), 45: (0, 73)}, 117: {0: (0, 137), 1: (0, 174)}, 118: {0: (1, {'@': 80}), 1: (1, {'@': 80}), 44: (1, {'@': 80}), 45: (1, {'@': 80}), 8: (1, {'@': 80}), 46: (1, {'@': 80})}, 119: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 7: (0, 90), 8: (0, 85), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 14: (0, 159), 16: (0, 146), 17: (0, 192), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 43: (0, 31), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 37: (0, 23), 38: (0, 74), 39: (0, 8), 40: (0, 30), 42: (0, 193), 41: (0, 48)}, 120: {45: (0, 58), 1: (0, 97)}, 121: {0: (1, {'@': 81}), 1: (1, {'@': 81}), 45: (1, {'@': 81})}, 122: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 14: (0, 154), 7: (0, 90), 8: (0, 85), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 16: (0, 146), 17: (0, 192), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 37: (0, 23), 38: (0, 74), 39: (0, 8), 40: (0, 30), 41: (0, 48)}, 123: {0: (1, {'@': 82}), 1: (1, {'@': 82}), 44: (1, {'@': 82}), 45: (1, {'@': 82}), 8: (1, {'@': 82}), 46: (1, {'@': 82})}, 124: {0: (1, {'@': 83}), 1: (1, {'@': 83}), 45: (1, {'@': 83})}, 125: {23: (0, 173), 61: (0, 63), 56: (0, 66), 57: (0, 34), 58: (0, 42), 59: (0, 121), 0: (0, 32), 60: (0, 39), 8: (0, 125), 52: (0, 61), 53: (0, 100), 36: (0, 28), 40: (0, 30)}, 126: {66: (0, 166)}, 127: {42: (0, 193), 43: (0, 96)}, 128: {0: (0, 150)}, 129: {54: (0, 108), 8: (0, 183), 0: (1, {'@': 84}), 1: (1, {'@': 84}), 44: (1, {'@': 84}), 45: (1, {'@': 84}), 46: (1, {'@': 84})}, 130: {42: (0, 193), 43: (0, 69)}, 131: {42: (0, 193), 43: (0, 103)}, 132: {0: (1, {'@': 85}), 1: (1, {'@': 85}), 44: (1, {'@': 85}), 45: (1, {'@': 85}), 8: (1, {'@': 85}), 46: (1, {'@': 85})}, 133: {23: (0, 173), 60: (0, 105)}, 134: {0: (0, 76)}, 135: {0: (1, {'@': 86}), 1: (1, {'@': 86}), 44: (1, {'@': 86}), 45: (1, {'@': 86}), 8: (1, {'@': 86}), 46: (1, {'@': 86})}, 136: {8: (0, 155)}, 137: {0: (1, {'@': 87}), 1: (1, {'@': 87}), 45: (1, {'@': 87})}, 138: {1: (0, 131)}, 139: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 7: (0, 90), 8: (0, 85), 14: (0, 87), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 16: (0, 146), 17: (0, 192), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 37: (0, 23), 38: (0, 74), 39: (0, 8), 40: (0, 30), 41: (0, 48)}, 140: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 7: (0, 90), 8: (0, 85), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 16: (0, 146), 14: (0, 157), 17: (0, 192), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 37: (0, 23), 38: (0, 74), 39: (0, 8), 40: (0, 30), 41: (0, 48)}, 141: {0: (1, {'@': 88}), 1: (1, {'@': 88}), 44: (1, {'@': 88}), 45: (1, {'@': 88}), 8: (1, {'@': 88}), 46: (1, {'@': 88})}, 142: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 14: (0, 95), 7: (0, 90), 8: (0, 85), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 16: (0, 146), 17: (0, 192), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 37: (0, 23), 38: (0, 74), 39: (0, 8), 40: (0, 30), 41: (0, 48)}, 143: {0: (1, {'@': 89}), 1: (1, {'@': 89}), 44: (1, {'@': 89}), 45: (1, {'@': 89}), 8: (1, {'@': 89}), 46: (1, {'@': 89})}, 144: {1: (0, 11)}, 145: {0: (1, {'@': 90}), 1: (1, {'@': 90}), 44: (1, {'@': 90}), 45: (1, {'@': 90}), 8: (1, {'@': 90}), 46: (1, {'@': 90})}, 146: {8: (0, 191)}, 147: {0: (1, {'@': 91}), 1: (1, {'@': 91}), 44: (1, {'@': 91}), 45: (1, {'@': 91}), 8: (1, {'@': 91}), 46: (1, {'@': 91})}, 148: {1: (0, 111)}, 149: {0: (1, {'@': 92}), 1: (1, {'@': 92}), 44: (1, {'@': 92}), 45: (1, {'@': 92}), 8: (1, {'@': 92}), 46: (1, {'@': 92})}, 150: {0: (1, {'@': 93}), 1: (1, {'@': 93}), 44: (1, {'@': 93}), 45: (1, {'@': 93}), 8: (1, {'@': 93}), 46: (1, {'@': 93})}, 151: {0: (1, {'@': 94}), 1: (1, {'@': 94}), 44: (1, {'@': 94}), 45: (1, {'@': 94}), 8: (1, {'@': 94}), 46: (1, {'@': 94})}, 152: {1: (0, 171), 48: (0, 180), 0: (0, 184)}, 153: {44: (1, {'@': 95})}, 154: {0: (1, {'@': 96}), 1: (1, {'@': 96}), 44: (1, {'@': 96}), 45: (1, {'@': 96}), 8: (1, {'@': 96}), 46: (1, {'@': 96})}, 155: {52: (0, 61), 53: (0, 190)}, 156: {1: (0, 130)}, 157: {45: (1, {'@': 97}), 1: (1, {'@': 97}), 0: (1, {'@': 97})}, 158: {0: (1, {'@': 98}), 1: (1, {'@': 98}), 44: (1, {'@': 98}), 45: (1, {'@': 98}), 8: (1, {'@': 98}), 46: (1, {'@': 98})}, 159: {0: (1, {'@': 99}), 1: (1, {'@': 99}), 46: (1, {'@': 99})}, 160: {46: (0, 177), 1: (0, 179)}, 161: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 7: (0, 90), 8: (0, 85), 14: (0, 148), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 16: (0, 146), 17: (0, 192), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 37: (0, 23), 38: (0, 74), 39: (0, 8), 40: (0, 30), 41: (0, 48)}, 162: {0: (1, {'@': 100}), 1: (1, {'@': 100}), 44: (1, {'@': 100}), 45: (1, {'@': 100}), 8: (1, {'@': 100}), 46: (1, {'@': 100})}, 163: {0: (0, 178), 1: (0, 127)}, 164: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 7: (0, 90), 8: (0, 85), 37: (0, 23), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 16: (0, 146), 17: (0, 192), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 38: (0, 74), 39: (0, 8), 40: (0, 30), 14: (0, 187), 41: (0, 48)}, 165: {44: (1, {'@': 101}), 8: (1, {'@': 101}), 46: (1, {'@': 101}), 1: (1, {'@': 101}), 45: (1, {'@': 101}), 0: (1, {'@': 101})}, 166: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 7: (0, 90), 8: (0, 85), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 16: (0, 146), 17: (0, 192), 14: (0, 176), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 37: (0, 23), 38: (0, 74), 39: (0, 8), 40: (0, 30), 41: (0, 48)}, 167: {0: (1, {'@': 102}), 1: (1, {'@': 102}), 44: (1, {'@': 102}), 45: (1, {'@': 102}), 8: (1, {'@': 102}), 46: (1, {'@': 102})}, 168: {0: (1, {'@': 103}), 1: (1, {'@': 103}), 44: (1, {'@': 103}), 45: (1, {'@': 103}), 8: (1, {'@': 103}), 46: (1, {'@': 103})}, 169: {42: (0, 193), 43: (0, 128)}, 170: {53: (0, 21), 52: (0, 61)}, 171: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 7: (0, 90), 8: (0, 85), 37: (0, 23), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 16: (0, 146), 17: (0, 192), 43: (0, 134), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 38: (0, 74), 39: (0, 8), 40: (0, 30), 42: (0, 193), 14: (0, 187), 41: (0, 48)}, 172: {0: (1, {'@': 104}), 1: (1, {'@': 104}), 44: (1, {'@': 104}), 45: (1, {'@': 104}), 8: (1, {'@': 104}), 46: (1, {'@': 104})}, 173: {63: (0, 116), 52: (0, 61), 53: (0, 102), 45: (0, 124)}, 174: {23: (0, 173), 56: (0, 66), 61: (0, 0), 57: (0, 34), 58: (0, 42), 59: (0, 121), 60: (0, 39), 8: (0, 125), 52: (0, 61), 53: (0, 100), 36: (0, 28), 40: (0, 30)}, 175: {8: (0, 36)}, 176: {0: (0, 188)}, 177: {0: (1, {'@': 105}), 1: (1, {'@': 105}), 44: (1, {'@': 105}), 45: (1, {'@': 105}), 8: (1, {'@': 105}), 46: (1, {'@': 105})}, 178: {0: (1, {'@': 106}), 1: (1, {'@': 106}), 44: (1, {'@': 106}), 45: (1, {'@': 106}), 8: (1, {'@': 106}), 46: (1, {'@': 106})}, 179: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 7: (0, 90), 8: (0, 85), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 14: (0, 159), 16: (0, 146), 17: (0, 192), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 37: (0, 23), 38: (0, 74), 39: (0, 8), 40: (0, 30), 41: (0, 48)}, 180: {1: (0, 119), 0: (0, 4)}, 181: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 7: (0, 90), 8: (0, 85), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 16: (0, 146), 17: (0, 192), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 14: (0, 92), 34: (0, 17), 35: (0, 16), 36: (0, 51), 37: (0, 23), 38: (0, 74), 39: (0, 8), 40: (0, 30), 41: (0, 48)}, 182: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 7: (0, 90), 8: (0, 85), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 16: (0, 146), 17: (0, 192), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 14: (0, 144), 37: (0, 23), 38: (0, 74), 39: (0, 8), 40: (0, 30), 41: (0, 48)}, 183: {42: (0, 193), 43: (0, 194)}, 184: {0: (1, {'@': 107}), 1: (1, {'@': 107}), 44: (1, {'@': 107}), 45: (1, {'@': 107}), 8: (1, {'@': 107}), 46: (1, {'@': 107})}, 185: {0: (1, {'@': 108}), 1: (1, {'@': 108}), 44: (1, {'@': 108}), 45: (1, {'@': 108}), 8: (1, {'@': 108}), 46: (1, {'@': 108})}, 186: {0: (0, 2), 1: (0, 179)}, 187: {0: (1, {'@': 109}), 1: (1, {'@': 109}), 46: (1, {'@': 109})}, 188: {0: (1, {'@': 110}), 1: (1, {'@': 110}), 44: (1, {'@': 110}), 45: (1, {'@': 110}), 8: (1, {'@': 110}), 46: (1, {'@': 110})}, 189: {0: (0, 149)}, 190: {51: (0, 139)}, 191: {2: (0, 22), 3: (0, 47), 4: (0, 55), 5: (0, 29), 6: (0, 114), 7: (0, 90), 8: (0, 85), 9: (0, 38), 10: (0, 35), 11: (0, 151), 12: (0, 136), 13: (0, 158), 15: (0, 162), 16: (0, 146), 17: (0, 192), 18: (0, 143), 19: (0, 142), 20: (0, 147), 21: (0, 132), 22: (0, 141), 23: (0, 195), 24: (0, 172), 25: (0, 175), 26: (0, 129), 14: (0, 152), 27: (0, 135), 28: (0, 86), 29: (0, 25), 30: (0, 19), 31: (0, 80), 32: (0, 7), 33: (0, 53), 34: (0, 17), 35: (0, 16), 36: (0, 51), 37: (0, 23), 38: (0, 74), 39: (0, 8), 40: (0, 30), 41: (0, 48)}, 192: {8: (0, 91)}, 193: {66: (0, 133)}, 194: {0: (0, 165)}, 195: {52: (0, 61), 53: (0, 78)}}, 'start_states': {'start': 15}, 'end_states': {'start': 65}}, 'lexer_conf': {'tokens': [{'@': 0}, {'@': 1}, {'@': 2}, {'@': 3}, {'@': 4}, {'@': 5}, {'@': 6}, {'@': 7}, {'@': 8}, {'@': 9}, {'@': 10}, {'@': 11}, {'@': 12}, {'@': 13}, {'@': 14}, {'@': 15}, {'@': 16}, {'@': 17}, {'@': 18}, {'@': 19}, {'@': 20}, {'@': 21}, {'@': 22}, {'@': 23}, {'@': 24}, {'@': 25}, {'@': 26}, {'@': 27}, {'@': 28}], 'ignore': ['WS'], 'g_regex_flags': 0, 'use_bytes': False, '__type__': 'LexerConf'}, 'start': ['start'], '__type__': 'LALR_ContextualLexer'}, 'rules': [{'@': 95}, {'@': 86}, {'@': 70}, {'@': 56}, {'@': 37}, {'@': 35}, {'@': 98}, {'@': 104}, {'@': 79}, {'@': 36}, {'@': 48}, {'@': 67}, {'@': 57}, {'@': 31}, {'@': 43}, {'@': 78}, {'@': 84}, {'@': 80}, {'@': 47}, {'@': 89}, {'@': 39}, {'@': 55}, {'@': 88}, {'@': 91}, {'@': 100}, {'@': 40}, {'@': 69}, {'@': 85}, {'@': 110}, {'@': 94}, {'@': 41}, {'@': 73}, {'@': 65}, {'@': 106}, {'@': 30}, {'@': 107}, {'@': 77}, {'@': 68}, {'@': 61}, {'@': 90}, {'@': 105}, {'@': 102}, {'@': 108}, {'@': 51}, {'@': 74}, {'@': 53}, {'@': 72}, {'@': 59}, {'@': 93}, {'@': 92}, {'@': 103}, {'@': 82}, {'@': 96}, {'@': 32}, {'@': 101}, {'@': 76}, {'@': 49}, {'@': 50}, {'@': 75}, {'@': 42}, {'@': 62}, {'@': 81}, {'@': 46}, {'@': 87}, {'@': 52}, {'@': 45}, {'@': 58}, {'@': 66}, {'@': 83}, {'@': 33}, {'@': 60}, {'@': 44}, {'@': 109}, {'@': 111}, {'@': 99}, {'@': 112}, {'@': 38}, {'@': 113}, {'@': 97}, {'@': 114}, {'@': 63}, {'@': 115}, {'@': 71}, {'@': 116}, {'@': 54}, {'@': 29}, {'@': 64}, {'@': 34}], 'options': {'debug': False, 'keep_all_tokens': False, 'tree_class': None, 'cache': False, 'postlex': None, 'parser': 'lalr', 'lexer': 'contextual', 'transformer': None, 'start': ['start'], 'priority': 'normal', 'ambiguity': 'auto', 'regex': False, 'propagate_positions': False, 'lexer_callbacks': {}, 'maybe_placeholders': False, 'edit_terminals': None, 'g_regex_flags': 0, 'use_bytes': False, 'import_paths': [], 'source_path': None}, '__type__': 'Lark'} -) -MEMO = ( -{0: {'name': 'HARDCODED', 'pattern': {'value': '(?:(?:(?:string|char)|bytes)|byte)', 'flags': [], '_width': [4, 6], '__type__': 'PatternRE'}, 'priority': 1, '__type__': 'TerminalDef'}, 1: {'name': 'TYPE', 'pattern': {'value': '(?:(?:(?:(?:(?:(?:(?:(?:(?:(?:(?:(?:int8|int16)|int32)|int64)|int128)|uint8)|uint16)|uint32)|uint64)|uint128)|float32)|float64)|bool)', 'flags': [], '_width': [4, 7], '__type__': 'PatternRE'}, 'priority': 1, '__type__': 'TerminalDef'}, 2: {'name': 'UNQUOTED_STRING', 'pattern': {'value': '[a-zA-Z]+', 'flags': [], '_width': [1, 4294967295], '__type__': 'PatternRE'}, 'priority': -1, '__type__': 'TerminalDef'}, 3: {'name': 'SIGNED_NUMBER', 'pattern': {'value': '(?:(?:\\+|\\-))?(?:(?:(?:[0-9])+(?:e|E)(?:(?:\\+|\\-))?(?:[0-9])+|(?:(?:[0-9])+\\.(?:(?:[0-9])+)?|\\.(?:[0-9])+)(?:(?:e|E)(?:(?:\\+|\\-))?(?:[0-9])+)?)|(?:[0-9])+)', 'flags': [], '_width': [1, 4294967295], '__type__': 'PatternRE'}, 'priority': 1, '__type__': 'TerminalDef'}, 4: {'name': 'WS', 'pattern': {'value': '(?:[ \t\x0c\r\n])+', 'flags': [], '_width': [1, 4294967295], '__type__': 'PatternRE'}, 'priority': 1, '__type__': 'TerminalDef'}, 5: {'name': 'UNKNOWN', 'pattern': {'value': 'unknown', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 6: {'name': 'CATEGORICAL', 'pattern': {'value': 'categorical', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 7: {'name': 'LSQB', 'pattern': {'value': '[', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 8: {'name': '__ANON_0', 'pattern': {'value': 'type', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 9: {'name': 'EQUAL', 'pattern': {'value': '=', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 10: {'name': 'RSQB', 'pattern': {'value': ']', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 11: {'name': 'QMARK', 'pattern': {'value': '?', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 12: {'name': 'OPTION', 'pattern': {'value': 'option', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 13: {'name': 'COMMA', 'pattern': {'value': ',', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 14: {'name': 'UNION', 'pattern': {'value': 'union', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 15: {'name': 'VAR', 'pattern': {'value': 'var', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 16: {'name': 'STAR', 'pattern': {'value': '*', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 17: {'name': 'LPAR', 'pattern': {'value': '(', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 18: {'name': 'RPAR', 'pattern': {'value': ')', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 19: {'name': 'TUPLE', 'pattern': {'value': 'tuple', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 20: {'name': 'COLON', 'pattern': {'value': ':', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 21: {'name': 'LBRACE', 'pattern': {'value': '{', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 22: {'name': 'RBRACE', 'pattern': {'value': '}', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 23: {'name': 'STRUCT', 'pattern': {'value': 'struct', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 24: {'name': 'PARAMETERS', 'pattern': {'value': 'parameters', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 25: {'name': 'TRUE', 'pattern': {'value': 'true', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 26: {'name': 'FALSE', 'pattern': {'value': 'false', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 27: {'name': 'NULL', 'pattern': {'value': 'null', 'flags': [], '__type__': 'PatternStr'}, 'priority': 1, '__type__': 'TerminalDef'}, 28: {'name': '__ANON_1', 'pattern': {'value': '((?:"(?:[^"\n\r\\\\]|(?:\\\\u[0-9a-fA-F]{4})|(?:\\\\["bfnrt]))*")|(?:\\\\\\\'(?:[^\\\\\\\'\n\r\\\\]|(?:\\\\u[0-9a-fA-F]{4})|(?:\\\\[\\\'bfnrt]))*")*\\\\\\\')', 'flags': [], '_width': [2, 4294967295], '__type__': 'PatternRE'}, 'priority': 1, '__type__': 'TerminalDef'}, 29: {'origin': {'name': '__list_obj_star_3', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__list_obj_star_3', '__type__': 'NonTerminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'json', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 30: {'origin': {'name': 'union_single', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'UNION', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': '__union_single_star_0', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 31: {'origin': {'name': 'record', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'record_struct', '__type__': 'NonTerminal'}], 'order': 3, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 32: {'origin': {'name': 'regular_outparm', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'number', '__type__': 'NonTerminal'}, {'name': 'STAR', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'def_option', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 33: {'origin': {'name': 'pair', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'string', '__type__': 'NonTerminal'}, {'name': 'COLON', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'json', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 34: {'origin': {'name': '__dict_obj_star_4', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__dict_obj_star_4', '__type__': 'NonTerminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'pair', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 35: {'origin': {'name': 'input', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'regular', '__type__': 'NonTerminal'}], 'order': 4, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 36: {'origin': {'name': 'input', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'categories', '__type__': 'NonTerminal'}], 'order': 8, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 37: {'origin': {'name': 'input', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'optiontype', '__type__': 'NonTerminal'}], 'order': 3, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 38: {'origin': {'name': '__record_dict_star_1', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'string', '__type__': 'NonTerminal'}, {'name': 'COLON', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 39: {'origin': {'name': 'optiontype', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'option_parm', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 40: {'origin': {'name': 'listtype', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'list_parm', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 41: {'origin': {'name': 'option_single', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'QMARK', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': 'options', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 42: {'origin': {'name': 'json', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'number', '__type__': 'NonTerminal'}], 'order': 3, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 43: {'origin': {'name': 'record', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'record_highlevel', '__type__': 'NonTerminal'}], 'order': 4, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 44: {'origin': {'name': 'number', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'SIGNED_NUMBER', 'filter_out': False, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 45: {'origin': {'name': 'list_obj', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 2, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': [False, True, False], '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 46: {'origin': {'name': 'json', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'NULL', 'filter_out': True, '__type__': 'Terminal'}], 'order': 6, 'alias': 'null', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 47: {'origin': {'name': 'unknown', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'UNKNOWN', 'filter_out': True, '__type__': 'Terminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': [False, True], '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 48: {'origin': {'name': 'record', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'record_tuple', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 49: {'origin': {'name': 'json', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'dict_obj', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 50: {'origin': {'name': 'json', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'list_obj', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 51: {'origin': {'name': 'record_tuple_param', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'TUPLE', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'def_option', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 52: {'origin': {'name': 'list_obj', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'json', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 53: {'origin': {'name': 'record_dict', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'LBRACE', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'string', '__type__': 'NonTerminal'}, {'name': 'COLON', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': 'RBRACE', 'filter_out': True, '__type__': 'Terminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 54: {'origin': {'name': '__list_obj_star_3', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'json', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 55: {'origin': {'name': 'optiontype', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'option_highlevel', '__type__': 'NonTerminal'}], 'order': 2, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 56: {'origin': {'name': 'input', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'primitive', '__type__': 'NonTerminal'}], 'order': 2, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 57: {'origin': {'name': 'record', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'record_dict', '__type__': 'NonTerminal'}], 'order': 2, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 58: {'origin': {'name': 'dict_obj', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'LBRACE', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'pair', '__type__': 'NonTerminal'}, {'name': '__dict_obj_star_4', '__type__': 'NonTerminal'}, {'name': 'RBRACE', 'filter_out': True, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 59: {'origin': {'name': 'record_struct', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'STRUCT', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'string', '__type__': 'NonTerminal'}, {'name': '__record_struct_star_2', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'def_option', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 60: {'origin': {'name': 'string', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__ANON_1', 'filter_out': False, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 61: {'origin': {'name': 'list_parm', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'VAR', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'STAR', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'def_option', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 62: {'origin': {'name': 'json', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'TRUE', 'filter_out': True, '__type__': 'Terminal'}], 'order': 4, 'alias': 'true', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 63: {'origin': {'name': '__record_struct_star_2', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'string', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 64: {'origin': {'name': '__dict_obj_star_4', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'pair', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 65: {'origin': {'name': 'option_parm', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'OPTION', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'def_option', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 66: {'origin': {'name': 'dict_obj', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'LBRACE', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'pair', '__type__': 'NonTerminal'}, {'name': 'RBRACE', 'filter_out': True, '__type__': 'Terminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 67: {'origin': {'name': 'record', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'record_tuple_param', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 68: {'origin': {'name': 'union_parm', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'UNION', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'def_option', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 69: {'origin': {'name': 'uniontype', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'union_single', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 70: {'origin': {'name': 'input', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'unknown', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 71: {'origin': {'name': '__record_struct_star_2', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__record_struct_star_2', '__type__': 'NonTerminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'string', '__type__': 'NonTerminal'}], 'order': 2, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 72: {'origin': {'name': 'record_struct', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'STRUCT', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'string', '__type__': 'NonTerminal'}, {'name': '__record_struct_star_2', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': '__union_single_star_0', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'def_option', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 73: {'origin': {'name': 'option_single', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'QMARK', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': [False, False, True], '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 74: {'origin': {'name': 'record_dict', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'LBRACE', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'string', '__type__': 'NonTerminal'}, {'name': 'COLON', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': '__record_dict_star_1', '__type__': 'NonTerminal'}, {'name': 'RBRACE', 'filter_out': True, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 75: {'origin': {'name': 'json', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'string', '__type__': 'NonTerminal'}], 'order': 2, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 76: {'origin': {'name': 'def_option', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'PARAMETERS', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'EQUAL', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'dict_obj', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 77: {'origin': {'name': 'union_parm', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'UNION', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': '__union_single_star_0', '__type__': 'NonTerminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'def_option', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 78: {'origin': {'name': 'primitive', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'TYPE', 'filter_out': False, '__type__': 'Terminal'}, {'name': 'options', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 79: {'origin': {'name': 'input', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'predefined_typestr', '__type__': 'NonTerminal'}], 'order': 7, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 80: {'origin': {'name': 'unknown', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'UNKNOWN', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'options', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 81: {'origin': {'name': 'json', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'FALSE', 'filter_out': True, '__type__': 'Terminal'}], 'order': 5, 'alias': 'false', 'options': {'keep_all_tokens': False, 'expand1': True, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 82: {'origin': {'name': 'record_highlevel', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'UNQUOTED_STRING', 'filter_out': False, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'string', '__type__': 'NonTerminal'}, {'name': 'COLON', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 83: {'origin': {'name': 'dict_obj', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'LBRACE', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'RBRACE', 'filter_out': True, '__type__': 'Terminal'}], 'order': 2, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': [False, True, False], '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 84: {'origin': {'name': 'primitive', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'TYPE', 'filter_out': False, '__type__': 'Terminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': [False, True], '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 85: {'origin': {'name': 'uniontype', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'union_parm', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 86: {'origin': {'name': 'input', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'record', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 87: {'origin': {'name': 'list_obj', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'json', '__type__': 'NonTerminal'}, {'name': '__list_obj_star_3', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 88: {'origin': {'name': 'regular', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'regular_inparm', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 89: {'origin': {'name': 'optiontype', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'option_single', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 90: {'origin': {'name': 'list_single', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'VAR', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'STAR', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 91: {'origin': {'name': 'regular', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'regular_outparm', '__type__': 'NonTerminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 92: {'origin': {'name': 'record_struct', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'STRUCT', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'string', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'def_option', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 3, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 93: {'origin': {'name': 'record_struct', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'STRUCT', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'string', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': '__union_single_star_0', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'def_option', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 2, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 94: {'origin': {'name': 'predefined_typestr', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'HARDCODED', 'filter_out': False, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 95: {'origin': {'name': 'start', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'input', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 96: {'origin': {'name': 'regular_inparm', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'number', '__type__': 'NonTerminal'}, {'name': 'STAR', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 97: {'origin': {'name': '__record_dict_star_1', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__record_dict_star_1', '__type__': 'NonTerminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'string', '__type__': 'NonTerminal'}, {'name': 'COLON', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}], 'order': 2, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 98: {'origin': {'name': 'input', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'listtype', '__type__': 'NonTerminal'}], 'order': 5, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 99: {'origin': {'name': '__union_single_star_0', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__union_single_star_0', '__type__': 'NonTerminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}], 'order': 2, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 100: {'origin': {'name': 'listtype', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'list_single', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 101: {'origin': {'name': 'options', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'def_option', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 102: {'origin': {'name': 'record_tuple', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'LPAR', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': 'RPAR', 'filter_out': True, '__type__': 'Terminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 103: {'origin': {'name': 'record_highlevel', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'UNQUOTED_STRING', 'filter_out': False, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'string', '__type__': 'NonTerminal'}, {'name': 'COLON', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': '__record_dict_star_1', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 104: {'origin': {'name': 'input', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'uniontype', '__type__': 'NonTerminal'}], 'order': 6, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 105: {'origin': {'name': 'record_tuple', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'LPAR', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': '__union_single_star_0', '__type__': 'NonTerminal'}, {'name': 'RPAR', 'filter_out': True, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 106: {'origin': {'name': 'option_highlevel', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'OPTION', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 107: {'origin': {'name': 'union_single', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'UNION', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 108: {'origin': {'name': 'record_tuple_param', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'TUPLE', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': '__union_single_star_0', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'def_option', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 109: {'origin': {'name': '__union_single_star_0', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'COMMA', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 110: {'origin': {'name': 'categories', '__type__': 'NonTerminal'}, 'expansion': [{'name': 'CATEGORICAL', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'LSQB', 'filter_out': True, '__type__': 'Terminal'}, {'name': '__ANON_0', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'EQUAL', 'filter_out': True, '__type__': 'Terminal'}, {'name': 'input', '__type__': 'NonTerminal'}, {'name': 'RSQB', 'filter_out': True, '__type__': 'Terminal'}], 'order': 0, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': (), '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 111: {'origin': {'name': '__union_single_star_0', '__type__': 'NonTerminal'}, 'expansion': [], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': [True], '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 112: {'origin': {'name': '__union_single_star_0', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__union_single_star_0', '__type__': 'NonTerminal'}], 'order': 3, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': [False, True], '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 113: {'origin': {'name': '__record_dict_star_1', '__type__': 'NonTerminal'}, 'expansion': [], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': [True], '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 114: {'origin': {'name': '__record_dict_star_1', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__record_dict_star_1', '__type__': 'NonTerminal'}], 'order': 3, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': [False, True], '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 115: {'origin': {'name': '__record_struct_star_2', '__type__': 'NonTerminal'}, 'expansion': [], 'order': 1, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': [True], '__type__': 'RuleOptions'}, '__type__': 'Rule'}, 116: {'origin': {'name': '__record_struct_star_2', '__type__': 'NonTerminal'}, 'expansion': [{'name': '__record_struct_star_2', '__type__': 'NonTerminal'}], 'order': 3, 'alias': None, 'options': {'keep_all_tokens': False, 'expand1': False, 'priority': None, 'template_source': None, 'empty_indices': [False, True], '__type__': 'RuleOptions'}, '__type__': 'Rule'}} -) -Shift = 0 -Reduce = 1 -def Lark_StandAlone(**kwargs): - return Lark._load_from_dict(DATA, MEMO, **kwargs) diff --git a/src/awkward/_typeparser/parser.py b/src/awkward/_typeparser/parser.py deleted file mode 100644 index 924a7d024f..0000000000 --- a/src/awkward/_typeparser/parser.py +++ /dev/null @@ -1,318 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -# v2: keep this file, but drop the two *_v1 functions - -import awkward as ak - -from awkward._typeparser.generated_parser import Lark_StandAlone, Transformer - - -class TreeToJson(Transformer): - def string(self, s): - (s,) = s - return s[1:-1] - - def number(self, n): - (n,) = n - if "." in n: - return float(n) - else: - return int(n) - - list_obj = list - pair = tuple - dict_obj = dict - - def null(self, s): - return None - - def true(self, s): - return True - - def false(self, s): - return False - - -def toast_v1(ptnode, highlevel, categorical): - if ptnode.__class__.__name__ == "Token": - return ptnode.value - - elif ptnode.data == "start": - return toast_v1(ptnode.children[0], highlevel, categorical) - - elif ptnode.data == "input": - assert len(ptnode.children) == 1 - return toast_v1(ptnode.children[0], highlevel, categorical) - - elif ptnode.data == "predefined_typestr": - if ptnode.children[0] == "string": - parms = {"__array__": "string"} - if categorical: - parms.update({"__categorical__": True}) - categorical = False - return ak.types.ListType( - ak.types.PrimitiveType( - "uint8", parameters={"__array__": "char"}, typestr="char" - ), - parameters=parms, - typestr="string", - ) - elif ptnode.children[0] == "char": - parms = {"__array__": "char"} - if categorical: - parms.update({"__categorical__": True}) - categorical = False - return ak.types.PrimitiveType("uint8", parameters=parms, typestr="char") - elif ptnode.children[0] == "byte": - parms = {"__array__": "byte"} - if categorical: - parms.update({"__categorical__": True}) - categorical = False - return ak.types.PrimitiveType("uint8", parameters=parms, typestr="byte") - elif ptnode.children[0] == "bytes": - parms = {"__array__": "bytestring"} - if categorical: - parms.update({"__categorical__": True}) - categorical = False - return ak.types.ListType( - ak.types.PrimitiveType( - "uint8", parameters={"__array__": "byte"}, typestr="byte" - ), - parameters=parms, - typestr="bytes", - ) - else: - raise AssertionError(f"unhandled typestring {ptnode.children[0]}") - - elif ptnode.data == "primitive": - if len(ptnode.children) == 1: - parms = {} - if categorical: - parms.update({"__categorical__": True}) - categorical = False - return ak.types.PrimitiveType( - toast_v1(ptnode.children[0], highlevel, False), parameters=parms - ) - elif len(ptnode.children) == 2: - parms = toast_v1(ptnode.children[1], highlevel, False) - if categorical: - parms.update({"__categorical__": True}) - categorical = False - return ak.types.PrimitiveType( - toast_v1(ptnode.children[0], highlevel, categorical), - parms, - ) - else: - raise AssertionError("unhandled PrimitiveType node") - - elif ptnode.data == "categories": - assert highlevel is True - return toast_v1(ptnode.children[0], highlevel, True) - - elif ptnode.data == "unknown": - if len(ptnode.children) == 0: - parms = {} - if categorical: - parms.update({"__categorical__": True}) - categorical = False - return ak.types.UnknownType(parameters=parms) - elif len(ptnode.children) == 1: - parms = toast_v1(ptnode.children[0], highlevel, False) - if categorical: - parms.update({"__categorical__": True}) - categorical = False - return ak.types.UnknownType(parameters=parms) - else: - raise AssertionError("unhandled UnknownType node") - - elif ptnode.data == "listtype": - return toast_v1(ptnode.children[0], highlevel, categorical) - - elif ptnode.data == "list_single": - parms = {} - if categorical: - parms.update({"__categorical__": True}) - categorical = False - return ak.types.ListType( - toast_v1(ptnode.children[0], highlevel, False), parameters=parms - ) - - elif ptnode.data == "list_parm": - parms = toast_v1(ptnode.children[1], highlevel, False) - if categorical: - parms.update({"__categorical__": True}) - categorical = False - return ak.types.ListType( - toast_v1(ptnode.children[0], highlevel, categorical), parms - ) - - elif ptnode.data == "uniontype": - return toast_v1(ptnode.children[0], highlevel, categorical) - - elif ptnode.data == "union_single": - parms = {} - if categorical: - parms.update({"__categorical__": True}) - categorical = False - content_list = [] - for node in ptnode.children: - content_list.append(toast_v1(node, highlevel, False)) - return ak.types.UnionType(content_list, parameters=parms) - - elif ptnode.data == "union_parm": - parms = toast_v1(ptnode.children[-1], highlevel, False) - if categorical: - parms.update({"__categorical__": True}) - categorical = False - content_list = [] - for node in ptnode.children[:-1]: - content_list.append(toast_v1(node, highlevel, False)) - return ak.types.UnionType(content_list, parms) - - elif ptnode.data == "optiontype": - return toast_v1(ptnode.children[0], highlevel, categorical) - - elif ptnode.data == "option_single": - parms = {} - if categorical: - parms.update({"__categorical__": True}) - categorical = False - return ak.types.OptionType( - toast_v1(ptnode.children[0], highlevel, False), parameters=parms - ) - - elif ptnode.data == "option_parm": - parms = toast_v1(ptnode.children[1], highlevel, False) - if categorical: - parms.update({"__categorical__": True}) - categorical = False - return ak.types.OptionType( - toast_v1(ptnode.children[0], highlevel, False), - parameters=parms, - ) - - elif ptnode.data == "option_highlevel": - assert highlevel - parms = {} - if categorical: - parms.update({"__categorical__": True}) - categorical = False - return ak.types.OptionType( - toast_v1(ptnode.children[0], highlevel, False), parameters=parms - ) - - elif ptnode.data == "record": - return toast_v1(ptnode.children[0], highlevel, categorical) - - elif ptnode.data == "record_tuple": - parms = {} - if categorical: - parms.update({"__categorical__": True}) - categorical = False - content_list = [] - for node in ptnode.children: - content_list.append(toast_v1(node, highlevel, categorical)) - return ak.types.RecordType(tuple(content_list), parameters=parms) - - elif ptnode.data == "record_dict": - parms = {} - if categorical: - parms.update({"__categorical__": True}) - categorical = False - content_types = [] - content_keys = [] - for i in range(0, len(ptnode.children), 2): - content_keys.append(ptnode.children[i]) - content_types.append( - toast_v1(ptnode.children[i + 1], highlevel, categorical) - ) - return ak.types.RecordType(content_types, content_keys, parameters=parms) - - elif ptnode.data == "record_tuple_param": - parms = toast_v1(ptnode.children[-1], highlevel, False) - if categorical: - parms.update({"__categorical__": True}) - categorical = False - content_list = [] - for node in ptnode.children[:-1]: - content_list.append(toast_v1(node, highlevel, False)) - return ak.types.RecordType(tuple(content_list), parameters=parms) - - elif ptnode.data == "record_struct": - parms = toast_v1(ptnode.children[-1], highlevel, False) - if categorical: - parms.update({"__categorical__": True}) - categorical = False - content_list = [] - content_keys = [] - for node in ptnode.children[:-1]: - if isinstance(node, str): - content_keys.append(node) - else: - content_list.append(toast_v1(node, highlevel, False)) - return ak.types.RecordType( - tuple(content_list), - keys=content_keys, - parameters=parms, - ) - - elif ptnode.data == "record_highlevel": - assert highlevel - parms = {"__record__": ptnode.children[0]} - if categorical: - parms.update({"__categorical__": True}) - categorical = False - content_list = [] - content_keys = [] - for node in ptnode.children[1:]: - if isinstance(node, str): - content_keys.append(node) - else: - content_list.append(toast_v1(node, highlevel, False)) - return ak.types.RecordType( - tuple(content_list), - keys=content_keys, - parameters=parms, - ) - - elif ptnode.data == "regular": - assert (len(ptnode.children)) == 1 - return toast_v1(ptnode.children[0], highlevel, categorical) - - elif ptnode.data == "regular_inparm": - assert len(ptnode.children) == 2 - if highlevel: - return ak.types.ArrayType( - toast_v1(ptnode.children[1], highlevel, categorical), ptnode.children[0] - ) - return ak.types.RegularType( - toast_v1(ptnode.children[1], highlevel, categorical), ptnode.children[0] - ) - - elif ptnode.data == "regular_outparm": - assert len(ptnode.children) == 3 - parms = toast_v1(ptnode.children[2], highlevel, False) - if categorical: - parms.update({"__categorical__": True}) - categorical = False - return ak.types.RegularType( - toast_v1(ptnode.children[1], highlevel, False), - ptnode.children[0], - parms, - ) - - elif ptnode.data == "def_option": - assert len(ptnode.children) == 1 - return ptnode.children[0] - - elif ptnode.data == "options": - assert len(ptnode.children) == 1 - return toast_v1(ptnode.children[0], highlevel, categorical) - - else: - raise AssertionError("unhandled node") - - -def from_datashape_v1(typestr, highlevel=False): - parseobj = Lark_StandAlone(transformer=TreeToJson()) - return toast_v1(parseobj.parse(typestr), highlevel, False) diff --git a/src/awkward/_typeparser/type-grammar.lark b/src/awkward/_typeparser/type-grammar.lark deleted file mode 100644 index 436ca681b8..0000000000 --- a/src/awkward/_typeparser/type-grammar.lark +++ /dev/null @@ -1,82 +0,0 @@ -start: input - -input: record - | unknown - | primitive - | optiontype - | regular - | listtype - | uniontype - | predefined_typestr - | categories - -record: record_tuple - | record_tuple_param - | record_dict - | record_struct - | record_highlevel -primitive: TYPE [options] -unknown: "unknown" [options] -optiontype: option_single - | option_parm - | option_highlevel -regular: regular_inparm - | regular_outparm -listtype: list_single - | list_parm -uniontype: union_single - | union_parm -categories: "categorical" "[" "type" "=" input "]" -predefined_typestr: HARDCODED - -HARDCODED: "string" - | "char" - | "bytes" - | "byte" -option_single: "?" input [options] -option_parm: "option" "[" input "," def_option "]" -option_highlevel: "option" "[" input "]" -union_single: "union" "[" input [ "," input]* "]" -union_parm: "union" "[" input [ "," input]* "," def_option "]" -list_parm: "[" "var" "*" input "," def_option "]" -list_single: "var" "*" input -record_tuple: "(" input ["," input]* ")" -record_tuple_param: "tuple" "[" "[" input ["," input]* "]" "," def_option "]" -record_dict: "{" string ":" input ["," string ":" input]* "}" -record_struct: "struct" "[" "[" string ["," string]* "]" "," "[" input ["," input]* "]" "," def_option "]" -record_highlevel: UNQUOTED_STRING "[" string ":" input ["," string ":" input]* "]" -regular_inparm: number "*" input -regular_outparm: "[" number "*" input "," def_option "]" -options: "[" def_option "]" -def_option: "parameters" "=" dict_obj -TYPE: "int8" - | "int16" - | "int32" - | "int64" - | "int128" - | "uint8" - | "uint16" - | "uint32" - | "uint64" - | "uint128" - | "float32" - | "float64" - | "bool" -?json: dict_obj - | list_obj - | string - | number - | "true" -> true - | "false" -> false - | "null" -> null -list_obj: "[" [json ("," json)*] "]" -dict_obj: "{" [pair ("," pair)*] "}" -pair: string ":" json -string: /((?:"(?:[^"\n\r\\]|(?:\\u[0-9a-fA-F]{4})|(?:\\["bfnrt]))*")|(?:\\\'(?:[^\\\'\n\r\\]|(?:\\u[0-9a-fA-F]{4})|(?:\\[\'bfnrt]))*")*\\\')/ -UNQUOTED_STRING.-1: /[a-zA-Z]+/ -number: SIGNED_NUMBER - -%import common.SIGNED_NUMBER -%import common.WS - -%ignore WS diff --git a/src/awkward/_v2/_typetracer.py b/src/awkward/_typetracer.py similarity index 86% rename from src/awkward/_v2/_typetracer.py rename to src/awkward/_typetracer.py index ba2978f90f..5055dc03f3 100644 --- a/src/awkward/_v2/_typetracer.py +++ b/src/awkward/_typetracer.py @@ -5,18 +5,18 @@ import numpy import awkward.nplike -import awkward._util import awkward as ak np = ak.nplike.NumpyMetadata.instance() class NoError: - str = None - filename = None - pass_through = False - attempt = ak._util.kSliceNone - id = ak._util.kSliceNone + def __init__(self): + self.str = None + self.filename = None + self.pass_through = False + self.attempt = ak._util.kSliceNone + self.id = ak._util.kSliceNone class NoKernel: @@ -201,7 +201,7 @@ def _length_after_slice(slice, original_length): class TypeTracerArray: @classmethod def from_array(cls, array, dtype=None): - if isinstance(array, ak._v2.index.Index): + if isinstance(array, ak.index.Index): array = array.data # not array-like @@ -209,7 +209,7 @@ def from_array(cls, array, dtype=None): sequence = list(array) array = numpy.array(sequence) if array.dtype == np.dtype("O"): - raise ak._v2._util.error( + raise ak._util.error( ValueError( f"bug in Awkward Array: attempt to construct `TypeTracerArray` " f"from a sequence of non-primitive types: {sequence}" @@ -242,7 +242,7 @@ def shape(self): @shape.setter def shape(self, value): - if ak._v2._util.isint(value): + if ak._util.isint(value): value = (value,) elif value is None or isinstance(value, (UnknownLengthType, UnknownScalar)): value = (UnknownLength,) @@ -286,14 +286,14 @@ def forget_length(self): return type(self)(self._dtype, (UnknownLength,) + self._shape[1:]) def __iter__(self): - raise ak._v2._util.error( + raise ak._util.error( AssertionError( "bug in Awkward Array: attempt to convert TypeTracerArray into a concrete array" ) ) def __array__(self, *args, **kwargs): - raise ak._v2._util.error( + raise ak._util.error( AssertionError( "bug in Awkward Array: attempt to convert TypeTracerArray into a concrete array" ) @@ -311,14 +311,14 @@ def ctypes(self): return self._CTypes def __len__(self): - raise ak._v2._util.error( + raise ak._util.error( AssertionError( "bug in Awkward Array: attempt to get length of a TypeTracerArray" ) ) def __setitem__(self, where, what): - raise ak._v2._util.error( + raise ak._util.error( AssertionError( "bug in Awkward Array: attempt to set values of a TypeTracerArray" ) @@ -335,7 +335,7 @@ def __getitem__(self, where): missing = max(0, len(self._shape) - (len(before) + len(after))) where = before + (slice(None, None, None),) * missing + after - if ak._v2._util.isint(where): + if ak._util.isint(where): if len(self._shape) == 1: if where == 0: return UnknownScalar(self._dtype) @@ -379,7 +379,7 @@ def __getitem__(self, where): shapes = [] for j in range(num_basic, len(where)): wh = where[j] - if ak._v2._util.isint(wh): + if ak._util.isint(wh): shapes.append(numpy.array(0)) elif hasattr(wh, "dtype") and hasattr(wh, "shape"): sh = [ @@ -392,7 +392,7 @@ def __getitem__(self, where): ) ) else: - raise ak._v2._util.error(NotImplementedError(repr(wh))) + raise ak._util.error(NotImplementedError(repr(wh))) slicer_shape = numpy.broadcast_arrays(*shapes)[0].shape @@ -404,7 +404,7 @@ def __getitem__(self, where): elif ( isinstance(where, tuple) and len(where) > 0 - and (ak._v2._util.isint(where[0]) or isinstance(where[0], slice)) + and (ak._util.isint(where[0]) or isinstance(where[0], slice)) ): head, tail = where[0], where[1:] next = self.__getitem__(head) @@ -417,13 +417,13 @@ def __getitem__(self, where): elif isinstance(wh, slice): after_shape.append(_length_after_slice(wh, inner_shape[i])) else: - raise ak._v2._util.error(NotImplementedError(repr(wh))) + raise ak._util.error(NotImplementedError(repr(wh))) shape = (next._shape[0],) + tuple(after_shape) return TypeTracerArray(self._dtype, shape) else: - raise ak._v2._util.error(NotImplementedError(repr(where))) + raise ak._util.error(NotImplementedError(repr(where))) def __lt__(self, other): if isinstance(other, numbers.Real): @@ -454,8 +454,8 @@ def reshape(self, *args): args = args[0] assert len(args) != 0 - assert ak._v2._util.isint(args[0]) or isinstance(args[0], UnknownLengthType) - assert all(ak._v2._util.isint(x) for x in args[1:]) + assert ak._util.isint(args[0]) or isinstance(args[0], UnknownLengthType) + assert all(ak._util.isint(x) for x in args[1:]) assert all(x >= 0 for x in args[1:]) return TypeTracerArray(self._dtype, (UnknownLength,) + args[1:]) @@ -473,18 +473,18 @@ def index_nplike(self): return self def to_rectilinear(self, array, *args, **kwargs): - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def __getitem__(self, name_and_types): return NoKernel() @property def ma(self): - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) @property def char(self): - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) @property def ndarray(self): @@ -498,13 +498,13 @@ def raw(self, array, nplike): elif isinstance(array, TypeTracerArray): return self elif hasattr(nplike, "known_data") and nplike.known_data: - raise ak._v2._util.error( + raise ak._util.error( TypeError( "Converting a TypeTracer nplike to a nplike with `known_data=True` is not possible" ) ) else: - raise ak._v2._util.error( + raise ak._util.error( TypeError( "Invalid nplike, choose between nplike.Numpy, nplike.Cupy, Typetracer" ) @@ -531,11 +531,11 @@ def ascontiguousarray(self, array, dtype=None, **kwargs): return TypeTracerArray.from_array(array, dtype=dtype) def isscalar(self, *args, **kwargs): - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def frombuffer(self, *args, **kwargs): # array[, dtype=] - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def zeros(self, shape, dtype=np.float64, **kwargs): # shape/len[, dtype=] @@ -586,24 +586,20 @@ def arange(self, *args, **kwargs): elif len(args) == 3: start, stop, step = args[0], args[1], args[2] - if ( - ak._v2._util.isint(start) - and ak._v2._util.isint(stop) - and ak._v2._util.isint(step) - ): + if ak._util.isint(start) and ak._util.isint(stop) and ak._util.isint(step): length = max(0, (stop - start + (step - (1 if step > 0 else -1))) // step) return TypeTracerArray(kwargs["dtype"], (length,)) def meshgrid(self, *args, **kwargs): # *arrays, indexing="ij" - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) ############################ testing def shape(self, *args, **kwargs): # array - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def array_equal(self, *args, **kwargs): # array1, array2 @@ -611,11 +607,11 @@ def array_equal(self, *args, **kwargs): def size(self, *args, **kwargs): # array - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def searchsorted(self, *args, **kwargs): # haystack, needle, side="right" - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def argsort(self, array, *args, **kwargs): # array @@ -653,7 +649,7 @@ def broadcast_arrays(self, *arrays): if shape[i] == 1 and thisshape[i] != 1: shape[i] = thisshape[i] elif shape[i] != 1 and thisshape[i] != 1 and shape[i] != thisshape[i]: - raise ak._v2._util.error( + raise ak._util.error( ValueError( "shape mismatch: objects cannot be broadcast to a single shape" ) @@ -711,11 +707,11 @@ def minimum(self, x, y): def cumsum(self, *args, **kwargs): # arrays[, out=] - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def cumprod(self, *args, **kwargs): # arrays[, out=] - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def nonzero(self, array): # array @@ -723,7 +719,7 @@ def nonzero(self, array): def unique(self, *args, **kwargs): # array - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def concatenate(self, arrays): inner_shape = None @@ -732,7 +728,7 @@ def concatenate(self, arrays): if inner_shape is None: inner_shape = x.shape[1:] elif inner_shape != x.shape[1:]: - raise ak._v2._util.error( + raise ak._util.error( ValueError( "inner dimensions don't match in concatenate: {} vs {}".format( inner_shape, x.shape[1:] @@ -742,9 +738,7 @@ def concatenate(self, arrays): emptyarrays.append(_emptyarray(x)) if inner_shape is None: - raise ak._v2._util.error( - ValueError("need at least one array to concatenate") - ) + raise ak._util.error(ValueError("need at least one array to concatenate")) return TypeTracerArray( numpy.concatenate(emptyarrays).dtype, (UnknownLength,) + inner_shape @@ -753,61 +747,61 @@ def concatenate(self, arrays): def repeat(self, *args, **kwargs): # array, int # array1, array2 - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def tile(self, *args, **kwargs): # array, int - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def stack(self, *args, **kwargs): # arrays - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def vstack(self, *args, **kwargs): # arrays - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def packbits(self, *args, **kwargs): # array - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def unpackbits(self, *args, **kwargs): # array - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def atleast_1d(self, *args, **kwargs): # *arrays - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def broadcast_to(self, *args, **kwargs): # array, shape - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def append(self, *args, **kwargs): # array, element - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def where(self, *args, **kwargs): # array, element - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) ############################ ufuncs def sqrt(self, *args, **kwargs): # array - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def exp(self, *args, **kwargs): # array - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def true_divide(self, *args, **kwargs): # array1, array2 - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def bitwise_or(self, *args, **kwargs): # array1, array2[, out=output] - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def logical_and(self, x, y): # array1, array2 @@ -835,21 +829,21 @@ def logical_or(self, x, y): def equal(self, *args, **kwargs): # array1, array2 - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def ceil(self, *args, **kwargs): # array - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) ############################ almost-ufuncs def nan_to_num(self, *args, **kwargs): # array, copy=True, nan=0.0, posinf=None, neginf=None - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def isclose(self, *args, **kwargs): # a, b, rtol=1e-05, atol=1e-08, equal_nan=False - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) ############################ reducers @@ -863,31 +857,31 @@ def any(self, array, prefer): def count_nonzero(self, *args, **kwargs): # array - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def sum(self, *args, **kwargs): # array - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def prod(self, *args, **kwargs): # array - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def min(self, *args, **kwargs): # array - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def max(self, *args, **kwargs): # array - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def argmin(self, *args, **kwargs): # array[, axis=] - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def argmax(self, *args, **kwargs): # array[, axis=] - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) def array_str( self, array, max_line_width=None, precision=None, suppress_small=None @@ -896,4 +890,4 @@ def array_str( return "[?? ... ??]" def datetime_as_string(self, *args, **kwargs): - raise ak._v2._util.error(NotImplementedError) + raise ak._util.error(NotImplementedError) diff --git a/src/awkward/_util.py b/src/awkward/_util.py index 99fca3ef82..fa69bdb543 100644 --- a/src/awkward/_util.py +++ b/src/awkward/_util.py @@ -1,19 +1,18 @@ # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE -# v2: replace with src/awkward/_v2/_util.py +# First, transition all the _v2 code to start using implementations in this file. +# Then build up the high-level replacements. -import re -import sys -import os -import os.path -import warnings import itertools import numbers +import os +import re +import threading +import traceback +import packaging.version +import warnings -from collections.abc import Mapping -from collections.abc import MutableMapping -from collections.abc import Iterable -from collections.abc import Sized +from collections.abc import Sequence, Sized, Mapping, Iterable import awkward as ak @@ -31,6 +30,36 @@ kSliceNone = kMaxInt64 + 1 # for Slice::none() kMaxLevels = 48 +_backends = { + "cpu": ak.nplike.Numpy, + "cuda": ak.nplike.Cupy, + "jax": ak.nplike.Jax, +} + + +def regularize_backend(backend): + if backend in _backends: + return _backends[backend].instance() + else: + raise error( # noqa: AK101 + ValueError("The available backends for now are `cpu` and `cuda`.") + ) + + +def parse_version(version): + return packaging.version.parse(version) + + +def numpy_at_least(version): + import numpy + + return parse_version(numpy.__version__) >= parse_version(version) + + +def in_module(obj, modulename): + m = type(obj).__module__ + return m == modulename or m.startswith(modulename + ".") + def is_file_path(x): try: @@ -44,48 +73,323 @@ def is_sized_iterable(obj): def isint(x): - """ - Returns True if and only if ``x`` is an integer (including NumPy, not - including bool). - """ return isinstance(x, (int, numbers.Integral, np.integer)) and not isinstance( x, (bool, np.bool_) ) def isnum(x): - """ - Returns True if and only if ``x`` is a number (including NumPy, not - including bool). - """ return isinstance(x, (int, float, numbers.Real, np.number)) and not isinstance( x, (bool, np.bool_) ) def isstr(x): - """ - Returns True if and only if ``x`` is a string. Mostly needed for Python 2 - compatibility in the past, but still mirrors isnum. - """ return isinstance(x, str) -def exception_suffix(filename): - line = "" - if hasattr(sys, "_getframe"): - line = "#L" + str(sys._getframe(1).f_lineno) - filename = filename.replace("\\", "/") - filename = "/src/awkward/" + filename.split("awkward/")[1] +def tobytes(array): + if hasattr(array, "tobytes"): + return array.tobytes() + else: + return array.tostring() + + +def little_endian(array): + return array.astype(array.dtype.newbyteorder("<"), copy=False) + + +def identifier_hash(str): + import base64 + import struct + return ( - "\n\n(https://github.com/scikit-hep/awkward-1.0/blob/" - + ak.__version__ - + filename - + line - + ")" + base64.encodebytes(struct.pack("q", hash(str))) + .rstrip(b"=\n") + .replace(b"+", b"") + .replace(b"/", b"") + .decode("ascii") ) +############################################################################### + + +class ErrorContext: + # Any other threads should get a completely independent _slate. + _slate = threading.local() + + _width = 80 + + @classmethod + def primary(cls): + return cls._slate.__dict__.get("__primary_context__") + + def __init__(self, **kwargs): + self._kwargs = kwargs + + def __enter__(self): + # Make it strictly non-reenterant. Only one ErrorContext (per thread) is primary. + if self.primary() is None: + self._slate.__dict__.clear() + self._slate.__dict__.update(self._kwargs) + self._slate.__dict__["__primary_context__"] = self + + def __exit__(self, exception_type, exception_value, traceback): + # Step out of the way so that another ErrorContext can become primary. + if self.primary() is self: + self._slate.__dict__.clear() + + def format_argument(self, width, value): + if isinstance(value, ak.contents.Content): + return self.format_argument(width, ak.highlevel.Array(value)) + elif isinstance(value, ak.record.Record): + return self.format_argument(width, ak.highlevel.Record(value)) + + valuestr = None + if isinstance( + value, + ( + ak.highlevel.Array, + ak.highlevel.Record, + ak.highlevel.ArrayBuilder, + ), + ): + try: + valuestr = value._repr(width) + except Exception as err: + valuestr = f"repr-raised-{type(err).__name__}" + + elif value is None or isinstance(value, (bool, int, float)): + try: + valuestr = repr(value) + except Exception as err: + valuestr = f"repr-raised-{type(err).__name__}" + + elif isinstance(value, (str, bytes)): + try: + if len(value) < 60: + valuestr = repr(value) + else: + valuestr = repr(value[:57]) + "..." + except Exception as err: + valuestr = f"repr-raised-{type(err).__name__}" + + elif isinstance(value, np.ndarray): + import numpy + + if not numpy.__version__.startswith("1.13."): # 'threshold' argument + prefix = f"{type(value).__module__}.{type(value).__name__}(" + suffix = ")" + try: + valuestr = numpy.array2string( + value, + max_line_width=width - len(prefix) - len(suffix), + threshold=0, + ).replace("\n", " ") + valuestr = prefix + valuestr + suffix + except Exception as err: + valuestr = f"array2string-raised-{type(err).__name__}" + + if len(valuestr) > width and "..." in valuestr[:-1]: + last = valuestr.rfind("...") + 3 + while last > width: + last = valuestr[: last - 3].rfind("...") + 3 + valuestr = valuestr[:last] + + if len(valuestr) > width: + valuestr = valuestr[: width - 3] + "..." + + elif isinstance(value, (Sequence, Mapping)) and len(value) < 10000: + valuestr = repr(value) + if len(valuestr) > width: + valuestr = valuestr[: width - 3] + "..." + + if valuestr is None: + return f"{type(value).__name__}-instance" + else: + return valuestr + + +class OperationErrorContext(ErrorContext): + def __init__(self, name, arguments): + string_arguments = {} + for key, value in arguments.items(): + if isstr(key): + width = self._width - 8 - len(key) - 3 + else: + width = self._width - 8 + + string_arguments[key] = self.format_argument(width, value) + + super().__init__( + name=name, + arguments=string_arguments, + traceback=traceback.extract_stack(limit=3)[0], + ) + + @property + def name(self): + return self._kwargs["name"] + + @property + def arguments(self): + return self._kwargs["arguments"] + + @property + def traceback(self): + return self._kwargs["traceback"] + + def format_exception(self, exception): + tb = self.traceback + try: + location = f" (from {tb.filename}, line {tb.lineno})" + except Exception: + location = "" + + arguments = [] + for name, valuestr in self.arguments.items(): + if isstr(name): + arguments.append(f"\n {name} = {valuestr}") + else: + arguments.append(f"\n {valuestr}") + + extra_line = "" if len(arguments) == 0 else "\n " + return f"""while calling{location} + + {self.name}({"".join(arguments)}{extra_line}) + +Error details: {str(exception)}""" + + +class SlicingErrorContext(ErrorContext): + def __init__(self, array, where): + super().__init__( + array=self.format_argument(self._width - 4, array), + where=self.format_slice(where), + traceback=traceback.extract_stack(limit=3)[0], + ) + + @property + def array(self): + return self._kwargs["array"] + + @property + def where(self): + return self._kwargs["where"] + + @property + def traceback(self): + return self._kwargs["traceback"] + + def format_exception(self, exception): + tb = self.traceback + try: + location = f" (from {tb.filename}, line {tb.lineno})" + except Exception: + location = "" + + if isstr(exception): + message = exception + else: + message = f"Error details: {str(exception)}" + + return f"""while attempting to slice{location} + + {self.array} + +with + + {self.where} + +{message}""" + + @staticmethod + def format_slice(x): + if isinstance(x, slice): + if x.step is None: + return "{}:{}".format( + "" if x.start is None else x.start, + "" if x.stop is None else x.stop, + ) + else: + return "{}:{}:{}".format( + "" if x.start is None else x.start, + "" if x.stop is None else x.stop, + x.step, + ) + + elif isinstance(x, tuple): + return "(" + ", ".join(SlicingErrorContext.format_slice(y) for y in x) + ")" + + elif isinstance(x, ak.index.Index64): + return str(x.data) + + elif isinstance(x, ak.contents.Content): + try: + return str(ak.highlevel.Array(x)) + except Exception: + return x._repr(" ", "", "") + + elif isinstance(x, ak.record.Record): + try: + return str(ak.highlevel.Record(x)) + except Exception: + return x._repr(" ", "", "") + + else: + return repr(x) + + +def error(exception, error_context=None): + if isinstance(exception, type) and issubclass(exception, Exception): + try: + exception = exception() + except Exception: + return exception + + if isinstance(exception, (NotImplementedError, AssertionError)): + return type(exception)( + str(exception) + + "\n\nSee if this has been reported at https://github.com/scikit-hep/awkward-1.0/issues" + ) + + if error_context is None: + error_context = ErrorContext.primary() + + if isinstance(error_context, ErrorContext): + # Note: returns an error for the caller to raise! + return type(exception)(error_context.format_exception(exception)) + else: + # Note: returns an error for the caller to raise! + return exception + + +def indexerror(subarray, slicer, details=None): + detailsstr = "" + if details is not None: + detailsstr = f""" + +Error details: {details}.""" + + error_context = ErrorContext.primary() + if not isinstance(error_context, SlicingErrorContext): + # Note: returns an error for the caller to raise! + return IndexError( + f"cannot slice {type(subarray).__name__} with {SlicingErrorContext.format_slice(slicer)}{detailsstr}" + ) + + else: + # Note: returns an error for the caller to raise! + return IndexError( + error_context.format_exception( + f"at inner {type(subarray).__name__} of length {subarray.length}, using sub-slice {error_context.format_slice(slicer)}.{detailsstr}" + ) + ) + + +############################################################################### + # Enable warnings for the Awkward package warnings.filterwarnings("default", module="awkward.*") @@ -103,14 +407,10 @@ def deprecate( else: date = " (target date: " + date + ")" warning = """In version {}{}, this will be {}. - To raise these warnings as errors (and get stack traces to find out where they're called), run - import warnings warnings.filterwarnings("error", module="awkward.*") - after the first `import awkward` or use `@pytest.mark.filterwarnings("error:::awkward.*")` in pytest. - Issue: {}.""".format( version, date, will_be, message ) @@ -118,52 +418,10 @@ def deprecate( # Sentinel object for catching pass-through values -class MISSING: +class Unspecified: pass -virtualtypes = (ak.layout.VirtualArray,) - -unknowntypes = (ak.layout.EmptyArray,) - -indexedtypes = ( - ak.layout.IndexedArray32, - ak.layout.IndexedArrayU32, - ak.layout.IndexedArray64, -) - -uniontypes = ( - ak.layout.UnionArray8_32, - ak.layout.UnionArray8_U32, - ak.layout.UnionArray8_64, -) - -indexedoptiontypes = ( - ak.layout.IndexedOptionArray32, - ak.layout.IndexedOptionArray64, -) - -optiontypes = ( - ak.layout.IndexedOptionArray32, - ak.layout.IndexedOptionArray64, - ak.layout.ByteMaskedArray, - ak.layout.BitMaskedArray, - ak.layout.UnmaskedArray, -) - -listtypes = ( - ak.layout.RegularArray, - ak.layout.ListArray32, - ak.layout.ListArrayU32, - ak.layout.ListArray64, - ak.layout.ListOffsetArray32, - ak.layout.ListOffsetArrayU32, - ak.layout.ListOffsetArray64, -) - -recordtypes = (ak.layout.RecordArray,) - - def regularize_path(path): """ Converts pathlib Paths into plain string paths (for all versions of Python). @@ -220,20 +478,14 @@ def __len__(self): def arrayclass(layout, behavior): - layout = ak.partition.first(layout) behavior = Behavior(ak.behavior, behavior) arr = layout.parameter("__array__") - if isinstance(arr, str): + if isstr(arr): cls = behavior[arr] if isinstance(cls, type) and issubclass(cls, ak.highlevel.Array): return cls - rec = layout.parameter("__record__") - if isinstance(rec, str): - cls = behavior[".", rec] - if isinstance(cls, type) and issubclass(cls, ak.highlevel.Array): - return cls deeprec = layout.purelist_parameter("__record__") - if isinstance(deeprec, str): + if isstr(deeprec): cls = behavior["*", deeprec] if isinstance(cls, type) and issubclass(cls, ak.highlevel.Array): return cls @@ -254,14 +506,13 @@ def custom_cast(obj, behavior): def custom_broadcast(layout, behavior): - layout = ak.partition.first(layout) behavior = Behavior(ak.behavior, behavior) custom = layout.parameter("__array__") - if not isinstance(custom, str): + if not isstr(custom): custom = layout.parameter("__record__") - if not isinstance(custom, str): + if not isstr(custom): custom = layout.purelist_parameter("__record__") - if isinstance(custom, str): + if isstr(custom): for key, fcn in behavior.items(): if ( isinstance(key, tuple) @@ -273,20 +524,34 @@ def custom_broadcast(layout, behavior): return None +def custom_ufunc(ufunc, layout, behavior): + import numpy + + behavior = Behavior(ak.behavior, behavior) + custom = layout.parameter("__array__") + if not isstr(custom): + custom = layout.parameter("__record__") + if isstr(custom): + for key, fcn in behavior.items(): + if ( + isinstance(key, tuple) + and len(key) == 2 + and (key[0] is ufunc or key[0] is numpy.ufunc) + and key[1] == custom + ): + return fcn + return None + + def numba_array_typer(layouttype, behavior): behavior = Behavior(ak.behavior, behavior) arr = layouttype.parameters.get("__array__") - if isinstance(arr, str): + if isstr(arr): typer = behavior["__numba_typer__", arr] if callable(typer): return typer - rec = layouttype.parameters.get("__record__") - if isinstance(rec, str): - typer = behavior["__numba_typer__", ".", rec] - if callable(typer): - return typer deeprec = layouttype.parameters.get("__record__") - if isinstance(deeprec, str): + if isstr(deeprec): typer = behavior["__numba_typer__", "*", deeprec] if callable(typer): return typer @@ -296,17 +561,12 @@ def numba_array_typer(layouttype, behavior): def numba_array_lower(layouttype, behavior): behavior = Behavior(ak.behavior, behavior) arr = layouttype.parameters.get("__array__") - if isinstance(arr, str): + if isstr(arr): lower = behavior["__numba_lower__", arr] if callable(lower): return lower - rec = layouttype.parameters.get("__record__") - if isinstance(rec, str): - lower = behavior["__numba_lower__", ".", rec] - if callable(lower): - return lower deeprec = layouttype.parameters.get("__record__") - if isinstance(deeprec, str): + if isstr(deeprec): lower = behavior["__numba_lower__", "*", deeprec] if callable(lower): return lower @@ -314,16 +574,22 @@ def numba_array_lower(layouttype, behavior): def recordclass(layout, behavior): - layout = ak.partition.first(layout) behavior = Behavior(ak.behavior, behavior) rec = layout.parameter("__record__") - if isinstance(rec, str): + if isstr(rec): cls = behavior[rec] if isinstance(cls, type) and issubclass(cls, ak.highlevel.Record): return cls return ak.highlevel.Record +def reducer_recordclass(reducer, layout, behavior): + behavior = Behavior(ak.behavior, behavior) + rec = layout.parameter("__record__") + if isstr(rec): + return behavior[reducer.highlevel_function(), rec] + + def typestrs(behavior): behavior = Behavior(ak.behavior, behavior) out = {} @@ -332,8 +598,8 @@ def typestrs(behavior): isinstance(key, tuple) and len(key) == 2 and key[0] == "__typestr__" - and isinstance(key[1], str) - and isinstance(typestr, str) + and isstr(key[1]) + and isstr(typestr) ): out[key[1]] = typestr return out @@ -357,7 +623,7 @@ def gettypestr(parameters, typestrs): def numba_record_typer(layouttype, behavior): behavior = Behavior(ak.behavior, behavior) rec = layouttype.parameters.get("__record__") - if isinstance(rec, str): + if isstr(rec): typer = behavior["__numba_typer__", rec] if callable(typer): return typer @@ -367,7 +633,7 @@ def numba_record_typer(layouttype, behavior): def numba_record_lower(layouttype, behavior): behavior = Behavior(ak.behavior, behavior) rec = layouttype.parameters.get("__record__") - if isinstance(rec, str): + if isstr(rec): lower = behavior["__numba_lower__", rec] if callable(lower): return lower @@ -396,7 +662,7 @@ def overload(behavior, signature): def numba_attrs(layouttype, behavior): behavior = Behavior(ak.behavior, behavior) rec = layouttype.parameters.get("__record__") - if isinstance(rec, str): + if isstr(rec): for key, typer in behavior.items(): if ( isinstance(key, tuple) @@ -411,7 +677,7 @@ def numba_attrs(layouttype, behavior): def numba_methods(layouttype, behavior): behavior = Behavior(ak.behavior, behavior) rec = layouttype.parameters.get("__record__") - if isinstance(rec, str): + if isstr(rec): for key, typer in behavior.items(): if ( isinstance(key, tuple) @@ -428,9 +694,9 @@ def numba_unaryops(unaryop, left, behavior): behavior = Behavior(ak.behavior, behavior) done = False - if isinstance(left, ak._connect._numba.layout.ContentType): + if isinstance(left, ak._connect.numba.layout.ContentType): left = left.parameters.get("__record__") - if not isinstance(left, str): + if not isstr(left): done = True if not done: @@ -450,14 +716,14 @@ def numba_binops(binop, left, right, behavior): behavior = Behavior(ak.behavior, behavior) done = False - if isinstance(left, ak._connect._numba.layout.ContentType): + if isinstance(left, ak._connect.numba.layout.ContentType): left = left.parameters.get("__record__") - if not isinstance(left, str): + if not isstr(left): done = True - if isinstance(right, ak._connect._numba.layout.ContentType): + if isinstance(right, ak._connect.numba.layout.ContentType): right = right.parameters.get("__record__") - if not isinstance(right, str): + if not isstr(right): done = True if not done: @@ -474,21 +740,20 @@ def numba_binops(binop, left, right, behavior): yield typer, lower -def behaviorof(*arrays, **kwargs): +def behavior_of(*arrays, **kwargs): behavior = kwargs.get("behavior") if behavior is not None: # An explicit 'behavior' always wins. return behavior copied = False + highs = ( + ak.highlevel.Array, + ak.highlevel.Record, + # ak.highlevel.ArrayBuilder, + ) for x in arrays[::-1]: - if ( - isinstance( - x, - (ak.highlevel.Array, ak.highlevel.Record, ak.highlevel.ArrayBuilder), - ) - and x.behavior is not None - ): + if isinstance(x, highs) and x.behavior is not None: if behavior is None: behavior = x.behavior elif behavior is x.behavior: @@ -502,26 +767,23 @@ def behaviorof(*arrays, **kwargs): return behavior -def wrap(content, behavior): - if isinstance(content, (ak.layout.Content, ak.partition.PartitionedArray)): - return ak.highlevel.Array(content, behavior=behavior, kernels=None) - - elif isinstance(content, ak.layout.Record): - return ak.highlevel.Record(content, behavior=behavior, kernels=None) - - else: - return content - - -def maybe_wrap(content, behavior, highlevel): +# maybe_wrap and maybe_wrap_like go here +def wrap(content, behavior=None, highlevel=True, like=None): + assert content is None or isinstance( + content, (ak.contents.Content, ak.record.Record) + ) + assert behavior is None or isinstance(behavior, Mapping) + assert isinstance(highlevel, bool) if highlevel: - return ak._util.wrap(content, behavior) - else: - return content + if like is not None and behavior is None: + behavior = behavior_of(like) + if isinstance(content, ak.contents.Content): + return ak.highlevel.Array(content, behavior=behavior) + elif isinstance(content, ak.record.Record): + return ak.highlevel.Record(content, behavior=behavior) -def maybe_wrap_like(content, array, behavior, highlevel): - return maybe_wrap(content, behaviorof(array, behavior=behavior), highlevel) + return content def extra(args, kwargs, defaults): @@ -536,1377 +798,353 @@ def extra(args, kwargs, defaults): return out -def key2index(keys, key): - if keys is None: - attempt = None - else: - try: - attempt = keys.index(key) - except ValueError: - attempt = None - - if attempt is None: - m = key2index._pattern.match(key) - if m is not None: - attempt = m.group(0) - - if attempt is None: - raise ValueError( - f"key {key!r} not found in record" + exception_suffix(__file__) - ) - else: - return attempt - - -key2index._pattern = re.compile(r"^[1-9][0-9]*$") - - -def completely_flatten(array): - if isinstance(array, ak.partition.PartitionedArray): - out = [] - for partition in array.partitions: - for outi in completely_flatten(partition): - out.append(outi) - return tuple(out) - - elif isinstance(array, virtualtypes): - return completely_flatten(array.array) - - elif isinstance(array, unknowntypes): - return (ak.nplike.of(array).array([], dtype=np.bool_),) - - elif isinstance(array, indexedtypes): - return completely_flatten(array.project()) - - elif isinstance(array, uniontypes): - out = [] - for i in range(array.numcontents): - tmp = completely_flatten(array.project(i)) - assert isinstance(tmp, tuple) - for x in tmp: - out.append(x) - return tuple(out) - - elif isinstance(array, optiontypes): - return completely_flatten(array.project()) - - elif isinstance(array, listtypes): - return completely_flatten(array.flatten(axis=1)) - - elif isinstance(array, recordtypes): - out = [] - for i in range(array.numfields): - out.extend(completely_flatten(array.field(i))) - return tuple(out) +def union_to_record(unionarray, anonymous): + nplike = ak.nplike.of(unionarray) - elif isinstance(array, ak.layout.NumpyArray): - if array.format.upper().startswith("M"): - return ( - ak.nplike.of(array) - .asarray(array.view_int64) - .view(array.format) - .reshape(-1), + contents = [] + for layout in unionarray.contents: + if layout.is_IndexedType and not layout.is_OptionType: + contents.append(layout.project()) + elif layout.is_UnionType: + contents.append(union_to_record(layout, anonymous)) + elif layout.is_OptionType: + contents.append( + ak.operations.fill_none(layout, np.nan, axis=0, highlevel=False) ) else: - return (ak.nplike.of(array).asarray(array).reshape(-1),) + contents.append(layout) - else: - raise RuntimeError( - f"cannot completely flatten: {type(array)}" + exception_suffix(__file__) + if not any(isinstance(x, ak.contents.RecordArray) for x in contents): + return ak.contents.UnionArray( + unionarray.tags, + unionarray.index, + contents, + unionarray.identifier, + unionarray.parameters, ) + else: + seen = set() + all_names = [] + for layout in contents: + if isinstance(layout, ak.contents.RecordArray): + for field in layout.fields: + if field not in seen: + seen.add(field) + all_names.append(field) + else: + if anonymous not in seen: + seen.add(anonymous) + all_names.append(anonymous) -def broadcast_and_apply( # noqa: C901 - inputs, - getfunction, - behavior, - allow_records=True, - pass_depth=True, - pass_user=False, - user=None, - left_broadcast=True, - right_broadcast=True, - numpy_to_regular=False, - regular_to_jagged=False, -): - def checklength(inputs): - length = len(inputs[0]) - for x in inputs[1:]: - if len(x) != length: - raise ValueError( - "cannot broadcast {} of length {} with {} of " - "length {}".format( - type(inputs[0]).__name__, length, type(x).__name__, len(x) - ) - + exception_suffix(__file__) - ) + missingarray = ak.contents.IndexedOptionArray( + ak.index.Index64(nplike.full(len(unionarray), -1, dtype=np.int64)), + ak.contents.EmptyArray(), + ) - def all_same_offsets(nplike, inputs): - offsets = None - for x in inputs: - if isinstance( - x, - ( - ak.layout.ListOffsetArray32, - ak.layout.ListOffsetArrayU32, - ak.layout.ListOffsetArray64, - ), - ): - if offsets is None: - offsets = nplike.asarray(x.offsets) - elif not nplike.array_equal(offsets, nplike.asarray(x.offsets)): - return False - elif isinstance( - x, - ( - ak.layout.ListArray32, - ak.layout.ListArrayU32, - ak.layout.ListArray64, - ), - ): - starts = nplike.asarray(x.starts) - stops = nplike.asarray(x.stops) - if not nplike.array_equal(starts[1:], stops[:-1]): - return False - if offsets is None: - offsets = nplike.empty(len(starts) + 1, dtype=starts.dtype) - if len(offsets) == 1: - offsets[0] = 0 + all_fields = [] + for name in all_names: + union_contents = [] + for layout in contents: + if isinstance(layout, ak.contents.RecordArray): + for field in layout.fields: + if name == field: + union_contents.append(layout._getitem_field(field)) + break else: - offsets[:-1] = starts - offsets[-1] = stops[-1] - elif not nplike.array_equal(offsets[:-1], starts) or ( - len(stops) != 0 and offsets[-1] != stops[-1] - ): - return False - elif isinstance(x, ak.layout.RegularArray): - if x.size == 0: - my_offsets = nplike.empty(0, dtype=np.int64) - else: - my_offsets = nplike.arange(0, len(x.content), x.size) - if offsets is None: - offsets = my_offsets - elif not nplike.array_equal(offsets, my_offsets): - return False - elif isinstance(x, ak.layout.Content): - return False - return True - - def apply(inputs, depth, user): - nplike = ak.nplike.of(*inputs) - - if numpy_to_regular: - inputs = [ - x.toRegularArray() if isinstance(x, ak.layout.NumpyArray) else x - for x in inputs - ] - - if regular_to_jagged: - inputs = [ - x.toListOffsetArray64(False) - if isinstance(x, ak.layout.RegularArray) - else x - for x in inputs - ] - - # handle implicit right-broadcasting (i.e. NumPy-like) - if right_broadcast and any(isinstance(x, listtypes) for x in inputs): - maxdepth = max( - x.purelist_depth for x in inputs if isinstance(x, ak.layout.Content) - ) - - if maxdepth > 0 and all( - x.purelist_isregular for x in inputs if isinstance(x, ak.layout.Content) - ): - nextinputs = [] - for obj in inputs: - if isinstance(obj, ak.layout.Content): - while obj.purelist_depth < maxdepth: - obj = ak.layout.RegularArray(obj, 1, len(obj)) - nextinputs.append(obj) - if any(x is not y for x, y in zip(inputs, nextinputs)): - return apply(nextinputs, depth, user) - - # now all lengths must agree - checklength([x for x in inputs if isinstance(x, ak.layout.Content)]) - - args = () - if pass_depth: - args = args + (depth,) - if pass_user: - args = args + (user,) - - custom = getfunction(inputs, *args) - if callable(custom): - return custom() - else: - user = custom - - # the rest of this is one switch statement - if any(isinstance(x, virtualtypes) for x in inputs): - nextinputs = [] - for x in inputs: - if isinstance(x, virtualtypes): - nextinputs.append(x.array) - else: - nextinputs.append(x) - return apply(nextinputs, depth, user) - - elif any(isinstance(x, unknowntypes) for x in inputs): - nextinputs = [] - for x in inputs: - if isinstance(x, unknowntypes): - nextinputs.append( - ak.layout.NumpyArray(nplike.array([], dtype=np.bool_)) - ) - else: - nextinputs.append(x) - return apply(nextinputs, depth, user) - - elif any(isinstance(x, ak.layout.NumpyArray) and x.ndim > 1 for x in inputs): - nextinputs = [] - for x in inputs: - if isinstance(x, ak.layout.NumpyArray) and x.ndim > 1: - nextinputs.append(x.toRegularArray()) - else: - nextinputs.append(x) - return apply(nextinputs, depth, user) - - elif any(isinstance(x, indexedtypes) for x in inputs): - nextinputs = [] - for x in inputs: - if isinstance(x, indexedtypes): - nextinputs.append(x.project()) + union_contents.append(missingarray) else: - nextinputs.append(x) - return apply(nextinputs, depth, user) - - elif any(isinstance(x, uniontypes) for x in inputs): - tagslist = [] - numtags = [] - length = None - for x in inputs: - if isinstance(x, uniontypes): - tagslist.append(nplike.asarray(x.tags)) - numtags.append(len(x.contents)) - if length is None: - length = len(tagslist[-1]) - elif length != len(tagslist[-1]): - raise ValueError( - "cannot broadcast UnionArray of length {} " - "with UnionArray of length {}".format( - length, len(tagslist[-1]) - ) - + exception_suffix(__file__) - ) - - combos = nplike.stack(tagslist, axis=-1) - - all_combos = nplike.array( - list(itertools.product(*[range(x) for x in numtags])), - dtype=[(str(i), combos.dtype) for i in range(len(tagslist))], - ) - - combos = combos.view( - [(str(i), combos.dtype) for i in range(len(tagslist))] - ).reshape(length) - - tags = nplike.empty(length, dtype=np.int8) - index = nplike.empty(length, dtype=np.int64) - numoutputs = None - outcontents = [] - for tag, combo in enumerate(all_combos): - mask = combos == combo - tags[mask] = tag - index[mask] = nplike.arange(nplike.count_nonzero(mask)) - nextinputs = [] - i = 0 - for x in inputs: - if isinstance(x, uniontypes): - nextinputs.append(x[mask].project(combo[str(i)])) - i += 1 - elif isinstance(x, ak.layout.Content): - nextinputs.append(x[mask]) - else: - nextinputs.append(x) - outcontents.append(apply(nextinputs, depth, user)) - assert isinstance(outcontents[-1], tuple) - if numoutputs is not None: - assert numoutputs == len(outcontents[-1]) - numoutputs = len(outcontents[-1]) - - assert numoutputs is not None - - tags = ak.layout.Index8(tags) - index = ak.layout.Index64(index) - return tuple( - ak.layout.UnionArray8_64( - tags, index, [x[i] for x in outcontents] - ).simplify() - for i in range(numoutputs) - ) - - elif any(isinstance(x, optiontypes) for x in inputs): - mask = None - for x in inputs: - if isinstance(x, optiontypes): - m = nplike.asarray(x.bytemask()).view(np.bool_) - if mask is None: - mask = m + if name == anonymous: + union_contents.append(layout) else: - nplike.bitwise_or(mask, m, out=mask) - - nextmask = ak.layout.Index8(mask.view(np.int8)) - index = nplike.full(len(mask), -1, dtype=np.int64) - index[~mask] = nplike.arange( - len(mask) - nplike.count_nonzero(mask), dtype=np.int64 - ) - index = ak.layout.Index64(index) - if any(not isinstance(x, optiontypes) for x in inputs): - nextindex = nplike.arange(len(mask), dtype=np.int64) - nextindex[mask] = -1 - nextindex = ak.layout.Index64(nextindex) - - nextinputs = [] - for x in inputs: - if isinstance(x, optiontypes): - nextinputs.append(x.project(nextmask)) - elif isinstance(x, ak.layout.Content): - nextinputs.append( - ak.layout.IndexedOptionArray64(nextindex, x).project(nextmask) - ) - else: - nextinputs.append(x) + union_contents.append(missingarray) - outcontent = apply(nextinputs, depth, user) - assert isinstance(outcontent, tuple) - return tuple( - ak.layout.IndexedOptionArray64(index, x).simplify() for x in outcontent + all_fields.append( + ak.contents.UnionArray( + unionarray.tags, + unionarray.index, + union_contents, + unionarray.identifier, + unionarray.parameters, + ).simplify_uniontype() ) - elif any(isinstance(x, listtypes) for x in inputs): - if all( - isinstance(x, ak.layout.RegularArray) or not isinstance(x, listtypes) - for x in inputs - ): - maxsize = max( - x.size for x in inputs if isinstance(x, ak.layout.RegularArray) - ) - for x in inputs: - if isinstance(x, ak.layout.RegularArray): - if maxsize > 1 and x.size == 1: - tmpindex = ak.layout.Index64( - nplike.repeat( - nplike.arange(len(x), dtype=np.int64), maxsize - ) - ) - nextinputs = [] - for x in inputs: - if isinstance(x, ak.layout.RegularArray): - if maxsize > 1 and x.size == 1: - nextinputs.append( - ak.layout.IndexedArray64( - tmpindex, x.content[: len(x) * x.size] - ).project() - ) - elif x.size == maxsize: - nextinputs.append(x.content[: len(x) * x.size]) - else: - raise ValueError( - "cannot broadcast RegularArray of size " - "{} with RegularArray of size {}".format( - x.size, maxsize - ) - + exception_suffix(__file__) - ) - else: - nextinputs.append(x) - - outcontent = apply(nextinputs, depth + 1, user) - assert isinstance(outcontent, tuple) - - length = None - for x in inputs: - if isinstance(x, ak.layout.Content): - if length is None: - length = len(x) - else: - assert length == len(x) - assert length is not None - - return tuple( - ak.layout.RegularArray(x, maxsize, length) for x in outcontent - ) + return ak.contents.RecordArray(all_fields, all_names, len(unionarray)) - elif not all_same_offsets(nplike, inputs): - fcns = [ - custom_broadcast(x, behavior) - if isinstance(x, ak.layout.Content) - else None - for x in inputs - ] - - first, secondround = None, False - for x, fcn in zip(inputs, fcns): - if ( - isinstance(x, listtypes) - and not isinstance(x, ak.layout.RegularArray) - and fcn is None - ): - first = x - break - - if first is None: - secondround = True - for x in inputs: - if isinstance(x, listtypes) and not isinstance( - x, ak.layout.RegularArray - ): - first = x - break - offsets = first.compact_offsets64(True) - - nextinputs = [] - for x, fcn in zip(inputs, fcns): - if callable(fcn) and not secondround: - nextinputs.append(fcn(x, offsets)) - elif isinstance(x, listtypes): - nextinputs.append(x.broadcast_tooffsets64(offsets).content) - # handle implicit left-broadcasting (unlike NumPy) - elif left_broadcast and isinstance(x, ak.layout.Content): - nextinputs.append( - ak.layout.RegularArray(x, 1, len(x)) - .broadcast_tooffsets64(offsets) - .content - ) - else: - nextinputs.append(x) +def direct_Content_subclass(node): + if node is None: + return None + else: + mro = type(node).mro() + return mro[mro.index(ak.contents.Content) - 1] - outcontent = apply(nextinputs, depth + 1, user) - assert isinstance(outcontent, tuple) - return tuple( - ak.layout.ListOffsetArray64(offsets, x) for x in outcontent - ) +def direct_Content_subclass_name(node): + out = direct_Content_subclass(node) + if out is None: + return None + else: + return out.__name__ - else: - lencontent, offsets, starts, stops = None, None, None, None - nextinputs = [] - - for x in inputs: - if isinstance( - x, - ( - ak.layout.ListOffsetArray32, - ak.layout.ListOffsetArrayU32, - ak.layout.ListOffsetArray64, - ), - ): - offsets = x.offsets - lencontent = offsets[-1] - nextinputs.append(x.content[:lencontent]) - - elif isinstance( - x, - ( - ak.layout.ListArray32, - ak.layout.ListArrayU32, - ak.layout.ListArray64, - ), - ): - starts, stops = x.starts, x.stops - if len(starts) == 0 or len(stops) == 0: - nextinputs.append(x.content[:0]) - else: - lencontent = nplike.max(stops) - nextinputs.append(x.content[:lencontent]) - else: - nextinputs.append(x) +def merge_parameters(one, two, merge_equal=False): + if one is None and two is None: + return None - outcontent = apply(nextinputs, depth + 1, user) + elif one is None: + return two - if isinstance(offsets, ak.layout.Index32): - return tuple( - ak.layout.ListOffsetArray32(offsets, x) for x in outcontent - ) - elif isinstance(offsets, ak.layout.IndexU32): - return tuple( - ak.layout.ListOffsetArrayU32(offsets, x) for x in outcontent - ) - elif isinstance(offsets, ak.layout.Index64): - return tuple( - ak.layout.ListOffsetArray64(offsets, x) for x in outcontent - ) - elif isinstance(starts, ak.layout.Index32): - return tuple( - ak.layout.ListArray32(starts, stops, x) for x in outcontent - ) - elif isinstance(starts, ak.layout.IndexU32): - return tuple( - ak.layout.ListArrayU32(starts, stops, x) for x in outcontent - ) - elif isinstance(starts, ak.layout.Index64): - return tuple( - ak.layout.ListArray64(starts, stops, x) for x in outcontent - ) - else: - raise AssertionError( - "unexpected offsets, starts: {} {}".format( - type(offsets), type(starts) - ) - + exception_suffix(__file__) - ) + elif two is None: + return one - elif any(isinstance(x, recordtypes) for x in inputs): - if not allow_records: - raise ValueError( - "cannot broadcast records in this type of operation" - + exception_suffix(__file__) - ) + elif merge_equal: + out = {} + for k, v in two.items(): + if k in one.keys(): + if v == one[k]: + out[k] = v + return out - keys = None - length = None - istuple = True - for x in inputs: - if isinstance(x, recordtypes): - if keys is None: - keys = x.keys() - elif set(keys) != set(x.keys()): - raise ValueError( - "cannot broadcast records because keys don't " - "match:\n {}\n {}".format( - ", ".join(sorted(keys)), ", ".join(sorted(x.keys())) - ) - + exception_suffix(__file__) - ) - if length is None: - length = len(x) - elif length != len(x): - raise ValueError( - "cannot broadcast RecordArray of length {} " - "with RecordArray of length {}".format(length, len(x)) - + exception_suffix(__file__) - ) - if not x.istuple: - istuple = False - - outcontents = [] - numoutputs = None - for key in keys: - outcontents.append( - apply( - [ - x if not isinstance(x, recordtypes) else x[key] - for x in inputs - ], - depth, - user, - ) - ) - assert isinstance(outcontents[-1], tuple) - if numoutputs is not None: - assert numoutputs == len(outcontents[-1]) - numoutputs = len(outcontents[-1]) - return tuple( - ak.layout.RecordArray( - [x[i] for x in outcontents], None if istuple else keys, length - ) - for i in range(numoutputs) - ) - - else: - raise ValueError( - "cannot broadcast: {}".format(", ".join(repr(type(x)) for x in inputs)) - + exception_suffix(__file__) - ) - - if any(isinstance(x, ak.partition.PartitionedArray) for x in inputs): - purelist_isregular = True - purelist_depths = set() - for x in inputs: - if isinstance(x, (ak.layout.Content, ak.partition.PartitionedArray)): - if not x.purelist_isregular: - purelist_isregular = False - break - purelist_depths.add(x.purelist_depth) - - if purelist_isregular and len(purelist_depths) > 1: - nextinputs = [] - for x in inputs: - if isinstance(x, ak.partition.PartitionedArray): - nextinputs.append(x.toContent()) - else: - nextinputs.append(x) - - isscalar = [] - out = apply(broadcast_pack(nextinputs, isscalar), 0, None) - assert isinstance(out, tuple) - return tuple(broadcast_unpack(x, isscalar) for x in out) + else: + out = dict(one) + for k, v in two.items(): + if v is not None: + out[k] = v + return out - else: - sample = None - for x in inputs: - if isinstance(x, ak.partition.PartitionedArray): - sample = x - break - nextinputs = ak.partition.partition_as(sample, inputs) - - outputs = [] - for part_inputs in ak.partition.iterate(sample.numpartitions, nextinputs): - isscalar = [] - part = apply(broadcast_pack(part_inputs, isscalar), 0, None) - assert isinstance(part, tuple) - outputs.append(tuple(broadcast_unpack(x, isscalar) for x in part)) - - out = () - for i in range(len(part)): - out = out + ( - ak.partition.IrregularlyPartitionedArray([x[i] for x in outputs]), - ) - return out - else: - isscalar = [] - out = apply(broadcast_pack(inputs, isscalar), 0, user) - assert isinstance(out, tuple) - return tuple(broadcast_unpack(x, isscalar) for x in out) - - -def broadcast_pack(inputs, isscalar): - maxlen = -1 - for x in inputs: - if isinstance(x, ak.layout.Content): - maxlen = max(maxlen, len(x)) - if maxlen < 0: - maxlen = 1 - - nextinputs = [] - for x in inputs: - if isinstance(x, ak.layout.Record): - index = ak.nplike.of(*inputs).full(maxlen, x.at, dtype=np.int64) - nextinputs.append(ak.layout.RegularArray(x.array[index], maxlen, 1)) - isscalar.append(True) - elif isinstance(x, ak.layout.Content): - nextinputs.append(ak.layout.RegularArray(x, len(x), 1)) - isscalar.append(False) - else: - nextinputs.append(x) - isscalar.append(True) +def expand_braces(text, seen=None): + if seen is None: + seen = set() - return nextinputs + spans = [m.span() for m in expand_braces.regex.finditer(text)][::-1] + alts = [text[start + 1 : stop - 1].split(",") for start, stop in spans] + if len(spans) == 0: + if text not in seen: + yield text + seen.add(text) -def broadcast_unpack(x, isscalar): - if all(isscalar): - if len(x) == 0: - return x.getitem_nothing().getitem_nothing() - else: - return x[0][0] else: - if len(x) == 0: - return x.getitem_nothing() - else: - return x[0] + for combo in itertools.product(*alts): + replaced = list(text) + for (start, stop), replacement in zip(spans, combo): + replaced[start:stop] = replacement + yield from expand_braces("".join(replaced), seen) -def recursively_apply( - layout, - getfunction, - pass_depth=True, - pass_user=False, - user=None, - keep_parameters=True, - numpy_to_regular=False, -): - def transform(layout, depth, user): - if numpy_to_regular and isinstance(layout, ak.layout.NumpyArray): - layout = layout.toRegularArray() +expand_braces.regex = re.compile(r"\{[^\{\}]*\}") - args = () - if pass_depth: - args = args + (depth,) - if pass_user: - args = args + (user,) - custom = getfunction(layout, *args) - if callable(custom): - return custom() +def from_arraylib(array, regulararray, recordarray, highlevel, behavior): + np = ak.nplike.NumpyMetadata.instance() + numpy = ak.nplike.Numpy.instance() - else: - return transform_child_layouts( - transform, layout, depth, user=custom, keep_parameters=keep_parameters + def recurse(array, mask=None): + if regulararray and len(array.shape) > 1: + return ak.contents.RegularArray( + recurse(array.reshape((-1,) + array.shape[2:])), + array.shape[1], + array.shape[0], ) - return transform(layout, 1, user) - - -def recursive_walk(layout, apply, args=(), depth=1, materialize=False): - apply(layout, depth, *args) - - if isinstance(layout, ak.partition.PartitionedArray): - for x in layout.partitions: - recursive_walk(x, apply, args, depth, materialize) - - elif isinstance(layout, ak.layout.NumpyArray): - pass - - elif isinstance(layout, ak.layout.EmptyArray): - pass - - elif isinstance( - layout, - ( - ak.layout.RegularArray, - ak.layout.ListArray32, - ak.layout.ListArrayU32, - ak.layout.ListArray64, - ak.layout.ListOffsetArray32, - ak.layout.ListOffsetArrayU32, - ak.layout.ListOffsetArray64, - ), - ): - recursive_walk(layout.content, apply, args, depth + 1, materialize) - - elif isinstance( - layout, - ( - ak.layout.IndexedArray32, - ak.layout.IndexedArrayU32, - ak.layout.IndexedArray64, - ak.layout.IndexedOptionArray32, - ak.layout.IndexedOptionArray64, - ak.layout.ByteMaskedArray, - ak.layout.BitMaskedArray, - ak.layout.UnmaskedArray, - ), - ): - recursive_walk(layout.content, apply, args, depth, materialize) - - elif isinstance( - layout, - ( - ak.layout.RecordArray, - ak.layout.UnionArray8_32, - ak.layout.UnionArray8_U32, - ak.layout.UnionArray8_64, - ), - ): - for x in layout.contents: - recursive_walk(x, apply, args, depth, materialize) - - elif isinstance(layout, ak.layout.Record): - recursive_walk(layout.array, apply, args, depth, materialize) - - elif isinstance(layout, ak.layout.VirtualArray): - if materialize: - recursive_walk(layout.array, apply, args, depth, materialize) - - else: - raise AssertionError( - f"unrecognized Content type: {type(layout)}" + exception_suffix(__file__) - ) - - -def transform_child_layouts(transform, layout, depth, user=None, keep_parameters=True): - # the rest of this is one switch statement - if isinstance(layout, ak.partition.PartitionedArray): - return ak.partition.IrregularlyPartitionedArray( - [transform(x, depth, user) for x in layout.partitions] - ) + if len(array.shape) == 0: + array = ak.contents.NumpyArray(array.reshape(1)) + + if array.dtype.kind == "S": + asbytes = array.reshape(-1) + itemsize = asbytes.dtype.itemsize + starts = numpy.arange(0, len(asbytes) * itemsize, itemsize, dtype=np.int64) + stops = starts + numpy.char.str_len(asbytes) + data = ak.contents.ListArray( + ak.index.Index64(starts), + ak.index.Index64(stops), + ak.contents.NumpyArray( + asbytes.view("u1"), parameters={"__array__": "byte"}, nplike=numpy + ), + parameters={"__array__": "bytestring"}, + ) + for i in range(len(array.shape) - 1, 0, -1): + data = ak.contents.RegularArray( + data, array.shape[i], array.shape[i - 1] + ) - elif isinstance(layout, ak.layout.NumpyArray): - if keep_parameters: - return layout - else: - return ak.layout.NumpyArray( - ak.nplike.of(layout).asarray(layout), layout.identities, None + elif array.dtype.kind == "U": + asbytes = numpy.char.encode(array.reshape(-1), "utf-8", "surrogateescape") + itemsize = asbytes.dtype.itemsize + starts = numpy.arange(0, len(asbytes) * itemsize, itemsize, dtype=np.int64) + stops = starts + numpy.char.str_len(asbytes) + data = ak.contents.ListArray( + ak.index.Index64(starts), + ak.index.Index64(stops), + ak.contents.NumpyArray( + asbytes.view("u1"), parameters={"__array__": "char"}, nplike=numpy + ), + parameters={"__array__": "string"}, ) + for i in range(len(array.shape) - 1, 0, -1): + data = ak.contents.RegularArray( + data, array.shape[i], array.shape[i - 1] + ) - elif isinstance(layout, ak.layout.EmptyArray): - if keep_parameters: - return layout else: - return ak.layout.EmptyArray(layout.identities, None) - - elif isinstance(layout, ak.layout.RegularArray): - return ak.layout.RegularArray( - transform(layout.content, depth + 1, user), - layout.size, - len(layout), - layout.identities, - layout.parameters if keep_parameters else None, - ) - - elif isinstance(layout, ak.layout.ListArray32): - return ak.layout.ListArray32( - layout.starts, - layout.stops, - transform(layout.content, depth + 1, user), - layout.identities, - layout.parameters if keep_parameters else None, - ) - - elif isinstance(layout, ak.layout.ListArrayU32): - return ak.layout.ListArrayU32( - layout.starts, - layout.stops, - transform(layout.content, depth + 1, user), - layout.identities, - layout.parameters if keep_parameters else None, - ) - - elif isinstance(layout, ak.layout.ListArray64): - return ak.layout.ListArray64( - layout.starts, - layout.stops, - transform(layout.content, depth + 1, user), - layout.identities, - layout.parameters if keep_parameters else None, - ) - - elif isinstance(layout, ak.layout.ListOffsetArray32): - return ak.layout.ListOffsetArray32( - layout.offsets, - transform(layout.content, depth + 1, user), - layout.identities, - layout.parameters if keep_parameters else None, - ) - - elif isinstance(layout, ak.layout.ListOffsetArrayU32): - return ak.layout.ListOffsetArrayU32( - layout.offsets, - transform(layout.content, depth + 1, user), - layout.identities, - layout.parameters if keep_parameters else None, - ) - - elif isinstance(layout, ak.layout.ListOffsetArray64): - return ak.layout.ListOffsetArray64( - layout.offsets, - transform(layout.content, depth + 1, user), - layout.identities, - layout.parameters if keep_parameters else None, - ) - - elif isinstance(layout, ak.layout.IndexedArray32): - return ak.layout.IndexedArray32( - layout.index, - transform(layout.content, depth, user), - layout.identities, - layout.parameters if keep_parameters else None, - ) - - elif isinstance(layout, ak.layout.IndexedArrayU32): - return ak.layout.IndexedArrayU32( - layout.index, - transform(layout.content, depth, user), - layout.identities, - layout.parameters if keep_parameters else None, - ) - - elif isinstance(layout, ak.layout.IndexedArray64): - return ak.layout.IndexedArray64( - layout.index, - transform(layout.content, depth, user), - layout.identities, - layout.parameters if keep_parameters else None, - ) + data = ak.contents.NumpyArray(array) - elif isinstance(layout, ak.layout.IndexedOptionArray32): - return ak.layout.IndexedOptionArray32( - layout.index, - transform(layout.content, depth, user), - layout.identities, - layout.parameters if keep_parameters else None, - ) - - elif isinstance(layout, ak.layout.IndexedOptionArray64): - return ak.layout.IndexedOptionArray64( - layout.index, - transform(layout.content, depth, user), - layout.identities, - layout.parameters if keep_parameters else None, - ) - - elif isinstance(layout, ak.layout.ByteMaskedArray): - return ak.layout.ByteMaskedArray( - layout.mask, - transform(layout.content, depth, user), - layout.valid_when, - layout.identities, - layout.parameters if keep_parameters else None, - ) - - elif isinstance(layout, ak.layout.BitMaskedArray): - return ak.layout.BitMaskedArray( - layout.mask, - transform(layout.content, depth, user), - layout.valid_when, - len(layout), - layout.lsb_order, - layout.identities, - layout.parameters if keep_parameters else None, - ) - - elif isinstance(layout, ak.layout.UnmaskedArray): - return ak.layout.UnmaskedArray( - transform(layout.content, depth, user), - layout.identities, - layout.parameters if keep_parameters else None, - ) - - elif isinstance(layout, ak.layout.RecordArray): - return ak.layout.RecordArray( - [transform(x, depth, user) for x in layout.contents], - layout.recordlookup, - len(layout), - layout.identities, - layout.parameters if keep_parameters else None, - ) - - elif isinstance(layout, ak.layout.Record): - return ak.layout.Record( - transform(layout.array, depth, user), - layout.at, - ) + if mask is None: + return data - elif isinstance(layout, ak.layout.UnionArray8_32): - return ak.layout.UnionArray8_32( - layout.tags, - layout.index, - [transform(x, depth, user) for x in layout.contents], - layout.identities, - layout.parameters if keep_parameters else None, - ) - - elif isinstance(layout, ak.layout.UnionArray8_U32): - return ak.layout.UnionArray8_U32( - layout.tags, - layout.index, - [transform(x, depth, user) for x in layout.contents], - layout.identities, - layout.parameters if keep_parameters else None, - ) + elif mask is False or (isinstance(mask, np.bool_) and not mask): + # NumPy's MaskedArray with mask == False is an UnmaskedArray + if len(array.shape) == 1: + return ak.contents.UnmaskedArray(data) + else: - elif isinstance(layout, ak.layout.UnionArray8_64): - return ak.layout.UnionArray8_64( - layout.tags, - layout.index, - [transform(x, depth, user) for x in layout.contents], - layout.identities, - layout.parameters if keep_parameters else None, - ) + def attach(x): + if isinstance(x, ak.contents.NumpyArray): + return ak.contents.UnmaskedArray(x) + else: + return ak.contents.RegularArray( + attach(x.content), x.size, len(x) + ) - elif isinstance(layout, ak.layout.VirtualArray): - return transform(layout.array, depth, user) + return attach(data.toRegularArray()) - else: - raise AssertionError( - f"unrecognized Content type: {type(layout)}" + exception_suffix(__file__) - ) + else: + # NumPy's MaskedArray is a ByteMaskedArray with valid_when=False + return ak.contents.ByteMaskedArray( + ak.index.Index8(mask), data, valid_when=False + ) + return data -def find_caches(layout): - # Both of the implementations below find referentially unique mutablemappings, - # but the PartitionedArray case is optimized for many unique values (with a set) - # and the non-partitioned case is optimized for few (O(n^2) algo, but no hashmap). - if isinstance(layout, ak.partition.PartitionedArray): - seen = set() - mutablemappings = [] - for partition in layout.partitions: - for cache in partition.caches: - x = cache.mutablemapping - if id(x) not in seen: - seen.add(id(x)) - mutablemappings.append(x) + if isinstance(array, numpy.ma.MaskedArray): + mask = numpy.ma.getmask(array) + array = numpy.ma.getdata(array) + if isinstance(mask, np.ndarray) and len(mask.shape) > 1: + regulararray = True + mask = mask.reshape(-1) else: - mutablemappings = [] - for cache in layout.caches: - x = cache.mutablemapping - for y in mutablemappings: - if x is y: - break - else: - mutablemappings.append(x) + mask = None - return tuple(mutablemappings) + if not recordarray or array.dtype.names is None: + layout = recurse(array, mask) - -def highlevel_type(layout, behavior, isarray): - if isarray: - return ak.types.ArrayType(layout.type(typestrs(behavior)), len(layout)) else: - return layout.type(typestrs(behavior)) - - -_is_identifier = re.compile(r"^[A-Za-z_][A-Za-z_0-9]*$") - - -def minimally_touching_string(limit_length, layout, behavior): - if isinstance(layout, ak.layout.Record): - layout = layout.array[layout.at : layout.at + 1] - - if len(layout) == 0: - return "[]" - - def forward(x, space, brackets=True, wrap=True, stop=None): - done = False - if wrap and isinstance(x, (ak.layout.Content, ak.partition.PartitionedArray)): - cls = arrayclass(x, behavior) - if cls is not ak.highlevel.Array: - y = cls(x, behavior=behavior) - if "__repr__" in type(y).__dict__: - yield space + repr(y) - done = True - if wrap and isinstance(x, ak.layout.Record): - cls = recordclass(x, behavior) - if cls is not ak.highlevel.Record: - y = cls(x, behavior=behavior) - if "__repr__" in type(y).__dict__: - yield space + repr(y) - done = True - if not done: - if isinstance(x, (ak.layout.Content, ak.partition.PartitionedArray)): - if brackets: - yield space + "[" - sp = "" - for i in range(len(x) if stop is None else stop): - for token in forward(x[i], sp): - yield token - sp = ", " - if brackets: - yield "]" - elif isinstance(x, ak.layout.Record) and x.istuple: - yield space + "(" - sp = "" - for i in range(x.numfields): - key = sp - for token in forward(x[str(i)], ""): - yield key + token - key = "" - sp = ", " - yield ")" - elif isinstance(x, ak.layout.Record): - yield space + "{" - sp = "" - for k in x.keys(): - if _is_identifier.match(k) is None: - kk = repr(k) - if kk.startswith("u"): - kk = kk[1:] - else: - kk = k - key = sp + kk + ": " - for token in forward(x[k], ""): - yield key + token - key = "" - sp = ", " - yield "}" - elif isinstance(x, (np.datetime64, np.timedelta64)): - yield space + str(x) - elif isinstance(x, (float, np.floating)): - yield space + f"{x:.3g}" - else: - yield space + repr(x) - - def backward(x, space, brackets=True, wrap=True, stop=-1): - done = False - if wrap and isinstance(x, (ak.layout.Content, ak.partition.PartitionedArray)): - cls = arrayclass(x, behavior) - if cls is not ak.highlevel.Array: - y = cls(x, behavior=behavior) - if "__repr__" in type(y).__dict__: - yield repr(y) + space - done = True - if wrap and isinstance(x, ak.layout.Record): - cls = recordclass(x, behavior) - if cls is not ak.highlevel.Record: - y = cls(x, behavior=behavior) - if "__repr__" in type(y).__dict__: - yield repr(y) + space - done = True - if not done: - if isinstance(x, (ak.layout.Content, ak.partition.PartitionedArray)): - if brackets: - yield "]" + space - sp = "" - for i in range(len(x) - 1, stop, -1): - for token in backward(x[i], sp): - yield token - sp = ", " - if brackets: - yield "[" - elif isinstance(x, ak.layout.Record) and x.istuple: - yield ")" + space - for i in range(x.numfields - 1, -1, -1): - last = None - for token in backward(x[str(i)], ""): - if last is not None: - yield last - last = token - if last is not None: - yield last - if i != 0: - yield ", " - yield "(" - elif isinstance(x, ak.layout.Record): - yield "}" + space - keys = x.keys() - for i in range(len(keys) - 1, -1, -1): - last = None - for token in backward(x[keys[i]], ""): - if last is not None: - yield last - last = token - if _is_identifier.match(keys[i]) is None: - kk = repr(keys[i]) - if kk.startswith("u"): - kk = kk[1:] - else: - kk = keys[i] - if last is not None: - yield kk + ": " + last - if i != 0: - yield ", " - yield "{" - elif isinstance(x, (np.datetime64, np.timedelta64)): - yield str(x) + space - elif isinstance(x, (float, np.floating)): - yield f"{x:.3g}" + space - else: - yield repr(x) + space - - def forever(iterable): - yield from iterable - while True: - yield None - - halfway = len(layout) // 2 - left, right = ["["], ["]"] - leftlen, rightlen = 1, 1 - leftgen = forever(forward(layout, "", brackets=False, wrap=False, stop=halfway)) - rightgen = forever( - backward(layout, "", brackets=False, wrap=False, stop=halfway - 1) - ) - while True: - lft = next(leftgen) - rgt = next(rightgen) + contents = [] + for name in array.dtype.names: + contents.append(recurse(array[name], mask)) + layout = ak.contents.RecordArray(contents, array.dtype.names) - if lft is not None: - if ( - leftlen - + rightlen - + len(lft) - + (2 if lft is None and rgt is None else 6) - > limit_length - ): - break - left.append(lft) - leftlen += len(lft) - - if rgt is not None: - if ( - leftlen - + rightlen - + len(rgt) - + (2 if lft is None and rgt is None else 6) - > limit_length - ): - break - right.append(rgt) - rightlen += len(rgt) - - if lft is None and rgt is None: - break - - while len(left) > 1 and ( - left[-1] == "[" - or left[-1] == ", [" - or left[-1] == "{" - or left[-1] == ", {" - or left[-1] == ", " - ): - left.pop() - lft = "" - while len(right) > 1 and ( - right[-1] == "]" - or right[-1] == "], " - or right[-1] == "}" - or right[-1] == "}, " - or right[-1] == ", " - ): - right.pop() - rgt = "" - if lft is None and rgt is None: - if left == ["["]: - return "[" + "".join(reversed(right)).lstrip(" ") - else: - return ( - "".join(left).rstrip(" ") + ", " + "".join(reversed(right)).lstrip(" ") - ) - else: - if left == ["["] and right == ["]"]: - return "[...]" - elif left == ["["]: - return "[... " + "".join(reversed(right)).lstrip(" ") - else: - return ( - "".join(left).rstrip(" ") - + ", ... " - + "".join(reversed(right)).lstrip(" ") - ) + return ak._util.wrap(layout, behavior, highlevel) -class MappingProxy(MutableMapping): - """ - A type suitable for use with layout.ArrayCache. +def to_arraylib(module, array, allow_missing): + def _impl(array): + if isinstance(array, (bool, numbers.Number)): + return module.array(array) - This can be used to wrap plain dict instances if need be, - since they are not able to be weak referenced. - """ + elif isinstance(array, module.ndarray): + return array - @classmethod - def maybe_wrap(cls, mapping): - if type(mapping) is dict: - return cls(mapping) - return mapping + elif isinstance(array, np.ndarray): + return module.asarray(array) - def __init__(self, base): - self.base = base + elif isinstance(array, ak.highlevel.Array): + return _impl(array.layout) - def __repr__(self): - return repr(self.base) + elif isinstance(array, ak.highlevel.Record): + raise ak._util.error( + ValueError(f"{module.__name__} does not support record structures") + ) - def __getitem__(self, key): - return self.base[key] + elif isinstance(array, ak.highlevel.ArrayBuilder): + return _impl(array.snapshot().layout) - def __setitem__(self, key, value): - self.base[key] = value + elif isinstance(array, ak._ext.ArrayBuilder): + return _impl(array.snapshot()) - def __delitem__(self, key): - del self.base[key] + elif ak.operations.parameters(array).get("__array__") in ( + "bytestring", + "string", + ): + raise ak._util.error( + ValueError(f"{module.__name__} does not support arrays of strings") + ) - def __iter__(self): - return iter(self.base) + elif isinstance(array, ak.contents.EmptyArray): + return module.array([]) - def __len__(self): - return len(self.base) + elif isinstance(array, ak.contents.IndexedArray): + return _impl(array.project()) + elif isinstance(array, ak.contents.UnionArray): + contents = [_impl(array.project(i)) for i in range(len(array.contents))] + out = module.concatenate(contents) -def make_union(tags, index, contents, identities, parameters): - if isinstance(index, ak.layout.Index32): - return ak.layout.UnionArray8_32(tags, index, contents, identities, parameters) - elif isinstance(index, ak.layout.IndexU32): - return ak.layout.UnionArray8_U32(tags, index, contents, identities, parameters) - elif isinstance(index, ak.layout.Index64): - return ak.layout.UnionArray8_64(tags, index, contents, identities, parameters) - else: - raise AssertionError(index) + tags = module.asarray(array.tags) + for tag, content in enumerate(contents): + mask = tags == tag + if type(out).__module__.startswith("jaxlib."): + out = out.at[mask].set(content) + else: + out[mask] = content + return out + elif isinstance(array, ak.contents.UnmaskedArray): + return _impl(array.content) -def union_to_record(unionarray, anonymous): - nplike = ak.nplike.of(unionarray) + elif isinstance(array, ak.contents.IndexedOptionArray): + content = _impl(array.project()) - contents = [] - for layout in unionarray.contents: - if isinstance(layout, virtualtypes): - contents.append(layout.array) - elif isinstance(layout, indexedtypes): - contents.append(layout.project()) - elif isinstance(layout, uniontypes): - contents.append(union_to_record(layout, anonymous)) - elif isinstance(layout, optiontypes): - contents.append( - ak.operations.structure.fill_none( - layout, np.nan, axis=0, highlevel=False + mask0 = array.mask_as_bool(valid_when=False) + if mask0.any(): + raise ak._util.error( + ValueError(f"{module.__name__} does not support masked arrays") ) - ) - else: - contents.append(layout) + else: + return content - if not any(isinstance(x, ak.layout.RecordArray) for x in contents): - return make_union( - unionarray.tags, - unionarray.index, - contents, - unionarray.identities, - unionarray.parameters, - ) + elif isinstance(array, ak.contents.RegularArray): + out = _impl(array.content) + head, tail = out.shape[0], out.shape[1:] + shape = (head // array.size, array.size) + tail + return out[: shape[0] * array.size].reshape(shape) - else: - seen = set() - all_names = [] - for layout in contents: - if isinstance(layout, ak.layout.RecordArray): - for key in layout.keys(): - if key not in seen: - seen.add(key) - all_names.append(key) - else: - if anonymous not in seen: - seen.add(anonymous) - all_names.append(anonymous) + elif isinstance(array, (ak.contents.ListArray, ak.contents.ListOffsetArray)): + return _impl(array.toRegularArray()) - missingarray = ak.layout.IndexedOptionArray64( - ak.layout.Index64(nplike.full(len(unionarray), -1, dtype=np.int64)), - ak.layout.EmptyArray(), - ) + elif isinstance(array, ak.contents.recordarray.RecordArray): + raise ak._util.error( + ValueError(f"{module.__name__} does not support record structures") + ) - all_fields = [] - for name in all_names: - union_contents = [] - for layout in contents: - if isinstance(layout, ak.layout.RecordArray): - for key in layout.keys(): - if name == key: - union_contents.append(layout.field(key)) - break - else: - union_contents.append(missingarray) - else: - if name == anonymous: - union_contents.append(layout) - else: - union_contents.append(missingarray) + elif isinstance(array, ak.contents.NumpyArray): + return module.asarray(array.data) - all_fields.append( - make_union( - unionarray.tags, - unionarray.index, - union_contents, - unionarray.identities, - unionarray.parameters, - ).simplify() + elif isinstance(array, ak.contents.Content): + raise ak._util.error( + AssertionError(f"unrecognized Content type: {type(array)}") ) - return ak.layout.RecordArray(all_fields, all_names, len(unionarray)) + elif isinstance(array, Iterable): + return module.asarray(array) + else: + raise ak._util.error( + ValueError(f"cannot convert {array} into {type(module.array([]))}") + ) -def adjust_old_pickle(form, container, num_partitions, behavior): - def key_format(**v): - if num_partitions is None: - if v["attribute"] == "data": - return "{form_key}".format(**v) - else: - return "{form_key}-{attribute}".format(**v) + if module.__name__ in ("jax.numpy", "cupy"): + return _impl(array) + elif module.__name__ == "numpy": + layout = ak.operations.to_layout(array, allow_record=True, allow_other=True) + if isinstance(layout, (ak.contents.Content, ak.record.Record)): + return layout.to_numpy(allow_missing=allow_missing) else: - if v["attribute"] == "data": - return "{form_key}-part{partition}".format(**v) - else: - return "{form_key}-{attribute}-part{partition}".format(**v) - - return ak.operations.convert.from_buffers( - form, - None, - container, - partition_start=0, - key_format=key_format, - lazy=False, - lazy_cache="new", - lazy_cache_key=None, - highlevel=False, - behavior=behavior, - ) + return module.asarray(array) + else: + raise ak._util.error( + ValueError(f"{module.__name__} is not supported by to_arraylib") + ) diff --git a/src/awkward/_v2/__init__.py b/src/awkward/_v2/__init__.py deleted file mode 100644 index 30baeee3f3..0000000000 --- a/src/awkward/_v2/__init__.py +++ /dev/null @@ -1,39 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -# layout classes; functionality that used to be in C++ (in Awkward 1.x) -import awkward._v2.index -import awkward._v2.identifier -import awkward._v2.contents -import awkward._v2.record -import awkward._v2.types -import awkward._v2.forms -import awkward._v2._slicing -import awkward._v2._broadcasting -import awkward._v2._typetracer - -# internal -import awkward._v2._util -import awkward._v2._lookup - -# third-party connectors -import awkward._v2._connect.numpy -import awkward._v2._connect.numexpr -import awkward._v2.numba - -# high-level interface -from awkward._v2.highlevel import Array -from awkward._v2.highlevel import Record -from awkward._v2.highlevel import ArrayBuilder - -# behaviors -import awkward._v2.behaviors.categorical -import awkward._v2.behaviors.mixins -import awkward._v2.behaviors.string - -# operations -from awkward._v2.operations import * - - -behavior = {} -behaviors.string.register(behavior) # noqa: F405 pylint: disable=E0602 -behaviors.categorical.register(behavior) # noqa: F405 pylint: disable=E0602 diff --git a/src/awkward/_v2/_connect/rdataframe/__init__.py b/src/awkward/_v2/_connect/rdataframe/__init__.py deleted file mode 100644 index 3f37305187..0000000000 --- a/src/awkward/_v2/_connect/rdataframe/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE diff --git a/src/awkward/_v2/_util.py b/src/awkward/_v2/_util.py deleted file mode 100644 index 64cd3f814d..0000000000 --- a/src/awkward/_v2/_util.py +++ /dev/null @@ -1,1187 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -# First, transition all the _v2 code to start using implementations in this file. -# Then build up the high-level replacements. - -import itertools -import numbers -import os -import re -import threading -import traceback -import packaging.version - -from collections.abc import Sequence, Mapping, Iterable - -import awkward as ak - -np = ak.nplike.NumpyMetadata.instance() - -win = os.name == "nt" -bits32 = ak.nplike.numpy.iinfo(np.intp).bits == 32 - -# matches include/awkward/common.h -kMaxInt8 = 127 # 2**7 - 1 -kMaxUInt8 = 255 # 2**8 - 1 -kMaxInt32 = 2147483647 # 2**31 - 1 -kMaxUInt32 = 4294967295 # 2**32 - 1 -kMaxInt64 = 9223372036854775806 # 2**63 - 2: see below -kSliceNone = kMaxInt64 + 1 # for Slice::none() -kMaxLevels = 48 - -_backends = { - "cpu": ak.nplike.Numpy, - "cuda": ak.nplike.Cupy, - "jax": ak.nplike.Jax, -} - - -def regularize_backend(backend): - if backend in _backends: - return _backends[backend].instance() - else: - raise error( # noqa: AK101 - ValueError("The available backends for now are `cpu` and `cuda`.") - ) - - -def parse_version(version): - return packaging.version.parse(version) - - -def numpy_at_least(version): - import numpy - - return parse_version(numpy.__version__) >= parse_version(version) - - -def in_module(obj, modulename): - m = type(obj).__module__ - return m == modulename or m.startswith(modulename + ".") - - -def is_file_path(x): - try: - return os.path.isfile(x) - except ValueError: - return False - - -def isint(x): - return isinstance(x, (int, numbers.Integral, np.integer)) and not isinstance( - x, (bool, np.bool_) - ) - - -def isnum(x): - return isinstance(x, (int, float, numbers.Real, np.number)) and not isinstance( - x, (bool, np.bool_) - ) - - -def isstr(x): - return isinstance(x, str) - - -def tobytes(array): - if hasattr(array, "tobytes"): - return array.tobytes() - else: - return array.tostring() - - -def little_endian(array): - return array.astype(array.dtype.newbyteorder("<"), copy=False) - - -def identifier_hash(str): - import base64 - import struct - - return ( - base64.encodebytes(struct.pack("q", hash(str))) - .rstrip(b"=\n") - .replace(b"+", b"") - .replace(b"/", b"") - .decode("ascii") - ) - - -############################################################################### - - -class ErrorContext: - # Any other threads should get a completely independent _slate. - _slate = threading.local() - - _width = 80 - - @classmethod - def primary(cls): - return cls._slate.__dict__.get("__primary_context__") - - def __init__(self, **kwargs): - self._kwargs = kwargs - - def __enter__(self): - # Make it strictly non-reenterant. Only one ErrorContext (per thread) is primary. - if self.primary() is None: - self._slate.__dict__.clear() - self._slate.__dict__.update(self._kwargs) - self._slate.__dict__["__primary_context__"] = self - - def __exit__(self, exception_type, exception_value, traceback): - # Step out of the way so that another ErrorContext can become primary. - if self.primary() is self: - self._slate.__dict__.clear() - - def format_argument(self, width, value): - if isinstance(value, ak._v2.contents.Content): - return self.format_argument(width, ak._v2.highlevel.Array(value)) - elif isinstance(value, ak._v2.record.Record): - return self.format_argument(width, ak._v2.highlevel.Record(value)) - - valuestr = None - if isinstance( - value, - ( - ak._v2.highlevel.Array, - ak._v2.highlevel.Record, - ak._v2.highlevel.ArrayBuilder, - ), - ): - try: - valuestr = value._repr(width) - except Exception as err: - valuestr = f"repr-raised-{type(err).__name__}" - - elif value is None or isinstance(value, (bool, int, float)): - try: - valuestr = repr(value) - except Exception as err: - valuestr = f"repr-raised-{type(err).__name__}" - - elif isinstance(value, (str, bytes)): - try: - if len(value) < 60: - valuestr = repr(value) - else: - valuestr = repr(value[:57]) + "..." - except Exception as err: - valuestr = f"repr-raised-{type(err).__name__}" - - elif isinstance(value, np.ndarray): - import numpy - - if not numpy.__version__.startswith("1.13."): # 'threshold' argument - prefix = f"{type(value).__module__}.{type(value).__name__}(" - suffix = ")" - try: - valuestr = numpy.array2string( - value, - max_line_width=width - len(prefix) - len(suffix), - threshold=0, - ).replace("\n", " ") - valuestr = prefix + valuestr + suffix - except Exception as err: - valuestr = f"array2string-raised-{type(err).__name__}" - - if len(valuestr) > width and "..." in valuestr[:-1]: - last = valuestr.rfind("...") + 3 - while last > width: - last = valuestr[: last - 3].rfind("...") + 3 - valuestr = valuestr[:last] - - if len(valuestr) > width: - valuestr = valuestr[: width - 3] + "..." - - elif isinstance(value, (Sequence, Mapping)) and len(value) < 10000: - valuestr = repr(value) - if len(valuestr) > width: - valuestr = valuestr[: width - 3] + "..." - - if valuestr is None: - return f"{type(value).__name__}-instance" - else: - return valuestr - - -class OperationErrorContext(ErrorContext): - def __init__(self, name, arguments): - string_arguments = {} - for key, value in arguments.items(): - if isstr(key): - width = self._width - 8 - len(key) - 3 - else: - width = self._width - 8 - - string_arguments[key] = self.format_argument(width, value) - - super().__init__( - name=name, - arguments=string_arguments, - traceback=traceback.extract_stack(limit=3)[0], - ) - - @property - def name(self): - return self._kwargs["name"] - - @property - def arguments(self): - return self._kwargs["arguments"] - - @property - def traceback(self): - return self._kwargs["traceback"] - - def format_exception(self, exception): - tb = self.traceback - try: - location = f" (from {tb.filename}, line {tb.lineno})" - except Exception: - location = "" - - arguments = [] - for name, valuestr in self.arguments.items(): - if isstr(name): - arguments.append(f"\n {name} = {valuestr}") - else: - arguments.append(f"\n {valuestr}") - - extra_line = "" if len(arguments) == 0 else "\n " - return f"""while calling{location} - - {self.name}({"".join(arguments)}{extra_line}) - -Error details: {str(exception)}""" - - -class SlicingErrorContext(ErrorContext): - def __init__(self, array, where): - super().__init__( - array=self.format_argument(self._width - 4, array), - where=self.format_slice(where), - traceback=traceback.extract_stack(limit=3)[0], - ) - - @property - def array(self): - return self._kwargs["array"] - - @property - def where(self): - return self._kwargs["where"] - - @property - def traceback(self): - return self._kwargs["traceback"] - - def format_exception(self, exception): - tb = self.traceback - try: - location = f" (from {tb.filename}, line {tb.lineno})" - except Exception: - location = "" - - if isstr(exception): - message = exception - else: - message = f"Error details: {str(exception)}" - - return f"""while attempting to slice{location} - - {self.array} - -with - - {self.where} - -{message}""" - - @staticmethod - def format_slice(x): - if isinstance(x, slice): - if x.step is None: - return "{}:{}".format( - "" if x.start is None else x.start, - "" if x.stop is None else x.stop, - ) - else: - return "{}:{}:{}".format( - "" if x.start is None else x.start, - "" if x.stop is None else x.stop, - x.step, - ) - - elif isinstance(x, tuple): - return "(" + ", ".join(SlicingErrorContext.format_slice(y) for y in x) + ")" - - elif isinstance(x, ak._v2.index.Index64): - return str(x.data) - - elif isinstance(x, ak._v2.contents.Content): - try: - return str(ak._v2.highlevel.Array(x)) - except Exception: - return x._repr(" ", "", "") - - elif isinstance(x, ak._v2.record.Record): - try: - return str(ak._v2.highlevel.Record(x)) - except Exception: - return x._repr(" ", "", "") - - else: - return repr(x) - - -def error(exception, error_context=None): - if isinstance(exception, type) and issubclass(exception, Exception): - try: - exception = exception() - except Exception: - return exception - - if isinstance(exception, (NotImplementedError, AssertionError)): - return type(exception)( - str(exception) - + "\n\nSee if this has been reported at https://github.com/scikit-hep/awkward-1.0/issues" - ) - - if error_context is None: - error_context = ErrorContext.primary() - - if isinstance(error_context, ErrorContext): - # Note: returns an error for the caller to raise! - return type(exception)(error_context.format_exception(exception)) - else: - # Note: returns an error for the caller to raise! - return exception - - -def indexerror(subarray, slicer, details=None): - detailsstr = "" - if details is not None: - detailsstr = f""" - -Error details: {details}.""" - - error_context = ErrorContext.primary() - if not isinstance(error_context, SlicingErrorContext): - # Note: returns an error for the caller to raise! - return IndexError( - f"cannot slice {type(subarray).__name__} with {SlicingErrorContext.format_slice(slicer)}{detailsstr}" - ) - - else: - # Note: returns an error for the caller to raise! - return IndexError( - error_context.format_exception( - f"at inner {type(subarray).__name__} of length {subarray.length}, using sub-slice {error_context.format_slice(slicer)}.{detailsstr}" - ) - ) - - -############################################################################### - -# # Enable warnings for the Awkward package -# warnings.filterwarnings("default", module="awkward.*") - - -# def deprecate( -# message, -# version, -# date=None, -# will_be="an error", -# category=DeprecationWarning, -# stacklevel=2, -# ): -# if date is None: -# date = "" -# else: -# date = " (target date: " + date + ")" -# warning = """In version {0}{1}, this will be {2}. - -# To raise these warnings as errors (and get stack traces to find out where they're called), run - -# import warnings -# warnings.filterwarnings("error", module="awkward.*") - -# after the first `import awkward` or use `@pytest.mark.filterwarnings("error:::awkward.*")` in pytest. - -# Issue: {3}.""".format( -# version, date, will_be, message -# ) -# warnings.warn(warning, category, stacklevel=stacklevel + 1) - - -# # Sentinel object for catching pass-through values -# class Unspecified(object): -# pass - - -def regularize_path(path): - """ - Converts pathlib Paths into plain string paths (for all versions of Python). - """ - is_path = False - - if isinstance(path, getattr(os, "PathLike", ())): - is_path = True - path = os.fspath(path) - - elif hasattr(path, "__fspath__"): - is_path = True - path = path.__fspath__() - - elif path.__class__.__module__ == "pathlib": - import pathlib - - if isinstance(path, pathlib.Path): - is_path = True - path = str(path) - - return is_path, path - - -class Behavior(Mapping): - def __init__(self, defaults, overrides): - self.defaults = defaults - if overrides is None: - self.overrides = {} - else: - self.overrides = overrides - - def __getitem__(self, where): - try: - return self.overrides[where] - except KeyError: - try: - return self.defaults[where] - except KeyError: - return None - - def items(self): - for n, x in self.overrides.items(): - yield n, x - for n, x in self.defaults.items(): - if n not in self.overrides: - yield n, x - - def __iter__(self): - yield from self.keys() - - def __len__(self): - return len(set(self.defaults) | set(self.overrides)) - - -def arrayclass(layout, behavior): - behavior = Behavior(ak._v2.behavior, behavior) - arr = layout.parameter("__array__") - if isstr(arr): - cls = behavior[arr] - if isinstance(cls, type) and issubclass(cls, ak._v2.highlevel.Array): - return cls - deeprec = layout.purelist_parameter("__record__") - if isstr(deeprec): - cls = behavior["*", deeprec] - if isinstance(cls, type) and issubclass(cls, ak._v2.highlevel.Array): - return cls - return ak._v2.highlevel.Array - - -def custom_cast(obj, behavior): - behavior = Behavior(ak._v2.behavior, behavior) - for key, fcn in behavior.items(): - if ( - isinstance(key, tuple) - and len(key) == 2 - and key[0] == "__cast__" - and isinstance(obj, key[1]) - ): - return fcn - return None - - -def custom_broadcast(layout, behavior): - behavior = Behavior(ak._v2.behavior, behavior) - custom = layout.parameter("__array__") - if not isstr(custom): - custom = layout.parameter("__record__") - if not isstr(custom): - custom = layout.purelist_parameter("__record__") - if isstr(custom): - for key, fcn in behavior.items(): - if ( - isinstance(key, tuple) - and len(key) == 2 - and key[0] == "__broadcast__" - and key[1] == custom - ): - return fcn - return None - - -def custom_ufunc(ufunc, layout, behavior): - import numpy - - behavior = Behavior(ak._v2.behavior, behavior) - custom = layout.parameter("__array__") - if not isstr(custom): - custom = layout.parameter("__record__") - if isstr(custom): - for key, fcn in behavior.items(): - if ( - isinstance(key, tuple) - and len(key) == 2 - and (key[0] is ufunc or key[0] is numpy.ufunc) - and key[1] == custom - ): - return fcn - return None - - -def numba_array_typer(layouttype, behavior): - behavior = Behavior(ak._v2.behavior, behavior) - arr = layouttype.parameters.get("__array__") - if isstr(arr): - typer = behavior["__numba_typer__", arr] - if callable(typer): - return typer - deeprec = layouttype.parameters.get("__record__") - if isstr(deeprec): - typer = behavior["__numba_typer__", "*", deeprec] - if callable(typer): - return typer - return None - - -def numba_array_lower(layouttype, behavior): - behavior = Behavior(ak._v2.behavior, behavior) - arr = layouttype.parameters.get("__array__") - if isstr(arr): - lower = behavior["__numba_lower__", arr] - if callable(lower): - return lower - deeprec = layouttype.parameters.get("__record__") - if isstr(deeprec): - lower = behavior["__numba_lower__", "*", deeprec] - if callable(lower): - return lower - return None - - -def recordclass(layout, behavior): - behavior = Behavior(ak._v2.behavior, behavior) - rec = layout.parameter("__record__") - if isstr(rec): - cls = behavior[rec] - if isinstance(cls, type) and issubclass(cls, ak._v2.highlevel.Record): - return cls - return ak._v2.highlevel.Record - - -def reducer_recordclass(reducer, layout, behavior): - behavior = Behavior(ak._v2.behavior, behavior) - rec = layout.parameter("__record__") - if isstr(rec): - return behavior[reducer.highlevel_function(), rec] - - -def typestrs(behavior): - behavior = Behavior(ak._v2.behavior, behavior) - out = {} - for key, typestr in behavior.items(): - if ( - isinstance(key, tuple) - and len(key) == 2 - and key[0] == "__typestr__" - and isstr(key[1]) - and isstr(typestr) - ): - out[key[1]] = typestr - return out - - -def gettypestr(parameters, typestrs): - if parameters is not None: - record = parameters.get("__record__") - if record is not None: - typestr = typestrs.get(record) - if typestr is not None: - return typestr - array = parameters.get("__array__") - if array is not None: - typestr = typestrs.get(array) - if typestr is not None: - return typestr - return None - - -def numba_record_typer(layouttype, behavior): - behavior = Behavior(ak._v2.behavior, behavior) - rec = layouttype.parameters.get("__record__") - if isstr(rec): - typer = behavior["__numba_typer__", rec] - if callable(typer): - return typer - return None - - -def numba_record_lower(layouttype, behavior): - behavior = Behavior(ak._v2.behavior, behavior) - rec = layouttype.parameters.get("__record__") - if isstr(rec): - lower = behavior["__numba_lower__", rec] - if callable(lower): - return lower - return None - - -def overload(behavior, signature): - if not any(s is None for s in signature): - behavior = Behavior(ak._v2.behavior, behavior) - for key, custom in behavior.items(): - if ( - isinstance(key, tuple) - and len(key) == len(signature) - and key[0] == signature[0] - and all( - k == s - or ( - isinstance(k, type) and isinstance(s, type) and issubclass(s, k) - ) - for k, s in zip(key[1:], signature[1:]) - ) - ): - return custom - - -def numba_attrs(layouttype, behavior): - behavior = Behavior(ak._v2.behavior, behavior) - rec = layouttype.parameters.get("__record__") - if isstr(rec): - for key, typer in behavior.items(): - if ( - isinstance(key, tuple) - and len(key) == 3 - and key[0] == "__numba_typer__" - and key[1] == rec - ): - lower = behavior["__numba_lower__", key[1], key[2]] - yield key[2], typer, lower - - -def numba_methods(layouttype, behavior): - behavior = Behavior(ak._v2.behavior, behavior) - rec = layouttype.parameters.get("__record__") - if isstr(rec): - for key, typer in behavior.items(): - if ( - isinstance(key, tuple) - and len(key) == 4 - and key[0] == "__numba_typer__" - and key[1] == rec - and key[3] == () - ): - lower = behavior["__numba_lower__", key[1], key[2], ()] - yield key[2], typer, lower - - -def numba_unaryops(unaryop, left, behavior): - behavior = Behavior(ak._v2.behavior, behavior) - done = False - - if isinstance(left, ak._v2._connect.numba.layout.ContentType): - left = left.parameters.get("__record__") - if not isstr(left): - done = True - - if not done: - for key, typer in behavior.items(): - if ( - isinstance(key, tuple) - and len(key) == 3 - and key[0] == "__numba_typer__" - and key[1] == unaryop - and key[2] == left - ): - lower = behavior["__numba_lower__", key[1], key[2]] - yield typer, lower - - -def numba_binops(binop, left, right, behavior): - behavior = Behavior(ak._v2.behavior, behavior) - done = False - - if isinstance(left, ak._v2._connect.numba.layout.ContentType): - left = left.parameters.get("__record__") - if not isstr(left): - done = True - - if isinstance(right, ak._v2._connect.numba.layout.ContentType): - right = right.parameters.get("__record__") - if not isstr(right): - done = True - - if not done: - for key, typer in behavior.items(): - if ( - isinstance(key, tuple) - and len(key) == 4 - and key[0] == "__numba_typer__" - and key[1] == left - and key[2] == binop - and key[3] == right - ): - lower = behavior["__numba_lower__", key[1], key[2], key[3]] - yield typer, lower - - -def behavior_of(*arrays, **kwargs): - behavior = kwargs.get("behavior") - if behavior is not None: - # An explicit 'behavior' always wins. - return behavior - - copied = False - highs = ( - ak._v2.highlevel.Array, - ak._v2.highlevel.Record, - # ak._v2.highlevel.ArrayBuilder, - ) - for x in arrays[::-1]: - if isinstance(x, highs) and x.behavior is not None: - if behavior is None: - behavior = x.behavior - elif behavior is x.behavior: - pass - elif not copied: - behavior = dict(behavior) - behavior.update(x.behavior) - copied = True - else: - behavior.update(x.behavior) - return behavior - - -# maybe_wrap and maybe_wrap_like go here -def wrap(content, behavior=None, highlevel=True, like=None): - assert content is None or isinstance( - content, (ak._v2.contents.Content, ak._v2.record.Record) - ) - assert behavior is None or isinstance(behavior, Mapping) - assert isinstance(highlevel, bool) - if highlevel: - if like is not None and behavior is None: - behavior = behavior_of(like) - - if isinstance(content, ak._v2.contents.Content): - return ak._v2.highlevel.Array(content, behavior=behavior) - elif isinstance(content, ak._v2.record.Record): - return ak._v2.highlevel.Record(content, behavior=behavior) - - return content - - -def extra(args, kwargs, defaults): - out = [] - for i, (name, default) in enumerate(defaults): - if i < len(args): - out.append(args[i]) - elif name in kwargs: - out.append(kwargs[name]) - else: - out.append(default) - return out - - -# def key2index(keys, key): -# if keys is None: -# attempt = None -# else: -# try: -# attempt = keys.index(key) -# except ValueError: -# attempt = None - -# if attempt is None: -# m = key2index._pattern.match(key) -# if m is not None: -# attempt = m.group(0) - -# if attempt is None: -# raise error(ValueError( -# "key {0} not found in record".format(repr(key)) -# )) -# else: -# return attempt - - -# key2index._pattern = re.compile(r"^[1-9][0-9]*$") - - -# def make_union(tags, index, contents, identifier, parameters): -# if isinstance(index, ak._v2.contents.Index32): -# return ak._v2.contents.UnionArray8_32(tags, index, contents, identities, parameters) -# elif isinstance(index, ak._v2.contents.IndexU32): -# return ak._v2.contents.UnionArray8_U32(tags, index, contents, identities, parameters) -# elif isinstance(index, ak._v2.index.Index64): -# return ak._v2.contents.UnionArray8_64(tags, index, contents, identities, parameters) -# else: -# raise error(AssertionError(index)) - - -def union_to_record(unionarray, anonymous): - nplike = ak.nplike.of(unionarray) - - contents = [] - for layout in unionarray.contents: - if layout.is_IndexedType and not layout.is_OptionType: - contents.append(layout.project()) - elif layout.is_UnionType: - contents.append(union_to_record(layout, anonymous)) - elif layout.is_OptionType: - contents.append( - ak._v2.operations.fill_none(layout, np.nan, axis=0, highlevel=False) - ) - else: - contents.append(layout) - - if not any(isinstance(x, ak._v2.contents.RecordArray) for x in contents): - return ak._v2.contents.UnionArray( - unionarray.tags, - unionarray.index, - contents, - unionarray.identifier, - unionarray.parameters, - ) - - else: - seen = set() - all_names = [] - for layout in contents: - if isinstance(layout, ak._v2.contents.RecordArray): - for field in layout.fields: - if field not in seen: - seen.add(field) - all_names.append(field) - else: - if anonymous not in seen: - seen.add(anonymous) - all_names.append(anonymous) - - missingarray = ak._v2.contents.IndexedOptionArray( - ak._v2.index.Index64(nplike.full(len(unionarray), -1, dtype=np.int64)), - ak._v2.contents.EmptyArray(), - ) - - all_fields = [] - for name in all_names: - union_contents = [] - for layout in contents: - if isinstance(layout, ak._v2.contents.RecordArray): - for field in layout.fields: - if name == field: - union_contents.append(layout._getitem_field(field)) - break - else: - union_contents.append(missingarray) - else: - if name == anonymous: - union_contents.append(layout) - else: - union_contents.append(missingarray) - - all_fields.append( - ak._v2.contents.UnionArray( - unionarray.tags, - unionarray.index, - union_contents, - unionarray.identifier, - unionarray.parameters, - ).simplify_uniontype() - ) - - return ak._v2.contents.RecordArray(all_fields, all_names, len(unionarray)) - - -def direct_Content_subclass(node): - if node is None: - return None - else: - mro = type(node).mro() - return mro[mro.index(ak._v2.contents.Content) - 1] - - -def direct_Content_subclass_name(node): - out = direct_Content_subclass(node) - if out is None: - return None - else: - return out.__name__ - - -def merge_parameters(one, two, merge_equal=False): - if one is None and two is None: - return None - - elif one is None: - return two - - elif two is None: - return one - - elif merge_equal: - out = {} - for k, v in two.items(): - if k in one.keys(): - if v == one[k]: - out[k] = v - return out - - else: - out = dict(one) - for k, v in two.items(): - if v is not None: - out[k] = v - return out - - -def expand_braces(text, seen=None): - if seen is None: - seen = set() - - spans = [m.span() for m in expand_braces.regex.finditer(text)][::-1] - alts = [text[start + 1 : stop - 1].split(",") for start, stop in spans] - - if len(spans) == 0: - if text not in seen: - yield text - seen.add(text) - - else: - for combo in itertools.product(*alts): - replaced = list(text) - for (start, stop), replacement in zip(spans, combo): - replaced[start:stop] = replacement - yield from expand_braces("".join(replaced), seen) - - -expand_braces.regex = re.compile(r"\{[^\{\}]*\}") - - -def from_arraylib(array, regulararray, recordarray, highlevel, behavior): - np = ak.nplike.NumpyMetadata.instance() - numpy = ak.nplike.Numpy.instance() - - def recurse(array, mask=None): - if regulararray and len(array.shape) > 1: - return ak._v2.contents.RegularArray( - recurse(array.reshape((-1,) + array.shape[2:])), - array.shape[1], - array.shape[0], - ) - - if len(array.shape) == 0: - array = ak._v2.contents.NumpyArray(array.reshape(1)) - - if array.dtype.kind == "S": - asbytes = array.reshape(-1) - itemsize = asbytes.dtype.itemsize - starts = numpy.arange(0, len(asbytes) * itemsize, itemsize, dtype=np.int64) - stops = starts + numpy.char.str_len(asbytes) - data = ak._v2.contents.ListArray( - ak._v2.index.Index64(starts), - ak._v2.index.Index64(stops), - ak._v2.contents.NumpyArray( - asbytes.view("u1"), parameters={"__array__": "byte"}, nplike=numpy - ), - parameters={"__array__": "bytestring"}, - ) - for i in range(len(array.shape) - 1, 0, -1): - data = ak._v2.contents.RegularArray( - data, array.shape[i], array.shape[i - 1] - ) - - elif array.dtype.kind == "U": - asbytes = numpy.char.encode(array.reshape(-1), "utf-8", "surrogateescape") - itemsize = asbytes.dtype.itemsize - starts = numpy.arange(0, len(asbytes) * itemsize, itemsize, dtype=np.int64) - stops = starts + numpy.char.str_len(asbytes) - data = ak._v2.contents.ListArray( - ak._v2.index.Index64(starts), - ak._v2.index.Index64(stops), - ak._v2.contents.NumpyArray( - asbytes.view("u1"), parameters={"__array__": "char"}, nplike=numpy - ), - parameters={"__array__": "string"}, - ) - for i in range(len(array.shape) - 1, 0, -1): - data = ak._v2.contents.RegularArray( - data, array.shape[i], array.shape[i - 1] - ) - - else: - data = ak._v2.contents.NumpyArray(array) - - if mask is None: - return data - - elif mask is False or (isinstance(mask, np.bool_) and not mask): - # NumPy's MaskedArray with mask == False is an UnmaskedArray - if len(array.shape) == 1: - return ak._v2.contents.UnmaskedArray(data) - else: - - def attach(x): - if isinstance(x, ak._v2.contents.NumpyArray): - return ak._v2.contents.UnmaskedArray(x) - else: - return ak._v2.contents.RegularArray( - attach(x.content), x.size, len(x) - ) - - return attach(data.toRegularArray()) - - else: - # NumPy's MaskedArray is a ByteMaskedArray with valid_when=False - return ak._v2.contents.ByteMaskedArray( - ak._v2.index.Index8(mask), data, valid_when=False - ) - - return data - - if isinstance(array, numpy.ma.MaskedArray): - mask = numpy.ma.getmask(array) - array = numpy.ma.getdata(array) - if isinstance(mask, np.ndarray) and len(mask.shape) > 1: - regulararray = True - mask = mask.reshape(-1) - else: - mask = None - - if not recordarray or array.dtype.names is None: - layout = recurse(array, mask) - - else: - contents = [] - for name in array.dtype.names: - contents.append(recurse(array[name], mask)) - layout = ak._v2.contents.RecordArray(contents, array.dtype.names) - - return ak._v2._util.wrap(layout, behavior, highlevel) - - -def to_arraylib(module, array, allow_missing): - def _impl(array): - if isinstance(array, (bool, numbers.Number)): - return module.array(array) - - elif isinstance(array, module.ndarray): - return array - - elif isinstance(array, np.ndarray): - return module.asarray(array) - - elif isinstance(array, ak._v2.highlevel.Array): - return _impl(array.layout) - - elif isinstance(array, ak._v2.highlevel.Record): - raise ak._v2._util.error( - ValueError(f"{module.__name__} does not support record structures") - ) - - elif isinstance(array, ak._v2.highlevel.ArrayBuilder): - return _impl(array.snapshot().layout) - - elif isinstance(array, ak.layout.ArrayBuilder): - return _impl(array.snapshot()) - - elif ak._v2.operations.parameters(array).get("__array__") in ( - "bytestring", - "string", - ): - raise ak._v2._util.error( - ValueError(f"{module.__name__} does not support arrays of strings") - ) - - elif isinstance(array, ak._v2.contents.EmptyArray): - return module.array([]) - - elif isinstance(array, ak._v2.contents.IndexedArray): - return _impl(array.project()) - - elif isinstance(array, ak._v2.contents.UnionArray): - contents = [_impl(array.project(i)) for i in range(len(array.contents))] - out = module.concatenate(contents) - - tags = module.asarray(array.tags) - for tag, content in enumerate(contents): - mask = tags == tag - if type(out).__module__.startswith("jaxlib."): - out = out.at[mask].set(content) - else: - out[mask] = content - return out - - elif isinstance(array, ak._v2.contents.UnmaskedArray): - return _impl(array.content) - - elif isinstance(array, ak._v2.contents.IndexedOptionArray): - content = _impl(array.project()) - - mask0 = array.mask_as_bool(valid_when=False) - if mask0.any(): - raise ak._v2._util.error( - ValueError(f"{module.__name__} does not support masked arrays") - ) - else: - return content - - elif isinstance(array, ak._v2.contents.RegularArray): - out = _impl(array.content) - head, tail = out.shape[0], out.shape[1:] - shape = (head // array.size, array.size) + tail - return out[: shape[0] * array.size].reshape(shape) - - elif isinstance( - array, (ak._v2.contents.ListArray, ak._v2.contents.ListOffsetArray) - ): - return _impl(array.toRegularArray()) - - elif isinstance(array, ak._v2.contents.recordarray.RecordArray): - raise ak._v2._util.error( - ValueError(f"{module.__name__} does not support record structures") - ) - - elif isinstance(array, ak._v2.contents.NumpyArray): - return module.asarray(array.data) - - elif isinstance(array, ak._v2.contents.Content): - raise ak._v2._util.error( - AssertionError(f"unrecognized Content type: {type(array)}") - ) - - elif isinstance(array, Iterable): - return module.asarray(array) - - else: - raise ak._v2._util.error( - ValueError(f"cannot convert {array} into {type(module.array([]))}") - ) - - if module.__name__ in ("jax.numpy", "cupy"): - return _impl(array) - elif module.__name__ == "numpy": - layout = ak._v2.operations.to_layout(array, allow_record=True, allow_other=True) - - if isinstance(layout, (ak._v2.contents.Content, ak._v2.record.Record)): - return layout.to_numpy(allow_missing=allow_missing) - else: - return module.asarray(array) - else: - raise ak._v2._util.error( - ValueError(f"{module.__name__} is not supported by to_arraylib") - ) diff --git a/src/awkward/_v2/behaviors/__init__.py b/src/awkward/_v2/behaviors/__init__.py deleted file mode 100644 index 3f37305187..0000000000 --- a/src/awkward/_v2/behaviors/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE diff --git a/src/awkward/_v2/behaviors/categorical.py b/src/awkward/_v2/behaviors/categorical.py deleted file mode 100644 index 184e2b67c6..0000000000 --- a/src/awkward/_v2/behaviors/categorical.py +++ /dev/null @@ -1,113 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - - -import awkward as ak -from awkward._v2.highlevel import Array - -np = ak.nplike.NumpyMetadata.instance() - - -class CategoricalBehavior(Array): - __name__ = "Array" - - -class _HashableDict: - def __init__(self, obj): - self.keys = tuple(sorted(obj)) - self.values = tuple(as_hashable(obj[k]) for k in self.keys) - self.hash = hash((_HashableDict,) + self.keys, self.values) - - def __hash__(self): - return self.hash - - def __eq__(self, other): - return ( - isinstance(other, _HashableDict) - and self.keys == other.keys - and self.values == other.values - ) - - -class _HashableList: - def __init__(self, obj): - self.values = tuple(obj) - self.hash = hash((_HashableList,) + self.values) - - def __hash__(self): - return self.hash - - def __eq__(self, other): - return isinstance(other, _HashableList) and self.values == other.values - - -def as_hashable(obj): - if isinstance(obj, dict): - return _HashableDict(obj) - elif isinstance(obj, tuple): - return tuple(as_hashable(x) for x in obj) - elif isinstance(obj, list): - return _HashableList(obj) - else: - return obj - - -def _categorical_equal(one, two): - behavior = ak._v2._util.behavior_of(one, two) - - one, two = one.layout, two.layout - - assert one.is_IndexedType or (one.is_OptionType and one.is_IndexedType) - assert two.is_IndexedType or (two.is_OptionType and two.is_IndexedType) - assert one.parameter("__array__") == "categorical" - assert two.parameter("__array__") == "categorical" - - one_index = ak.nplike.numpy.asarray(one.index) - two_index = ak.nplike.numpy.asarray(two.index) - one_content = ak._v2._util.wrap(one.content, behavior) - two_content = ak._v2._util.wrap(two.content, behavior) - - if len(one_content) == len(two_content) and ak._v2.operations.all( - one_content == two_content, axis=None - ): - one_mapped = one_index - - else: - one_list = ak._v2.operations.to_list(one_content) - two_list = ak._v2.operations.to_list(two_content) - one_hashable = [as_hashable(x) for x in one_list] - two_hashable = [as_hashable(x) for x in two_list] - two_lookup = {x: i for i, x in enumerate(two_hashable)} - - one_to_two = ak.nplike.numpy.empty(len(one_hashable) + 1, dtype=np.int64) - for i, x in enumerate(one_hashable): - one_to_two[i] = two_lookup.get(x, len(two_hashable)) - one_to_two[-1] = -1 - - one_mapped = one_to_two[one_index] - - out = one_mapped == two_index - out = ak._v2._util.wrap( - ak._v2.contents.NumpyArray(out), ak._v2._util.behavior_of(one, two) - ) - return out - - -def _apply_ufunc(ufunc, method, inputs, kwargs): - nextinputs = [] - for x in inputs: - if isinstance(x, ak._v2.highlevel.Array) and x.layout.is_IndexedType: - nextinputs.append( - ak._v2.highlevel.Array( - x.layout.project(), behavior=ak._v2._util.behavior_of(x) - ) - ) - else: - nextinputs.append(x) - - return getattr(ufunc, method)(*nextinputs, **kwargs) - - -def register(behavior): - behavior["categorical"] = CategoricalBehavior - behavior[ak.nplike.numpy.equal, "categorical", "categorical"] = _categorical_equal - behavior[ak.nplike.numpy.ufunc, "categorical"] = _apply_ufunc diff --git a/src/awkward/_v2/behaviors/mixins.py b/src/awkward/_v2/behaviors/mixins.py deleted file mode 100644 index e0ed86e9b7..0000000000 --- a/src/awkward/_v2/behaviors/mixins.py +++ /dev/null @@ -1,99 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - - -import sys - -import awkward as ak - - -def mixin_class(registry, name=None): - """ - Args: - registry (dict): The destination behavior mapping registry. Typically, - this would be the global registry #ak.behavior, but one may wish - to register methods in an alternative way. - name (str): The name to assign to the behaviour class. - - This decorator can be used to register a behavior mixin class. - - Any inherited behaviors will automatically be made available to the decorated - class. - - See the "Mixin decorators" section of #ak.behavior for further details. - """ - - def register(cls): - cls_name = cls.__name__ - if name is None: - behavior_name = cls_name - else: - behavior_name = name - - record = type( - cls_name + "Record", - (cls, ak._v2.highlevel.Record), - {"__module__": cls.__module__}, - ) - setattr(sys.modules[cls.__module__], cls_name + "Record", record) - registry[behavior_name] = record - array = type( - cls_name + "Array", - (cls, ak._v2.highlevel.Array), - {"__module__": cls.__module__}, - ) - setattr(sys.modules[cls.__module__], cls_name + "Array", array) - registry["*", behavior_name] = array - for basecls in cls.mro(): - for method in basecls.__dict__.values(): - if hasattr(method, "_awkward_mixin"): - ufunc, rhs, transpose = method._awkward_mixin - if rhs is None: - registry.setdefault((ufunc, behavior_name), method) - continue - for rhs_name in list(rhs) + [behavior_name]: - registry.setdefault((ufunc, behavior_name, rhs_name), method) - if transpose is not None and rhs_name != behavior_name: - registry.setdefault( - (ufunc, rhs_name, behavior_name), transpose - ) - if basecls.__name__ in rhs: - rhs.add(behavior_name) - return cls - - return register - - -def mixin_class_method(ufunc, rhs=None, transpose=True): - """ - Args: - ufunc (numpy.ufunc): A universal function (or NEP18 callable) that is - hooked in Awkward Array, i.e. it can be the first argument of a behavior. - rhs (Set[type] or None): Set of right-hand side argument types, optional - if wrapping a unary function. The left-hand side is expected to - always be `self` of the parent class. - transpose (bool): If true, automatically create a transpose signature - (only makes sense for binary ufuncs). - - This decorator can be used to register a mixin class method. - - Using this decorator ensures that derived classes that are declared with the - #ak.mixin_class decorator will also have the behaviors that this class has. - """ - - def register(method): - if not isinstance(rhs, (set, type(None))): - raise ak._v2._util.error( - ValueError("expected a set of right-hand-side argument types") - ) - if transpose and rhs is not None: - - def transposed(left, right): - return method(right, left) - - # make a copy of rhs, we will edit it later - method._awkward_mixin = (ufunc, set(rhs), transposed) - else: - method._awkward_mixin = (ufunc, rhs, None) - return method - - return register diff --git a/src/awkward/_v2/behaviors/string.py b/src/awkward/_v2/behaviors/string.py deleted file mode 100644 index 8c6cf7d9eb..0000000000 --- a/src/awkward/_v2/behaviors/string.py +++ /dev/null @@ -1,261 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -import awkward as ak -from awkward._v2.highlevel import Array - -np = ak.nplike.NumpyMetadata.instance() - - -class ByteBehavior(Array): - __name__ = "Array" - - def __bytes__(self): - tmp = ak.nplike.of(self.layout).asarray(self.layout) - if hasattr(tmp, "tobytes"): - return tmp.tobytes() - else: - return tmp.tostring() - - def __str__(self): - return str(self.__bytes__()) - - def __repr__(self): - return repr(self.__bytes__()) - - def __iter__(self): - yield from self.__bytes__() - - def __eq__(self, other): - if isinstance(other, (bytes, ByteBehavior)): - return bytes(self) == bytes(other) - else: - return False - - def __ne__(self, other): - return not self.__eq__(self, other) - - def __add__(self, other): - if isinstance(other, (bytes, ByteBehavior)): - return bytes(self) + bytes(other) - else: - raise ak._v2._util.error(TypeError("can only concatenate bytes to bytes")) - - def __radd__(self, other): - if isinstance(other, (bytes, ByteBehavior)): - return bytes(other) + bytes(self) - else: - raise ak._v2._util.error(TypeError("can only concatenate bytes to bytes")) - - -class CharBehavior(Array): - __name__ = "Array" - - def __bytes__(self): - tmp = ak.nplike.of(self.layout).asarray(self.layout) - if hasattr(tmp, "tobytes"): - return tmp.tobytes() - else: - return tmp.tostring() - - def __str__(self): - return self.__bytes__().decode("utf-8", "surrogateescape") - - def __repr__(self): - return repr(self.__bytes__().decode("utf-8", "surrogateescape")) - - def __iter__(self): - yield from self.__str__() - - def __eq__(self, other): - if isinstance(other, (str, CharBehavior)): - return str(self) == str(other) - else: - return False - - def __ne__(self, other): - return not self.__eq__(other) - - def __add__(self, other): - if isinstance(other, (str, CharBehavior)): - return str(self) + str(other) - else: - raise ak._v2._util.error(TypeError("can only concatenate str to str")) - - def __radd__(self, other): - if isinstance(other, (str, CharBehavior)): - return str(other) + str(self) - else: - raise ak._v2._util.error(TypeError("can only concatenate str to str")) - - -class ByteStringBehavior(Array): - __name__ = "Array" - - def __iter__(self): - for x in super().__iter__(): - yield x.__bytes__() - - -class StringBehavior(Array): - __name__ = "Array" - - def __iter__(self): - for x in super().__iter__(): - yield x.__str__() - - -def _string_equal(one, two): - nplike = ak.nplike.of(one, two) - behavior = ak._v2._util.behavior_of(one, two) - - one, two = ( - ak._v2.operations.without_parameters(one).layout, - ak._v2.operations.without_parameters(two).layout, - ) - - # first condition: string lengths must be the same - counts1 = nplike.asarray(one.count(axis=-1)) - counts2 = nplike.asarray(two.count(axis=-1)) - - out = counts1 == counts2 - - # only compare characters in strings that are possibly equal (same length) - possible = nplike.logical_and(out, counts1) - possible_counts = counts1[possible] - - if len(possible_counts) > 0: - onepossible = one[possible] - twopossible = two[possible] - - reduced = ak._v2.operations.all( - ak._v2.Array(onepossible) == ak._v2.Array(twopossible), axis=-1 - ).layout - # update same-length strings with a verdict about their characters - out[possible] = reduced.data - - return ak._v2._util.wrap(ak._v2.contents.NumpyArray(out), behavior) - - -def _string_notequal(one, two): - return ~_string_equal(one, two) - - -def _string_broadcast(layout, offsets): - nplike = ak.nplike.of(offsets) - offsets = nplike.asarray(offsets) - counts = offsets[1:] - offsets[:-1] - if ak._v2._util.win or ak._v2._util.bits32: - counts = counts.astype(np.int32) - parents = nplike.repeat(nplike.arange(len(counts), dtype=counts.dtype), counts) - return ak._v2.contents.IndexedArray( - ak._v2.index.Index64(parents, nplike=nplike), layout - ).project() - - -def _string_numba_typer(viewtype): - import numba - - if viewtype.type.parameters["__array__"] == "string": - return numba.types.string - else: - return numba.cpython.charseq.bytes_type - - -def _string_numba_lower( - context, builder, rettype, viewtype, viewval, viewproxy, attype, atval -): - import numba - import llvmlite.ir - - whichpos = ak._v2._connect.numba.layout.posat( - context, builder, viewproxy.pos, viewtype.type.CONTENT - ) - nextpos = ak._v2._connect.numba.layout.getat( - context, builder, viewproxy.arrayptrs, whichpos - ) - - whichnextpos = ak._v2._connect.numba.layout.posat( - context, builder, nextpos, viewtype.type.contenttype.ARRAY - ) - - startspos = ak._v2._connect.numba.layout.posat( - context, builder, viewproxy.pos, viewtype.type.STARTS - ) - startsptr = ak._v2._connect.numba.layout.getat( - context, builder, viewproxy.arrayptrs, startspos - ) - startsarraypos = builder.add(viewproxy.start, atval) - start = ak._v2._connect.numba.layout.getat( - context, builder, startsptr, startsarraypos, viewtype.type.indextype.dtype - ) - - stopspos = ak._v2._connect.numba.layout.posat( - context, builder, viewproxy.pos, viewtype.type.STOPS - ) - stopsptr = ak._v2._connect.numba.layout.getat( - context, builder, viewproxy.arrayptrs, stopspos - ) - stopsarraypos = builder.add(viewproxy.start, atval) - stop = ak._v2._connect.numba.layout.getat( - context, builder, stopsptr, stopsarraypos, viewtype.type.indextype.dtype - ) - - baseptr = ak._v2._connect.numba.layout.getat( - context, builder, viewproxy.arrayptrs, whichnextpos - ) - rawptr = builder.add( - baseptr, - ak._v2._connect.numba.layout.castint( - context, builder, viewtype.type.indextype.dtype, numba.intp, start - ), - ) - rawptr_cast = builder.inttoptr( - rawptr, - llvmlite.ir.PointerType(llvmlite.ir.IntType(numba.intp.bitwidth // 8)), - ) - strsize = builder.sub(stop, start) - strsize_cast = ak._v2._connect.numba.layout.castint( - context, builder, viewtype.type.indextype.dtype, numba.intp, strsize - ) - - pyapi = context.get_python_api(builder) - gil = pyapi.gil_ensure() - - strptr = builder.bitcast(rawptr_cast, pyapi.cstring) - - if viewtype.type.parameters["__array__"] == "string": - kind = context.get_constant(numba.types.int32, pyapi.py_unicode_1byte_kind) - pystr = pyapi.string_from_kind_and_data(kind, strptr, strsize_cast) - else: - pystr = pyapi.bytes_from_string_and_size(strptr, strsize_cast) - - out = pyapi.to_native_value(rettype, pystr).value - - pyapi.gil_release(gil) - - return out - - -def register(behavior): - behavior["byte"] = ByteBehavior - behavior["__typestr__", "byte"] = "byte" - behavior["char"] = CharBehavior - behavior["__typestr__", "char"] = "char" - - behavior["bytestring"] = ByteStringBehavior - behavior["__typestr__", "bytestring"] = "bytes" - behavior["string"] = StringBehavior - behavior["__typestr__", "string"] = "string" - - behavior[ak.nplike.numpy.equal, "bytestring", "bytestring"] = _string_equal - behavior[ak.nplike.numpy.equal, "string", "string"] = _string_equal - behavior[ak.nplike.numpy.not_equal, "bytestring", "bytestring"] = _string_notequal - behavior[ak.nplike.numpy.not_equal, "string", "string"] = _string_notequal - - behavior["__broadcast__", "bytestring"] = _string_broadcast - behavior["__broadcast__", "string"] = _string_broadcast - - behavior["__numba_typer__", "bytestring"] = _string_numba_typer - behavior["__numba_lower__", "bytestring"] = _string_numba_lower - behavior["__numba_typer__", "string"] = _string_numba_typer - behavior["__numba_lower__", "string"] = _string_numba_lower diff --git a/src/awkward/_v2/contents/__init__.py b/src/awkward/_v2/contents/__init__.py deleted file mode 100644 index b469842f2b..0000000000 --- a/src/awkward/_v2/contents/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -import awkward._v2.index # noqa: F401 -import awkward._v2.record # noqa: F401 - -from awkward._v2.contents.content import Content # noqa: F401 -from awkward._v2.contents.emptyarray import EmptyArray # noqa: F401 -from awkward._v2.contents.numpyarray import NumpyArray # noqa: F401 -from awkward._v2.contents.regulararray import RegularArray # noqa: F401 -from awkward._v2.contents.listarray import ListArray # noqa: F401 -from awkward._v2.contents.listoffsetarray import ListOffsetArray # noqa: F401 -from awkward._v2.contents.recordarray import RecordArray # noqa: F401 -from awkward._v2.contents.indexedarray import IndexedArray # noqa: F401 -from awkward._v2.contents.indexedoptionarray import IndexedOptionArray # noqa: F401 -from awkward._v2.contents.bytemaskedarray import ByteMaskedArray # noqa: F401 -from awkward._v2.contents.bitmaskedarray import BitMaskedArray # noqa: F401 -from awkward._v2.contents.unmaskedarray import UnmaskedArray # noqa: F401 -from awkward._v2.contents.unionarray import UnionArray # noqa: F401 diff --git a/src/awkward/_v2/forms/__init__.py b/src/awkward/_v2/forms/__init__.py deleted file mode 100644 index f115f97090..0000000000 --- a/src/awkward/_v2/forms/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -from awkward._v2.forms.form import Form, from_iter, from_json # noqa: F401 -from awkward._v2.forms.emptyform import EmptyForm # noqa: F401 -from awkward._v2.forms.numpyform import NumpyForm, from_dtype # noqa: F401 -from awkward._v2.forms.regularform import RegularForm # noqa: F401 -from awkward._v2.forms.listform import ListForm # noqa: F401 -from awkward._v2.forms.listoffsetform import ListOffsetForm # noqa: F401 -from awkward._v2.forms.recordform import RecordForm # noqa: F401 -from awkward._v2.forms.indexedform import IndexedForm # noqa: F401 -from awkward._v2.forms.indexedoptionform import IndexedOptionForm # noqa: F401 -from awkward._v2.forms.bytemaskedform import ByteMaskedForm # noqa: F401 -from awkward._v2.forms.bitmaskedform import BitMaskedForm # noqa: F401 -from awkward._v2.forms.unmaskedform import UnmaskedForm # noqa: F401 -from awkward._v2.forms.unionform import UnionForm # noqa: F401 diff --git a/src/awkward/_v2/highlevel.py b/src/awkward/_v2/highlevel.py deleted file mode 100644 index 41b0ebb0b9..0000000000 --- a/src/awkward/_v2/highlevel.py +++ /dev/null @@ -1,3180 +0,0 @@ -# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE - -import io -import sys -import re -import keyword -import copy - -from collections.abc import Iterable -from collections.abc import Sized -from collections.abc import Mapping - -import awkward as ak -from awkward._v2._connect.numpy import NDArrayOperatorsMixin - -np = ak.nplike.NumpyMetadata.instance() -numpy = ak.nplike.Numpy.instance() - -_dir_pattern = re.compile(r"^[a-zA-Z_]\w*$") - - -class Array(NDArrayOperatorsMixin, Iterable, Sized): - """ - Args: - data (#ak.layout.Content, #ak.Array, `np.ndarray`, `cp.ndarray`, `pyarrow.*`, str, dict, or iterable): - Data to wrap or convert into an array. - - If a NumPy array, the regularity of its dimensions is preserved - and the data are viewed, not copied. - - CuPy arrays are treated the same way as NumPy arrays except that - they default to `backend="cuda"`, rather than `backend="cpu"`. - - If a pyarrow object, calls #ak.from_arrow, preserving as much - metadata as possible, usually zero-copy. - - If a dict of str \u2192 columns, combines the columns into an - array of records (like Pandas's DataFrame constructor). - - If a string, the data are assumed to be JSON. - - If an iterable, calls #ak.from_iter, which assumes all dimensions - have irregular lengths. - behavior (None or dict): Custom #ak.behavior for this Array only. - with_name (None or str): Gives tuples and records a name that can be - used to override their behavior (see below). - check_valid (bool): If True, verify that the #layout is valid. - backend (None, `"cpu"`, or `"cuda"`): If `"cpu"`, the Array will be placed in - main memory for use with other `"cpu"` Arrays and Records; if `"cuda"`, - the Array will be placed in GPU global memory using CUDA; if None, - the `data` are left untouched. For `"cuda"`, - [awkward-cuda-kernels](https://pypi.org/project/awkward-cuda-kernels) - must be installed, which can be invoked with - `pip install awkward[cuda] --upgrade`. - - High-level array that can contain data of any type. - - For most users, this is the only class in Awkward Array that matters: it - is the entry point for data analysis with an emphasis on usability. It - intentionally has a minimum of methods, preferring standalone functions - like - - ak.num(array1) - ak.combinations(array1) - ak.cartesian([array1, array2]) - ak.zip({"x": array1, "y": array2, "z": array3}) - - instead of bound methods like - - array1.num() - array1.combinations() - array1.cartesian([array2, array3]) - array1.zip(...) # ? - - because its namespace is valuable for domain-specific parameters and - functionality. For example, if records contain a field named `"num"`, - they can be accessed as - - array1.num - - instead of - - array1["num"] - - without any confusion or interference from #ak.num. The same is true - for domain-specific methods that have been attached to the data. For - instance, an analysis of mailing addresses might have a function that - computes zip codes, which can be attached to the data with a method - like - - latlon.zip() - - without any confusion or interference from #ak.zip. Custom methods like - this can be added with #ak.behavior, and so the namespace of Array - attributes must be kept clear for such applications. - - See also #ak.Record. - - Interfaces to other libraries - ============================= - - NumPy - ***** - - When NumPy - [universal functions](https://docs.scipy.org/doc/numpy/reference/ufuncs.html) - (ufuncs) are applied to an ak.Array, they are passed through the Awkward - data structure, applied to the numerical data at its leaves, and the output - maintains the original structure. - - For example, - - >>> array = ak.Array([[1, 4, 9], [], [16, 25]]) - >>> np.sqrt(array) - - - See also #ak.Array.__array_ufunc__. - - Some NumPy functions other than ufuncs are also handled properly in - NumPy >= 1.17 (see - [NEP 18](https://numpy.org/neps/nep-0018-array-function-protocol.html)) - and if an Awkward override exists. That is, - - np.concatenate - - can be used on an Awkward Array because - - ak.concatenate - - exists. If your NumPy is older than 1.17, use `ak.concatenate` directly. - - Pandas - ****** - - Ragged arrays (list type) can be converted into Pandas - [MultiIndex](https://pandas.pydata.org/pandas-docs/stable/user_guide/advanced.html) - rows and nested records can be converted into MultiIndex columns. If the - Awkward Array has only one "branch" of nested lists (i.e. different record - fields do not have different-length lists, but a single chain of lists-of-lists - is okay), then it can be losslessly converted into a single DataFrame. - Otherwise, multiple DataFrames are needed, though they can be merged (with a - loss of information). - - The #ak.to_dataframe function performs this conversion; if `how=None`, it - returns a list of DataFrames; otherwise, `how` is passed to `pd.merge` when - merging the resultant DataFrames. - - Numba - ***** - - Arrays can be used in [Numba](http://numba.pydata.org/): they can be - passed as arguments to a Numba-compiled function or returned as return - values. The only limitation is that Awkward Arrays cannot be *created* - inside the Numba-compiled function; to make outputs, consider - #ak.ArrayBuilder. - - Arrow - ***** - - Arrays are convertible to and from [Apache Arrow](https://arrow.apache.org/), - a standard for representing nested data structures in columnar arrays. - See #ak.to_arrow and #ak.from_arrow. - - NumExpr - ******* - - [NumExpr](https://numexpr.readthedocs.io/en/latest/user_guide.html) can - calculate expressions on a set of ak.Arrays, but only if the functions in - `ak.numexpr` are used, not the functions in the `numexpr` library directly. - - Like NumPy ufuncs, the expression is evaluated on the numeric leaves of the - data structure, maintaining structure in the output. - - See #ak.numexpr.evaluate to calculate an expression. - - See #ak.numexpr.re_evaluate to recalculate an expression without - rebuilding its virtual machine. - - Autograd - ******** - - Derivatives of a calculation on a set of ak.Arrays can be calculated with - [Autograd](https://github.com/HIPS/autograd#readme), but only if the - function in `ak.autograd` is used, not the functions in the `autograd` - library directly. - - Like NumPy ufuncs, the function and its derivatives are evaluated on the - numeric leaves of the data structure, maintaining structure in the output. - - See #ak.autograd.elementwise_grad to calculate a function and its - derivatives elementwise on each numeric value in an ak.Array. - """ - - def __init__( - self, - data, - behavior=None, - with_name=None, - check_valid=False, - backend=None, - ): - if isinstance(data, ak._v2.contents.Content): - layout = data - - elif isinstance(data, Array): - layout = data._layout - - elif isinstance(data, np.ndarray) and data.dtype != np.dtype("O"): - layout = ak._v2.operations.from_numpy(data, highlevel=False) - - elif ak._v2._util.in_module(data, "cupy"): - layout = ak._v2.operations.from_cupy(data, highlevel=False) - - elif ak._v2._util.in_module(data, "pyarrow"): - layout = ak._v2.operations.from_arrow(data, highlevel=False) - - elif isinstance(data, dict): - fields = [] - contents = [] - length = None - for k, v in data.items(): - fields.append(k) - contents.append(Array(v).layout) - if length is None: - length = len(contents[-1]) - elif length != len(contents[-1]): - raise ak._v2._util.error( - ValueError( - "dict of arrays in ak.Array constructor must have arrays " - "of equal length ({} vs {})".format( - length, len(contents[-1]) - ) - ) - ) - layout = ak._v2.contents.RecordArray(contents, fields) - - elif isinstance(data, str): - layout = ak._v2.operations.from_json(data, highlevel=False) - - else: - layout = ak._v2.operations.from_iter( - data, highlevel=False, allow_record=False - ) - - if not isinstance(layout, ak._v2.contents.Content): - raise ak._v2._util.error( - TypeError("could not convert data into an ak.Array") - ) - - if with_name is not None: - layout = ak._v2.operations.with_name( - layout, with_name, highlevel=False, behavior=behavior - ) - - if backend is not None and backend != ak._v2.operations.backend(layout): - layout = ak._v2.operations.to_backend(layout, backend, highlevel=False) - - self.layout = layout - self.behavior = behavior - - docstr = layout.purelist_parameter("__doc__") - if ak._v2._util.isstr(docstr): - self.__doc__ = docstr - - if check_valid: - ak._v2.operations.validity_error(self, exception=True) - - @property - def layout(self): - """ - The composable #ak.layout.Content elements that determine how this - Array is structured. - - This may be considered a "low-level" view, as it distinguishes between - arrays that have the same logical meaning (i.e. same JSON output and - high-level #type) but different - - * node types, such as #ak.layout.ListArray64 and - #ak.layout.ListOffsetArray64, - * integer type specialization, such as #ak.layout.ListArray64 - and #ak.layout.ListArray64, - * or specific values, such as gaps in a #ak.layout.ListArray64. - - The #ak.layout.Content elements are fully composable, whereas an - Array is not; the high-level Array is a single-layer "shell" around - its layout. - - Layouts are rendered as XML instead of a nested list. For example, - the following `array` - - ak.Array([[1.1, 2.2, 3.3], [], [4.4, 5.5]]) - - is presented as - - - - but `array.layout` is presented as - - - - - - - - - - - (with truncation for large arrays). - """ - return self._layout - - @layout.setter - def layout(self, layout): - if isinstance(layout, ak._v2.contents.Content): - self._layout = layout - self._numbaview = None - else: - raise ak._v2._util.error( - TypeError("layout must be a subclass of ak._v2.contents.Content") - ) - - @property - def behavior(self): - """ - The `behavior` parameter passed into this Array's constructor. - - * If a dict, this `behavior` overrides the global #ak.behavior. - Any keys in the global #ak.behavior but not this `behavior` are - still valid, but any keys in both are overridden by this - `behavior`. Keys with a None value are equivalent to missing keys, - so this `behavior` can effectively remove keys from the - global #ak.behavior. - - * If None, the Array defaults to the global #ak.behavior. - - See #ak.behavior for a list of recognized key patterns and their - meanings. - """ - return self._behavior - - @behavior.setter - def behavior(self, behavior): - if behavior is None or isinstance(behavior, Mapping): - self.__class__ = ak._v2._util.arrayclass(self._layout, behavior) - self._behavior = behavior - else: - raise ak._v2._util.error(TypeError("behavior must be None or a dict")) - - class Mask: - def __init__(self, array): - self._array = array - - def __getitem__(self, where): - with ak._v2._util.OperationErrorContext( - "ak._v2.Array.mask", {0: self._array, 1: where} - ): - return ak._v2.operations.mask(self._array, where, True) - - @property - def mask(self): - """ - Whereas - - array[array_of_booleans] - - removes elements from `array` in which `array_of_booleans` is False, - - array.mask[array_of_booleans] - - returns data with the same length as the original `array` but False - values in `array_of_booleans` are mapped to None. Such an output - can be used in mathematical expressions with the original `array` - because they are still aligned. - - See <> and #ak.mask. - """ - return self.Mask(self) - - def tolist(self): - """ - Converts this Array into Python objects; same as #ak.to_list - (but without the underscore, like NumPy's - [tolist](https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.tolist.html)). - """ - return self.to_list() - - def to_list(self): - """ - Converts this Array into Python objects; same as #ak.to_list. - """ - return self._layout.to_list(self._behavior) - - def to_numpy(self, allow_missing=True): - """ - Converts this Array into a NumPy array, if possible; same as #ak.to_numpy. - """ - return ak._v2.operations.to_numpy(self, allow_missing=allow_missing) - - @property - def nbytes(self): - """ - The total number of bytes in all the #ak.layout.Index, - #ak.layout.Identifier, and #ak.layout.NumpyArray buffers in this - array tree. - - It does not count buffers that must be kept in memory because - of ownership, but are not directly used in the array. Nor does it count - the (small) C++ nodes or Python objects that reference the (large) - array buffers. - """ - return self._layout.nbytes - - @property - def ndim(self): - """ - Number of dimensions (nested variable-length lists and/or regular arrays) - before reaching a numeric type or a record. - - There may be nested lists within the record, as field values, but this - number of dimensions does not count those. - - (Some fields may have different depths than others, which is why they - are not counted.) - """ - return self._layout.purelist_depth - - @property - def fields(self): - """ - List of field names or tuple slot numbers (as strings) of the outermost - record or tuple in this array. - - If the array contains nested records, only the fields of the outermost - record are shown. If it contains tuples instead of records, its fields - are string representations of integers, such as `"0"`, `"1"`, `"2"`, etc. - The records or tuples may be within multiple layers of nested lists. - - If the array contains neither tuples nor records, it is an empty list. - - See also #ak.fields. - """ - return self._layout.fields - - @property - def is_tuple(self): - """ - If True, the top-most record structure has no named fields, i.e. it's a tuple. - """ - return self._layout.is_tuple - - def _ipython_key_completions_(self): - return self._layout.fields - - @property - def type(self): - """ - The high-level type of this Array; same as #ak.type. - - Note that the outermost element of an Array's type is always an - #ak.types.ArrayType, which specifies the number of elements in the array. - - The type of a #ak.layout.Content (from #ak.Array.layout) is not - wrapped by an #ak.types.ArrayType. - """ - return ak._v2.types.ArrayType( - self._layout.form.type_from_behavior(self._behavior), len(self._layout) - ) - - @property - def typestr(self): - """ - The high-level type of this Array, presented as a string. - - Note that the outermost element of an Array's type is always an - #ak.types.ArrayType, which specifies the number of elements in the array. - - The type of a #ak.layout.Content (from #ak.Array.layout) is not - wrapped by an #ak.types.ArrayType. - """ - return str(self.type) - - def __len__(self): - """ - The length of this Array, only counting the outermost structure. - - For example, the length of - - ak.Array([[1.1, 2.2, 3.3], [], [4.4, 5.5]]) - - is `3`, not `5`. - """ - return len(self._layout) - - def __iter__(self): - """ - Iterates over this Array in Python. - - Note that this is the *slowest* way to access data (even slower than - native Python objects, like lists and dicts). Usually, you should - express your problems in array-at-a-time operations. - - In other words, do this: - - >>> print(np.sqrt(ak.Array([[1.1, 2.2, 3.3], [], [4.4, 5.5]]))) - [[1.05, 1.48, 1.82], [], [2.1, 2.35]] - - not this: - - >>> for outer in ak.Array([[1.1, 2.2, 3.3], [], [4.4, 5.5]]): - ... for inner in outer: - ... print(np.sqrt(inner)) - ... - 1.0488088481701516 - 1.4832396974191326 - 1.816590212458495 - 2.0976176963403033 - 2.345207879911715 - - Iteration over Arrays exists so that they can be more easily inspected - as Python objects. - - See also #ak.to_list. - """ - if isinstance(self._layout, ak._v2.contents.NumpyArray): - array = self._layout.raw(numpy) - array_param = self._layout.parameter("__array__") - if array_param == "byte": - for x in ak._v2._util.tobytes(array): - yield x - elif array_param == "char": - for x in ak._v2._util.tobytes(array).decode(errors="surrogateescape"): - yield x - else: - for x in array: - yield x - else: - for x in self._layout: - if isinstance(x, ak._v2.contents.NumpyArray): - array_param = x.parameter("__array__") - if array_param == "byte": - yield ak._v2._util.tobytes(x.raw(numpy)) - elif array_param == "char": - yield ak._v2._util.tobytes(x.raw(numpy)).decode( - errors="surrogateescape" - ) - else: - yield ak._v2._util.wrap(x, self._behavior) - elif isinstance(x, (ak._v2.contents.Content, ak._v2.record.Record)): - yield ak._v2._util.wrap(x, self._behavior) - else: - yield x - - def __getitem__(self, where): - """ - Args: - where (many types supported; see below): Index of positions to - select from this Array. - - Select items from the Array using an extension of NumPy's (already - quite extensive) rules. - - All methods of selecting items described in - [NumPy indexing](https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html) - are supported with one exception - ([combining advanced and basic indexing](https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#combining-advanced-and-basic-indexing) - with basic indexes *between* two advanced indexes: the definition - NumPy chose for the result does not have a generalization beyond - rectilinear arrays). - - The `where` parameter can be any of the following or a tuple of - the following. - - * **An integer** selects one element. Like Python/NumPy, it is - zero-indexed: `0` is the first item, `1` is the second, etc. - Negative indexes count from the end of the list: `-1` is the - last, `-2` is the second-to-last, etc. - Indexes beyond the size of the array, either because they're too - large or because they're too negative, raise errors. In - particular, some nested lists might contain a desired element - while others don't; this would raise an error. - * **A slice** (either a Python `slice` object or the - `start:stop:step` syntax) selects a range of elements. The - `start` and `stop` values are zero-indexed; `start` is inclusive - and `stop` is exclusive, like Python/NumPy. Negative `step` - values are allowed, but a `step` of `0` is an error. Slices - beyond the size of the array are not errors but are truncated, - like Python/NumPy. - * **A string** selects a tuple or record field, even if its - position in the tuple is to the left of the dimension where the - tuple/record is defined. (See <> below.) This is - similar to NumPy's - [field access](https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#field-access), - except that strings are allowed in the same tuple with other - slice types. While record fields have names, tuple fields are - integer strings, such as `"0"`, `"1"`, `"2"` (always - non-negative). Be careful to distinguish these from non-string - integers. - * **An iterable of strings** (not the top-level tuple) selects - multiple tuple/record fields. - * **An ellipsis** (either the Python `Ellipsis` object or the - `...` syntax) skips as many dimensions as needed to put the - rest of the slice items to the innermost dimensions. - * **A np.newaxis** or its equivalent, None, does not select items - but introduces a new regular dimension in the output with size - `1`. This is a convenient way to explicitly choose a dimension - for broadcasting. - * **A boolean array** with the same length as the current dimension - (or any iterable, other than the top-level tuple) selects elements - corresponding to each True value in the array, dropping those - that correspond to each False. The behavior is similar to - NumPy's - [compress](https://docs.scipy.org/doc/numpy/reference/generated/numpy.compress.html) - function. - * **An integer array** (or any iterable, other than the top-level - tuple) selects elements like a single integer, but produces a - regular dimension of as many as are desired. The array can have - any length, any order, and it can have duplicates and incomplete - coverage. The behavior is similar to NumPy's - [take](https://docs.scipy.org/doc/numpy/reference/generated/numpy.take.html) - function. - * **An integer Array with missing (None) items** selects multiple - values by index, as above, but None values are passed through - to the output. This behavior matches pyarrow's - [Array.take](https://arrow.apache.org/docs/python/generated/pyarrow.Array.html#pyarrow.Array.take) - which also manages arrays with missing values. See - <