Lines 23-49
public:
Link Here
|
23 |
protected: |
23 |
protected: |
24 |
enum { OuterSize = IsRowMajor ? BlockRows : BlockCols }; |
24 |
enum { OuterSize = IsRowMajor ? BlockRows : BlockCols }; |
25 |
public: |
25 |
public: |
26 |
EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType) |
26 |
EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType) |
27 |
|
27 |
|
28 |
class InnerIterator: public XprType::InnerIterator |
28 |
class InnerIterator: public XprType::InnerIterator |
29 |
{ |
29 |
{ |
30 |
public: |
30 |
public: |
|
|
31 |
inline InnerIterator() |
32 |
: XprType::InnerIterator(), m_outer(-1) |
33 |
{} |
31 |
inline InnerIterator(const BlockType& xpr, Index outer) |
34 |
inline InnerIterator(const BlockType& xpr, Index outer) |
32 |
: XprType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer) |
35 |
: XprType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer) |
33 |
{} |
36 |
{} |
34 |
inline Index row() const { return IsRowMajor ? m_outer : this->index(); } |
37 |
inline Index row() const { return IsRowMajor ? m_outer : this->index(); } |
35 |
inline Index col() const { return IsRowMajor ? this->index() : m_outer; } |
38 |
inline Index col() const { return IsRowMajor ? this->index() : m_outer; } |
36 |
protected: |
39 |
protected: |
37 |
Index m_outer; |
40 |
Index m_outer; |
38 |
}; |
41 |
}; |
39 |
class ReverseInnerIterator: public XprType::ReverseInnerIterator |
42 |
class ReverseInnerIterator: public XprType::ReverseInnerIterator |
40 |
{ |
43 |
{ |
41 |
public: |
44 |
public: |
|
|
45 |
inline ReverseInnerIterator() |
46 |
: XprType::ReverseInnerIterator(), m_outer(-1) |
47 |
{} |
42 |
inline ReverseInnerIterator(const BlockType& xpr, Index outer) |
48 |
inline ReverseInnerIterator(const BlockType& xpr, Index outer) |
43 |
: XprType::ReverseInnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer) |
49 |
: XprType::ReverseInnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer) |
44 |
{} |
50 |
{} |
45 |
inline Index row() const { return IsRowMajor ? m_outer : this->index(); } |
51 |
inline Index row() const { return IsRowMajor ? m_outer : this->index(); } |
46 |
inline Index col() const { return IsRowMajor ? this->index() : m_outer; } |
52 |
inline Index col() const { return IsRowMajor ? this->index() : m_outer; } |
47 |
protected: |
53 |
protected: |
48 |
Index m_outer; |
54 |
Index m_outer; |
49 |
}; |
55 |
}; |
Lines 83-109
public:
Link Here
|
83 |
EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType) |
89 |
EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType) |
84 |
protected: |
90 |
protected: |
85 |
enum { OuterSize = IsRowMajor ? BlockRows : BlockCols }; |
91 |
enum { OuterSize = IsRowMajor ? BlockRows : BlockCols }; |
86 |
public: |
92 |
public: |
87 |
|
93 |
|
88 |
class InnerIterator: public SparseMatrixType::InnerIterator |
94 |
class InnerIterator: public SparseMatrixType::InnerIterator |
89 |
{ |
95 |
{ |
90 |
public: |
96 |
public: |
|
|
97 |
inline InnerIterator() |
98 |
: SparseMatrixType::InnerIterator(),m_outer(-1) |
99 |
{} |
91 |
inline InnerIterator(const BlockType& xpr, Index outer) |
100 |
inline InnerIterator(const BlockType& xpr, Index outer) |
92 |
: SparseMatrixType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer) |
101 |
: SparseMatrixType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer) |
93 |
{} |
102 |
{} |
94 |
inline Index row() const { return IsRowMajor ? m_outer : this->index(); } |
103 |
inline Index row() const { return IsRowMajor ? m_outer : this->index(); } |
95 |
inline Index col() const { return IsRowMajor ? this->index() : m_outer; } |
104 |
inline Index col() const { return IsRowMajor ? this->index() : m_outer; } |
96 |
protected: |
105 |
protected: |
97 |
Index m_outer; |
106 |
Index m_outer; |
98 |
}; |
107 |
}; |
99 |
class ReverseInnerIterator: public SparseMatrixType::ReverseInnerIterator |
108 |
class ReverseInnerIterator: public SparseMatrixType::ReverseInnerIterator |
100 |
{ |
109 |
{ |
101 |
public: |
110 |
public: |
|
|
111 |
inline ReverseInnerIterator() |
112 |
: SparseMatrixType::ReverseInnerIterator(),m_outer(-1) |
113 |
{} |
102 |
inline ReverseInnerIterator(const BlockType& xpr, Index outer) |
114 |
inline ReverseInnerIterator(const BlockType& xpr, Index outer) |
103 |
: SparseMatrixType::ReverseInnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer) |
115 |
: SparseMatrixType::ReverseInnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer) |
104 |
{} |
116 |
{} |
105 |
inline Index row() const { return IsRowMajor ? m_outer : this->index(); } |
117 |
inline Index row() const { return IsRowMajor ? m_outer : this->index(); } |
106 |
inline Index col() const { return IsRowMajor ? this->index() : m_outer; } |
118 |
inline Index col() const { return IsRowMajor ? this->index() : m_outer; } |
107 |
protected: |
119 |
protected: |
108 |
Index m_outer; |
120 |
Index m_outer; |
109 |
}; |
121 |
}; |
Lines 338-393
public:
Link Here
|
338 |
m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); |
350 |
m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); |
339 |
} |
351 |
} |
340 |
|
352 |
|
341 |
inline const _MatrixTypeNested& nestedExpression() const { return m_matrix; } |
353 |
inline const _MatrixTypeNested& nestedExpression() const { return m_matrix; } |
342 |
|
354 |
|
343 |
class InnerIterator : public _MatrixTypeNested::InnerIterator |
355 |
class InnerIterator : public _MatrixTypeNested::InnerIterator |
344 |
{ |
356 |
{ |
345 |
typedef typename _MatrixTypeNested::InnerIterator Base; |
357 |
typedef typename _MatrixTypeNested::InnerIterator Base; |
346 |
const BlockType& m_block; |
358 |
const BlockType *m_block; |
347 |
Index m_end; |
359 |
Index m_end; |
348 |
public: |
360 |
public: |
349 |
|
361 |
|
|
|
362 |
InnerIterator() |
363 |
: Base(), m_block(0),m_end(0) |
364 |
{} |
350 |
EIGEN_STRONG_INLINE InnerIterator(const BlockType& block, Index outer) |
365 |
EIGEN_STRONG_INLINE InnerIterator(const BlockType& block, Index outer) |
351 |
: Base(block.derived().nestedExpression(), outer + (IsRowMajor ? block.m_startRow.value() : block.m_startCol.value())), |
366 |
: Base(block.derived().nestedExpression(), outer + (IsRowMajor ? block.m_startRow.value() : block.m_startCol.value())), |
352 |
m_block(block), |
367 |
m_block(&block), |
353 |
m_end(IsRowMajor ? block.m_startCol.value()+block.m_blockCols.value() : block.m_startRow.value()+block.m_blockRows.value()) |
368 |
m_end(IsRowMajor ? block.m_startCol.value()+block.m_blockCols.value() : block.m_startRow.value()+block.m_blockRows.value()) |
354 |
{ |
369 |
{ |
355 |
while( (Base::operator bool()) && (Base::index() < (IsRowMajor ? m_block.m_startCol.value() : m_block.m_startRow.value())) ) |
370 |
while( (Base::operator bool()) && (Base::index() < (IsRowMajor ? m_block->m_startCol.value() : m_block->m_startRow.value())) ) |
356 |
Base::operator++(); |
371 |
Base::operator++(); |
357 |
} |
372 |
} |
358 |
|
373 |
|
359 |
inline Index index() const { return Base::index() - (IsRowMajor ? m_block.m_startCol.value() : m_block.m_startRow.value()); } |
374 |
inline Index index() const { return Base::index() - (IsRowMajor ? m_block->m_startCol.value() : m_block->m_startRow.value()); } |
360 |
inline Index outer() const { return Base::outer() - (IsRowMajor ? m_block.m_startRow.value() : m_block.m_startCol.value()); } |
375 |
inline Index outer() const { return Base::outer() - (IsRowMajor ? m_block->m_startRow.value() : m_block->m_startCol.value()); } |
361 |
inline Index row() const { return Base::row() - m_block.m_startRow.value(); } |
376 |
inline Index row() const { return Base::row() - m_block->m_startRow.value(); } |
362 |
inline Index col() const { return Base::col() - m_block.m_startCol.value(); } |
377 |
inline Index col() const { return Base::col() - m_block->m_startCol.value(); } |
363 |
|
378 |
|
364 |
inline operator bool() const { return Base::operator bool() && Base::index() < m_end; } |
379 |
inline operator bool() const { return Base::operator bool() && Base::index() < m_end; } |
365 |
}; |
380 |
}; |
366 |
class ReverseInnerIterator : public _MatrixTypeNested::ReverseInnerIterator |
381 |
class ReverseInnerIterator : public _MatrixTypeNested::ReverseInnerIterator |
367 |
{ |
382 |
{ |
368 |
typedef typename _MatrixTypeNested::ReverseInnerIterator Base; |
383 |
typedef typename _MatrixTypeNested::ReverseInnerIterator Base; |
369 |
const BlockType& m_block; |
384 |
const BlockType* m_block; |
370 |
Index m_begin; |
385 |
Index m_begin; |
371 |
public: |
386 |
public: |
372 |
|
387 |
ReverseInnerIterator() |
|
|
388 |
: m_block(0),m_begin(0) |
389 |
{} |
373 |
EIGEN_STRONG_INLINE ReverseInnerIterator(const BlockType& block, Index outer) |
390 |
EIGEN_STRONG_INLINE ReverseInnerIterator(const BlockType& block, Index outer) |
374 |
: Base(block.derived().nestedExpression(), outer + (IsRowMajor ? block.m_startRow.value() : block.m_startCol.value())), |
391 |
: Base(block.derived().nestedExpression(), outer + (IsRowMajor ? block.m_startRow.value() : block.m_startCol.value())), |
375 |
m_block(block), |
392 |
m_block(*block), |
376 |
m_begin(IsRowMajor ? block.m_startCol.value() : block.m_startRow.value()) |
393 |
m_begin(IsRowMajor ? block.m_startCol.value() : block.m_startRow.value()) |
377 |
{ |
394 |
{ |
378 |
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())) ) |
395 |
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())) ) |
379 |
Base::operator--(); |
396 |
Base::operator--(); |
380 |
} |
397 |
} |
381 |
|
398 |
|
382 |
inline Index index() const { return Base::index() - (IsRowMajor ? m_block.m_startCol.value() : m_block.m_startRow.value()); } |
399 |
inline Index index() const { return Base::index() - (IsRowMajor ? m_block->m_startCol.value() : m_block->m_startRow.value()); } |
383 |
inline Index outer() const { return Base::outer() - (IsRowMajor ? m_block.m_startRow.value() : m_block.m_startCol.value()); } |
400 |
inline Index outer() const { return Base::outer() - (IsRowMajor ? m_block->m_startRow.value() : m_block->m_startCol.value()); } |
384 |
inline Index row() const { return Base::row() - m_block.m_startRow.value(); } |
401 |
inline Index row() const { return Base::row() - m_block->m_startRow.value(); } |
385 |
inline Index col() const { return Base::col() - m_block.m_startCol.value(); } |
402 |
inline Index col() const { return Base::col() - m_block->m_startCol.value(); } |
386 |
|
403 |
|
387 |
inline operator bool() const { return Base::operator bool() && Base::index() >= m_begin; } |
404 |
inline operator bool() const { return Base::operator bool() && Base::index() >= m_begin; } |
388 |
}; |
405 |
}; |
389 |
protected: |
406 |
protected: |
390 |
friend class InnerIterator; |
407 |
friend class InnerIterator; |
391 |
friend class ReverseInnerIterator; |
408 |
friend class ReverseInnerIterator; |
392 |
|
409 |
|
393 |
typename XprType::Nested m_matrix; |
410 |
typename XprType::Nested m_matrix; |