27#pragma GCC diagnostic push
28#pragma GCC diagnostic ignored "-Wshadow"
32#pragma GCC diagnostic pop
41template<
typename AReal>
64 AReal * CPointer = C.GetRawDataPointer();
67 APointer, &
m, BPointer, &k, &beta, CPointer, &
m);
76template<
typename AReal>
99 AReal *CPointer = C.GetRawDataPointer();
102 APointer, &k, BPointer, &k, &beta, CPointer, &
m);
109 tmp = tmp + beta * tmp0;
116template<
typename AReal>
129 for (
size_t j = 0; j < nSteps; ++j) {
130 size_t idx = workerID+j;
131 if (idx >= nElements)
break;
132 dataB[idx] *= dataA[idx];
137 if (nSteps < nElements) {
141 for (
size_t i = 0; i < nElements ; i+= nSteps)
151template<
typename AReal>
164 for (
size_t j = 0; j < nSteps; ++j) {
165 size_t idx = workerID+j;
166 if (idx >= nElements)
break;
167 dataB[idx] *= dataA[idx];
172 if (nSteps < nElements) {
176 for (
size_t i = 0; i < nElements ; i+= nSteps)
193template<
typename AReal>
197 Fatal(
"AlmostEquals",
"The passed matrices have unequal shapes.");
204 for(
size_t i = 0; i < nElements; i++) {
205 if(fabs(dataA[i] - dataB[i]) > epsilon)
return false;
211template<
typename AReal>
233 &beta, BPointer, &inc);
240 tmp = alpha * tA * ones + beta * tmp;
247template<
typename AReal>
268template<
typename AReal>
278template<
typename AReal>
286 ScaleAdd(B_m, A.
At(i).GetMatrix(), alpha);
291template<
typename AReal>
301template <
typename AReal>
304 auto f = [beta](
AReal x) {
return x + beta; };
309template <
typename AReal>
312 auto f = [beta](
AReal x) {
return x * beta; };
317template <
typename AReal>
320 auto f = [](
AReal x) {
return 1.0 /
x; };
325template <
typename AReal>
333template <
typename AReal>
336 auto f = [](
AReal x) {
return sqrt(
x); };
342template<
typename AReal>
356template<
typename AReal>
368template<
typename AReal>
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
void Fatal(const char *location, const char *msgfmt,...)
Use this function in case of a fatal error. It will abort the program.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
A pseudo container class which is a generator of indices.
Executor & GetThreadExecutor()
Get executor class for multi-thread usage In case when MT is not enabled will return a serial executo...
static Config & Instance()
static function: returns TMVA instance
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.
static size_t GetNWorkItems(size_t nelements)
void Map(Function_t &f)
Map the given function over the matrix elements.
static Executor & GetThreadExecutor()
size_t GetNoElements() const
AFloat * GetRawDataPointer()
Return raw pointer to the elements stored contiguously in column-major order.
size_t GetNoElements() const
void MapFrom(Function_t &f, const TCpuTensor< AFloat > &A)
Same as maps but takes the input values from the tensor A and writes the results in this tensor.
size_t GetFirstSize() const
TCpuTensor< AFloat > At(size_t i)
static void TransposeMultiply(Matrix_t &output, const Matrix_t &input, const Matrix_t &Weights, Scalar_t alpha=1.0, Scalar_t beta=0.)
Matrix multiplication of two matrices A and B^T (transposed) with the result being written into C.
static void ScaleAdd(Matrix_t &A, const Matrix_t &B, Scalar_t beta=1.0)
Adds a the elements in matrix B scaled by c to the elements in the matrix A.
static void ConstAdd(Matrix_t &A, Scalar_t beta)
Add the constant beta to all the elements of matrix A and write the result into A.
static void SumColumns(Matrix_t &B, const Matrix_t &A, Scalar_t alpha=1.0, Scalar_t beta=0.)
Sum columns of (m x n) matrix A and write the results into the first m elements in A.
static bool AlmostEquals(const Matrix_t &A, const Matrix_t &B, double epsilon=0.1)
Check two matrices for equality, taking floating point arithmetic errors into account.
static void Hadamard(Tensor_t &A, const Tensor_t &B)
In-place Hadamard (element-wise) product of matrices A and B with the result being written into A.
static void SqrtElementWise(Matrix_t &A)
Square root each element of the matrix A and write the result into A.
static void Multiply(Matrix_t &C, const Matrix_t &A, const Matrix_t &B)
Standard multiplication of two matrices A and B with the result being written into C.
static void AdamUpdateSecondMom(Matrix_t &A, const Matrix_t &B, Scalar_t beta)
static void Copy(Matrix_t &B, const Matrix_t &A)
static void SquareElementWise(Matrix_t &A)
Square each element of the matrix A and write the result into A.
static void AdamUpdateFirstMom(Matrix_t &A, const Matrix_t &B, Scalar_t beta)
static void ConstMult(Matrix_t &A, Scalar_t beta)
Multiply the constant beta to all the elements of matrix A and write the result into A.
static void ReciprocalElementWise(Matrix_t &A)
Reciprocal each element of the matrix A and write the result into A.
static void AdamUpdate(Matrix_t &A, const Matrix_t &M, const Matrix_t &V, Scalar_t alpha, Scalar_t eps)
Adam updates.
static void ScaleAdd(TMatrixT< Scalar_t > &A, const TMatrixT< Scalar_t > &B, Scalar_t beta=1.0)
Adds a the elements in matrix B scaled by c to the elements in the matrix A.
void Foreach(Function func, unsigned int nTimes, unsigned nChunks=0)
wrap TExecutor::Foreach
TMatrixT< Element > & T()
void Axpy(const int *n, const AReal *alpha, const AReal *x, const int *incx, AReal *y, const int *incy)
Add the vector x scaled by alpha to y scaled by \beta
void Gemm(const char *transa, const char *transb, const int *m, const int *n, const int *k, const AReal *alpha, const AReal *A, const int *lda, const AReal *B, const int *ldb, const AReal *beta, AReal *C, const int *ldc)
Multiply the matrix A with the matrix B and store the result in C.
void Gemv(const char *trans, const int *m, const int *n, const AReal *alpha, const AReal *A, const int *lda, const AReal *x, const int *incx, const AReal *beta, AReal *y, const int *incy)
Multiply the vector x with the matrix A and store the result in y.
create variable transformations