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
This commit is contained in:
@@ -400,12 +400,29 @@ public:
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//############################################
|
||||
//# VECTOR: Abs #
|
||||
//############################################
|
||||
Vector<T> abs()const{
|
||||
Vector<T> result = *this;
|
||||
const uint64_t n = v.size();
|
||||
for (uint64_t i = 0; i < n; ++i){
|
||||
if (v[i]<T{0}){
|
||||
result[i] = -v[i];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//############################################
|
||||
//# VECTOR: Norm #
|
||||
//############################################
|
||||
T norm() const{
|
||||
return static_cast<T>(std::sqrt(this->dot(*this)));
|
||||
}
|
||||
|
||||
//############################################
|
||||
//# VECTOR: Normalize #
|
||||
//############################################
|
||||
|
||||
Reference in New Issue
Block a user