15namespace Experimental {
 
   31   if (shape.size() == 0)
 
 
   50   const auto size = shape.size();
 
   52   if (
layout == MemoryLayout::RowMajor) {
 
   53      for (std::size_t i = 0; i < 
size; i++) {
 
   55            strides[
size - 1 - i] = 1;
 
   57            strides[
size - 1 - i] = strides[
size - 1 - i + 1] * shape[
size - 1 - i + 1];
 
   60   } 
else if (
layout == MemoryLayout::ColumnMajor) {
 
   61      for (std::size_t i = 0; i < 
size; i++) {
 
   65            strides[i] = strides[i - 1] * shape[i - 1];
 
   70      ss << 
"Memory layout type is not valid for calculating strides.";
 
   71      throw std::runtime_error(
ss.str());
 
 
   84    const auto size = shape.size();
 
   88    for (std::size_t i = 0; i < 
size; i++) {
 
   89        indices[i] = 
int(
r / strides[i]);
 
 
   99template <
typename U, 
typename V>
 
  103   const auto size = idx.size();
 
  104   for (std::size_t i = 0; i < 
size; i++) {
 
 
  111template <
class... 
Ts>
 
  115template <
class T0, 
class... 
Ts>
 
  116struct and_types<
T0, 
Ts...> : std::integral_constant<bool, T0() && and_types<Ts...>()> {
 
 
  131                   const std::vector<std::size_t> &
mins, 
const std::vector<std::size_t> &
maxs,
 
  132                   std::vector<std::size_t> idx, std::size_t active)
 
  134   const auto size = idx.size();
 
  135   for (std::size_t i = 
mins[active]; i < 
maxs[active]; i++) {
 
  137      if (active == 
size - 1) {
 
  139         for (std::size_t 
j = 0; 
j < 
size; 
j++) {
 
 
  162template <
typename V, 
typename C = std::vector<V>>
 
  317template <
typename Value_t, 
typename Container_t>
 
  322      std::stringstream 
ss;
 
  323      ss << 
"Cannot reshape tensor with size " << 
fSize << 
" into shape { ";
 
  324      for (std::size_t i = 0; i < shape.size(); i++) {
 
  325         if (i != shape.size() - 1) {
 
  326            ss << shape[i] << 
", ";
 
  328            ss << shape[i] << 
" }.";
 
  331      throw std::runtime_error(
ss.str());
 
 
  344template <
typename Value_t, 
typename Container_t>
 
  354template <
typename Value_t, 
typename Container_t>
 
  364template <
typename Value_t, 
typename Container_t>
 
  365template <
typename... Idx>
 
  369                 "Indices are not convertible to std::size_t.");
 
  370   return operator()({
static_cast<std::size_t
>(idx)...});
 
 
  376template <
typename Value_t, 
typename Container_t>
 
  377template <
typename... Idx>
 
  381                 "Indices are not convertible to std::size_t.");
 
  382   return operator()({
static_cast<std::size_t
>(idx)...});
 
 
  390template <
typename Value_t, 
typename Container_t>
 
  395   if (fLayout == MemoryLayout::RowMajor) {
 
  396      layout = MemoryLayout::ColumnMajor;
 
  397   } 
else if (fLayout == MemoryLayout::ColumnMajor) {
 
  398      layout = MemoryLayout::RowMajor;
 
  400      throw std::runtime_error(
"Memory layout is not known.");
 
  407   std::reverse(
x.fShape.begin(), 
x.fShape.end());
 
  410   std::reverse(
x.fStrides.begin(), 
x.fStrides.end());
 
 
  418template <
typename Value_t, 
typename Container_t>
 
  424   for (std::size_t i = 0; i < 
fShape.size(); i++) {
 
  426         shape.emplace_back(
fShape[i]);
 
  427         strides.emplace_back(fStrides[i]);
 
  434   if (shape.size() == 0 && 
fShape.size() != 0) {
 
  435      shape.emplace_back(1);
 
  436      strides.emplace_back(1);
 
  442   x.fStrides = strides;
 
 
  450template <
typename Value_t, 
typename Container_t>
 
  456   auto strides = fStrides;
 
  461      throw std::runtime_error(
"Given negative index is invalid.");
 
  463   else if (idx > 
len) {
 
  464      throw std::runtime_error(
"Given index is invalid.");
 
  466   shape.insert(shape.begin() + idx, 1);
 
  472   x.fStrides = strides;
 
 
  480template <
typename Value_t, 
typename Container_t>
 
  485   x.ReshapeInplace(shape);
 
 
  493template <
typename Value_t, 
typename Container_t>
 
  501   std::copy(this->GetData(), this->GetData() + 
n, 
x.GetData() );
 
 
  510template <
typename Value_t, 
typename Container_t>
 
  517      std::stringstream 
ss;
 
  518      ss << 
"Size of slice (" << 
sliceSize << 
") is unequal number of dimensions (" << 
shapeSize << 
").";
 
  519      throw std::runtime_error(
ss.str());
 
  534   for (std::size_t i = 0; i < 
sliceSize; i++) {
 
  535      shape[i] = slice[i][1] - slice[i][0];
 
  542   for (std::size_t i = 0; i < 
sliceSize; i++) {
 
  543      idx[i] = slice[i][0];
 
 
 
  563template <
typename Value_t, 
typename Container_t>
 
  588      const auto size = 
x.GetSize();
 
  589      for (std::size_t i = 0; i < 
size; i++) {
 
  597      const auto shape = 
x.GetShape();
 
  598      for (std::size_t i = 0; i < shape[0]; i++) {
 
  600         for (std::size_t 
j = 0; 
j < shape[1]; 
j++) {
 
  602            if (
j < shape[1] - 1) {
 
  612      os << 
"{ printing not yet implemented for this rank }";
 
 
  624   std::stringstream 
ss;
 
 
 
 
 
 
 
 
 
 
 
 
 
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
 
TRObject operator()(const T1 &t1) const
 
std::ptrdiff_t difference_type
 
bool operator>=(const Iterator &rhs) const
 
bool operator==(const Iterator &rhs) const
 
std::random_access_iterator_tag iterator_category
 
Iterator(RTensor< Value_t, Container_t > &x, typename Index_t::value_type idx)
 
bool operator!=(const Iterator &rhs) const
 
difference_type operator-(const Iterator &rhs)
 
Iterator operator+(difference_type rhs) const
 
bool operator<(const Iterator &rhs) const
 
Index_t::value_type fGlobalIndex
 
Iterator & operator+=(difference_type rhs)
 
Iterator & operator-=(difference_type rhs)
 
RTensor< Value_t, Container_t > & fTensor
 
bool operator>(const Iterator &rhs) const
 
Iterator operator-(difference_type rhs) const
 
Index_t::value_type GetGlobalIndex() const
 
bool operator<=(const Iterator &rhs) const
 
RTensor is a container with contiguous memory and shape information.
 
void ReshapeInplace(const Shape_t &shape)
Reshape tensor in place.
 
RTensor< Value_t, Container_t > Squeeze() const
Squeeze dimensions.
 
const std::shared_ptr< Container_t > GetContainer() const
 
Value_t & operator()(const Index_t &idx)
Access elements.
 
RTensor(Shape_t shape, MemoryLayout layout=MemoryLayout::RowMajor)
Construct a tensor owning data initialized with new container.
 
MemoryLayout GetMemoryLayout() const
 
std::vector< Shape_t > Slice_t
 
RTensor(Value_t *data, Shape_t shape, Shape_t strides, MemoryLayout layout=MemoryLayout::RowMajor)
Construct a tensor as view on data.
 
RTensor< Value_t, Container_t > ExpandDims(int idx) const
Expand dimensions.
 
RTensor< Value_t, Container_t > Transpose() const
Transpose.
 
std::shared_ptr< Container_t > GetContainer()
 
Value_t & operator()(Idx... idx)
Access elements.
 
std::shared_ptr< Container_t > fContainer
 
RTensor(std::shared_ptr< Container_t > container, Shape_t shape, MemoryLayout layout=MemoryLayout::RowMajor)
Construct a tensor owning externally provided data.
 
RTensor< Value_t, Container_t > Resize(const Shape_t &shape)
Resize tensor.
 
RTensor< Value_t, Container_t > Copy(MemoryLayout layout=MemoryLayout::RowMajor) const
Copy RTensor to new object.
 
const Shape_t & GetStrides() const
 
std::size_t GetSize() const
 
RTensor< Value_t, Container_t > Reshape(const Shape_t &shape) const
Reshape tensor.
 
RTensor(Value_t *data, Shape_t shape, MemoryLayout layout=MemoryLayout::RowMajor)
Construct a tensor as view on data.
 
RTensor< Value_t, Container_t > Slice(const Slice_t &slice)
Create a slice of the tensor.
 
const Value_t * GetData() const
 
Iterator begin() noexcept
 
const Shape_t & GetShape() const
 
std::vector< std::size_t > Shape_t
 
void RecursiveCopy(const T &here, T &there, const std::vector< std::size_t > &mins, const std::vector< std::size_t > &maxs, std::vector< std::size_t > idx, std::size_t active)
Copy slice of a tensor recursively from here to there.
 
std::vector< std::size_t > ComputeStridesFromShape(const T &shape, MemoryLayout layout)
Compute strides from shape vector.
 
T ComputeIndicesFromGlobalIndex(const T &shape, MemoryLayout layout, const typename T::value_type idx)
Compute indices from global index.
 
std::size_t GetSizeFromShape(const T &shape)
Get size of tensor from shape vector.
 
std::size_t ComputeGlobalIndex(const U &strides, const V &idx)
Compute global index from indices.
 
MemoryLayout
Memory layout type (copy from RTensor.hxx)
 
std::ostream & operator<<(std::ostream &os, RTensor< T > &x)
Pretty printing.
 
create variable transformations
 
Type checking for all types of a parameter pack, e.g., used in combination with std::is_convertible.