#include "tensorstore/rank.h"
struct tensorstore::RankConstraint;

Represents an optional rank value and provides related operations.

Constructors

constexpr RankConstraint();
constexpr RankConstraint(DynamicRank);

Constructs with an unspecified rank value (dynamic_rank).

explicit constexpr RankConstraint(DimensionIndex rank);

Constructs with the specified rank value.

static constexpr RankConstraint FromInlineRank(InlineRank value);

Constructs from an InlineRank value, ignoring the inline buffer size.

Data members

DimensionIndex rank = dynamic_rank;

Indicates the rank, or equal to dynamic_rank if unknown.

Conversion operators

constexpr operator DimensionIndex() const;

Returns rank.

Methods

constexpr bool valid() const;

Returns true if this is a valid rank constraint.

Composition

static constexpr RankConstraint
And(DimensionIndex aDimensionIndex b);
static constexpr RankConstraint
And(std::initializer_list<DimensionIndex> constraints);

Returns the intersection of the rank constraints.

static constexpr RankConstraint
Add(DimensionIndex aDimensionIndex b);
static constexpr RankConstraint
Add(std::initializer_list<DimensionIndex> constraints);

Adds the rank constraints.

static constexpr RankConstraint
Subtract(DimensionIndex aDimensionIndex b);

Subtracts the rank constraints.

Comparison

static constexpr bool
Implies(DimensionIndex innerDimensionIndex outer);

Returns true if any rank satisfying inner also satisfies outer.

static constexpr bool
EqualOrUnspecified(DimensionIndex aDimensionIndex b);
static constexpr bool
EqualOrUnspecified(std::initializer_list<DimensionIndex> constraints);

Returns true if there is at least one rank satisfying all constraints.

static constexpr bool
LessOrUnspecified(DimensionIndex aDimensionIndex b);

Returns true if some rank satisfying a is less than some rank satisfying b.

static constexpr bool
LessEqualOrUnspecified(DimensionIndex aDimensionIndex b);

Returns true if some rank satisfying a is less than or equal to some rank satisfying b.

static constexpr bool
GreaterOrUnspecified(DimensionIndex aDimensionIndex b);

Returns true if some rank satisfying a is greater than some rank satisfying b.

static constexpr bool
GreaterEqualOrUnspecified(DimensionIndex aDimensionIndex b);

Returns true if some rank satisfying a is greater than or equal to some rank satisfying b.

constexpr StaticOrDynamicRank<Rank> tensorstore::GetDefaultRank();

If Rank == dynamic_rank, returns dynamic_rank. Otherwise, returns StaticRank<Rank>{}.