#include "tensorstore/index_interval.h"
class tensorstore::IndexInterval;

Represents an interval of index values, with support for +/-inf bounds.

Constructors

constexpr IndexInterval();

Constructs an interval corresponding to (-inf, +inf).

static constexpr IndexInterval Infinite() noexcept;

Returns an interval corresponding to (-inf, +inf).

static constexpr IndexInterval
UncheckedClosed(Index inclusive_minIndex inclusive_max) noexcept;

Constructs an interval from inclusive lower and upper bounds.

static Result<IndexInterval>
Closed(Index inclusive_minIndex inclusive_max);

Tries to construct an interval from inclusive lower and upper bounds.

static constexpr IndexInterval
UncheckedHalfOpen(Index inclusive_minIndex exclusive_max) noexcept;

Constructs an interval from an inclusive lower bound and exclusive upper bound.

static Result<IndexInterval>
HalfOpen(Index inclusive_minIndex exclusive_max);

Tries to construct an interval from an inclusive lower bound and exclusive upper bound.

static constexpr IndexInterval
UncheckedSized(Index inclusive_minIndex size);

Constructs an interval from the specified inclusive lower bound and size.

static Result<IndexInterval> Sized(Index inclusive_minIndex size);

Tries to construct an interval from the specified inclusive lower bound and size.

Methods

static constexpr bool
ValidClosed(Index inclusive_minIndex inclusive_max);

Returns true if inclusive_min and inclusive_max specify a valid closed interval.

static constexpr bool
ValidHalfOpen(Index inclusive_minIndex exclusive_max);

Returns true if inclusive_min and exclusive_max specify a valid interval.

static constexpr bool ValidSized(Index inclusive_minIndex size);

Returns true if inclusive_min and size specify a valid interval.

static constexpr IndexInterval FiniteRange();

Returns the full range of all valid finite index values.

constexpr IndexInterval operator-() const;

Returns the negated interval.

Accessors

constexpr Index inclusive_min() const;

Returns the inclusive lower bound of the interval.

constexpr Index exclusive_min() const;

Returns the exclusive lower bound.

constexpr Index exclusive_max() const;

Returns the inclusive upper bound of the interval.

constexpr Index inclusive_max() const;

Returns the inclusive upper bound of the interval.

constexpr Index size() const;

Returns the size of the interval.

constexpr bool empty() const;

Returns size() == 0.

Friend functions

friend std::ostreamoperator<<(std::ostreamosIndexInterval x);

Writes a string representation of an interval to an ostream.

friend constexpr bool operator==(IndexInterval aIndexInterval b);

Compares two intervals for equality.

constexpr bool
tensorstore::Contains(IndexInterval intervalIndex index);

Returns true if index is contained within the interval.

constexpr bool
tensorstore::Contains(IndexInterval outerIndexInterval inner);

Returns true if outer is a superset of inner.

constexpr bool tensorstore::IsFinite(IndexInterval interval);

Returns true if interval is bounded below and above.

IndexInterval tensorstore::Hull(IndexInterval aIndexInterval b);

Returns the smallest interval that contains a and b.

IndexInterval
tensorstore::Intersect(IndexInterval aIndexInterval b);

Returns the intersection of two intervals.

IndexInterval tensorstore::FiniteSubset(IndexInterval interval);

Returns Intersect(interval, IndexInterval::FiniteRange()).

bool tensorstore::AreCompatibleOrUnbounded(IndexInterval a,
                                           
IndexInterval b);

Returns true if the lower and upper bounds of a “match” the lower and upper bounds of b.

bool tensorstore::ContainsOrUnbounded(IndexInterval outer,
                                      
IndexInterval inner);

Returns true if the lower and upper bound of inner is either unbounded or contained with the lower and upper bound, respectively, of outer.

Result<IndexInterval>
tensorstore::ShiftInterval(IndexInterval interval,
                           
Index min_offset,
                           
Index max_offset);
Result<IndexInterval>
tensorstore::ShiftInterval(IndexInterval intervalIndex offset);

Adds an offset to the min and max bounds of an interval.

Result<IndexInterval>
tensorstore::ShiftIntervalBackward(IndexInterval interval,
                                   
Index min_offset,
                                   
Index max_offset);
Result<IndexInterval>
tensorstore::ShiftIntervalBackward(IndexInterval interval,
                                   
Index offset);

Subtracts an offset from the min and max bounds of an interval.

Result<IndexInterval>
tensorstore::ShiftIntervalTo(IndexInterval intervalIndex origin);

Shifts interval.inclusive_min() to origin.

absl::Status
tensorstore::CheckContains(IndexInterval intervalIndex index);

Checks that interval.Contains(index).

Result<IndexInterval>
tensorstore::GetAffineTransformDomain(IndexInterval interval,
                                      
Index offset,
                                      
Index divisor);

Computes the largest possible domain such that the affine-transformed range is contained within interval.

Result<OptionallyImplicitIndexInterval>
tensorstore::GetAffineTransformDomain(
    
OptionallyImplicitIndexInterval interval,
    
Index offset,
    
Index divisor);

Same as above, but also propagates interval.implicit_lower() and interval.implicit_upper() to the input space.

Result<IndexInterval>
tensorstore::GetAffineTransformRange(IndexInterval interval,
                                     
Index offset,
                                     
Index multiplier);

Computes the range of the affine-transformed domain interval.

Result<IndexInterval>
tensorstore::GetAffineTransformInverseDomain(IndexInterval interval,
                                             
Index offset,
                                             
Index divisor);

Computes the interval containing all indices x for which (x - offset) / divisor is in interval, where / rounds towards 0.

constexpr IndexInterval
tensorstore::DividePositiveRoundOut(IndexInterval interval,
                                    
Index divisor);

Divides the lower and upper bounds of interval by divisor, rounding out (expanding the interval) to the nearest integer.

class tensorstore::IndexIntervalRef;

Represents a mutable reference to an index interval stored as an inclusive_min, size pair.

enum class tensorstore::IntervalForm;

Indicates how the interval bounds are specified to slicing operations.