-
#include "tensorstore/index_space/dim_expression.h"
-
template <int&... ExplicitArgumentBarrier>
requires (sizeof...(Op) == 1)
auto tensorstore::DimExpression<Op...>::AddNew() const; Adds new inert input dimensions that have no effect on the output indices.
The added dimensions have a domain of
(-kInfIndex, kInfIndex)
, which can be reduced by chaining a call toClosedInterval
,SizedInterval
, orHalfOpenInterval
. The lower and upper bounds of the added dimensions are implicit. The labels of the added dimensions (if applicable) are empty.The prior dimension selection (e.g. specified by a call to Dims on which the call to AddNew is chained) specifies the indices of the new dimensions, in the range
(-input_rank - selection_rank, input_rank + selection_rank)
. This is unlike every other operation, for which the prior dimension selection specifies existing dimensions. The new dimension selection is equal to the prior dimension selection.Because the prior dimension selection specifies new rather than existing dimensions, this operation cannot be chained after any other operation (but other operations may be changed after it).
For example,
Dims(0, -1).AddNew()
(equivalent toDims(0, 2).AddNew()
) has the following effects:Before
After
Dimension selection
{0, 2}
{0, 2}
Input domain
[1, 5]
[-inf*, +inf*], [1, 5], [-inf*, +inf*]
Labels
{"x"}
{"", "x", ""}
Equivalent input indices
{2}
{1, 2, 8}
Equivalent input indices
{x}
{a, x, b}
where
x
is any index in[1, 5]
,a
is any index, andb
is any index.