17 #ifndef TMVA_DNN_ARCHITECTURES_CPU_CPUMATRIX 18 #define TMVA_DNN_ARCHITECTURES_CPU_CPUMATRIX 45 template<
typename AFloat>
51 static std::vector<AFloat>
fOnes;
85 template <
typename Function_t>
86 void Map(Function_t &
f);
90 template <
typename Function_t>
98 AFloat
operator()(
size_t i,
size_t j)
const {
return fBuffer[j * fNRows + i];}
99 AFloat &
operator()(
size_t i,
size_t j) {
return fBuffer[j * fNRows + i];}
114 template<
typename AFloat>
117 template<
typename AFloat>
123 template<
typename AFloat>
124 template<
typename Function_t>
131 data[workerID] =
f(data[workerID]);
138 template<
typename AFloat>
139 template<
typename Function_t>
145 auto ff = [&dataB, &dataA, &
f](
UInt_t workerID)
147 dataB[workerID] =
f(dataA[workerID]);
AFloat operator()(size_t i, size_t j) const
Return matrix element in row i and column j.
TCpuBuffer< AFloat > fBuffer
The buffer holding the matrix elements in column-major format.
AFloat & operator()(size_t i, size_t j)
size_t GetNElements() const
static std::vector< AFloat > fOnes
Vector filled with ones used for BLAS calls.
static ROOT::TThreadExecutor fPool
This class provides a simple interface to execute the same task multiple times in parallel...
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.
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.
ROOT::TThreadExecutor & GetThreadExecutor() const
const AFloat * GetRawDataPointer() const
Abstract ClassifierFactory template that handles arbitrary types.
auto Map(F func, unsigned nTimes) -> std::vector< typename std::result_of< F()>::type >
Execute func (with no arguments) nTimes in parallel.