#include <table.hpp>
Definition at line 68 of file table.hpp.
typedef empty_format FT [inherited] |
Definition at line 196 of file type_props.hpp.
typedef empty_format FT [inherited] |
Definition at line 196 of file type_props.hpp.
~table_rep | ( | ) | [inline] |
double complexity | ( | ) | const [inline] |
bool contains | ( | const T & | x | ) | const [inline] |
Definition at line 254 of file table.hpp.
References mmx::is_nil(), mmx::read_car(), and mmx::read_cdr().
00254 { 00255 list<pair<T,C> > l (a [V::key_op::hash_op (x) & (n-1)]); 00256 while (!is_nil (l)) { 00257 if (V::key_op::op (read_car (l).x1, x)) return true; 00258 l= read_cdr (l); 00259 } 00260 return false; 00261 }
empty_format format1 | ( | ) | const [inline, inherited] |
Definition at line 189 of file type_props.hpp.
Referenced by mmx::get_format1().
00189 { return empty_format (); }
empty_format format1 | ( | ) | const [inline, inherited] |
Definition at line 189 of file type_props.hpp.
Referenced by mmx::get_format1().
00189 { return empty_format (); }
empty_format format2 | ( | ) | const [inline, inherited] |
Definition at line 190 of file type_props.hpp.
Referenced by mmx::get_format2().
00190 { return empty_format (); }
empty_format format2 | ( | ) | const [inline, inherited] |
Definition at line 190 of file type_props.hpp.
Referenced by mmx::get_format2().
00190 { return empty_format (); }
empty_format format3 | ( | ) | const [inline, inherited] |
Definition at line 191 of file type_props.hpp.
00191 { return empty_format (); }
empty_format format3 | ( | ) | const [inline, inherited] |
Definition at line 191 of file type_props.hpp.
00191 { return empty_format (); }
Definition at line 296 of file table.hpp.
References mmx::is_nil(), table_rep< C, T, V >::lazy_initialize(), mmx::read_car(), and mmx::read_cdr().
00296 { 00297 list<pair<T,C> > l (a [V::key_op::hash_op (x) & (n-1)]); 00298 while (!is_nil (l)) { 00299 if (V::key_op::op (read_car (l).x1, x)) return read_car (l).x2; 00300 l= read_cdr (l); 00301 } 00302 lazy_initialize (); 00303 return *init; 00304 }
Definition at line 264 of file table.hpp.
References mmx::is_nil(), mmx::read_car(), and mmx::read_cdr().
void lazy_initialize | ( | ) | const [inline] |
Definition at line 103 of file table.hpp.
Referenced by table_rep< C, T, V >::get(), table_rep< C, T, V >::set(), and table_rep< C, T, V >::simplify().
void reset | ( | const T & | x | ) | [inline] |
Definition at line 307 of file table.hpp.
References mmx::cdr(), mmx::is_nil(), mmx::read_car(), mmx::read_cdr(), and table_rep< C, T, V >::resize().
void resize | ( | nat | n | ) | [inline] |
Definition at line 232 of file table.hpp.
References mmx::cons(), mmx::is_nil(), mmx::read_car(), and mmx::read_cdr().
Referenced by table_rep< C, T, V >::reset(), table_rep< C, T, V >::set(), and table_rep< C, T, V >::simplify().
00232 { 00233 nat i, oldn= n; 00234 list<pair<T,C> >* olda= a; 00235 n= n2; 00236 a= mmx_new<list<pair<T,C> > > (n); 00237 for (i=0; i<oldn; i++) { 00238 list<pair<T,C> > l (olda [i]); 00239 while (!is_nil (l)) { 00240 nat code= V::key_op::hash_op (read_car(l).x1); 00241 list<pair<T,C> >& newl= a [code & (n-1)]; 00242 newl= cons (read_car (l), newl); 00243 l= read_cdr (l); 00244 } 00245 } 00246 mmx_delete<list<pair<T,C> > > (olda, oldn); 00247 //double acc= 0.0; 00248 //for (i=0; i<n; i++) 00249 //acc += N(a[i]) * N(a[i]); 00250 //mmout << "Access ratio: " << (acc/n) << " out of " << n << "\n"; 00251 }
empty_format rfm | ( | ) | const [inline, inherited] |
Definition at line 188 of file type_props.hpp.
empty_format rfm | ( | ) | const [inline, inherited] |
Definition at line 188 of file type_props.hpp.
T sample | ( | ) | const [inline, inherited] |
Definition at line 202 of file type_props.hpp.
00202 { return C(); }
C sample | ( | ) | const [inline, inherited] |
Definition at line 202 of file type_props.hpp.
Referenced by mmx::get_sample().
00202 { return C(); }
Definition at line 277 of file table.hpp.
References mmx::car(), mmx::cdr(), mmx::cons(), mmx::is_nil(), table_rep< C, T, V >::lazy_initialize(), mmx::read_car(), and table_rep< C, T, V >::resize().
00277 { 00278 register nat hv= V::key_op::hash_op (x); 00279 list<pair<T,C> >* l= &(a [hv & (n-1)]); 00280 while (!is_nil (*l)) { 00281 if (V::key_op::op (read_car (*l).x1, x)) 00282 return car (*l).x2; 00283 l= &cdr (*l); 00284 } 00285 //mmout << "size= " << size << ", n= " << n << "\n"; 00286 if (size>=n) resize (n<<1); 00287 //mmout << "Resized\n"; 00288 lazy_initialize (); 00289 l= &a [hv & (n-1)]; 00290 *l= cons (pair<T,C> (x, *init), *l); 00291 size ++; 00292 return car (*l).x2; 00293 }
void simplify | ( | ) | [inline] |
Definition at line 321 of file table.hpp.
References mmx::cdr(), mmx::is_nil(), table_rep< C, T, V >::lazy_initialize(), mmx::read_car(), mmx::read_cdr(), and table_rep< C, T, V >::resize().
00321 { 00322 lazy_initialize (); 00323 for (nat i=0; i<n; i++) { 00324 list<pair<T,C> > *l= &(a[i]); 00325 while (!is_nil (*l)) { 00326 if (V::val_op::op (read_car (*l).x2, *init)) { 00327 *l= read_cdr (*l); 00328 size --; 00329 } 00330 else l= &cdr (*l); 00331 } 00332 } 00333 while (size < (n>>1)) resize (n>>1); 00334 }
Definition at line 201 of file type_props.hpp.
Definition at line 201 of file type_props.hpp.
Definition at line 264 of file type_props.hpp.
00264 { return this->tfm (); }
Definition at line 271 of file type_props.hpp.
00271 { return this->tfm (); }
Definition at line 227 of file table.hpp.
Referenced by table_rep< C, T, V >::complexity().