27#pragma GCC diagnostic push
28#pragma GCC diagnostic ignored "-Wshadow"
32#pragma GCC diagnostic pop
41template<
typename AReal>
46 int m = (
int) A.GetNrows();
47 int k = (
int) A.GetNcols();
48 int n = (
int) B.GetNcols();
76template<
typename AReal>
83 int m = (
int) A.GetNcols();
84 int k = (
int) A.GetNrows();
85 int n = (
int) B.GetNcols();
109 tmp = tmp + beta *
tmp0;
116template<
typename AReal>
151template<
typename AReal>
193template<
typename AReal>
196 if (A.GetNrows() != B.GetNrows() || A.GetNcols() != B.GetNcols()) {
197 Fatal(
"AlmostEquals",
"The passed matrices have unequal shapes.");
205 if(fabs(
dataA[i] -
dataB[i]) > epsilon)
return false;
211template<
typename AReal>
217 int m = (
int) A.GetNrows();
218 int n = (
int) A.GetNcols();
220 assert((
int) B.GetNoElements() >=
n);
239 assert(B.GetNrows() == 1 || B.GetNcols() == 1);
240 tmp = alpha *
tA *
ones + beta * tmp;
242 std::copy(tmp.GetMatrixArray(), tmp.GetMatrixArray() +
n, B.GetRawDataPointer());
247template<
typename AReal>
253 int n = (
int) (A.GetNcols() * A.GetNrows());
256 const AReal *
x = A.GetRawDataPointer();
257 AReal *
y = B.GetRawDataPointer();
268template<
typename AReal>
278template<
typename AReal>
284 for (
size_t i = 0; i < B.GetFirstSize(); ++i) {
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>
347 AReal *
a = A.GetRawDataPointer();
348 const AReal *
m = M.GetRawDataPointer();
349 const AReal *
v = V.GetRawDataPointer();
356template<
typename AReal>
361 AReal *
a = A.GetRawDataPointer();
362 const AReal *
b = B.GetRawDataPointer();
368template<
typename AReal>
373 AReal *
a = A.GetRawDataPointer();
374 const AReal *
b = B.GetRawDataPointer();
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#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
static Config & Instance()
static function: returns TMVA instance
static size_t GetNWorkItems(size_t nelements)
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 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