#include "tensorstore/strided_layout.h"
absl::Status
tensorstore::BroadcastStridedLayout(StridedLayoutView<> source,
                                    
span<const Index> target_shape,
                                    
Indextarget_byte_strides);
absl::Status
tensorstore::BroadcastStridedLayout(StridedLayoutView<> source,
                                    
span<const Index> target_shape,
                                    
StridedLayout<>target);
Result<Index> tensorstore::BroadcastStridedLayout(
    
StridedLayoutView<dynamic_rank, offset_origin> source,
    
BoxView<> target_domain,
    
StridedLayout<dynamic_rank, offset_origin>target);

Broadcasts source to target_shape.

Parameters:
StridedLayoutView<> source
StridedLayoutView<dynamic_rank, offset_origin> source

Source layout to broadcast.

span<const Index> target_shape

Target shape to which source will be broadcast.

Index *target_byte_strides

Pointer to array of length target_shape.size().

StridedLayout<> &target
StridedLayout<dynamic_rank, offset_origin> &target

Target layout to assign.

Returns:

For offset_origin overload, the offset in bytes of broadcasted array data pointer relative to source array data pointer.

Error absl::StatusCode::kInvalidArgument:

if the shapes are not compatible.