11 #ifndef EIGEN_ORTHOMETHODS_H 12 #define EIGEN_ORTHOMETHODS_H 27 template<
typename Derived>
28 template<
typename OtherDerived>
29 #ifndef EIGEN_PARSED_BY_DOXYGEN 30 EIGEN_DEVICE_FUNC
inline typename MatrixBase<Derived>::template cross_product_return_type<OtherDerived>::type
32 inline typename MatrixBase<Derived>::PlainObject
36 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Derived,3)
37 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,3)
43 return typename cross_product_return_type<OtherDerived>::type(
44 numext::conj(lhs.coeff(1) * rhs.coeff(2) - lhs.coeff(2) * rhs.coeff(1)),
45 numext::conj(lhs.coeff(2) * rhs.coeff(0) - lhs.coeff(0) * rhs.coeff(2)),
46 numext::conj(lhs.coeff(0) * rhs.coeff(1) - lhs.coeff(1) * rhs.coeff(0))
52 template<
int Arch,
typename VectorLhs,
typename VectorRhs,
53 typename Scalar =
typename VectorLhs::Scalar,
54 bool Vectorizable = bool((VectorLhs::Flags&VectorRhs::Flags)&
PacketAccessBit)>
57 run(
const VectorLhs& lhs,
const VectorRhs& rhs)
60 numext::conj(lhs.coeff(1) * rhs.coeff(2) - lhs.coeff(2) * rhs.coeff(1)),
61 numext::conj(lhs.coeff(2) * rhs.coeff(0) - lhs.coeff(0) * rhs.coeff(2)),
62 numext::conj(lhs.coeff(0) * rhs.coeff(1) - lhs.coeff(1) * rhs.coeff(0)),
79 template<
typename Derived>
80 template<
typename OtherDerived>
81 EIGEN_DEVICE_FUNC
inline typename MatrixBase<Derived>::PlainObject
84 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Derived,4)
85 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,4)
89 DerivedNested lhs(derived());
90 OtherDerivedNested rhs(other.derived());
106 template<
typename ExpressionType,
int Direction>
107 template<
typename OtherDerived>
109 const typename VectorwiseOp<ExpressionType,Direction>::CrossReturnType
112 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,3)
114 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
119 CrossReturnType res(_expression().rows(),_expression().cols());
122 eigen_assert(CrossReturnType::RowsAtCompileTime==3 &&
"the matrix must have exactly 3 rows");
123 res.row(0) = (mat.row(1) * vec.coeff(2) - mat.row(2) * vec.coeff(1)).conjugate();
124 res.row(1) = (mat.row(2) * vec.coeff(0) - mat.row(0) * vec.coeff(2)).conjugate();
125 res.row(2) = (mat.row(0) * vec.coeff(1) - mat.row(1) * vec.coeff(0)).conjugate();
129 eigen_assert(CrossReturnType::ColsAtCompileTime==3 &&
"the matrix must have exactly 3 columns");
130 res.col(0) = (mat.col(1) * vec.coeff(2) - mat.col(2) * vec.coeff(1)).conjugate();
131 res.col(1) = (mat.col(2) * vec.coeff(0) - mat.col(0) * vec.coeff(2)).conjugate();
132 res.col(2) = (mat.col(0) * vec.coeff(1) - mat.col(1) * vec.coeff(0)).conjugate();
139 template<
typename Derived,
int Size = Derived::SizeAtCompileTime>
147 static inline VectorType run(
const Derived& src)
149 VectorType perp = VectorType::Zero(src.size());
152 src.cwiseAbs().maxCoeff(&maxi);
155 RealScalar invnm = RealScalar(1)/(Vector2() << src.coeff(sndi),src.coeff(maxi)).finished().norm();
156 perp.coeffRef(maxi) = -numext::conj(src.coeff(sndi)) * invnm;
157 perp.coeffRef(sndi) = numext::conj(src.coeff(maxi)) * invnm;
163 template<
typename Derived>
170 static inline VectorType run(
const Derived& src)
180 if((!isMuchSmallerThan(src.x(), src.z()))
181 || (!isMuchSmallerThan(src.y(), src.z())))
183 RealScalar invnm = RealScalar(1)/src.template head<2>().norm();
184 perp.coeffRef(0) = -numext::conj(src.y())*invnm;
185 perp.coeffRef(1) = numext::conj(src.x())*invnm;
186 perp.coeffRef(2) = 0;
194 RealScalar invnm = RealScalar(1)/src.template tail<2>().norm();
195 perp.coeffRef(0) = 0;
196 perp.coeffRef(1) = -numext::conj(src.z())*invnm;
197 perp.coeffRef(2) = numext::conj(src.y())*invnm;
204 template<
typename Derived>
209 static inline VectorType run(
const Derived& src)
210 {
return VectorType(-numext::conj(src.y()), numext::conj(src.x())).normalized(); }
224 template<
typename Derived>
225 EIGEN_DEVICE_FUNC
typename MatrixBase<Derived>::PlainObject
228 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
234 #endif // EIGEN_ORTHOMETHODS_H internal::traits< Derived >::Scalar Scalar
The numeric type of the expression' coefficients, e.g.
Definition: DenseBase.h:66
EIGEN_DEVICE_FUNC PlainObject unitOrthogonal(void) const
Definition: OrthoMethods.h:226
For Reverse, all columns are reversed; for PartialReduxExpr and VectorwiseOp, act on columns...
Definition: Constants.h:265
EIGEN_DEVICE_FUNC PlainObject cross3(const MatrixBase< OtherDerived > &other) const
Definition: OrthoMethods.h:82
Definition: XprHelper.h:275
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:85
Holds information about the various numeric (i.e.
Definition: NumTraits.h:150
const unsigned int PacketAccessBit
Short version: means the expression might be vectorized.
Definition: Constants.h:89
Definition: OrthoMethods.h:140
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
EIGEN_DEVICE_FUNC const CrossReturnType cross(const MatrixBase< OtherDerived > &other) const
Definition: OrthoMethods.h:110
Definition: BandTriangularSolver.h:13
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:55
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:178
Definition: OrthoMethods.h:55
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
Definition: ForwardDeclarations.h:17