11 #ifndef EIGEN_ORTHOMETHODS_H 12 #define EIGEN_ORTHOMETHODS_H 23 template<
typename Derived>
24 template<
typename OtherDerived>
25 inline typename MatrixBase<Derived>::template cross_product_return_type<OtherDerived>::type
36 numext::conj(lhs.coeff(1) * rhs.coeff(2) - lhs.coeff(2) * rhs.coeff(1)),
37 numext::conj(lhs.coeff(2) * rhs.coeff(0) - lhs.coeff(0) * rhs.coeff(2)),
38 numext::conj(lhs.coeff(0) * rhs.coeff(1) - lhs.coeff(1) * rhs.coeff(0))
44 template<
int Arch,
typename VectorLhs,
typename VectorRhs,
45 typename Scalar =
typename VectorLhs::Scalar,
46 bool Vectorizable = bool((VectorLhs::Flags&VectorRhs::Flags)&
PacketAccessBit)>
49 run(
const VectorLhs& lhs,
const VectorRhs& rhs)
52 numext::conj(lhs.coeff(1) * rhs.coeff(2) - lhs.coeff(2) * rhs.coeff(1)),
53 numext::conj(lhs.coeff(2) * rhs.coeff(0) - lhs.coeff(0) * rhs.coeff(2)),
54 numext::conj(lhs.coeff(0) * rhs.coeff(1) - lhs.coeff(1) * rhs.coeff(0)),
71 template<
typename Derived>
72 template<
typename OtherDerived>
81 DerivedNested lhs(derived());
82 OtherDerivedNested rhs(other.derived());
98 template<
typename ExpressionType,
int Direction>
99 template<
typename OtherDerived>
105 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
110 eigen_assert(CrossReturnType::RowsAtCompileTime==3 &&
"the matrix must have exactly 3 rows");
111 res.row(0) = (_expression().row(1) * other.coeff(2) - _expression().
row(2) * other.coeff(1)).
conjugate();
112 res.row(1) = (_expression().row(2) * other.coeff(0) - _expression().
row(0) * other.coeff(2)).
conjugate();
113 res.row(2) = (_expression().row(0) * other.coeff(1) - _expression().
row(1) * other.coeff(0)).
conjugate();
117 eigen_assert(CrossReturnType::ColsAtCompileTime==3 &&
"the matrix must have exactly 3 columns");
118 res.col(0) = (_expression().col(1) * other.coeff(2) - _expression().
col(2) * other.coeff(1)).
conjugate();
119 res.col(1) = (_expression().col(2) * other.coeff(0) - _expression().
col(0) * other.coeff(2)).
conjugate();
120 res.col(2) = (_expression().col(0) * other.coeff(1) - _expression().
col(1) * other.coeff(0)).
conjugate();
127 template<
typename Derived,
int Size = Derived::SizeAtCompileTime>
133 typedef typename Derived::Index
Index;
135 static inline VectorType
run(
const Derived& src)
137 VectorType perp = VectorType::Zero(src.size());
140 src.cwiseAbs().maxCoeff(&maxi);
143 RealScalar invnm = RealScalar(1)/(Vector2() << src.coeff(sndi),src.coeff(maxi)).finished().norm();
144 perp.coeffRef(maxi) = -numext::conj(src.coeff(sndi)) * invnm;
145 perp.coeffRef(sndi) = numext::conj(src.coeff(maxi)) * invnm;
151 template<
typename Derived>
157 static inline VectorType
run(
const Derived& src)
170 RealScalar invnm = RealScalar(1)/src.template head<2>().norm();
171 perp.coeffRef(0) = -numext::conj(src.y())*invnm;
172 perp.coeffRef(1) = numext::conj(src.x())*invnm;
173 perp.coeffRef(2) = 0;
181 RealScalar invnm = RealScalar(1)/src.template tail<2>().norm();
182 perp.coeffRef(0) = 0;
183 perp.coeffRef(1) = -numext::conj(src.z())*invnm;
184 perp.coeffRef(2) = numext::conj(src.y())*invnm;
191 template<
typename Derived>
195 static inline VectorType
run(
const Derived& src)
196 {
return VectorType(-numext::conj(src.y()), numext::conj(src.x())).normalized(); }
208 template<
typename Derived>
218 #endif // EIGEN_ORTHOMETHODS_H
PlainObject unitOrthogonal(void) const
const CrossReturnType cross(const MatrixBase< OtherDerived > &other) const
NumTraits< Scalar >::Real RealScalar
static internal::plain_matrix_type< VectorLhs >::type run(const VectorLhs &lhs, const VectorRhs &rhs)
traits< Derived >::Scalar Scalar
plain_matrix_type< Derived >::type VectorType
traits< Derived >::Scalar Scalar
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, typename NumTraits< Scalar >::Real precision=NumTraits< Scalar >::dummy_precision())
internal::traits< Derived >::Scalar Scalar
const unsigned int PacketAccessBit
Matrix< Scalar, 2, 1 > Vector2
PlainObject cross3(const MatrixBase< OtherDerived > &other) const
ConjugateReturnType conjugate() const
plain_matrix_type< Derived >::type VectorType
static VectorType run(const Derived &src)
cross_product_return_type< OtherDerived >::type cross(const MatrixBase< OtherDerived > &other) const
static VectorType run(const Derived &src)
plain_matrix_type< Derived >::type VectorType
The matrix class, also used for vectors and row-vectors.
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
ExpressionType::PlainObject CrossReturnType
Base class for all dense matrices, vectors, and expressions.
NumTraits< Scalar >::Real RealScalar
static VectorType run(const Derived &src)
#define EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(TYPE, SIZE)