strata::Reduce¶
Part of Reductions.
E reduced along Axes: an expression of the axes left.
Element i... is the reduction of the values of E along those axes at the position i... of the others, which are kept, in order. Lazy, as any expression: sum.along<1>(x) computes nothing until assigned or read. Made by the reductions sum, mean and the others with along, not by hand.
A slice, a permutation or a block of a reduction is the reduction of the same operation on its operand, which keeps the operand's views views. That is so for one that can be copied; one that holds a temporary owner is cut by the nodes of slice, permute and block.
Template parameters
| Name | Description |
|---|---|
R | The reducer, a type satisfying reducer_for the value type of E. |
E | The operand as it is held, a tensor. |
Axes | The axes of E to reduce, sorted, at least one, none twice. |
Members¶
reducer_type¶
The reducer.
input_type¶
The value type of the operand.
shape_type¶
using strata::Reduce< R, E, Axes >::shape_type = decltype(detail::kept_shape<kept_, shape_t<E>>(std::make_index_sequence<kept_.size()>{}))
The shape of the axes left: those of the operand's shape that are not reduced.
value_type¶
using strata::Reduce< R, E, Axes >::value_type = std::remove_cvref_t<decltype(std::declval<const R&>().finalize(
std::declval<detail::accumulator_t<R, input_type>>(), std::size_t{}))>
What the reducer's finalize gives.
Reduce¶
Reduces operand along Axes with reducer.
Precondition
For a reducer without an identity, the reduced axes have values, unless the result is empty itself.
reducer¶
The reducer.
operand¶
The operand that is reduced.
shape¶
The shape of the axes left.
cursor¶
A cursor that reads the reduction at its position: each read reduces the operand along the reduced axes, and stepping moves along the kept ones.
operator[]¶
One element: the operand sliced at the kept indices, reduced whole.
Parameters
| Name | Description |
|---|---|
indices | One per kept axis. |
slice¶
template <std::size_t... Fixed>
constexpr auto slice(const Reduce &reduction, const std::array<std::size_t, sizeof...(Fixed)> &indices)
The slice of the reduction along kept axes: the reduction of the operand's slice, its reduced axes numbered as the operand's slice has them.
permute¶
The permutation of the kept axes: the reduction of the operand with those axes permuted and the reduced ones put last.
block¶
template <Extent... Sizes>
constexpr auto block(const Reduce &reduction, const Shape<Sizes...> &sizes, const std::array<std::size_t, sizeof...(Sizes)> &corner)
The block of the kept axes: the reduction of the operand's block, over the whole of the reduced axes.