MOAB  4.9.3pre
Eigen::CommaInitializer< XprType > Class Template Reference

Helper class used by the comma initializer operator. More...

#include <CommaInitializer.h>

List of all members.

Public Types

typedef XprType::Scalar Scalar

Public Member Functions

EIGEN_DEVICE_FUNC CommaInitializer (XprType &xpr, const Scalar &s)
template<typename OtherDerived >
EIGEN_DEVICE_FUNC CommaInitializer (XprType &xpr, const DenseBase< OtherDerived > &other)
EIGEN_DEVICE_FUNC CommaInitializer (const CommaInitializer &o)
EIGEN_DEVICE_FUNC
CommaInitializer
operator, (const Scalar &s)
template<typename OtherDerived >
EIGEN_DEVICE_FUNC
CommaInitializer
operator, (const DenseBase< OtherDerived > &other)
EIGEN_DEVICE_FUNC ~CommaInitializer ()
EIGEN_DEVICE_FUNC XprType & finished ()

Public Attributes

XprType & m_xpr
Index m_row
Index m_col
Index m_currentBlockRows

Detailed Description

template<typename XprType>
class Eigen::CommaInitializer< XprType >

Helper class used by the comma initializer operator.

This class is internally used to implement the comma initializer feature. It is the return type of MatrixBase::operator<<, and most of the time this is the only way it is used.

See also:
MatrixBase::operator<<, CommaInitializer::finished()

Definition at line 28 of file CommaInitializer.h.


Member Typedef Documentation

template<typename XprType >
typedef XprType::Scalar Eigen::CommaInitializer< XprType >::Scalar

Definition at line 30 of file CommaInitializer.h.


Constructor & Destructor Documentation

template<typename XprType >
EIGEN_DEVICE_FUNC Eigen::CommaInitializer< XprType >::CommaInitializer ( XprType &  xpr,
const Scalar s 
) [inline]

Definition at line 33 of file CommaInitializer.h.

    : m_xpr(xpr), m_row(0), m_col(1), m_currentBlockRows(1)
  {
    m_xpr.coeffRef(0,0) = s;
  }
template<typename XprType >
template<typename OtherDerived >
EIGEN_DEVICE_FUNC Eigen::CommaInitializer< XprType >::CommaInitializer ( XprType &  xpr,
const DenseBase< OtherDerived > &  other 
) [inline]

Definition at line 41 of file CommaInitializer.h.

    : m_xpr(xpr), m_row(0), m_col(other.cols()), m_currentBlockRows(other.rows())
  {
    m_xpr.block(0, 0, other.rows(), other.cols()) = other;
  }
template<typename XprType >
EIGEN_DEVICE_FUNC Eigen::CommaInitializer< XprType >::CommaInitializer ( const CommaInitializer< XprType > &  o) [inline]

Definition at line 51 of file CommaInitializer.h.

  : m_xpr(o.m_xpr), m_row(o.m_row), m_col(o.m_col), m_currentBlockRows(o.m_currentBlockRows) {
    // Mark original object as finished. In absence of R-value references we need to const_cast:
    const_cast<CommaInitializer&>(o).m_row = m_xpr.rows();
    const_cast<CommaInitializer&>(o).m_col = m_xpr.cols();
    const_cast<CommaInitializer&>(o).m_currentBlockRows = 0;
  }
template<typename XprType >
EIGEN_DEVICE_FUNC Eigen::CommaInitializer< XprType >::~CommaInitializer ( ) [inline]

Definition at line 107 of file CommaInitializer.h.

  {
    eigen_assert((m_row+m_currentBlockRows) == m_xpr.rows()
         && m_col == m_xpr.cols()
         && "Too few coefficients passed to comma initializer (operator<<)");
  }

Member Function Documentation

template<typename XprType >
EIGEN_DEVICE_FUNC XprType& Eigen::CommaInitializer< XprType >::finished ( ) [inline]
Returns:
the built matrix once all its coefficients have been set. Calling finished is 100% optional. Its purpose is to write expressions like this:
 quaternion.fromRotationMatrix((Matrix3f() << axis0, axis1, axis2).finished());

Definition at line 125 of file CommaInitializer.h.

{ return m_xpr; }
template<typename XprType >
EIGEN_DEVICE_FUNC CommaInitializer& Eigen::CommaInitializer< XprType >::operator, ( const Scalar s) [inline]

Definition at line 61 of file CommaInitializer.h.

  {
    if (m_col==m_xpr.cols())
    {
      m_row+=m_currentBlockRows;
      m_col = 0;
      m_currentBlockRows = 1;
      eigen_assert(m_row<m_xpr.rows()
        && "Too many rows passed to comma initializer (operator<<)");
    }
    eigen_assert(m_col<m_xpr.cols()
      && "Too many coefficients passed to comma initializer (operator<<)");
    eigen_assert(m_currentBlockRows==1);
    m_xpr.coeffRef(m_row, m_col++) = s;
    return *this;
  }
template<typename XprType >
template<typename OtherDerived >
EIGEN_DEVICE_FUNC CommaInitializer& Eigen::CommaInitializer< XprType >::operator, ( const DenseBase< OtherDerived > &  other) [inline]

Definition at line 81 of file CommaInitializer.h.

  {
    if(other.cols()==0 || other.rows()==0)
      return *this;
    if (m_col==m_xpr.cols())
    {
      m_row+=m_currentBlockRows;
      m_col = 0;
      m_currentBlockRows = other.rows();
      eigen_assert(m_row+m_currentBlockRows<=m_xpr.rows()
        && "Too many rows passed to comma initializer (operator<<)");
    }
    eigen_assert(m_col<m_xpr.cols()
      && "Too many coefficients passed to comma initializer (operator<<)");
    eigen_assert(m_currentBlockRows==other.rows());
    if (OtherDerived::SizeAtCompileTime != Dynamic)
      m_xpr.template block<OtherDerived::RowsAtCompileTime != Dynamic ? OtherDerived::RowsAtCompileTime : 1,
                              OtherDerived::ColsAtCompileTime != Dynamic ? OtherDerived::ColsAtCompileTime : 1>
                    (m_row, m_col) = other;
    else
      m_xpr.block(m_row, m_col, other.rows(), other.cols()) = other;
    m_col += other.cols();
    return *this;
  }

Member Data Documentation

template<typename XprType >
Index Eigen::CommaInitializer< XprType >::m_col

Definition at line 129 of file CommaInitializer.h.

template<typename XprType >
Index Eigen::CommaInitializer< XprType >::m_currentBlockRows

Definition at line 130 of file CommaInitializer.h.

template<typename XprType >
Index Eigen::CommaInitializer< XprType >::m_row

Definition at line 128 of file CommaInitializer.h.

template<typename XprType >
XprType& Eigen::CommaInitializer< XprType >::m_xpr

Definition at line 127 of file CommaInitializer.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines