tesseract++
0.0.1
N-dimensional tensor library for embedded systems
Loading...
Searching...
No Matches
core
include
algorithms
operations
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
5
#include "
fused/fused_vector.h
"
6
42
namespace
matrix_algorithms
43
{
44
54
template
<
typename
T, my_
size_t
N>
55
FusedVector<T, N>
cross
(
const
FusedVector<T, N>
&a,
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
FusedVector
Definition
fused_vector.h:9
config.h
Global configuration for the tesseract tensor library.
fused_vector.h
matrix_algorithms
Definition
cholesky.h:52
matrix_algorithms::cross
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
Generated by
1.9.8