#include <guma_rkdtree.h>
Inheritance diagram for guma::kdtnode::

Public Methods | |
| kdtnode (const kdrec< U, V > &rec, int disc) | |
| kdtnode (gul::List< gul::ListNode< kdrec< U, V > > > &recs, int disc) | |
| const V & | key () const |
| void | add_rec (const kdrec< U, V > &rec) |
| void | update () |
| void | set_left (kdtnode *left) |
| void | set_right (kdtnode *right) |
| void | set_childs (kdtnode *left, kdtnode *right) |
| void | unlink (kdtnode **left, kdtnode **right, gul::List< gul::ListNode< kdrec< U, V > > > &L) |
| ~kdtnode () | |
| void | height (int cur_height, int *max_height, int *avg_count, double *avg_sum) |
| void | dump (int dim, int space) |
Public Attributes | |
| int | m_disc |
| gul::List< gul::ListNode< kdrec< U, V > > > | m_recs |
| int | m_nelems |
| kdtnode * | m_left |
| kdtnode * | m_right |
| kdtnode * | m_parent |
|
||||||||||||||||
|
Definition at line 49 of file guma_rkdtree.h. References gul::List::Append(), m_disc, and m_nelems. Referenced by set_childs(), set_left(), set_right(), and unlink().
|
|
||||||||||||||||
|
Definition at line 56 of file guma_rkdtree.h. References m_disc, and m_nelems.
|
|
|||||||||
|
Definition at line 125 of file guma_rkdtree.h.
00126 {
00127 if( m_left )
00128 {
00129 m_left->m_parent = 0;
00130 delete m_left;
00131 }
00132 if( m_right )
00133 {
00134 m_right->m_parent = 0;
00135 delete m_right;
00136 }
00137 if( m_parent )
00138 {
00139 if( m_parent->m_left == this )
00140 m_parent->m_left = 0;
00141 if( m_parent->m_right == this )
00142 m_parent->m_right = 0;
00143 m_parent->update();
00144 }
00145 }
|
|
||||||||||
|
Definition at line 67 of file guma_rkdtree.h. References gul::List::Append().
00068 {
00069 m_recs.Append( new gul::ListNode< kdrec<U,V> >(rec) );
00070 }
|
|
||||||||||||||||
|
Definition at line 71 of file guma_rkdtree.cpp. References gul::List< gul::ListNode< kdrec< U, V > > >::First(), m_disc, m_left, m_nelems, m_recs, and m_right.
00072 {
00073 int i;
00074 ListNode< kdrec<U,V> > *r;
00075
00076 for( i = 0; i < space; i++ ) cout << " ";
00077 cout << "discriminant = " << m_disc << ", number of elements = "
00078 << m_nelems << "\n";
00079
00080 for( i = 0; i < space; i++ ) cout << " ";
00081 cout << "records: {";
00082 for( r = m_recs.First(); r; r = r->next )
00083 {
00084 cout << "(" << r->el[0];
00085 for( i = 1; i < dim; i++ )
00086 cout << ", " << r->el[i];
00087 cout << ") ";
00088 }
00089 cout << "}\n";
00090
00091 for( i = 0; i < space; i++ ) cout << " ";
00092 cout << "left subtree: " << (void *)m_left << "\n";
00093 if( m_left )
00094 {
00095 m_left->dump(dim,space+4);
00096 }
00097 for( i = 0; i < space; i++ ) cout << " ";
00098 cout << "right subtree: " << (void *)m_right << "\n";
00099 if( m_right )
00100 {
00101 m_right->dump(dim,space+4);
00102 }
00103 }
|
|
||||||||||||||||||||||||
|
Definition at line 46 of file guma_rkdtree.cpp. References m_left, m_parent, and m_right.
00048 {
00049 (*avg_count)++;
00050 (*avg_sum) += (double)cur_height;
00051
00052 if( m_parent == 0 )
00053 cout << "warning: parent == 0 in node " << (void *)this
00054 << "\n";
00055
00056 if( !m_left && !m_right )
00057 {
00058 if( cur_height > *max_height )
00059 *max_height = cur_height;
00060 }
00061 else
00062 {
00063 if( m_left )
00064 m_left->height( cur_height+1, max_height, avg_count, avg_sum );
00065 if( m_right )
00066 m_right->height( cur_height+1, max_height, avg_count, avg_sum );
00067 }
00068 }
|
|
|||||||||
|
Definition at line 63 of file guma_rkdtree.h. References gul::List::First(), and m_disc.
|
|
||||||||||||||||
|
Definition at line 90 of file guma_rkdtree.h. References kdtnode(), and update().
|
|
||||||||||
|
Definition at line 78 of file guma_rkdtree.h. References kdtnode(), and update().
|
|
||||||||||
|
Definition at line 84 of file guma_rkdtree.h. References kdtnode(), and update().
|
|
||||||||||||||||||||
|
Definition at line 98 of file guma_rkdtree.h. References kdtnode().
00100 {
00101 L += m_recs;
00102
00103 *left = m_left;
00104 if( m_left )
00105 {
00106 m_left->m_parent = 0;
00107 m_left = 0;
00108 }
00109 *right = m_right;
00110 if( m_right )
00111 {
00112 m_right->m_parent = 0;
00113 m_right = 0;
00114 }
00115 if( m_parent )
00116 {
00117 if( m_parent->m_left == this )
00118 m_parent->m_left = 0;
00119 if( m_parent->m_right == this )
00120 m_parent->m_right = 0;
00121 m_parent->update();
00122 m_parent = 0;
00123 }
00124 }
|
|
|||||||||
|
Definition at line 71 of file guma_rkdtree.h. References m_nelems. Referenced by set_childs(), set_left(), and set_right().
|
|
|||||
|
Definition at line 41 of file guma_rkdtree.h. |
|
|||||
|
Definition at line 45 of file guma_rkdtree.h. |
|
|||||
|
Definition at line 43 of file guma_rkdtree.h. |
|
|||||
|
Definition at line 47 of file guma_rkdtree.h. Referenced by height(). |
|
|||||
|
Definition at line 42 of file guma_rkdtree.h. Referenced by dump(). |
|
|||||
|
Definition at line 46 of file guma_rkdtree.h. |
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001