Awkward Array: include/awkward/Content.h Source File

Loading...
Searching...
No Matches
Content.h
Go to the documentation of this file.
1// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
2
3#ifndef AWKWARD_CONTENT_H_
4#define AWKWARD_CONTENT_H_
5
6#include <map>
7
8#include "awkward/common.h"
9#include "awkward/Identities.h"
10#include "awkward/Slice.h"
11#include "awkward/Index.h"
12
13namespace awkward {
14 class Content;
15 using ContentPtr = std::shared_ptr<Content>;
16 using ContentPtrVec = std::vector<std::shared_ptr<Content>>;
17 class Form;
18 using FormPtr = std::shared_ptr<Form>;
19 using FormKey = std::shared_ptr<std::string>;
20 class ArrayCache;
21 using ArrayCachePtr = std::shared_ptr<ArrayCache>;
22 class Type;
23 using TypePtr = std::shared_ptr<Type>;
24 class Reducer;
25 class ToJson;
26 class ToJsonPrettyString;
27 class ToJsonString;
28 class ToJsonPrettyFile;
29 class ToJsonFile;
30
39 class LIBAWKWARD_EXPORT_SYMBOL Form {
40 public:
41 static FormPtr
42 fromnumpy(char kind,
43 int64_t itemsize,
44 const std::vector<int64_t>& inner_shape);
45 static FormPtr
46 fromjson(const std::string& data);
47
50 Form(bool has_identities,
51 const util::Parameters& parameters,
52 const FormKey& form_key);
53
55 virtual ~Form() { }
56
61 virtual const TypePtr
62 type(const util::TypeStrs& typestrs) const = 0;
63
66 virtual void
67 tojson_part(ToJson& builder, bool verbose) const = 0;
68
71 virtual const FormPtr
72 shallow_copy() const = 0;
73
75 virtual const FormPtr
76 with_form_key(const FormKey& form_key) const = 0;
77
91 virtual bool
92 equal(const FormPtr& other,
93 bool check_identities,
94 bool check_parameters,
95 bool check_form_key,
96 bool compatibility_check) const = 0;
97
99 bool
100 form_key_equals(const FormKey& other_form_key) const;
101
105 virtual const std::string
106 purelist_parameter(const std::string& key) const = 0;
107
118 bool
119 parameter_equals(const std::string& key, const std::string& value) const;
120
123 virtual bool
124 purelist_isregular() const = 0;
125
131 virtual int64_t
132 purelist_depth() const = 0;
133
136 virtual bool
137 dimension_optiontype() const = 0;
138
141 const FormKey
142 form_key() const;
143
148 virtual const std::pair<int64_t, int64_t>
149 minmax_depth() const = 0;
150
157 virtual const std::pair<bool, int64_t>
158 branch_depth() const = 0;
159
162 virtual int64_t
163 numfields() const = 0;
164
167 virtual int64_t
168 fieldindex(const std::string& key) const = 0;
169
174 virtual const std::string
175 key(int64_t fieldindex) const = 0;
176
179 virtual bool
180 haskey(const std::string& key) const = 0;
181
184 virtual const std::vector<std::string>
185 keys() const = 0;
186
188 virtual bool
189 istuple() const = 0;
190
193 virtual const std::string
194 tostring() const;
195
200 virtual const std::string
201 tojson(bool pretty, bool verbose) const;
202
205 bool
206 has_identities() const;
207
214 const util::Parameters
215 parameters() const;
216
224 const std::string
225 parameter(const std::string& key) const;
226
230 void
231 identities_tojson(ToJson& builder, bool verbose) const;
232
236 void
237 parameters_tojson(ToJson& builder, bool verbose) const;
238
242 void
243 form_key_tojson(ToJson& builder, bool verbose) const;
244
248 virtual const FormPtr
249 getitem_range() const;
250
254 virtual const FormPtr
255 getitem_field(const std::string& key) const = 0;
256
260 virtual const FormPtr
261 getitem_fields(const std::vector<std::string>& keys) const = 0;
262
263 protected:
265 bool has_identities_;
267 util::Parameters parameters_;
269 FormKey form_key_;
270 };
271
276 class LIBAWKWARD_EXPORT_SYMBOL Content {
277 public:
280 Content(const IdentitiesPtr& identities,
281 const util::Parameters& parameters);
282
284 virtual ~Content() { }
285
306 virtual bool
307 isscalar() const;
308
311 virtual const std::string
312 classname() const = 0;
313
316 virtual const IdentitiesPtr
317 identities() const;
318
327 virtual void
328 setidentities() = 0;
329
338 virtual void
339 setidentities(const IdentitiesPtr& identities) = 0;
340
345 virtual const TypePtr
346 type(const util::TypeStrs& typestrs) const = 0;
347
356 virtual const FormPtr
357 form(bool materialize) const = 0;
358
363 virtual kernel::lib
364 kernels() const = 0;
365
368 virtual void
369 caches(std::vector<ArrayCachePtr>& out) const = 0;
370
377 virtual const std::string
378 tostring_part(const std::string& indent,
379 const std::string& pre,
380 const std::string& post) const = 0;
381
384 virtual void
385 tojson_part(ToJson& builder, bool include_beginendlist) const = 0;
386
396 virtual void
397 nbytes_part(std::map<size_t, int64_t>& largest) const = 0;
398
400 virtual int64_t
401 length() const = 0;
402
407 virtual const ContentPtr
408 shallow_copy() const = 0;
409
423 virtual const ContentPtr
424 deep_copy(bool copyarrays,
425 bool copyindexes,
426 bool copyidentities) const = 0;
427
430 virtual void
431 check_for_iteration() const = 0;
432
435 virtual const ContentPtr
436 getitem_nothing() const = 0;
437
443 virtual const ContentPtr
444 getitem_at(int64_t at) const = 0;
445
450 virtual const ContentPtr
451 getitem_at_nowrap(int64_t at) const = 0;
452
464 virtual const ContentPtr
465 getitem_range(int64_t start, int64_t stop) const = 0;
466
474 virtual const ContentPtr
475 getitem_range_nowrap(int64_t start, int64_t stop) const = 0;
476
479 virtual const ContentPtr
480 getitem_field(const std::string& key) const = 0;
481
482 virtual const ContentPtr
483 getitem_field(const std::string& key,
484 const Slice& only_fields) const = 0;
485
488 virtual const ContentPtr
489 getitem_fields(const std::vector<std::string>& keys) const = 0;
490
491 virtual const ContentPtr
492 getitem_fields(const std::vector<std::string>& keys,
493 const Slice& only_fields) const = 0;
494
497 virtual const ContentPtr
498 getitem(const Slice& where) const;
499
512 virtual const ContentPtr
513 getitem_next(const SliceItemPtr& head,
514 const Slice& tail,
515 const Index64& advanced) const;
516
526 virtual const ContentPtr
527 getitem_next_jagged(const Index64& slicestarts,
528 const Index64& slicestops,
529 const SliceItemPtr& slicecontent,
530 const Slice& tail) const;
531
557 virtual const ContentPtr
558 carry(const Index64& carry, bool allow_lazy) const = 0;
559
563 virtual const std::string
564 purelist_parameter(const std::string& key) const;
565
568 bool
569 purelist_isregular() const;
570
573 virtual bool
574 dimension_optiontype() const;
575
584 virtual int64_t
585 purelist_depth() const = 0;
586
591 virtual const std::pair<int64_t, int64_t>
592 minmax_depth() const = 0;
593
600 virtual const std::pair<bool, int64_t>
601 branch_depth() const = 0;
602
605 virtual int64_t
606 numfields() const = 0;
607
610 virtual int64_t
611 fieldindex(const std::string& key) const = 0;
612
617 virtual const std::string
618 key(int64_t fieldindex) const = 0;
619
622 virtual bool
623 haskey(const std::string& key) const = 0;
624
627 virtual const std::vector<std::string>
628 keys() const = 0;
629
631 virtual bool
632 istuple() const = 0;
633
636 virtual const std::string
637 validityerror(const std::string& path) const = 0;
638
646 virtual const ContentPtr
647 shallow_simplify() const = 0;
648
660 virtual const ContentPtr
661 num(int64_t axis, int64_t depth) const = 0;
662
676 virtual const std::pair<Index64, ContentPtr>
677 offsets_and_flattened(int64_t axis, int64_t depth) const = 0;
678
688 virtual bool
689 mergeable(const ContentPtr& other, bool mergebool) const = 0;
690
695 virtual bool
696 referentially_equal(const ContentPtr& other) const = 0;
697
719 virtual const std::pair<ContentPtrVec, ContentPtrVec>
720 merging_strategy(const ContentPtrVec& others) const;
721
727 virtual const ContentPtr
728 reverse_merge(const ContentPtr& other) const;
729
732 const ContentPtr
733 merge(const ContentPtr& other) const;
734
737 virtual const ContentPtr
738 mergemany(const ContentPtrVec& others) const = 0;
739
742 virtual const SliceItemPtr
743 asslice() const = 0;
744
750 virtual const ContentPtr
751 fillna(const ContentPtr& value) const = 0;
752
766 virtual const ContentPtr
767 rpad(int64_t target, int64_t axis, int64_t depth) const = 0;
768
782 virtual const ContentPtr
783 rpad_and_clip(int64_t target, int64_t axis, int64_t depth) const = 0;
784
814 virtual const ContentPtr
815 reduce_next(const Reducer& reducer,
816 int64_t negaxis,
817 const Index64& starts,
818 const Index64& shifts,
819 const Index64& parents,
820 int64_t outlength,
821 bool mask,
822 bool keepdims) const = 0;
823
843 virtual const ContentPtr
844 sort_next(int64_t negaxis,
845 const Index64& starts,
846 const Index64& parents,
847 int64_t outlength,
848 bool ascending,
849 bool stable) const = 0;
850
873 virtual const ContentPtr
874 argsort_next(int64_t negaxis,
875 const Index64& starts,
876 const Index64& shifts,
877 const Index64& parents,
878 int64_t outlength,
879 bool ascending,
880 bool stable) const = 0;
881
896 virtual const ContentPtr
897 localindex(int64_t axis, int64_t depth) const = 0;
898
964 virtual const ContentPtr
965 combinations(int64_t n,
966 bool replacement,
967 const util::RecordLookupPtr& recordlookup,
968 const util::Parameters& parameters,
969 int64_t axis,
970 int64_t depth) const = 0;
971
980 const std::string
981 tostring() const;
982
1000 const std::string
1001 tojson(bool pretty, int64_t maxdecimals,
1002 const char* nan_string = nullptr,
1003 const char* infinity_string = nullptr,
1004 const char* minus_infinity_string = nullptr,
1005 const char* complex_real_string = nullptr,
1006 const char* complex_imag_string = nullptr) const;
1007
1028 void
1029 tojson(FILE* destination,
1030 bool pretty,
1031 int64_t maxdecimals,
1032 int64_t buffersize,
1033 const char* nan_string = nullptr,
1034 const char* infinity_string = nullptr,
1035 const char* minus_infinity_string = nullptr,
1036 const char* complex_real_string = nullptr,
1037 const char* complex_imag_string = nullptr) const;
1038
1042 int64_t
1043 nbytes() const;
1044
1061 const ContentPtr
1062 reduce(const Reducer& reducer,
1063 int64_t axis,
1064 bool mask,
1065 bool keepdims) const;
1066
1079 const ContentPtr
1080 sort(int64_t axis, bool ascending, bool stable) const;
1081
1095 const ContentPtr
1096 argsort(int64_t axis, bool ascending, bool stable) const;
1097
1104 const util::Parameters
1105 parameters() const;
1106
1117 void
1118 setparameters(const util::Parameters& parameters);
1119
1127 const std::string
1128 parameter(const std::string& key) const;
1129
1140 void
1141 setparameter(const std::string& key, const std::string& value);
1142
1153 bool
1154 parameter_equals(const std::string& key, const std::string& value) const;
1155
1169 bool
1170 parameters_equal(const util::Parameters& other, bool check_all) const;
1171
1174 bool
1175 parameter_isstring(const std::string& key) const;
1176
1179 bool
1180 parameter_isname(const std::string& key) const;
1181
1184 const std::string
1185 parameter_asstring(const std::string& key) const;
1186
1191 const ContentPtr
1192 merge_as_union(const ContentPtr& other) const;
1193
1203 const ContentPtr
1204 rpad_axis0(int64_t target, bool clip) const;
1205
1210 const ContentPtr
1211 localindex_axis0() const;
1212
1234 const ContentPtr
1235 combinations_axis0(int64_t n,
1236 bool replacement,
1237 const util::RecordLookupPtr& recordlookup,
1238 const util::Parameters& parameters) const;
1239
1244 virtual const ContentPtr
1245 getitem_next(const SliceAt& at,
1246 const Slice& tail,
1247 const Index64& advanced) const = 0;
1248
1253 virtual const ContentPtr
1254 getitem_next(const SliceRange& range,
1255 const Slice& tail,
1256 const Index64& advanced) const = 0;
1257
1262 virtual const ContentPtr
1263 getitem_next(const SliceEllipsis& ellipsis,
1264 const Slice& tail,
1265 const Index64& advanced) const;
1266
1271 virtual const ContentPtr
1272 getitem_next(const SliceNewAxis& newaxis,
1273 const Slice& tail,
1274 const Index64& advanced) const;
1275
1280 virtual const ContentPtr
1281 getitem_next(const SliceArray64& array,
1282 const Slice& tail,
1283 const Index64& advanced) const = 0;
1284
1289 virtual const ContentPtr
1290 getitem_next(const SliceField& field,
1291 const Slice& tail,
1292 const Index64& advanced) const;
1293
1298 virtual const ContentPtr
1299 getitem_next(const SliceFields& fields,
1300 const Slice& tail,
1301 const Index64& advanced) const;
1302
1307 virtual const ContentPtr
1308 getitem_next(const SliceMissing64& missing,
1309 const Slice& tail,
1310 const Index64& advanced) const;
1311
1316 virtual const ContentPtr
1317 getitem_next(const SliceJagged64& jagged,
1318 const Slice& tail,
1319 const Index64& advanced) const = 0;
1320
1325 virtual const ContentPtr
1326 getitem_next_jagged(const Index64& slicestarts,
1327 const Index64& slicestops,
1328 const SliceArray64& slicecontent,
1329 const Slice& tail) const = 0;
1330
1335 virtual const ContentPtr
1336 getitem_next_jagged(const Index64& slicestarts,
1337 const Index64& slicestops,
1338 const SliceMissing64& slicecontent,
1339 const Slice& tail) const = 0;
1340
1345 virtual const ContentPtr
1346 getitem_next_jagged(const Index64& slicestarts,
1347 const Index64& slicestops,
1348 const SliceJagged64& slicecontent,
1349 const Slice& tail) const = 0;
1350
1365 const int64_t
1366 axis_wrap_if_negative(int64_t axis) const;
1367
1371 virtual const ContentPtr
1372 copy_to(kernel::lib ptr_lib) const = 0;
1373
1375 virtual const ContentPtr
1376 numbers_to_type(const std::string& name) const = 0;
1377
1379 virtual bool
1380 is_unique() const = 0;
1381
1384 virtual const ContentPtr
1385 unique() const = 0;
1386
1388 virtual bool
1389 is_subrange_equal(const Index64& start, const Index64& stop) const = 0;
1390
1391 protected:
1394 const std::string
1395 validityerror_parameters(const std::string& path) const;
1396
1402 const ContentPtr
1403 getitem_next_array_wrap(const ContentPtr& outcontent,
1404 const std::vector<int64_t>& shape) const;
1405
1413 const std::string
1414 parameters_tostring(const std::string& indent,
1415 const std::string& pre,
1416 const std::string& post) const;
1417
1419 kernel::lib
1420 kernels_compare(kernel::lib from_index, const ContentPtr& content) const;
1421
1422 protected:
1424 IdentitiesPtr identities_;
1426 util::Parameters parameters_;
1427 };
1428}
1429
1430#endif // AWKWARD_CONTENT_H_
Identities.h
Index.h
Slice.h
awkward::ArrayCache
Abstract superclass of cache for VirtualArray, defining the interface.
Definition: ArrayCache.h:17
awkward::Content
Abstract superclass of all array node types (flat hierarchy). Any Content can be nested within any ot...
Definition: Content.h:276
awkward::Content::Content
Content(const IdentitiesPtr &identities, const util::Parameters &parameters)
Called by all subclass constructors; assigns identities and parameters upon construction.
awkward::Content::rpad_axis0
const ContentPtr rpad_axis0(int64_t target, bool clip) const
Internal function to handle the axis = 0 case of rpad and rpad_and_clip.
awkward::Content::parameter_isstring
bool parameter_isstring(const std::string &key) const
Returns true if the parameter associated with key is a string; false otherwise.
awkward::Content::dimension_optiontype
virtual bool dimension_optiontype() const
Returns true if this dimension has option-type; false otherwise.
awkward::Content::parameters_
util::Parameters parameters_
See parameters.
Definition: Content.h:1426
awkward::Content::parameter_equals
bool parameter_equals(const std::string &key, const std::string &value) const
Returns true if the parameter associated with key exists and is equal to value; false otherwise.
awkward::Content::istuple
virtual bool istuple() const =0
Returns true if the outermost RecordArray is a tuple.
awkward::Content::~Content
virtual ~Content()
Empty destructor; required for some C++ reason.
Definition: Content.h:284
awkward::Content::carry
virtual const ContentPtr carry(const Index64 &carry, bool allow_lazy) const =0
Returns an array of the same type with elements filtered, rearranged, and possibly duplicated by the ...
awkward::Content::getitem_next_jagged
virtual const ContentPtr getitem_next_jagged(const Index64 &slicestarts, const Index64 &slicestops, const SliceArray64 &slicecontent, const Slice &tail) const =0
Internal function that propagates a jagged array (array with irregular-length dimensions) slice throu...
awkward::Content::kernels_compare
kernel::lib kernels_compare(kernel::lib from_index, const ContentPtr &content) const
Internal function to support most of the logic in kernels.
awkward::Content::combinations
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
Tuples or records of all n-tuple combinations of list items at some axis depth.
awkward::Content::parameter
const std::string parameter(const std::string &key) const
Get one parameter from this array node.
awkward::Content::setidentities
virtual void setidentities()=0
Assign a surrogate index of Identities to this array (in-place).
awkward::Content::sort_next
virtual const ContentPtr sort_next(int64_t negaxis, const Index64 &starts, const Index64 &parents, int64_t outlength, bool ascending, bool stable) const =0
This array sorted.
awkward::Content::tostring
const std::string tostring() const
Returns a string representation of this array (multi-line XML).
awkward::Content::getitem_next_jagged
virtual const ContentPtr getitem_next_jagged(const Index64 &slicestarts, const Index64 &slicestops, const SliceJagged64 &slicecontent, const Slice &tail) const =0
Internal function that propagates a jagged array (array with irregular-length dimensions) slice throu...
awkward::Content::tojson
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
Returns a JSON representation of this array.
awkward::Content::deep_copy
virtual const ContentPtr deep_copy(bool copyarrays, bool copyindexes, bool copyidentities) const =0
Copies this node and all nodes hierarchically nested within it, optionally copying the associated arr...
awkward::Content::getitem_fields
virtual const ContentPtr getitem_fields(const std::vector< std::string > &keys, const Slice &only_fields) const =0
awkward::Content::minmax_depth
virtual const std::pair< int64_t, int64_t > minmax_depth() const =0
Returns (a) the minimum list-depth and (b) the maximum list-depth of the array, which can differ if t...
awkward::Content::key
virtual const std::string key(int64_t fieldindex) const =0
The record name associated with a given field index or the tuple index as a string (e....
awkward::Content::nbytes
int64_t nbytes() const
The number of bytes contained in all array buffers, Index buffers, and Identities buffers,...
awkward::Content::getitem_next
virtual const ContentPtr getitem_next(const SliceItemPtr &head, const Slice &tail, const Index64 &advanced) const
Internal function that propagates a generic getitem request through one axis (including advanced inde...
awkward::Content::getitem_next
virtual const ContentPtr getitem_next(const SliceField &field, const Slice &tail, const Index64 &advanced) const
Internal function that propagates a generic getitem request through one axis (including advanced inde...
awkward::Content::combinations_axis0
const ContentPtr combinations_axis0(int64_t n, bool replacement, const util::RecordLookupPtr &recordlookup, const util::Parameters &parameters) const
Internal function to handle the axis = 0 case of combinations.
awkward::Content::getitem_nothing
virtual const ContentPtr getitem_nothing() const =0
Internal function to get an empty slice (with the correct type).
awkward::Content::numbers_to_type
virtual const ContentPtr numbers_to_type(const std::string &name) const =0
Change the leaf types to 'totype'.
awkward::Content::axis_wrap_if_negative
const int64_t axis_wrap_if_negative(int64_t axis) const
Internal function defining the negative axis handling for many operations.
awkward::Content::rpad
virtual const ContentPtr rpad(int64_t target, int64_t axis, int64_t depth) const =0
If axis = 0, returns a view of this array padded on the right with None values to have a minimum leng...
awkward::Content::purelist_isregular
bool purelist_isregular() const
Returns true if all nested lists down to the first RecordArray are RegularArray nodes; false otherwis...
awkward::Content::getitem_range
virtual const ContentPtr getitem_range(int64_t start, int64_t stop) const =0
Subinterval of this array, handling negative indexing and bounds-checking like Python.
awkward::Content::mergeable
virtual bool mergeable(const ContentPtr &other, bool mergebool) const =0
Returns true if this array can be merged with the other; false otherwise.
awkward::Content::tojson_part
virtual void tojson_part(ToJson &builder, bool include_beginendlist) const =0
Internal function to produce a JSON representation one node at a time.
awkward::Content::copy_to
virtual const ContentPtr copy_to(kernel::lib ptr_lib) const =0
Recursively copies components of the array from main memory to a GPU (if ptr_lib == kernel::lib::cuda...
awkward::Content::num
virtual const ContentPtr num(int64_t axis, int64_t depth) const =0
The length of this array (as a NumpyArray scalar) if axis = 0 or the lengths of subarrays (as an arra...
awkward::Content::getitem_fields
virtual const ContentPtr getitem_fields(const std::vector< std::string > &keys) const =0
This array with the first nested RecordArray replaced by a RecordArray of a given subset of keys.
awkward::Content::merging_strategy
virtual const std::pair< ContentPtrVec, ContentPtrVec > merging_strategy(const ContentPtrVec &others) const
Partitions this array plus a list of others into a head sequence and a tail sequence:
awkward::Content::check_for_iteration
virtual void check_for_iteration() const =0
Performs up-front validity checks on an array so that they don't have to be checked in getitem_at_now...
awkward::Content::localindex
virtual const ContentPtr localindex(int64_t axis, int64_t depth) const =0
A (possibly nested) array of integers indicating the positions of elements within each nested list.
awkward::Content::is_unique
virtual bool is_unique() const =0
Returns 'true' if all components of the array are unique.
awkward::Content::getitem_at_nowrap
virtual const ContentPtr getitem_at_nowrap(int64_t at) const =0
Returns the element at a given position in the array, without handling negative indexing or bounds-ch...
awkward::Content::shallow_copy
virtual const ContentPtr shallow_copy() const =0
Copies this node without copying any nodes hierarchically nested within it or any array/index/identit...
awkward::Content::identities_
IdentitiesPtr identities_
See identities.
Definition: Content.h:1424
awkward::Content::caches
virtual void caches(std::vector< ArrayCachePtr > &out) const =0
Accumulates all the unique #ArrayCache objects from nested #VirtualArray nodes. (Uniqueness is determ...
awkward::Content::getitem_at
virtual const ContentPtr getitem_at(int64_t at) const =0
Returns the element at a given position in the array, handling negative indexing and bounds-checking ...
awkward::Content::kernels
virtual kernel::lib kernels() const =0
Returns the kernel library enum for all nested ptr_lib within the array's tree structure....
awkward::Content::purelist_depth
virtual int64_t purelist_depth() const =0
The list-depth of this array, not counting any contained within a RecordArray.
awkward::Content::mergemany
virtual const ContentPtr mergemany(const ContentPtrVec &others) const =0
Returns an array with this and the others concatenated (in order, this first, others last).
awkward::Content::purelist_parameter
virtual const std::string purelist_parameter(const std::string &key) const
The parameter associated with key at the first level that has a non-null value, descending only as de...
awkward::Content::getitem_field
virtual const ContentPtr getitem_field(const std::string &key) const =0
This array with the first nested RecordArray replaced by the field at key.
awkward::Content::merge_as_union
const ContentPtr merge_as_union(const ContentPtr &other) const
Concatenates this array with other by creating a UnionArray instead of actually merging the data....
awkward::Content::referentially_equal
virtual bool referentially_equal(const ContentPtr &other) const =0
Returns true if this array has all the same buffers and parameters as other; false otherwise.
awkward::Content::reduce
const ContentPtr reduce(const Reducer &reducer, int64_t axis, bool mask, bool keepdims) const
This array with one axis removed by applying a Reducer (e.g. "sum", "max", "any", "all).
awkward::Content::tostring_part
virtual const std::string tostring_part(const std::string &indent, const std::string &pre, const std::string &post) const =0
Internal function to build an output string for tostring.
awkward::Content::getitem_next
virtual const ContentPtr getitem_next(const SliceArray64 &array, const Slice &tail, const Index64 &advanced) const =0
Internal function that propagates a generic getitem request through one axis (including advanced inde...
awkward::Content::unique
virtual const ContentPtr unique() const =0
Returns sorted unique values.
awkward::Content::getitem_next
virtual const ContentPtr getitem_next(const SliceRange &range, const Slice &tail, const Index64 &advanced) const =0
Internal function that propagates a generic getitem request through one axis (including advanced inde...
awkward::Content::numfields
virtual int64_t numfields() const =0
The number of fields in the first nested tuple or records or -1 if this array does not contain a Reco...
awkward::Content::getitem_next
virtual const ContentPtr getitem_next(const SliceJagged64 &jagged, const Slice &tail, const Index64 &advanced) const =0
Internal function that propagates a generic getitem request through one axis (including advanced inde...
awkward::Content::getitem_range_nowrap
virtual const ContentPtr getitem_range_nowrap(int64_t start, int64_t stop) const =0
Subinterval of this array, without handling negative indexing or bounds-checking.
awkward::Content::isscalar
virtual bool isscalar() const
Returns true if the data represented by this node is scalar, not a true array.
awkward::Content::identities
virtual const IdentitiesPtr identities() const
Optional Identities for each element of the array (may be nullptr).
awkward::Content::parameters_equal
bool parameters_equal(const util::Parameters &other, bool check_all) const
Returns true if all parameters of this array node are equal to the other parameters.
awkward::Content::getitem_field
virtual const ContentPtr getitem_field(const std::string &key, const Slice &only_fields) const =0
awkward::Content::getitem_next
virtual const ContentPtr getitem_next(const SliceMissing64 &missing, const Slice &tail, const Index64 &advanced) const
Internal function that propagates a generic getitem request through one axis (including advanced inde...
awkward::Content::type
virtual const TypePtr type(const util::TypeStrs &typestrs) const =0
High-level Type describing this array.
awkward::Content::reduce_next
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
This array with one axis removed by applying a Reducer (e.g. "sum", "max", "any", "all).
awkward::Content::validityerror_parameters
const std::string validityerror_parameters(const std::string &path) const
Internal function to determine if a particular set of parameters are allowed on a particular node (ce...
awkward::Content::fieldindex
virtual int64_t fieldindex(const std::string &key) const =0
The position of a tuple or record key name if this array contains a RecordArray.
awkward::Content::parameter_asstring
const std::string parameter_asstring(const std::string &key) const
Returns the parameter associated with key as a string if parameter_isstring; raises an error otherwis...
awkward::Content::localindex_axis0
const ContentPtr localindex_axis0() const
Internal function to handle the axis = 0 case of localindex.
awkward::Content::getitem_next_jagged
virtual const ContentPtr getitem_next_jagged(const Index64 &slicestarts, const Index64 &slicestops, const SliceMissing64 &slicecontent, const Slice &tail) const =0
Internal function that propagates a jagged array (array with irregular-length dimensions) slice throu...
awkward::Content::shallow_simplify
virtual const ContentPtr shallow_simplify() const =0
Returns an equivalent array simplified at one level only using simplify_optiontype if an option-type ...
awkward::Content::setparameter
void setparameter(const std::string &key, const std::string &value)
Assign one parameter for this array node (in-place).
awkward::Content::classname
virtual const std::string classname() const =0
User-friendly name of this class, including integer-type specialization.
awkward::Content::setparameters
void setparameters(const util::Parameters &parameters)
Assign all the parameters for this array node (in-place).
awkward::Content::parameter_isname
bool parameter_isname(const std::string &key) const
Returns true if the parameter associated with key is a string that matches [A-Za-z_][A-Za-z_0-9]*; fa...
awkward::Content::getitem_next_array_wrap
const ContentPtr getitem_next_array_wrap(const ContentPtr &outcontent, const std::vector< int64_t > &shape) const
Internal function to wrap putative getitem output with enough RegularArray nodes to satisfy a given s...
awkward::Content::setidentities
virtual void setidentities(const IdentitiesPtr &identities)=0
Assign a specified set of Identities to this array (in-place).
awkward::Content::getitem_next
virtual const ContentPtr getitem_next(const SliceFields &fields, const Slice &tail, const Index64 &advanced) const
Internal function that propagates a generic getitem request through one axis (including advanced inde...
awkward::Content::argsort_next
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
This array sorted indices.
awkward::Content::tojson
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
Writes a JSON representation of this array to a destination file.
awkward::Content::keys
virtual const std::vector< std::string > keys() const =0
A list of RecordArray keys or an empty list if this array does not contain a RecordArray.
awkward::Content::argsort
const ContentPtr argsort(int64_t axis, bool ascending, bool stable) const
This array indices with one axis sorted by applying a sorting algorithm.
awkward::Content::nbytes_part
virtual void nbytes_part(std::map< size_t, int64_t > &largest) const =0
Internal function used to calculate nbytes.
awkward::Content::rpad_and_clip
virtual const ContentPtr rpad_and_clip(int64_t target, int64_t axis, int64_t depth) const =0
If axis = 0, returns a view of this array padded on the right.
awkward::Content::fillna
virtual const ContentPtr fillna(const ContentPtr &value) const =0
Returns this array with None values replaced by a given value.
awkward::Content::getitem_next
virtual const ContentPtr getitem_next(const SliceEllipsis &ellipsis, const Slice &tail, const Index64 &advanced) const
Internal function that propagates a generic getitem request through one axis (including advanced inde...
awkward::Content::validityerror
virtual const std::string validityerror(const std::string &path) const =0
Returns an error message if this array is invalid; otherwise, returns an empty string.
awkward::Content::getitem_next_jagged
virtual const ContentPtr getitem_next_jagged(const Index64 &slicestarts, const Index64 &slicestops, const SliceItemPtr &slicecontent, const Slice &tail) const
Internal function that propagates a jagged array (array with irregular-length dimensions) slice throu...
awkward::Content::is_subrange_equal
virtual bool is_subrange_equal(const Index64 &start, const Index64 &stop) const =0
Returns 'true' if subranges are equal.
awkward::Content::branch_depth
virtual const std::pair< bool, int64_t > branch_depth() const =0
Returns (a) whether the list-depth of this array "branches," or differs when followed through differe...
awkward::Content::merge
const ContentPtr merge(const ContentPtr &other) const
An array with this and the other concatenated (this first, other last).
awkward::Content::sort
const ContentPtr sort(int64_t axis, bool ascending, bool stable) const
This array with one axis sorted by applying a sorting algorithm.
awkward::Content::parameters_tostring
const std::string parameters_tostring(const std::string &indent, const std::string &pre, const std::string &post) const
Internal function to convert parameters into a string fragment for tostring.
awkward::Content::form
virtual const FormPtr form(bool materialize) const =0
Low-level Form describing all the features of this array except the actual data buffers (Index,...
awkward::Content::offsets_and_flattened
virtual const std::pair< Index64, ContentPtr > offsets_and_flattened(int64_t axis, int64_t depth) const =0
Returns (a) an offsets Index and (b) a flattened version of the array at some axis depth.
awkward::Content::asslice
virtual const SliceItemPtr asslice() const =0
Converts this array into a SliceItem that can be used in getitem.
awkward::Content::getitem_next
virtual const ContentPtr getitem_next(const SliceNewAxis &newaxis, const Slice &tail, const Index64 &advanced) const
Internal function that propagates a generic getitem request through one axis (including advanced inde...
awkward::Content::parameters
const util::Parameters parameters() const
String-to-JSON map that augments the meaning of this array.
awkward::Content::length
virtual int64_t length() const =0
The number of elements in the array.
awkward::Content::getitem_next
virtual const ContentPtr getitem_next(const SliceAt &at, const Slice &tail, const Index64 &advanced) const =0
Internal function that propagates a generic getitem request through one axis (including advanced inde...
awkward::Content::haskey
virtual bool haskey(const std::string &key) const =0
Returns true if the array contains a RecordArray with the specified key; false otherwise.
awkward::Content::reverse_merge
virtual const ContentPtr reverse_merge(const ContentPtr &other) const
Merges a single other with this array in reverse order: other first, this last.
awkward::Content::getitem
virtual const ContentPtr getitem(const Slice &where) const
Entry point for general slicing: Slice represents a tuple of SliceItem nodes applying to each level o...
awkward::Form
Abstract superclass of all array node forms, which expresses the nesting structure without any large ...
Definition: Content.h:39
awkward::Form::purelist_parameter
virtual const std::string purelist_parameter(const std::string &key) const =0
The parameter associated with key at the first level that has a non-null value, descending only as de...
awkward::Form::parameters_
util::Parameters parameters_
See parameters.
Definition: Content.h:267
awkward::Form::has_identities_
bool has_identities_
See has_identities.
Definition: Content.h:265
awkward::Form::parameter_equals
bool parameter_equals(const std::string &key, const std::string &value) const
Returns true if the parameter associated with key exists and is equal to value; false otherwise.
awkward::Form::istuple
virtual bool istuple() const =0
Returns true if the outermost RecordArray is a tuple.
awkward::Form::identities_tojson
void identities_tojson(ToJson &builder, bool verbose) const
Internal function for adding identities in tojson.
awkward::Form::parameter
const std::string parameter(const std::string &key) const
Get one parameter from this Form.
awkward::Form::dimension_optiontype
virtual bool dimension_optiontype() const =0
Returns true if this dimension has option-type; false otherwise.
awkward::Form::form_key_tojson
void form_key_tojson(ToJson &builder, bool verbose) const
Internal function for adding form_key in tojson.
awkward::Form::Form
Form(bool has_identities, const util::Parameters &parameters, const FormKey &form_key)
Called by subclass constructors; assigns has_identities, parameters, and form_key upon construction.
awkward::Form::fromnumpy
static FormPtr fromnumpy(char kind, int64_t itemsize, const std::vector< int64_t > &inner_shape)
awkward::Form::form_key_equals
bool form_key_equals(const FormKey &other_form_key) const
Returns true if this Form has the same form_key as the other.
awkward::Form::minmax_depth
virtual const std::pair< int64_t, int64_t > minmax_depth() const =0
Returns (a) the minimum list-depth and (b) the maximum list-depth of the array, which can differ if t...
awkward::Form::key
virtual const std::string key(int64_t fieldindex) const =0
The record name associated with a given field index or the tuple index as a string (e....
awkward::Form::purelist_isregular
virtual bool purelist_isregular() const =0
Returns true if all nested lists down to the first RecordForm are RegularForm nodes; false otherwise.
awkward::Form::form_key
const FormKey form_key() const
An optional string associated with this Form, usually specifying where an array may be fetched.
awkward::Form::getitem_fields
virtual const FormPtr getitem_fields(const std::vector< std::string > &keys) const =0
Returns the Form that would result from a fields-slice.
awkward::Form::shallow_copy
virtual const FormPtr shallow_copy() const =0
Copies this node without copying any nodes hierarchically nested within it.
awkward::Form::fromjson
static FormPtr fromjson(const std::string &data)
awkward::Form::purelist_depth
virtual int64_t purelist_depth() const =0
The list-depth of this array, not counting any contained within a RecordForm.
awkward::Form::getitem_range
virtual const FormPtr getitem_range() const
Returns the Form that would result from a range-slice.
awkward::Form::with_form_key
virtual const FormPtr with_form_key(const FormKey &form_key) const =0
Copies this node, adding or replacing a form_key.
awkward::Form::numfields
virtual int64_t numfields() const =0
The number of fields in the first nested tuple or records or -1 if this array does not contain a Reco...
awkward::Form::tojson
virtual const std::string tojson(bool pretty, bool verbose) const
Returns a JSON representation of this array.
awkward::Form::type
virtual const TypePtr type(const util::TypeStrs &typestrs) const =0
High-level Type describing this Form.
awkward::Form::tostring
virtual const std::string tostring() const
Returns a string representation of this Form (tojson with pretty = true and verbose = false).
awkward::Form::fieldindex
virtual int64_t fieldindex(const std::string &key) const =0
The position of a tuple or record key name if this array contains a RecordForm.
awkward::Form::equal
virtual bool equal(const FormPtr &other, bool check_identities, bool check_parameters, bool check_form_key, bool compatibility_check) const =0
Returns true if this Form is equal to the other Form; false otherwise.
awkward::Form::keys
virtual const std::vector< std::string > keys() const =0
A list of RecordArray keys or an empty list if this array does not contain a RecordArray.
awkward::Form::getitem_field
virtual const FormPtr getitem_field(const std::string &key) const =0
Returns the Form that would result from a field-slice.
awkward::Form::parameters_tojson
void parameters_tojson(ToJson &builder, bool verbose) const
Internal function for adding parameters in tojson.
awkward::Form::~Form
virtual ~Form()
Empty destructor; required for some C++ reason.
Definition: Content.h:55
awkward::Form::branch_depth
virtual const std::pair< bool, int64_t > branch_depth() const =0
Returns (a) whether the list-depth of this array "branches," or differs when followed through differe...
awkward::Form::form_key_
FormKey form_key_
See form_key.
Definition: Content.h:269
awkward::Form::tojson_part
virtual void tojson_part(ToJson &builder, bool verbose) const =0
Internal function to produce a JSON representation one node at a time.
awkward::Form::has_identities
bool has_identities() const
Returns true if the corresponding array has associated Identities.
awkward::Form::parameters
const util::Parameters parameters() const
String-to-JSON map that augments the meaning of this Form.
awkward::Form::haskey
virtual bool haskey(const std::string &key) const =0
Returns true if the array contains a RecordForm with the specified key; false otherwise.
awkward::IndexOf
A contiguous, one-dimensional array of integers used to represent data structures,...
Definition: Index.h:82
awkward::Reducer
Abstract class for all reducer algorithms.
Definition: Reducer.h:20
awkward::SliceArrayOf
Represents an array of integers in a slice (possibly converted from an array of booleans).
Definition: Slice.h:229
awkward::SliceAt
Represents an integer in a tuple of slices passed to __getitem__ in Python.
Definition: Slice.h:58
awkward::SliceEllipsis
Represents a Python Ellipsis object (usual syntax: array[...]).
Definition: Slice.h:169
awkward::SliceField
Represents a single string in a slice tuple, indicating that a RecordArray should be replaced by one ...
Definition: Slice.h:340
awkward::SliceFields
Definition: Slice.h:384
awkward::SliceJaggedOf
Represents an array of nested lists, where the content may be SliceArrayOf, SliceMissingOf,...
Definition: Slice.h:515
awkward::SliceMissingOf
Represents a SliceArrayOf, SliceMissingOf, or SliceJaggedOf with missing values: None (no equivalent ...
Definition: Slice.h:435
awkward::SliceNewAxis
Represents NumPy's newaxis marker (a.k.a. None), which prompts __getitem__ to insert a length-1 regul...
Definition: Slice.h:197
awkward::SliceRange
Represents a Python slice object (usual syntax: array[start:stop:step]).
Definition: Slice.h:93
awkward::Slice
A sequence of SliceItem objects representing a tuple passed to Python's __getitem__.
Definition: Slice.h:585
awkward::ToJsonFile
Produces a JSON-formatted file.
Definition: json.h:203
awkward::ToJsonPrettyFile
Produces a pretty JSON-formatted file.
Definition: json.h:268
awkward::ToJsonPrettyString
Produces a pretty JSON-formatted string.
Definition: json.h:139
awkward::ToJsonString
Produces a JSON-formatted string.
Definition: json.h:75
awkward::ToJson
Definition: json.h:21
awkward::Type
Abstract superclass of all high level types (flat hierarchy).
Definition: Type.h:23
common.h
LIBAWKWARD_EXPORT_SYMBOL
#define LIBAWKWARD_EXPORT_SYMBOL
Definition: common.h:45
awkward::kernel::lib
lib
Definition: kernel-dispatch.h:20
awkward::util::Parameters
std::map< std::string, std::string > Parameters
Definition: util.h:165
awkward::util::RecordLookupPtr
std::shared_ptr< RecordLookup > RecordLookupPtr
Definition: util.h:130
awkward::util::TypeStrs
std::map< std::string, std::string > TypeStrs
Definition: util.h:215
awkward
Definition: BitMaskedArray.h:15
awkward::FormKey
std::shared_ptr< std::string > FormKey
Definition: Content.h:19
awkward::ContentPtrVec
std::vector< std::shared_ptr< Content > > ContentPtrVec
Definition: Content.h:16
awkward::SliceItemPtr
std::shared_ptr< SliceItem > SliceItemPtr
Definition: Slice.h:15
awkward::ContentPtr
std::shared_ptr< Content > ContentPtr
Definition: Content.h:15
awkward::FormPtr
std::shared_ptr< Form > FormPtr
Definition: Content.h:18
awkward::TypePtr
std::shared_ptr< Type > TypePtr
Definition: Content.h:23
awkward::ArrayCachePtr
std::shared_ptr< ArrayCache > ArrayCachePtr
Definition: Content.h:21
awkward::IdentitiesPtr
std::shared_ptr< Identities > IdentitiesPtr
Definition: Identities.h:16