10#ifndef EIGEN_HOMOGENEOUS_H
11#define EIGEN_HOMOGENEOUS_H
32template<
typename MatrixType,
int Direction>
38 typedef typename remove_reference<MatrixTypeNested>::type _MatrixTypeNested;
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)
65 typedef MatrixType NestedExpression;
71 explicit inline Homogeneous(
const MatrixType& matrix)
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 const NestedExpression& nestedExpression()
const {
return m_matrix; }
80 template<
typename Rhs>
88 template<
typename Lhs>
friend
92 eigen_assert(
int(Direction)==
Vertical);
96 template<
typename Scalar,
int Dim,
int Mode,
int Options>
friend
100 eigen_assert(
int(Direction)==
Vertical);
104 template<
typename Func>
106 redux(
const Func& func)
const
108 return func(m_matrix.redux(func), Scalar(1));
112 typename MatrixType::Nested m_matrix;
126template<
typename Derived>
130 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
142template<
typename ExpressionType,
int Direction>
157template<
typename Derived>
161 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);
163 ColsAtCompileTime==1?size()-1:1,
164 ColsAtCompileTime==1?1:size()-1) / coeff(size()-1);
175template<
typename ExpressionType,
int Direction>
180 Direction==
Vertical ? _expression().rows()-1 : _expression().rows(),
181 Direction==
Horizontal ? _expression().cols()-1 : _expression().cols()).cwiseQuotient(
183 Direction==
Vertical ? HNormalized_SizeMinusOne : 1,
184 Direction==
Horizontal ? HNormalized_SizeMinusOne : 1>
186 Direction==
Vertical ? _expression().rows()-1:0,
187 Direction==
Horizontal ? _expression().cols()-1:0,
188 Direction==
Vertical ? 1 : _expression().rows(),
189 Direction==
Horizontal ? 1 : _expression().cols()),
190 Direction==
Vertical ? _expression().rows()-1 : 1,
191 Direction==
Horizontal ? _expression().cols()-1 : 1));
196template<
typename MatrixOrTransformType>
200 static const type& run(
const type &x) {
return x; }
203template<
typename Scalar,
int Dim,
int Mode,
int Options>
211template<
typename Scalar,
int Dim,
int Options>
215 typedef typename TransformType::MatrixType type;
216 static const type& run (
const TransformType& x) {
return x.matrix(); }
219template<
typename MatrixType,
typename Lhs>
227 LhsMatrixTypeCleaned::RowsAtCompileTime,
228 MatrixTypeCleaned::ColsAtCompileTime,
229 MatrixTypeCleaned::PlainObject::Options,
230 LhsMatrixTypeCleaned::MaxRowsAtCompileTime,
231 MatrixTypeCleaned::MaxColsAtCompileTime>::type
ReturnType;
234template<
typename MatrixType,
typename Lhs>
236 :
public ReturnByValue<homogeneous_left_product_impl<Homogeneous<MatrixType,Vertical>,Lhs> >
240 typedef typename remove_all<typename LhsMatrixTypeCleaned::Nested>::type
LhsMatrixTypeNested;
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
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()
260 typename LhsMatrixTypeCleaned::Nested m_lhs;
261 typename MatrixType::Nested m_rhs;
264template<
typename MatrixType,
typename Rhs>
268 MatrixType::RowsAtCompileTime,
269 Rhs::ColsAtCompileTime,
270 MatrixType::PlainObject::Options,
271 MatrixType::MaxRowsAtCompileTime,
275template<
typename MatrixType,
typename Rhs>
277 :
public ReturnByValue<homogeneous_right_product_impl<Homogeneous<MatrixType,Horizontal>,Rhs> >
281 : m_lhs(lhs), m_rhs(rhs)
284 inline Index rows()
const {
return m_lhs.rows(); }
285 inline Index cols()
const {
return m_rhs.cols(); }
287 template<
typename Dest>
void evalTo(
Dest&
dst)
const
291 RhsNested::RowsAtCompileTime==Dynamic?Dynamic:RhsNested::RowsAtCompileTime-1,
292 RhsNested::ColsAtCompileTime>
293 (m_rhs,0,0,m_rhs.rows()-1,m_rhs.cols());
294 dst += m_rhs.row(m_rhs.rows()-1).colwise()
298 typename MatrixType::Nested m_lhs;
299 typename Rhs::Nested m_rhs;
302template<
typename ArgType,
int Direction>
307 static const int AssumeAliasing = 0;
313template<
typename ArgType,
int Direction>
315 :
evaluator<typename Homogeneous<ArgType,Direction>::PlainObject >
318 typedef typename XprType::PlainObject PlainObject;
324 ::new (
static_cast<Base*
>(
this))
Base(m_temp);
332template<
typename DstXprType,
typename ArgType,
typename Scalar>
339 dst.row(
dst.rows()-1).setOnes();
344template<
typename DstXprType,
typename ArgType,
typename Scalar>
351 dst.col(
dst.cols()-1).setOnes();
355template<
typename LhsArg,
typename Rhs,
int ProductTag>
358 template<
typename Dest>
365template<
typename Lhs,
typename Rhs>
369 Dim = Lhs::ColsAtCompileTime,
370 Rows = Lhs::RowsAtCompileTime
372 typedef typename Rhs::template ConstNRowsBlockXpr<Dim>::Type LinearBlockConst;
373 typedef typename remove_const<LinearBlockConst>::type LinearBlock;
374 typedef typename Rhs::ConstRowXpr ConstantColumn;
380template<
typename Lhs,
typename Rhs,
int ProductTag>
382 :
public evaluator<typename homogeneous_right_product_refactoring_helper<typename Lhs::NestedExpression,Rhs>::Xpr>
386 typedef typename helper::ConstantBlock ConstantBlock;
387 typedef typename helper::Xpr RefactoredXpr;
392 + ConstantBlock(
xpr.rhs().row(
xpr.rhs().rows()-1),
xpr.lhs().rows(), 1) )
396template<
typename Lhs,
typename RhsArg,
int ProductTag>
399 template<
typename Dest>
406template<
typename Lhs,
typename Rhs>
410 Dim = Rhs::RowsAtCompileTime,
411 Cols = Rhs::ColsAtCompileTime
413 typedef typename Lhs::template ConstNColsBlockXpr<Dim>::Type LinearBlockConst;
414 typedef typename remove_const<LinearBlockConst>::type LinearBlock;
415 typedef typename Lhs::ConstColXpr ConstantColumn;
421template<
typename Lhs,
typename Rhs,
int ProductTag>
423 :
public evaluator<typename homogeneous_left_product_refactoring_helper<Lhs,typename Rhs::NestedExpression>::Xpr>
427 typedef typename helper::ConstantBlock ConstantBlock;
428 typedef typename helper::Xpr RefactoredXpr;
433 + ConstantBlock(
xpr.lhs().col(
xpr.lhs().cols()-1),1,
xpr.rhs().cols()) )
437template<
typename Scalar,
int Dim,
int Mode,
int Options,
typename RhsArg,
int ProductTag>
441 template<
typename Dest>
448template<
typename ExpressionType,
int S
ide,
bool Transposed>
Expression of a fixed-size or dynamic-size block.
Definition Block.h:106
\geometry_module
Definition Homogeneous.h:62
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
Expression of the product of two arbitrary matrices or vectors.
Definition Product.h:111
Expression of the multiple replication of a matrix or vector.
Definition Replicate.h:62
Definition ReturnByValue.h:53
Pseudo expression representing a solving operation.
Definition Solve.h:63
Pseudo expression providing partial reduction operations.
Definition VectorwiseOp.h:157
Definition XprHelper.h:198
Definition XprHelper.h:50
@ Horizontal
For Reverse, all rows are reversed; for PartialReduxExpr and VectorwiseOp, act on rows.
Definition Constants.h:268
@ Vertical
For Reverse, all columns are reversed; for PartialReduxExpr and VectorwiseOp, act on columns.
Definition Constants.h:265
@ Projective
Transformation is a general projective transformation stored as a (Dim+1)^2 matrix.
Definition Constants.h:454
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:61
Definition Constants.h:511
Definition Constants.h:513
Definition AssignEvaluator.h:677
Definition AssignEvaluator.h:684
Definition AssignEvaluator.h:674
Definition Constants.h:525
Definition AssignmentFunctors.h:21
Definition CoreEvaluators.h:75
Definition CoreEvaluators.h:82
Definition ProductEvaluators.h:81
Definition Homogeneous.h:55
Definition Homogeneous.h:408
Definition Homogeneous.h:56
Definition Homogeneous.h:367
Definition ProductEvaluators.h:880
Definition ForwardDeclarations.h:165
Definition Homogeneous.h:198
Definition ForwardDeclarations.h:17
Definition CoreEvaluators.h:56