Struct BackendArrayOps

Struct Documentation

struct BackendArrayOps

Backend-provided realizations of the two operations external-axis batching needs but that are backend-specific: constructing a zero destination array and chunking an axis into batches.

The neutral eval layer names only indices (which carry their spaces); the backend (the “user”, e.g. mpqc) supplies these closures, so no backend artifact – a TiledArray tiling has no meaning for, say, an on-disk backend – ever leaks into the eval layer.

Tiling is a property of the space, not of any one array, so it is sourced once, backend-side, from the index alone rather than borrowed from whichever array in the DAG carries that axis.

Public Functions

inline explicit operator bool() const noexcept

Public Members

std::function<ResultPtr(container::vector<Index> const &descriptor)> make_zeros

Construct a sufficiently-initialized zero result shaped by descriptor – a full (unsliced) index list, e.g. a node’s canon_indices(). The backend maps each index’s space to its own artifact and applies its own outer/inner split for proto-bearing (nested) indices, so flat-vs-nested is decided by the descriptor, not by any type reconciliation here. “Sufficiently initialized” is backend-defined (TA: a World + TiledRange, zero-filled; a nested result gets empty inner tiles, filled by the subsequent scatter writes).

std::function<container::svector<std::pair<std::size_t, std::size_t>>(Index const &axis, std::size_t target_batch_size)> axis_batches

Enumerate the half-open [lo,hi) element ranges chunking axis at ~target_batch_size. The backend owns the chunking rule (TA lands on tile boundaries). Per-space: two indices of one space chunk identically.

std::function<ResultPtr(container::vector<Index> const &descriptor)> make_zeros_on_disk

True iff both closures are installed (a batched run requires them). Optional: like make_zeros , but the result is the on-disk form of the zero value (Result::is_on_disk ), to be assembled by write_into_slice without ever being whole in memory. Empty if the backend cannot.