17 #ifndef TMVA_DNN_ARCHITECTURES_CPU_CPUMATRIX
18 #define TMVA_DNN_ARCHITECTURES_CPU_CPUMATRIX
24 #include "ROOT/TThreadExecutor.hxx"
45 template<
typename AFloat>
50 static ROOT::TThreadExecutor
fPool;
51 static std::vector<AFloat>
fOnes;
85 template <
typename Function_t>
86 void Map(Function_t &
f);
90 template <
typename Function_t>
114 template<
typename AFloat>
117 template<
typename AFloat>
118 std::vector<AFloat> TCpuMatrix<AFloat>::fOnes {};
123 template<
typename AFloat>
124 template<
typename Function_t>
127 AFloat *
data = GetRawDataPointer();
131 data[workerID] =
f(data[workerID]);
138 template<
typename AFloat>
139 template<
typename Function_t>
142 AFloat *dataB = GetRawDataPointer();
145 auto ff = [&dataB, &dataA, &
f](
UInt_t workerID)
147 dataB[workerID] =
f(dataA[workerID]);
TCpuBuffer< AFloat > fBuffer
The buffer holding the matrix elements in column-major format.
ROOT::TThreadExecutor & GetThreadExecutor() const
const AFloat * GetRawDataPointer() const
AFloat & operator()(size_t i, size_t j)
static std::vector< AFloat > fOnes
Vector filled with ones used for BLAS calls.
static ROOT::TThreadExecutor fPool
void MapFrom(Function_t &f, const TCpuMatrix &A)
Same as maps but takes the input values from the matrix A and writes the results in this matrix...
AFloat * GetRawDataPointer()
Return raw pointer to the elements stored contiguously in column-major order.
size_t GetNElements() const
AFloat operator()(size_t i, size_t j) const
Return matrix element in row i and column j.
TCpuMatrix & operator=(const TCpuMatrix &)=default
A pseudo container class which is a generator of indices.
static const AFloat * GetOnePointer()
Returns pointer to a vector holding only ones with a guaranteed length of the number of columns of ev...
TCpuMatrix(size_t nRows, size_t nCols)
Construct matrix and allocate space for its elements.
void Map(Function_t &f)
Map the given function over the matrix elements.