| 73 |
|
inline bool equal(RealType e1, RealType e2) { |
| 74 |
|
return fabs(e1 - e2) < epsilon; |
| 75 |
|
} |
| 76 |
– |
|
| 76 |
|
|
| 77 |
|
/** |
| 78 |
|
* @class Vector Vector.hpp "math/Vector.hpp" |
| 284 |
|
this->data_[i] = v1.data_[i] * v2.data_[i]; |
| 285 |
|
} |
| 286 |
|
|
| 287 |
+ |
/* replaces the elements with the absolute values of those elements */ |
| 288 |
+ |
inline Vector<Real, Dim>& abs() { |
| 289 |
+ |
for (unsigned int i = 0; i < Dim; i++) { |
| 290 |
+ |
this->data_[i] = std::abs(this->data_[i]); |
| 291 |
+ |
} |
| 292 |
+ |
return *this; |
| 293 |
+ |
} |
| 294 |
+ |
|
| 295 |
+ |
/* returns the maximum value in this vector */ |
| 296 |
+ |
inline Real max() { |
| 297 |
+ |
Real val = this->data_[0]; |
| 298 |
+ |
for (unsigned int i = 0; i < Dim; i++) { |
| 299 |
+ |
if (this->data_[i] > val) val = this->data_[i]; |
| 300 |
+ |
} |
| 301 |
+ |
return val; |
| 302 |
+ |
} |
| 303 |
+ |
|
| 304 |
|
/** |
| 305 |
|
* Sets the value of this vector to the scalar division of itself (*this /= s ). |
| 306 |
|
* @param s the scalar value |