10 #ifndef EIGEN_HOMOGENEOUS_H 11 #define EIGEN_HOMOGENEOUS_H 32 template<
typename MatrixType,
int Direction>
40 RowsPlusOne = (MatrixType::RowsAtCompileTime !=
Dynamic) ?
41 int(MatrixType::RowsAtCompileTime) + 1 :
Dynamic,
42 ColsPlusOne = (MatrixType::ColsAtCompileTime !=
Dynamic) ?
43 int(MatrixType::ColsAtCompileTime) + 1 :
Dynamic,
44 RowsAtCompileTime = Direction==
Vertical ? RowsPlusOne : MatrixType::RowsAtCompileTime,
45 ColsAtCompileTime = Direction==
Horizontal ? ColsPlusOne : MatrixType::ColsAtCompileTime,
46 MaxRowsAtCompileTime = RowsAtCompileTime,
47 MaxColsAtCompileTime = ColsAtCompileTime,
48 TmpFlags = _MatrixTypeNested::Flags & HereditaryBits,
49 Flags = ColsAtCompileTime==1 ? (TmpFlags & ~
RowMajorBit)
52 CoeffReadCost = _MatrixTypeNested::CoeffReadCost
61 template<
typename MatrixType,
int _Direction>
class Homogeneous 66 enum { Direction = _Direction };
75 inline Index rows()
const {
return m_matrix.rows() + (int(Direction)==
Vertical ? 1 : 0); }
76 inline Index cols()
const {
return m_matrix.cols() + (int(Direction)==
Horizontal ? 1 : 0); }
78 inline Scalar coeff(
Index row,
Index col)
const 80 if( (
int(Direction)==
Vertical && row==m_matrix.rows())
81 || (
int(Direction)==
Horizontal && col==m_matrix.cols()))
83 return m_matrix.coeff(row, col);
86 template<
typename Rhs>
94 template<
typename Lhs>
friend 98 eigen_assert(
int(Direction)==
Vertical);
102 template<
typename Scalar,
int Dim,
int Mode,
int Options>
friend 106 eigen_assert(
int(Direction)==
Vertical);
111 typename MatrixType::Nested m_matrix;
125 template<
typename Derived>
129 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
141 template<
typename ExpressionType,
int Direction>
145 return _expression();
156 template<
typename Derived>
160 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
162 ColsAtCompileTime==1?
size()-1:1,
163 ColsAtCompileTime==1?1:
size()-1) / coeff(
size()-1);
174 template<
typename ExpressionType,
int Direction>
179 Direction==
Vertical ? _expression().rows()-1 : _expression().rows(),
180 Direction==
Horizontal ? _expression().cols()-1 : _expression().cols()).cwiseQuotient(
182 Direction==
Vertical ? HNormalized_SizeMinusOne : 1,
183 Direction==
Horizontal ? HNormalized_SizeMinusOne : 1>
185 Direction==
Vertical ? _expression().rows()-1:0,
186 Direction==
Horizontal ? _expression().cols()-1:0,
187 Direction==
Vertical ? 1 : _expression().rows(),
188 Direction==
Horizontal ? 1 : _expression().cols()),
189 Direction==
Vertical ? _expression().rows()-1 : 1,
190 Direction==
Horizontal ? _expression().cols()-1 : 1));
195 template<
typename MatrixOrTransformType>
198 typedef MatrixOrTransformType type;
199 static const type& run(
const type &x) {
return x; }
202 template<
typename Scalar,
int Dim,
int Mode,
int Options>
207 static type run (
const TransformType& x) {
return x.
affine(); }
210 template<
typename Scalar,
int Dim,
int Options>
215 static const type& run (
const TransformType& x) {
return x.
matrix(); }
218 template<
typename MatrixType,
typename Lhs>
221 typedef typename take_matrix_for_product<Lhs>::type LhsMatrixType;
226 LhsMatrixTypeCleaned::RowsAtCompileTime,
227 MatrixTypeCleaned::ColsAtCompileTime,
228 MatrixTypeCleaned::PlainObject::Options,
229 LhsMatrixTypeCleaned::MaxRowsAtCompileTime,
230 MatrixTypeCleaned::MaxColsAtCompileTime>::type
ReturnType;
233 template<
typename MatrixType,
typename Lhs>
235 :
public ReturnByValue<homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs> >
240 typedef typename MatrixType::Index Index;
246 inline Index rows()
const {
return m_lhs.rows(); }
247 inline Index cols()
const {
return m_rhs.cols(); }
249 template<
typename Dest>
void evalTo(Dest& dst)
const 252 dst =
Block<
const LhsMatrixTypeNested,
253 LhsMatrixTypeNested::RowsAtCompileTime,
254 LhsMatrixTypeNested::ColsAtCompileTime==
Dynamic?
Dynamic:LhsMatrixTypeNested::ColsAtCompileTime-1>
255 (m_lhs,0,0,m_lhs.rows(),m_lhs.cols()-1) * m_rhs;
256 dst += m_lhs.col(m_lhs.cols()-1).rowwise()
257 .template replicate<MatrixType::ColsAtCompileTime>(m_rhs.cols());
260 typename LhsMatrixTypeCleaned::Nested m_lhs;
261 typename MatrixType::Nested m_rhs;
264 template<
typename MatrixType,
typename Rhs>
268 MatrixType::RowsAtCompileTime,
269 Rhs::ColsAtCompileTime,
270 MatrixType::PlainObject::Options,
271 MatrixType::MaxRowsAtCompileTime,
275 template<
typename MatrixType,
typename Rhs>
277 :
public ReturnByValue<homogeneous_right_product_impl<Homogeneous<MatrixType,Horizontal>,Rhs> >
280 typedef typename MatrixType::Index Index;
282 : m_lhs(lhs), m_rhs(rhs)
285 inline Index rows()
const {
return m_lhs.rows(); }
286 inline Index cols()
const {
return m_rhs.cols(); }
288 template<
typename Dest>
void evalTo(Dest& dst)
const 291 dst = m_lhs *
Block<
const RhsNested,
292 RhsNested::RowsAtCompileTime==
Dynamic?
Dynamic:RhsNested::RowsAtCompileTime-1,
293 RhsNested::ColsAtCompileTime>
294 (m_rhs,0,0,m_rhs.rows()-1,m_rhs.cols());
295 dst += m_rhs.row(m_rhs.rows()-1).colwise()
296 .template replicate<MatrixType::RowsAtCompileTime>(m_lhs.rows());
299 typename MatrixType::Nested m_lhs;
300 typename Rhs::Nested m_rhs;
307 #endif // EIGEN_HOMOGENEOUS_H Definition: XprHelper.h:114
For Reverse, all columns are reversed; for PartialReduxExpr and VectorwiseOp, act on columns...
Definition: Constants.h:209
internal::traits< Derived >::Index Index
The type of indices.
Definition: DenseBase.h:60
const HNormalizedReturnType hnormalized() const
Definition: Homogeneous.h:158
Expression of the transpose of a matrix.
Definition: Transpose.h:57
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
const internal::permut_matrix_product_retval< PermutationDerived, Derived, OnTheRight > operator*(const MatrixBase< Derived > &matrix, const PermutationBase< PermutationDerived > &permutation)
Definition: PermutationMatrix.h:539
Pseudo expression providing partial reduction operations.
Definition: ForwardDeclarations.h:212
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition: Constants.h:53
Definition: XprHelper.h:32
Transformation is a general projective transformation stored as a (Dim+1)^2 matrix.
Definition: Constants.h:398
Definition: ReturnByValue.h:50
detail::size< coerce_list< Ts... >> size
Get the size of a list (number of elements.)
Definition: Size.h:56
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition: CwiseBinaryOp.h:107
Definition: XprHelper.h:371
Definition: Homogeneous.h:196
Expression of the multiple replication of a matrix or vector.
Definition: Replicate.h:62
For Reverse, all rows are reversed; for PartialReduxExpr and VectorwiseOp, act on rows...
Definition: Constants.h:212
Definition: BandTriangularSolver.h:13
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:103
const HNormalizedReturnType hnormalized() const
Definition: Homogeneous.h:176
Definition: Homogeneous.h:56
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time, and that instead the value is stored in some runtime variable.
Definition: Constants.h:21
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:59
Definition: Homogeneous.h:57
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
Definition: ForwardDeclarations.h:17
Definition: osvr_print_tree.cpp:52
double Scalar
Common scalar type.
Definition: FlexibleKalmanBase.h:48
Definition: Homogeneous.h:61