LU and LU inverse is done
This commit is contained in:
+27
-2
@@ -27,6 +27,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
|
||||
//##########################################################
|
||||
//# VECTOR: --- basic properties --- #
|
||||
//##########################################################
|
||||
@@ -399,13 +400,37 @@ public:
|
||||
void print() const{
|
||||
std::cout << *this << std::endl;
|
||||
}
|
||||
|
||||
|
||||
bool nearly_equal(const Vector<T>& a, T tol = static_cast<T>(1e-9)) const {
|
||||
if (v.size() != a.size()){
|
||||
return false;
|
||||
}
|
||||
for (uint64_t i = 0; i < v.size(); ++i){
|
||||
T val1 = v[i];
|
||||
T val2 = a[i];
|
||||
if (std::is_floating_point<T>::value) {
|
||||
if (std::fabs(val1 - val2) > tol) return false;
|
||||
} else {
|
||||
if (val1 != val2) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
typedef Vector<int> Vi;
|
||||
typedef Vector<float> Vf;
|
||||
typedef Vector<double> Vd;
|
||||
|
||||
|
||||
/*
|
||||
if (std::is_floating_point<T>::value) {
|
||||
if (std::fabs(a - b) > tol) return false;
|
||||
} else {
|
||||
if (a != b) return false;
|
||||
}*/
|
||||
} // namespace utils
|
||||
|
||||
#endif // _vector_n_
|
||||
Reference in New Issue
Block a user