Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RFlat2DMatrixOperators.hxx
Go to the documentation of this file.
1// Author: Martin Føll, University of Oslo (UiO) & CERN 1/2026
2
3/*************************************************************************
4 * Copyright (C) 1995-2026, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#ifndef ROOT_INTERNAL_ML_RFLAT2DMATRIXOPERATORS
12#define ROOT_INTERNAL_ML_RFLAT2DMATRIXOPERATORS
13
14#include <cstddef>
15#include <vector>
16
17// Forward decl
19struct RFlat2DMatrix;
20} // namespace ROOT::Experimental::Internal::ML
21
23/**
24\class ROOT::Experimental::Internal::ML::RFlat2DMatrixOperators
25
26\brief Collection of operations applied to one or multiple flat 2D matrices.
27*/
28
30private:
32 std::size_t fSetSeed;
33
34public:
35 RFlat2DMatrixOperators(bool shuffle = true, const std::size_t setSeed = 0) : fShuffle(shuffle), fSetSeed(setSeed) {}
36
38
39 // returns the order in which to read the rows of a tensor, empty when shuffling is off
40 std::vector<std::size_t> MakePermutation(std::size_t rows);
41
42 // shuffles the indices in place, nothing when shuffling is off
43 void ShuffleIndices(std::vector<std::size_t> &indices);
44
45 // appends the rows [begin, end) of Tensor to Dest, read in the order of the permutation unless it is empty
46 static void AppendRows(RFlat2DMatrix &Dest, const RFlat2DMatrix &Tensor, const std::vector<std::size_t> &permutation,
47 std::size_t begin, std::size_t end);
48};
49
50} // namespace ROOT::Experimental::Internal::ML
51#endif // ROOT_INTERNAL_ML_RFLAT2DMATRIXOPERATORS
Collection of operations applied to one or multiple flat 2D matrices.
RFlat2DMatrixOperators(bool shuffle=true, const std::size_t setSeed=0)
std::vector< std::size_t > MakePermutation(std::size_t rows)
static void AppendRows(RFlat2DMatrix &Dest, const RFlat2DMatrix &Tensor, const std::vector< std::size_t > &permutation, std::size_t begin, std::size_t end)
Wrapper around ROOT::RVec<float> representing a 2D matrix.