-
#include "tensorstore/index_space/index_transform.h" -
template <DimensionIndex InputRank,
DimensionIndex OutputRank,
ContainerKind CKind>
Result<IndexTransform<InputRank, OutputRank>>
tensorstore::PropagateBoundsToTransform(
std::type_identity_t<BoxView<OutputRank>> b_domain,
DimensionSet b_implicit_lower_bounds,
DimensionSet b_implicit_upper_bounds,
IndexTransform<InputRank, OutputRank, CKind> a_to_b); -
template <DimensionIndex InputRank,
DimensionIndex OutputRank,
ContainerKind CKind>
Result<IndexTransform<InputRank, OutputRank>>
tensorstore::PropagateBoundsToTransform(
std::type_identity_t<IndexDomainView<OutputRank>> b_domain,
IndexTransform<InputRank, OutputRank, CKind> a_to_b); Returns a new transform that represents the same mapping as
a_to_bbut may have a reduced input domain:Any implicit bounds are replaced with inferred values propagated from
b_domain. Bounds are only inferred fromOutputIndexMethod::single_input_dimensionoutput index maps. If any explicit input dimension bounds would result in an output range not contained withinb_domain, then this function returns an error.The
index_rangeintervals of any index array output index maps are also restricted as needed to ensure the output range is contained withinb_domain. Note that only theindex_rangeintervals are adjusted; the actual index values contained in any index arrays are not checked (but any subsequent attempt to use them will cause them to be checked against the reducedindex_rangeintervals). Implicit bounds of “b” are not propagated to theindex_rangeintervals.
Additionally, this function returns an error, rather than a new transform, if constant output index maps produce output indices outside
b_domain(implicit bounds ofbare ignored).If this function does not return an error, it is guaranteed that any output index vector computed by the returned transform will be contained within
b_domain.The
IndexTransform::implicit_lower_boundsandIndexTransform::implicit_upper_boundsvectors for the input spaceaof the returned transform are computed based on the implicit bound state of the inputa_to_btransform and the specifiedb_implicit_lower_boundsandb_implicit_upper_bounds:Each propagated lower/upper bound for
ais implicit iff:The original bound specified in
a_to_bis implicit; andAll contributing (by way of a
OutputIndexMethod::single_input_dimensionmap) bounds ofbare implicit.
- Parameters:¶
- std::type_identity_t<BoxView<OutputRank>> b_domain¶
- std::type_identity_t<IndexDomainView<OutputRank>> b_domain
The bounds in the “b” index space.
- DimensionSet b_implicit_lower_bounds¶
Implicit indicator for each lower bound of
b.- DimensionSet b_implicit_upper_bounds¶
Implicit indicator for each upper bound of
b.- IndexTransform<InputRank, OutputRank, CKind> a_to_b¶
The transform from
atob. May be null, which implies an identity transform overb_domain.
- Returns:¶
A new index transform that specifies the same transform as
a_to_bbut with a restricted input domain as computed by thePropagateBoundsoverload defined above, and with theindex_rangevalues of anyOutputIndexMethod::arrayoutput index maps also restricted.- Error absl::StatusCode::kInvalidArgument:¶
if integer overflow occurs when propagating bounds.
- Error absl::StatusCode::kOutOfRange:¶
if the existing input domain or constant index maps of
a_to_bare incompatible withb_domain