Database join on matrix columns. More...
#include <vnl_scalar_join_iterator.h>
Public Member Functions | |
| vnl_scalar_join_iterator (const vnl_matrix< T > &relation1, unsigned column1, const vnl_matrix< T > &relation2, unsigned column2) | |
| Initialize this iterator to the join of relation1(:,column1) and relation2(:,column2). More... | |
| ~vnl_scalar_join_iterator () | |
| Destructor. More... | |
| operator bool () const | |
| Return true if all pairs have been seen. More... | |
| bool | operator! () const |
| Return false if all pairs have been seen. More... | |
| vnl_scalar_join_iterator< T > & | operator++ () |
| Advance to the next pair. This is prefix ++. More... | |
| bool | done () const |
| void | next () |
| Increment the iterator to point to the next pair of rows. More... | |
| unsigned | row1 () const |
| Return the index of the current row in the first relation. More... | |
| unsigned | row2 () const |
| Return the index of the current row in the second relation. More... | |
Protected Attributes | |
| unsigned | n1 |
| unsigned | n2 |
| std::list< vnl_scalar_join_iterator_indexed_pair< T > > * | pI1 |
| std::list< vnl_scalar_join_iterator_indexed_pair< T > > * | pI2 |
| std::list< vnl_scalar_join_iterator_indexed_pair< T > > & | I1 |
| std::list< vnl_scalar_join_iterator_indexed_pair< T > > & | I2 |
| std::list< vnl_scalar_join_iterator_indexed_pair< T > >::iterator | index1 |
| std::list< vnl_scalar_join_iterator_indexed_pair< T > >::iterator | index2 |
Private Member Functions | |
| vnl_scalar_join_iterator< T > | operator++ (int) |
| Postfix ++ should not be used. Only present for instantiation purposes. More... | |
Database join on matrix columns.
vnl_scalar_join_iterator implements a fast database join on columns of matrices of scalars. "Scalar" here really means that the objects have comparison operators. The cost is O(n log n) where n is the number of rows, all for the two sorts in the ctor.
CAVEAT: The current implementation fudges multiple occurrences of the same key in the source column. For example,
join 1 3 and 3 5 on columns 2 and 1 respectively
2 3 3 6
should give
1 3 3 5
1 3 3 6
2 3 3 5
2 3 3 6
and it doesn't. Contact awf if you need this to work.
Definition at line 69 of file vnl_scalar_join_iterator.h.
| vnl_scalar_join_iterator< T >::vnl_scalar_join_iterator | ( | const vnl_matrix< T > & | relation1, |
| unsigned | column1, | ||
| const vnl_matrix< T > & | relation2, | ||
| unsigned | column2 | ||
| ) |
Initialize this iterator to the join of relation1(:,column1) and relation2(:,column2).
The algorithm sorts an array of pointers to each row and traversal of the iterator runs through these to produce the join. After construction the row1() and row2() methods indicate the first pair.
Definition at line 51 of file vnl_scalar_join_iterator.hxx.
| vnl_scalar_join_iterator< T >::~vnl_scalar_join_iterator | ( | ) |
Destructor.
Definition at line 92 of file vnl_scalar_join_iterator.hxx.
| bool vnl_scalar_join_iterator< T >::done | ( | ) | const |
Definition at line 99 of file vnl_scalar_join_iterator.hxx.
| void vnl_scalar_join_iterator< T >::next | ( | ) |
Increment the iterator to point to the next pair of rows.
Definition at line 106 of file vnl_scalar_join_iterator.hxx.
|
inlineexplicit |
Return true if all pairs have been seen.
Definition at line 96 of file vnl_scalar_join_iterator.h.
|
inline |
Return false if all pairs have been seen.
Definition at line 100 of file vnl_scalar_join_iterator.h.
|
inline |
Advance to the next pair. This is prefix ++.
Definition at line 104 of file vnl_scalar_join_iterator.h.
|
private |
Postfix ++ should not be used. Only present for instantiation purposes.
Definition at line 156 of file vnl_scalar_join_iterator.hxx.
| unsigned vnl_scalar_join_iterator< T >::row1 | ( | ) | const |
Return the index of the current row in the first relation.
Definition at line 143 of file vnl_scalar_join_iterator.hxx.
| unsigned vnl_scalar_join_iterator< T >::row2 | ( | ) | const |
Return the index of the current row in the second relation.
Definition at line 149 of file vnl_scalar_join_iterator.hxx.
|
protected |
Definition at line 78 of file vnl_scalar_join_iterator.h.
|
protected |
Definition at line 79 of file vnl_scalar_join_iterator.h.
|
protected |
Definition at line 80 of file vnl_scalar_join_iterator.h.
|
protected |
Definition at line 81 of file vnl_scalar_join_iterator.h.
|
protected |
Definition at line 74 of file vnl_scalar_join_iterator.h.
|
protected |
Definition at line 75 of file vnl_scalar_join_iterator.h.
|
protected |
Definition at line 76 of file vnl_scalar_join_iterator.h.
|
protected |
Definition at line 77 of file vnl_scalar_join_iterator.h.
1.8.15