#include "tensorstore/index_space/transformed_array.h"
template <typename Func, typename... Arrays>
Result<bool> tensorstore::IterateOverTransformedArrays(
    
Func&func,
    
IterationConstraints constraints,
    
const Arrays&... arrays);

Jointly iterates over one or more transformed arrays with compatible domains.

For each index vector input_indices in the domain of the transformed arrays, invokes:

func(&TransformedArray(arrays).array()(output_indices)...)

where for each of the arrays, output_indices is the output index vector corresponding to input_indices.

Requires:

sizeof...(Arrays) > 0

Parameters:
Func &&func

The element-wise function. Must return void or bool when invoked with (Array::Element*...). Iteration stops if the return value of func is false.

IterationConstraints constraints

Specifies constraints on the iteration order, and whether repeated elements may be skipped. If constraints.can_skip_repeated_elements(), the element-wise function may be invoked only once for multiple input_indices vectors that yield the same tuple of element pointers. If constraints.has_order_constraint(), func is invoked in the order given by constraints.order_constraint_value(). Otherwise, iteration is not guaranteed to occur in any particular order; an efficient iteration order is determined automatically.

const Arrays&... arrays

The transformed arrays over which to iterate, which must all have compatible input domains.

Returns:

true on success, or false in the case of an error.

Error absl::StatusCode::kInvalidArgument:

if the transformed arrays do not all have the same rank.

Error absl::StatusCode::kOutOfRange:

if the transformed arrays do not have compatible domains.

Error absl::StatusCode::kOutOfRange:

if an index array contains an out-of-bounds index.

Error absl::StatusCode::kInvalidArgument:

if integer overflow occurs computing output indices.