Files
Flux/include/numerics/detail/binary_threshold_serial.h
T
Bausager cb65174cf4 Binomial_CrossEnthophy
fixed rowwise/colswise mean/sum and implemented binomial_corssentrhopy. Next up is regression.
2026-05-22 10:11:43 +02:00

45 lines
856 B
C++

#pragma once
#include <cstdint> //uint64_t
#include <cmath> // std::abs
#include "utils/vector.h"
#include "utils/matrix.h"
namespace numerics::detail{
// ---------------- Elemenwise ----------------
template <typename T>
void inplace_greater_than_serial(T& a, const T c) {
if (a > c){
a = T{1};
}
else{
a = T{0};
}
}
template <typename T>
void inplace_greater_than_serial(utils::Vector<T>& v, const T c) {
for (uint64_t i = 0; i < v.size(); ++i){
inplace_greater_than_serial(v[i], c);
}
}
template <typename T>
void inplace_greater_than_serial(utils::Matrix<T>& A, const T c) {
const uint64_t rows = A.rows();
const uint64_t cols = A.cols();
for (uint64_t i = 0; i < rows; ++i){
for (uint64_t j = 0; j < cols; ++j){
inplace_greater_than_serial(A(i,j), c);
}
}
}
} // namespace numerics