5template<
int Size,
typename Scalar>
11 #pragma forceinline recursive
14 for (
int i=0;
i <
Size;
i++ ) {
21template<
int Size,
typename Scalar>
27 #pragma forceinline recursive
30 for (
int i=0;
i <
Size;
i++ ) {
37template<
int Size,
typename Scalar>
44 #pragma forceinline recursive
47 for (
int i=0;
i <
Size;
i++ ) {
48 result(i) =
rhs(i) + lhs(i);
54template<
int Size,
typename Scalar>
61 #pragma forceinline recursive
64 for (
int i=0;
i <
Size;
i++ ) {
65 result(i) = lhs(i) -
rhs(i);
71template<
int Size,
typename Scalar>
78 #pragma forceinline recursive
81 for (
int i=0;
i <
Size;
i++ ) {
82 result(i) = lhs(i) *
rhs(i);
88template<
int Size,
typename Scalar>
95 #pragma forceinline recursive
98 for (
int i=0;
i <
Size;
i++ ) {
99 result(i) = std::max( lhs(i),
rhs(i) );
105template<
int Size,
typename Scalar>
112 #pragma forceinline recursive
115 for (
int i=0;
i <
Size;
i++ ) {
116 result(i) = std::min( lhs(i),
rhs(i) );
122template<
int Size,
typename Scalar>
131template<
int Size,
typename Scalar>
136 Scalar result = lhs(0) * rhs(0);
137 for (
int i=1; i < Size; i++ ) {
138 result += lhs(i) * rhs(i);
144template<
int Size,
typename Scalar>
153template<
typename Scalar>
160 result(0) = lhs(1) * rhs(2) - lhs(2) * rhs(1);
161 result(1) = lhs(2) * rhs(0) - lhs(0) * rhs(2);
162 result(2) = lhs(0) * rhs(1) - lhs(1) * rhs(0);
168template<
int Size,
typename Scalar>
172 const Scalar tolerance
174 for (
int i=0; i < Size; i++ ) {
175 if ( la::abs(lhs(i) - rhs(i)) > tolerance ) {
183template<
int Size,
typename Scalar>
187 const Scalar tolerance
189 for (
int i=0; i < Size; i++ ) {
190 if ( lhs(i) - rhs(i) > tolerance ) {
193 else if ( rhs(i) - lhs(i) > tolerance ) {
201template<
int Size,
typename Scalar>
205 const Scalar tolerance
207 for (
int i=0; i < Size; i++ ) {
208 if ( lhs(i) - rhs(i) > tolerance ) {
216template<
int Size,
typename Scalar>
220 const Scalar tolerance
222 for (
int i=0; i < Size; i++ ) {
223 if ( lhs(i) - rhs(i) >= - tolerance ) {
231template<
int Size,
typename Scalar>
235 const Scalar tolerance
238 for (
int i=0; i < Size; i++ ) {
239 result &=
greater(lhs(i),rhs(i),tolerance);
245template<
int Size,
typename Scalar>
249 const Scalar tolerance
252 for (
int i=0; i < Size; i++ ) {
259template<
int Size,
typename Scalar>
263 const Scalar tolerance
266 for (
int i=0; i < Size; i++ ) {
267 result &= smaller(lhs(i),rhs(i),tolerance);
273template<
int Size,
typename Scalar>
277 const Scalar tolerance
280 for (
int i=0; i < Size; i++ ) {
287template<
int Size,
typename Scalar>
291 const Scalar tolerance
293 for (
int i=0; i < Size; i++ ) {
294 if (smaller(lhs(i),rhs(i),tolerance)) {
302template<
int Size,
typename Scalar>
306 const Scalar tolerance
308 for (
int i=0; i < Size; i++ ) {
317template<
int Size,
typename Scalar>
322 for (
int i=0; i < Size; i++) {
323 if (lhs(i) != rhs(i)) {
331template<
int Size,
typename Scalar>
340template<
int Size,
typename Scalar>
344 const Scalar tolerance
346 for (
int i=0; i < Size; i++) {
347 if(
std::abs(lhs(i) - rhs(i)) > tolerance)
return i;
358 for (
int i=0; i < Size; i++) {
359 if (lhs(i)!=rhs(i))
return i;
372 for (
int i=0; i<Size; i++) {
373 result += (lhs(i)==rhs(i)) ? 1 : 0;
380template<
int Size,
typename Scalar>
384 const Scalar tolerance
388 for (
int i=0; i<Size; i++) {
389 result += ( equals( lhs(i),rhs(i),tolerance) ) ? 1 : 0;
Scalar dot(const Vector< Size, Scalar > &lhs, const Vector< Size, Scalar > &rhs)
Performs the dot (=inner) product of two vectors.
bool allGreaterEquals(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
bool operator!=(const Vector< Size, Scalar > &lhs, const Vector< Size, Scalar > &rhs)
Bit-wise comparison of the components of two vectors for inequality.
bool allGreater(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
Vector< 3, Scalar > cross(const Vector< 3, Scalar > &lhs, const Vector< 3, Scalar > &rhs)
Performs the cross product of two 3D vectors into result.
bool oneSmaller(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
bool greater(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
int countEqualEntries(const Vector< Size, int > &lhs, const Vector< Size, int > &rhs)
Run through both vectors and count how many entries are the same.
bool greaterEquals(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
bool operator==(const Matrix< Rows, Cols, Scalar > &lhs, const Matrix< Rows, Cols, Scalar > &rhs)
Bitwise comparison of the components of two matrices on equality.
Matrix< Rows, Cols, Scalar > operator-(const Matrix< Rows, Cols, Scalar > &lhs, const Matrix< Rows, Cols, Scalar > &rhs)
Vector< Size, Scalar > & operator+=(Vector< Size, Scalar > &vector, const Scalar &scalar)
Adds every component of the vector to the scalar and assigns the result to the vector.
Matrix< Rows, Cols, Scalar > operator+(const Matrix< Rows, Cols, Scalar > &lhs, const Matrix< Rows, Cols, Scalar > &rhs)
bool oneSmallerEquals(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
double max(double a, double b, double c)
I need the maximum of three values all the time, to I decided to write a function for this.
bool smallerEquals(double lhs, double rhs, double tolerance=NUMERICAL_ZERO_DIFFERENCE)
bool firstGreater(const Vector< Size, Scalar > &lhs, const Vector< Size, Scalar > &rhs, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
Compares sequentially every component pair of lVector and rVector, and stops as soon as one is greate...
bool allSmallerEquals(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
bool allSmaller(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
Matrix< Rows, Cols, Scalar > operator*(const Matrix< Rows, X, Scalar > &lhs, const Matrix< X, Cols, Scalar > &rhs)
bool equals(const Matrix< Rows, Cols, Scalar > &lhs, const Matrix< Rows, Cols, Scalar > &rhs, const Scalar &tolerance=NUMERICAL_ZERO_DIFFERENCE)
Compares to matrices on equality by means of a numerical accuracy.
std::pair< int, int > equalsReturnIndex(const Matrix< Rows, Cols, Scalar > &lhs, const Matrix< Rows, Cols, Scalar > &rhs, const Scalar &tolerance=NUMERICAL_ZERO_DIFFERENCE)
Return Index of element which is not equals.
bool oneGreaterEquals(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
Matrix< Rows, Cols, Scalar > multiplyComponents(const Matrix< Rows, X, Scalar > &lhs, const Matrix< X, Cols, Scalar > &rhs)
Scalar innerDot(const Vector< Size, Scalar > &lhs, const Vector< Size, Scalar > &rhs)
Performs the dot (=inner) product of two vectors.
Vector< Size, Scalar > & operator-=(Vector< Size, Scalar > &vector, const Scalar &scalar)
Subtracts the scalar from every component of the vector and assigns the result to the vector.
bool oneGreater(const Vector< Size, Scalar > &lhs, const Scalar &cmp, const Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
Scalar min(const Vector< Size, Scalar > &vector)
Returns the element with minimal value (NOT absolute value).