8 #ifndef LIN_CORE_OPERATIONS_VECTOR_OPERATIONS_HPP_ 9 #define LIN_CORE_OPERATIONS_VECTOR_OPERATIONS_HPP_ 11 #include "../config.hpp" 12 #include "../traits.hpp" 13 #include "../types/stream.hpp" 14 #include "../types/vector.hpp" 19 #include <type_traits> 24 template <
class C,
class D>
26 have_same_vector_dimensions<C, D, Vector3f>,
27 is_detected<multiply::expression, _elem_t<C>, _elem_t<D>>
30 template <
class C,
class D>
32 have_same_vector_dimensions<C, D>,
33 is_detected<multiply::expression, _elem_t<C>, _elem_t<D>>
41 template <class C, class D, std::enable_if_t<internal::can_cross<C, D>::value,
size_t> = 0>
44 typedef typename internal::multiply::template expression<internal::_elem_t<C>, internal::_elem_t<D>> T;
46 return std::conditional_t<
50 u(1) * v(2) - u(2) * v(1),
51 u(2) * v(0) - u(0) * v(2),
52 u(0) * v(1) - u(1) * v(0)
56 template <class C, class D, std::enable_if_t<internal::can_dot<C, D>::value,
size_t> = 0>
60 typedef internal::multiply::expression<internal::_elem_t<C>, internal::_elem_t<D>> T;
63 for (
size_t i = 1; i < u.
size(); i++) x += u(i) * v(i);
67 template <class C, std::enable_if_t<internal::can_norm<C>::value,
size_t> = 0>
69 return std::sqrt(fro(u));
Definition: vector_operations.hpp:25
constexpr size_t size() const
Definition: stream.hpp:90
Generic vector.
Definition: vector.hpp:33
#define LIN_ASSERT(x)
Asserts the condition x when assertions are enabled within lin.
Definition: config.hpp:22
Definition: vector_operations.hpp:31
Generic row vector.
Definition: vector.hpp:131
Definition: vector_operations.hpp:37
Logical AND operation for template metaprogramming.
Definition: utilities.hpp:54
Tests if a tensor type is a vector.
Definition: vector.hpp:73
Tests if a tensor type is a column vector.
Definition: vector.hpp:54
Definition: config.hpp:27
Definition: vector.hpp:76