26template<
typename AFloat>
34 std::vector<AFloat> temp(nElements/nSteps + 1);
36 auto f = [&
data, &temp, nElements, nSteps](
UInt_t workerID)
38 size_t iMax = std::min(workerID+nSteps, nElements);
39 size_t iWorker = workerID/nSteps;
40 for (
size_t i = workerID; i < iMax; ++i) {
41 temp[iWorker] += fabs(
data[i]);
45 auto reduction = [](
const std::vector<AFloat> &
v )
47 return std::accumulate(
v.begin(),
v.end(),AFloat{});
59template<
typename AFloat>
76 size_t iMax = std::min(workerID+nSteps, nElements);
77 for (
size_t i = workerID; i < iMax; ++i) {
78 AFloat sign = (dataA[i] < 0.0) ? -1.0 : 1.0;
84 if (nSteps < nElements) {
88 for (
size_t i = 0; i < nElements; i+=nSteps)
97template<
typename AFloat>
105 std::vector<AFloat> temp(nElements/nSteps + 1);
107 auto f = [&
data, &temp, nElements, nSteps](
UInt_t workerID)
109 size_t iMax = std::min(workerID+nSteps, nElements);
110 size_t iWorker = workerID/nSteps;
112 for (
size_t i = workerID; i < iMax; ++i) {
117 auto reduction = [](
const std::vector<AFloat> &
v )
119 return std::accumulate(
v.begin(),
v.end(),AFloat{});
131template<
typename AFloat>
146 size_t iMax = std::min(workerID+nSteps, nElements);
147 for (
size_t i = workerID; i < iMax; ++i) {
153 if (nSteps < nElements) {
157 for (
size_t i = 0; i < nElements; i+=nSteps)
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
A pseudo container class which is a generator of indices.
AFloat * GetRawDataPointer()
Return raw pointer to the elements stored contiguously in column-major order.
static size_t GetNWorkItems(size_t nelements)
static Executor & GetThreadExecutor()
size_t GetNoElements() const
static Scalar_t L1Regularization(const Matrix_t &W)
static void AddL1RegularizationGradients(Matrix_t &A, const Matrix_t &W, Scalar_t weightDecay)
static Scalar_t L2Regularization(const Matrix_t &W)
static void AddL2RegularizationGradients(Matrix_t &A, const Matrix_t &W, Scalar_t weightDecay)
void Foreach(Function func, unsigned int nTimes, unsigned nChunks=0)
wrap TExecutor::Foreach
auto Reduce(const std::vector< T > &objs, R redfunc) -> decltype(redfunc(objs))
Wrap Reduce function.
double weightDecay(double error, ItWeight itWeight, ItWeight itWeightEnd, double factorWeightDecay, EnumRegularization eRegularization)
compute the weight decay for regularization (L1 or L2)
create variable transformations