17 #ifndef TMVA_DNN_ARCHITECTURES_CPU_CPUMATRIX 18 #define TMVA_DNN_ARCHITECTURES_CPU_CPUMATRIX 45 template<
typename AFloat>
50 static std::vector<AFloat>
fOnes;
84 template <
typename Function_t>
85 void Map(Function_t &f);
89 template <
typename Function_t>
97 AFloat
operator()(
size_t i,
size_t j)
const {
return fBuffer[j * fNRows + i];}
98 AFloat &
operator()(
size_t i,
size_t j) {
return fBuffer[j * fNRows + i];}
113 template<
typename AFloat>
119 template<
typename AFloat>
120 template<
typename Function_t>
127 data[workerID] = f(data[workerID]);
134 template<
typename AFloat>
135 template<
typename Function_t>
141 auto ff = [&dataB, &dataA, &f](
UInt_t workerID)
143 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.
static Config & Instance()
static function: returns TMVA instance
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.
ROOT::TThreadExecutor & GetThreadExecutor()
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.