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,
52 CoeffReadCost = _MatrixTypeNested::CoeffReadCost
61 template<
typename MatrixType,
int _Direction>
class Homogeneous 66 enum { Direction = _Direction };
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 102 template<
typename Scalar,
int Dim,
int Mode,
int Options>
friend 125 template<
typename Derived>
141 template<
typename ExpressionType,
int Direction>
145 return _expression();
156 template<
typename 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>
226 LhsMatrixTypeCleaned::RowsAtCompileTime,
227 MatrixTypeCleaned::ColsAtCompileTime,
228 MatrixTypeCleaned::PlainObject::Options,
229 LhsMatrixTypeCleaned::MaxRowsAtCompileTime,
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;
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());
307 #endif // EIGEN_HOMOGENEOUS_H
MatrixOrTransformType type
remove_all< LhsMatrixType >::type LhsMatrixTypeCleaned
take_matrix_for_product< Lhs >::type LhsMatrixType
Scalar coeff(Index row, Index col) const
remove_all< typename Rhs::Nested >::type RhsNested
internal::traits< Derived >::Index Index
The type of indices.
void evalTo(Dest &dst) const
homogeneous_right_product_impl(const MatrixType &lhs, const Rhs &rhs)
Expression of the transpose of a matrix.
nested< MatrixType >::type MatrixTypeNested
remove_reference< MatrixTypeNested >::type _MatrixTypeNested
remove_all< MatrixType >::type MatrixTypeCleaned
const internal::permut_matrix_product_retval< PermutationDerived, Derived, OnTheRight > operator*(const MatrixBase< Derived > &matrix, const PermutationBase< PermutationDerived > &permutation)
Pseudo expression providing partial reduction operations.
homogeneous_left_product_impl(const Lhs &lhs, const MatrixType &rhs)
const unsigned int RowMajorBit
const HNormalizedReturnType hnormalized() const
void evalTo(Dest &dst) const
LhsMatrixTypeCleaned::Nested m_lhs
Generic expression where a coefficient-wise binary operator is applied to two expressions.
const unsigned int HereditaryBits
make_proper_matrix_type< typename traits< MatrixType >::Scalar, MatrixType::RowsAtCompileTime, Rhs::ColsAtCompileTime, MatrixType::PlainObject::Options, MatrixType::MaxRowsAtCompileTime, Rhs::MaxColsAtCompileTime >::type ReturnType
remove_all< typename LhsMatrixTypeCleaned::Nested >::type LhsMatrixTypeNested
Expression of the multiple replication of a matrix or vector.
const HNormalizedReturnType hnormalized() const
remove_all< LhsMatrixType >::type LhsMatrixTypeCleaned
static const type & run(const type &x)
traits< homogeneous_left_product_impl >::LhsMatrixType LhsMatrixType
make_proper_matrix_type< typename traits< MatrixTypeCleaned >::Scalar, LhsMatrixTypeCleaned::RowsAtCompileTime, MatrixTypeCleaned::ColsAtCompileTime, MatrixTypeCleaned::PlainObject::Options, LhsMatrixTypeCleaned::MaxRowsAtCompileTime, MatrixTypeCleaned::MaxColsAtCompileTime >::type ReturnType
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
Expression of a fixed-size or dynamic-size block.
Generic expression where a coefficient-wise unary operator is applied to an expression.
MatrixBase< Homogeneous > Base
traits< MatrixType >::StorageKind StorageKind
MatrixType::Nested m_matrix
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
void run(ClassLoader *loader)
Base class for all dense matrices, vectors, and expressions.
Expression of one (or a set of) homogeneous vector(s)