Sync public subset from Flux
This commit is contained in:
34
include/numerics/matlog.h
Normal file
34
include/numerics/matlog.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "./utils/vector.h"
|
||||
#include "./utils/matrix.h"
|
||||
|
||||
|
||||
namespace numerics{
|
||||
|
||||
|
||||
template <typename T>
|
||||
void inplace_matlog(utils::Matrix<T>& A){
|
||||
|
||||
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){
|
||||
numerics::inplace_log(A(i,j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
utils::Matrix<T> log(const utils::Matrix<T>& A){
|
||||
|
||||
utils::Matrix<T> B = A;
|
||||
inplace_matlog(B);
|
||||
return B;
|
||||
}
|
||||
|
||||
|
||||
} // namespace numerics
|
||||
|
||||
Reference in New Issue
Block a user