Binomial_CrossEnthophy
fixed rowwise/colswise mean/sum and implemented binomial_corssentrhopy. Next up is regression.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#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
|
||||
|
||||
Reference in New Issue
Block a user