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
28 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Derived,3)
29 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,3)
35 return typename 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,
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>
76 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Derived,4)
77 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,4)
81 DerivedNested lhs(derived());
82 OtherDerivedNested rhs(other.derived());
98 template<
typename ExpressionType,
int Direction>
99 template<
typename OtherDerived>
100 const typename VectorwiseOp<ExpressionType,Direction>::CrossReturnType
103 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,3)
105 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
107 CrossReturnType res(_expression().rows(),_expression().cols());
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)
167 if((!isMuchSmallerThan(src.x(), src.z()))
168 || (!isMuchSmallerThan(src.y(), src.z())))
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>
212 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
218 #endif // EIGEN_ORTHOMETHODS_H ColXpr col(Index i)
Definition: DenseBase.h:733
For Reverse, all columns are reversed; for PartialReduxExpr and VectorwiseOp, act on columns...
Definition: Constants.h:209
Definition: XprHelper.h:170
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
Holds information about the various numeric (i.e.
Definition: NumTraits.h:88
RowXpr row(Index i)
Definition: DenseBase.h:750
PlainObject unitOrthogonal(void) const
Definition: OrthoMethods.h:210
const unsigned int PacketAccessBit
Short version: means the expression might be vectorized.
Definition: Constants.h:81
Definition: OrthoMethods.h:128
PlainObject cross3(const MatrixBase< OtherDerived > &other) const
Definition: OrthoMethods.h:74
const CrossReturnType cross(const MatrixBase< OtherDerived > &other) const
Definition: OrthoMethods.h:101
Definition: BandTriangularSolver.h:13
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:127
Definition: OrthoMethods.h:47
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
Definition: ForwardDeclarations.h:17
double Scalar
Common scalar type.
Definition: FlexibleKalmanBase.h:48