$treeview $search $mathjax
Eigen  3.2.3
$projectbrief
$projectbrief
$searchbox

SparseBlock.h

00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
00005 //
00006 // This Source Code Form is subject to the terms of the Mozilla
00007 // Public License v. 2.0. If a copy of the MPL was not distributed
00008 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
00009 
00010 #ifndef EIGEN_SPARSE_BLOCK_H
00011 #define EIGEN_SPARSE_BLOCK_H
00012 
00013 namespace Eigen { 
00014 
00015 template<typename XprType, int BlockRows, int BlockCols>
00016 class BlockImpl<XprType,BlockRows,BlockCols,true,Sparse>
00017   : public SparseMatrixBase<Block<XprType,BlockRows,BlockCols,true> >
00018 {
00019     typedef typename internal::remove_all<typename XprType::Nested>::type _MatrixTypeNested;
00020     typedef Block<XprType, BlockRows, BlockCols, true> BlockType;
00021 public:
00022     enum { IsRowMajor = internal::traits<BlockType>::IsRowMajor };
00023 protected:
00024     enum { OuterSize = IsRowMajor ? BlockRows : BlockCols };
00025 public:
00026     EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType)
00027     
00028     class InnerIterator: public XprType::InnerIterator
00029     {
00030         typedef typename BlockImpl::Index Index;
00031       public:
00032         inline InnerIterator(const BlockType& xpr, Index outer)
00033           : XprType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
00034         {}
00035         inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
00036         inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
00037       protected:
00038         Index m_outer;
00039     };
00040     class ReverseInnerIterator: public XprType::ReverseInnerIterator
00041     {
00042         typedef typename BlockImpl::Index Index;
00043       public:
00044         inline ReverseInnerIterator(const BlockType& xpr, Index outer)
00045           : XprType::ReverseInnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
00046         {}
00047         inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
00048         inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
00049       protected:
00050         Index m_outer;
00051     };
00052 
00053     inline BlockImpl(const XprType& xpr, int i)
00054       : m_matrix(xpr), m_outerStart(i), m_outerSize(OuterSize)
00055     {}
00056 
00057     inline BlockImpl(const XprType& xpr, int startRow, int startCol, int blockRows, int blockCols)
00058       : m_matrix(xpr), m_outerStart(IsRowMajor ? startRow : startCol), m_outerSize(IsRowMajor ? blockRows : blockCols)
00059     {}
00060 
00061     EIGEN_STRONG_INLINE Index rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
00062     EIGEN_STRONG_INLINE Index cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
00063 
00064   protected:
00065 
00066     typename XprType::Nested m_matrix;
00067     Index m_outerStart;
00068     const internal::variable_if_dynamic<Index, OuterSize> m_outerSize;
00069 
00070     EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl)
00071   private:
00072     Index nonZeros() const;
00073 };
00074 
00075 
00076 /***************************************************************************
00077 * specialisation for SparseMatrix
00078 ***************************************************************************/
00079 
00080 template<typename _Scalar, int _Options, typename _Index, int BlockRows, int BlockCols>
00081 class BlockImpl<SparseMatrix<_Scalar, _Options, _Index>,BlockRows,BlockCols,true,Sparse>
00082   : public SparseMatrixBase<Block<SparseMatrix<_Scalar, _Options, _Index>,BlockRows,BlockCols,true> >
00083 {
00084     typedef SparseMatrix<_Scalar, _Options, _Index> SparseMatrixType;
00085     typedef typename internal::remove_all<typename SparseMatrixType::Nested>::type _MatrixTypeNested;
00086     typedef Block<SparseMatrixType, BlockRows, BlockCols, true> BlockType;
00087     typedef Block<const SparseMatrixType, BlockRows, BlockCols, true> ConstBlockType;
00088 public:
00089     enum { IsRowMajor = internal::traits<BlockType>::IsRowMajor };
00090     EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType)
00091 protected:
00092     enum { OuterSize = IsRowMajor ? BlockRows : BlockCols };
00093 public:
00094     
00095     class InnerIterator: public SparseMatrixType::InnerIterator
00096     {
00097       public:
00098         inline InnerIterator(const BlockType& xpr, Index outer)
00099           : SparseMatrixType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
00100         {}
00101         inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
00102         inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
00103       protected:
00104         Index m_outer;
00105     };
00106     class ReverseInnerIterator: public SparseMatrixType::ReverseInnerIterator
00107     {
00108       public:
00109         inline ReverseInnerIterator(const BlockType& xpr, Index outer)
00110           : SparseMatrixType::ReverseInnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
00111         {}
00112         inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
00113         inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
00114       protected:
00115         Index m_outer;
00116     };
00117 
00118     inline BlockImpl(const SparseMatrixType& xpr, int i)
00119       : m_matrix(xpr), m_outerStart(i), m_outerSize(OuterSize)
00120     {}
00121 
00122     inline BlockImpl(const SparseMatrixType& xpr, int startRow, int startCol, int blockRows, int blockCols)
00123       : m_matrix(xpr), m_outerStart(IsRowMajor ? startRow : startCol), m_outerSize(IsRowMajor ? blockRows : blockCols)
00124     {}
00125 
00126     template<typename OtherDerived>
00127     inline BlockType& operator=(const SparseMatrixBase<OtherDerived>& other)
00128     {
00129       typedef typename internal::remove_all<typename SparseMatrixType::Nested>::type _NestedMatrixType;
00130       _NestedMatrixType& matrix = const_cast<_NestedMatrixType&>(m_matrix);;
00131       // This assignement is slow if this vector set is not empty
00132       // and/or it is not at the end of the nonzeros of the underlying matrix.
00133 
00134       // 1 - eval to a temporary to avoid transposition and/or aliasing issues
00135       SparseMatrix<Scalar, IsRowMajor ? RowMajor : ColMajor, Index> tmp(other);
00136 
00137       // 2 - let's check whether there is enough allocated memory
00138       Index nnz           = tmp.nonZeros();
00139       Index start         = m_outerStart==0 ? 0 : matrix.outerIndexPtr()[m_outerStart]; // starting position of the current block
00140       Index end           = m_matrix.outerIndexPtr()[m_outerStart+m_outerSize.value()]; // ending posiiton of the current block
00141       Index block_size    = end - start;                                                // available room in the current block
00142       Index tail_size     = m_matrix.outerIndexPtr()[m_matrix.outerSize()] - end;
00143       
00144       Index free_size     = m_matrix.isCompressed()
00145                           ? Index(matrix.data().allocatedSize()) + block_size
00146                           : block_size;
00147 
00148       if(nnz>free_size) 
00149       {
00150         // realloc manually to reduce copies
00151         typename SparseMatrixType::Storage newdata(m_matrix.data().allocatedSize() - block_size + nnz);
00152 
00153         std::memcpy(&newdata.value(0), &m_matrix.data().value(0), start*sizeof(Scalar));
00154         std::memcpy(&newdata.index(0), &m_matrix.data().index(0), start*sizeof(Index));
00155 
00156         std::memcpy(&newdata.value(start), &tmp.data().value(0), nnz*sizeof(Scalar));
00157         std::memcpy(&newdata.index(start), &tmp.data().index(0), nnz*sizeof(Index));
00158 
00159         std::memcpy(&newdata.value(start+nnz), &matrix.data().value(end), tail_size*sizeof(Scalar));
00160         std::memcpy(&newdata.index(start+nnz), &matrix.data().index(end), tail_size*sizeof(Index));
00161         
00162         newdata.resize(m_matrix.outerIndexPtr()[m_matrix.outerSize()] - block_size + nnz);
00163 
00164         matrix.data().swap(newdata);
00165       }
00166       else
00167       {
00168         // no need to realloc, simply copy the tail at its respective position and insert tmp
00169         matrix.data().resize(start + nnz + tail_size);
00170 
00171         std::memmove(&matrix.data().value(start+nnz), &matrix.data().value(end), tail_size*sizeof(Scalar));
00172         std::memmove(&matrix.data().index(start+nnz), &matrix.data().index(end), tail_size*sizeof(Index));
00173 
00174         std::memcpy(&matrix.data().value(start), &tmp.data().value(0), nnz*sizeof(Scalar));
00175         std::memcpy(&matrix.data().index(start), &tmp.data().index(0), nnz*sizeof(Index));
00176       }
00177       
00178       // update innerNonZeros
00179       if(!m_matrix.isCompressed())
00180         for(Index j=0; j<m_outerSize.value(); ++j)
00181           matrix.innerNonZeroPtr()[m_outerStart+j] = tmp.innerVector(j).nonZeros();
00182 
00183       // update outer index pointers
00184       Index p = start;
00185       for(Index k=0; k<m_outerSize.value(); ++k)
00186       {
00187         matrix.outerIndexPtr()[m_outerStart+k] = p;
00188         p += tmp.innerVector(k).nonZeros();
00189       }
00190       std::ptrdiff_t offset = nnz - block_size;
00191       for(Index k = m_outerStart + m_outerSize.value(); k<=matrix.outerSize(); ++k)
00192       {
00193         matrix.outerIndexPtr()[k] += offset;
00194       }
00195 
00196       return derived();
00197     }
00198 
00199     inline BlockType& operator=(const BlockType& other)
00200     {
00201       return operator=<BlockType>(other);
00202     }
00203 
00204     inline const Scalar* valuePtr() const
00205     { return m_matrix.valuePtr() + m_matrix.outerIndexPtr()[m_outerStart]; }
00206     inline Scalar* valuePtr()
00207     { return m_matrix.const_cast_derived().valuePtr() + m_matrix.outerIndexPtr()[m_outerStart]; }
00208 
00209     inline const Index* innerIndexPtr() const
00210     { return m_matrix.innerIndexPtr() + m_matrix.outerIndexPtr()[m_outerStart]; }
00211     inline Index* innerIndexPtr()
00212     { return m_matrix.const_cast_derived().innerIndexPtr() + m_matrix.outerIndexPtr()[m_outerStart]; }
00213 
00214     inline const Index* outerIndexPtr() const
00215     { return m_matrix.outerIndexPtr() + m_outerStart; }
00216     inline Index* outerIndexPtr()
00217     { return m_matrix.const_cast_derived().outerIndexPtr() + m_outerStart; }
00218 
00219     Index nonZeros() const
00220     {
00221       if(m_matrix.isCompressed())
00222         return  std::size_t(m_matrix.outerIndexPtr()[m_outerStart+m_outerSize.value()])
00223               - std::size_t(m_matrix.outerIndexPtr()[m_outerStart]);
00224       else if(m_outerSize.value()==0)
00225         return 0;
00226       else
00227         return Map<const Matrix<Index,OuterSize,1> >(m_matrix.innerNonZeroPtr()+m_outerStart, m_outerSize.value()).sum();
00228     }
00229 
00230     const Scalar& lastCoeff() const
00231     {
00232       EIGEN_STATIC_ASSERT_VECTOR_ONLY(BlockImpl);
00233       eigen_assert(nonZeros()>0);
00234       if(m_matrix.isCompressed())
00235         return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart+1]-1];
00236       else
00237         return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart]+m_matrix.innerNonZeroPtr()[m_outerStart]-1];
00238     }
00239 
00240     EIGEN_STRONG_INLINE Index rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
00241     EIGEN_STRONG_INLINE Index cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
00242 
00243   protected:
00244 
00245     typename SparseMatrixType::Nested m_matrix;
00246     Index m_outerStart;
00247     const internal::variable_if_dynamic<Index, OuterSize> m_outerSize;
00248 
00249 };
00250 
00251 
00252 template<typename _Scalar, int _Options, typename _Index, int BlockRows, int BlockCols>
00253 class BlockImpl<const SparseMatrix<_Scalar, _Options, _Index>,BlockRows,BlockCols,true,Sparse>
00254   : public SparseMatrixBase<Block<const SparseMatrix<_Scalar, _Options, _Index>,BlockRows,BlockCols,true> >
00255 {
00256     typedef SparseMatrix<_Scalar, _Options, _Index> SparseMatrixType;
00257     typedef typename internal::remove_all<typename SparseMatrixType::Nested>::type _MatrixTypeNested;
00258     typedef Block<const SparseMatrixType, BlockRows, BlockCols, true> BlockType;
00259 public:
00260     enum { IsRowMajor = internal::traits<BlockType>::IsRowMajor };
00261     EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType)
00262 protected:
00263     enum { OuterSize = IsRowMajor ? BlockRows : BlockCols };
00264 public:
00265     
00266     class InnerIterator: public SparseMatrixType::InnerIterator
00267     {
00268       public:
00269         inline InnerIterator(const BlockType& xpr, Index outer)
00270           : SparseMatrixType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
00271         {}
00272         inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
00273         inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
00274       protected:
00275         Index m_outer;
00276     };
00277     class ReverseInnerIterator: public SparseMatrixType::ReverseInnerIterator
00278     {
00279       public:
00280         inline ReverseInnerIterator(const BlockType& xpr, Index outer)
00281           : SparseMatrixType::ReverseInnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
00282         {}
00283         inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
00284         inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
00285       protected:
00286         Index m_outer;
00287     };
00288 
00289     inline BlockImpl(const SparseMatrixType& xpr, int i)
00290       : m_matrix(xpr), m_outerStart(i), m_outerSize(OuterSize)
00291     {}
00292 
00293     inline BlockImpl(const SparseMatrixType& xpr, int startRow, int startCol, int blockRows, int blockCols)
00294       : m_matrix(xpr), m_outerStart(IsRowMajor ? startRow : startCol), m_outerSize(IsRowMajor ? blockRows : blockCols)
00295     {}
00296 
00297     inline const Scalar* valuePtr() const
00298     { return m_matrix.valuePtr() + m_matrix.outerIndexPtr()[m_outerStart]; }
00299 
00300     inline const Index* innerIndexPtr() const
00301     { return m_matrix.innerIndexPtr() + m_matrix.outerIndexPtr()[m_outerStart]; }
00302 
00303     inline const Index* outerIndexPtr() const
00304     { return m_matrix.outerIndexPtr() + m_outerStart; }
00305 
00306     Index nonZeros() const
00307     {
00308       if(m_matrix.isCompressed())
00309         return  std::size_t(m_matrix.outerIndexPtr()[m_outerStart+m_outerSize.value()])
00310               - std::size_t(m_matrix.outerIndexPtr()[m_outerStart]);
00311       else if(m_outerSize.value()==0)
00312         return 0;
00313       else
00314         return Map<const Matrix<Index,OuterSize,1> >(m_matrix.innerNonZeroPtr()+m_outerStart, m_outerSize.value()).sum();
00315     }
00316 
00317     const Scalar& lastCoeff() const
00318     {
00319       EIGEN_STATIC_ASSERT_VECTOR_ONLY(BlockImpl);
00320       eigen_assert(nonZeros()>0);
00321       if(m_matrix.isCompressed())
00322         return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart+1]-1];
00323       else
00324         return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart]+m_matrix.innerNonZeroPtr()[m_outerStart]-1];
00325     }
00326 
00327     EIGEN_STRONG_INLINE Index rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
00328     EIGEN_STRONG_INLINE Index cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
00329 
00330   protected:
00331 
00332     typename SparseMatrixType::Nested m_matrix;
00333     Index m_outerStart;
00334     const internal::variable_if_dynamic<Index, OuterSize> m_outerSize;
00335 
00336 };
00337 
00338 //----------
00339 
00343 template<typename Derived>
00344 typename SparseMatrixBase<Derived>::InnerVectorReturnType SparseMatrixBase<Derived>::innerVector(Index outer)
00345 { return InnerVectorReturnType(derived(), outer); }
00346 
00350 template<typename Derived>
00351 const typename SparseMatrixBase<Derived>::ConstInnerVectorReturnType SparseMatrixBase<Derived>::innerVector(Index outer) const
00352 { return ConstInnerVectorReturnType(derived(), outer); }
00353 
00357 template<typename Derived>
00358 Block<Derived,Dynamic,Dynamic,true> SparseMatrixBase<Derived>::innerVectors(Index outerStart, Index outerSize)
00359 {
00360   return Block<Derived,Dynamic,Dynamic,true>(derived(),
00361                                              IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,
00362                                              IsRowMajor ? outerSize : rows(), IsRowMajor ? cols() : outerSize);
00363   
00364 }
00365 
00369 template<typename Derived>
00370 const Block<const Derived,Dynamic,Dynamic,true> SparseMatrixBase<Derived>::innerVectors(Index outerStart, Index outerSize) const
00371 {
00372   return Block<const Derived,Dynamic,Dynamic,true>(derived(),
00373                                                   IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,
00374                                                   IsRowMajor ? outerSize : rows(), IsRowMajor ? cols() : outerSize);
00375   
00376 }
00377 
00381 template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel>
00382 class BlockImpl<XprType,BlockRows,BlockCols,InnerPanel,Sparse>
00383   : public SparseMatrixBase<Block<XprType,BlockRows,BlockCols,InnerPanel> >, internal::no_assignment_operator
00384 {
00385   typedef typename internal::remove_all<typename XprType::Nested>::type _MatrixTypeNested;
00386   typedef Block<XprType, BlockRows, BlockCols, InnerPanel> BlockType;
00387 public:
00388     enum { IsRowMajor = internal::traits<BlockType>::IsRowMajor };
00389     EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType)
00390 
00391     
00393     inline BlockImpl(const XprType& xpr, int i)
00394       : m_matrix(xpr),
00395         m_startRow( (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0),
00396         m_startCol( (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0),
00397         m_blockRows(xpr.rows()),
00398         m_blockCols(xpr.cols())
00399     {}
00400 
00403     inline BlockImpl(const XprType& xpr, int startRow, int startCol, int blockRows, int blockCols)
00404       : m_matrix(xpr), m_startRow(startRow), m_startCol(startCol), m_blockRows(blockRows), m_blockCols(blockCols)
00405     {}
00406 
00407     inline int rows() const { return m_blockRows.value(); }
00408     inline int cols() const { return m_blockCols.value(); }
00409 
00410     inline Scalar& coeffRef(int row, int col)
00411     {
00412       return m_matrix.const_cast_derived()
00413                .coeffRef(row + m_startRow.value(), col + m_startCol.value());
00414     }
00415 
00416     inline const Scalar coeff(int row, int col) const
00417     {
00418       return m_matrix.coeff(row + m_startRow.value(), col + m_startCol.value());
00419     }
00420 
00421     inline Scalar& coeffRef(int index)
00422     {
00423       return m_matrix.const_cast_derived()
00424              .coeffRef(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index),
00425                        m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0));
00426     }
00427 
00428     inline const Scalar coeff(int index) const
00429     {
00430       return m_matrix
00431              .coeff(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index),
00432                     m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0));
00433     }
00434     
00435     inline const _MatrixTypeNested& nestedExpression() const { return m_matrix; }
00436     
00437     class InnerIterator : public _MatrixTypeNested::InnerIterator
00438     {
00439       typedef typename _MatrixTypeNested::InnerIterator Base;
00440       const BlockType& m_block;
00441       Index m_end;
00442     public:
00443 
00444       EIGEN_STRONG_INLINE InnerIterator(const BlockType& block, Index outer)
00445         : Base(block.derived().nestedExpression(), outer + (IsRowMajor ? block.m_startRow.value() : block.m_startCol.value())),
00446           m_block(block),
00447           m_end(IsRowMajor ? block.m_startCol.value()+block.m_blockCols.value() : block.m_startRow.value()+block.m_blockRows.value())
00448       {
00449         while( (Base::operator bool()) && (Base::index() < (IsRowMajor ? m_block.m_startCol.value() : m_block.m_startRow.value())) )
00450           Base::operator++();
00451       }
00452 
00453       inline Index index()  const { return Base::index() - (IsRowMajor ? m_block.m_startCol.value() : m_block.m_startRow.value()); }
00454       inline Index outer()  const { return Base::outer() - (IsRowMajor ? m_block.m_startRow.value() : m_block.m_startCol.value()); }
00455       inline Index row()    const { return Base::row()   - m_block.m_startRow.value(); }
00456       inline Index col()    const { return Base::col()   - m_block.m_startCol.value(); }
00457       
00458       inline operator bool() const { return Base::operator bool() && Base::index() < m_end; }
00459     };
00460     class ReverseInnerIterator : public _MatrixTypeNested::ReverseInnerIterator
00461     {
00462       typedef typename _MatrixTypeNested::ReverseInnerIterator Base;
00463       const BlockType& m_block;
00464       Index m_begin;
00465     public:
00466 
00467       EIGEN_STRONG_INLINE ReverseInnerIterator(const BlockType& block, Index outer)
00468         : Base(block.derived().nestedExpression(), outer + (IsRowMajor ? block.m_startRow.value() : block.m_startCol.value())),
00469           m_block(block),
00470           m_begin(IsRowMajor ? block.m_startCol.value() : block.m_startRow.value())
00471       {
00472         while( (Base::operator bool()) && (Base::index() >= (IsRowMajor ? m_block.m_startCol.value()+block.m_blockCols.value() : m_block.m_startRow.value()+block.m_blockRows.value())) )
00473           Base::operator--();
00474       }
00475 
00476       inline Index index()  const { return Base::index() - (IsRowMajor ? m_block.m_startCol.value() : m_block.m_startRow.value()); }
00477       inline Index outer()  const { return Base::outer() - (IsRowMajor ? m_block.m_startRow.value() : m_block.m_startCol.value()); }
00478       inline Index row()    const { return Base::row()   - m_block.m_startRow.value(); }
00479       inline Index col()    const { return Base::col()   - m_block.m_startCol.value(); }
00480       
00481       inline operator bool() const { return Base::operator bool() && Base::index() >= m_begin; }
00482     };
00483   protected:
00484     friend class InnerIterator;
00485     friend class ReverseInnerIterator;
00486     
00487     EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl)
00488 
00489     typename XprType::Nested m_matrix;
00490     const internal::variable_if_dynamic<Index, XprType::RowsAtCompileTime == 1 ? 0 : Dynamic> m_startRow;
00491     const internal::variable_if_dynamic<Index, XprType::ColsAtCompileTime == 1 ? 0 : Dynamic> m_startCol;
00492     const internal::variable_if_dynamic<Index, RowsAtCompileTime> m_blockRows;
00493     const internal::variable_if_dynamic<Index, ColsAtCompileTime> m_blockCols;
00494 
00495 };
00496 
00497 } // end namespace Eigen
00498 
00499 #endif // EIGEN_SPARSE_BLOCK_H