Files
Flux/include/numerics/matabs.h
T
Bausager 48f329feef
Sync public mirror / sync (push) Failing after 27s
Regulaization
Started on regulaization in  Loss.h. I need to refactor the matsum.h since I need a total sum over the matrix. Also matmul needs a elementwise matmul function, which is the next this in the ragulaization
2026-01-03 22:10:50 +01:00

30 lines
464 B
C++

#pragma once
#include "./numerics/abs.h"
#include "./utils/matrix.h"
namespace numerics{
template <typename T>
void inplace_matabs(utils::Matrix<T>& A){
for (uint64_t i = 0; i < A.rows(); ++i){
for (uint64_t j = 0; j < A.cols(); ++j){
A(i,j) = numerics::abs(A(i,j));
}
}
}
template <typename T>
utils::Matrix<T> matabs(const utils::Matrix<T>& A){
utils::Matrix<T> B = A;
inplace_matabs(B);
return B;
}
} // namespace numerics