tesseract++ 0.0.1
N-dimensional tensor library for embedded systems
Loading...
Searching...
No Matches
cross_product.h
Go to the documentation of this file.
1#ifndef FUSED_ALGORITHMS_CROSS_PRODUCT_H
2#define FUSED_ALGORITHMS_CROSS_PRODUCT_H
3
4#include "config.h" // for my_size_t
6
42namespace matrix_algorithms
43{
44
54 template <typename T, my_size_t N>
56 const FusedVector<T, N> &b)
57 {
58 static_assert(N == 3,
59 "cross product is only defined for 3-vectors");
60
61 FusedVector<T, 3> result(T(0));
62
63 result(0) = a(1) * b(2) - a(2) * b(1);
64 result(1) = a(2) * b(0) - a(0) * b(2);
65 result(2) = a(0) * b(1) - a(1) * b(0);
66
67 return result;
68 }
69
70} // namespace matrix_algorithms
71
72#endif // FUSED_ALGORITHMS_CROSS_PRODUCT_H
Definition fused_vector.h:9
Global configuration for the tesseract tensor library.
Definition cholesky.h:52
FusedVector< T, N > cross(const FusedVector< T, N > &a, const FusedVector< T, N > &b)
Compute the cross product of two 3-vectors.
Definition cross_product.h:55