H2Lib  3.0
block.h
Go to the documentation of this file.
1 
2 /* ------------------------------------------------------------
3  * This is the file "block.h" of the H2Lib package.
4  * All rights reserved, Steffen Boerm 2009
5  * ------------------------------------------------------------ */
6 
11 #ifndef BLOCK_H
12 #define BLOCK_H
13 
21 typedef struct _block block;
22 
24 typedef block *pblock;
25 
27 typedef const block *pcblock;
28 
29 #ifdef USE_CAIRO
30 #include <cairo/cairo.h>
31 #endif
32 
33 #include "cluster.h"
34 #include "settings.h"
35 
48 struct _block {
51 
54 
56  bool a;
57 
60 
63 
66 
69 };
70 
71 /* ------------------------------------------------------------
72  * Admissibility condition
73  * ------------------------------------------------------------ */
74 
76 typedef bool (*admissible)(pcluster rc, pcluster cc, void *data);
77 
94 HEADER_PREFIX bool
96 
113 HEADER_PREFIX bool
115 
132 HEADER_PREFIX bool
134 
151 HEADER_PREFIX bool
153 
154 /* ------------------------------------------------------------
155  Constructors and destructors
156  ------------------------------------------------------------ */
157 
173 
181 HEADER_PREFIX void
182 del_block(pblock b);
183 
195 HEADER_PREFIX void
197 
198 /* ------------------------------------------------------------
199  Block clustering strategies
200  ------------------------------------------------------------ */
201 
217 
233 
248 build_strict_block(pcluster rc, pcluster cc, void *data, admissible admis);
249 
265 
266 /* ------------------------------------------------------------
267  * Drawing block trees
268  * ------------------------------------------------------------ */
269 
273 #ifdef USE_CAIRO
274 
282 HEADER_PREFIX void
283 draw_cairo_block(cairo_t *cr, pcblock b, int levels);
284 #endif
285 
286 /* ------------------------------------------------------------
287  * Interactive visualization
288  * ------------------------------------------------------------ */
289 
295 HEADER_PREFIX void
297 
298 /* ------------------------------------------------------------
299  * Hierarchical iterators
300  * ------------------------------------------------------------ */
301 
303 typedef struct _blockentry blockentry;
304 
307 
309 typedef const blockentry *pcblockentry;
310 
313 struct _blockentry {
326 };
327 
349 HEADER_PREFIX void
350 iterate_block(pcblock b, uint bname, uint rname, uint cname,
351  void (*pre)(pcblock b, uint bname, uint rname, uint cname, uint pardepth,
352  void *data),
353  void (*post)(pcblock b, uint bname, uint rname, uint cname, uint pardepth,
354  void *data), void *data);
355 
370 HEADER_PREFIX void
371 iterate_rowlist_block(pcblock b, uint bname, uint rname, uint cname,
372  uint pardepth, void (*pre)(pcblockentry pb, uint pardepth, void *data),
373  void (*post)(pcblockentry pb, uint pardepth, void *data), void *data);
374 
390 HEADER_PREFIX void
391 iterate_collist_block(pcblock b, uint bname, uint rname, uint cname,
392  uint pardepth, void (*pre)(pcblockentry pb, uint pardepth, void *data),
393  void (*post)(pcblockentry pb, uint pardepth, void *data), void *data);
394 
412 HEADER_PREFIX void
413 iterate_byrow_block(pcblock b, uint bname, uint rname, uint cname,
414  uint pardepth,
415  void (*pre)(pcblock b, uint bname, uint rname, uint cname, uint pardepth,
416  void *data),
417  void (*post)(pcblock b, uint bname, uint rname, uint cname, uint pardepth,
418  void *data), void *data);
419 
437 HEADER_PREFIX void
438 iterate_bycol_block(pcblock b, uint bname, uint rname, uint cname,
439  uint pardepth,
440  void (*pre)(pcblock b, uint bname, uint rname, uint cname, uint pardepth,
441  void *data),
442  void (*post)(pcblock b, uint bname, uint rname, uint cname, uint pardepth,
443  void *data), void *data);
444 
445 /* ------------------------------------------------------------
446  * Enumeration
447  * ------------------------------------------------------------ */
448 
463 
479 
480 /* ------------------------------------------------------------
481  * Utility functions
482  * ------------------------------------------------------------ */
483 
493 
505 
506 #endif
507 
pblock build_nonstrict_lower_block(pcluster rc, pcluster cc, void *data, admissible admis)
Build a non strict lower triangular block tree.
uint * enumerate_level_block(pblock t)
Enumerate the levels of a block tree.
void iterate_byrow_block(pcblock b, uint bname, uint rname, uint cname, uint pardepth, void(*pre)(pcblock b, uint bname, uint rname, uint cname, uint pardepth, void *data), void(*post)(pcblock b, uint bname, uint rname, uint cname, uint pardepth, void *data), void *data)
Iterate through all subblocks of a block tree.
void update_block(pblock b)
Complete initialization of a block object.
void iterate_bycol_block(pcblock b, uint bname, uint rname, uint cname, uint pardepth, void(*pre)(pcblock b, uint bname, uint rname, uint cname, uint pardepth, void *data), void(*post)(pcblock b, uint bname, uint rname, uint cname, uint pardepth, void *data), void *data)
Iterate through all subblocks of a block tree.
uint cname
Number of the column cluster of b.
Definition: block.h:321
Auxiliary structure for hierarchical iterators for a block cluster tree.
Definition: block.h:313
pblock * enumerate_block(pblock t)
Enumerate a block tree.
uint rsons
Number of row sons.
Definition: block.h:62
pcluster cc
Column Cluster.
Definition: block.h:53
unsigned uint
Unsigned integer type.
Definition: settings.h:70
unsigned short bool
Boolean type.
Definition: settings.h:58
bool a
Admissibility flag.
Definition: block.h:56
void del_block(pblock b)
Delete a block tree.
bool admissible_2_cluster(pcluster rc, pcluster cc, void *data)
Check the euclidian (maximum) admissibility condition.
void iterate_collist_block(pcblock b, uint bname, uint rname, uint cname, uint pardepth, void(*pre)(pcblockentry pb, uint pardepth, void *data), void(*post)(pcblockentry pb, uint pardepth, void *data), void *data)
Iterate through all subblocks of a block tree, columnwise.
pblock build_strict_lower_block(pcluster rc, pcluster cc, void *data, admissible admis)
Build a strict lower triangular block tree.
pblock * son
Son blocks, if the block is subdivided.
Definition: block.h:59
void view_block(pcblock b)
Visualize a block tree in OpenGL.
bool admissible_2_min_cluster(pcluster rc, pcluster cc, void *data)
Check the euclidian minimum admissibility condition.
void iterate_rowlist_block(pcblock b, uint bname, uint rname, uint cname, uint pardepth, void(*pre)(pcblockentry pb, uint pardepth, void *data), void(*post)(pcblockentry pb, uint pardepth, void *data), void *data)
Iterate through all subblocks of a block tree, rowwise.
const block * pcblock
Pointer to constant block object.
Definition: block.h:27
uint rname
Number of the row cluster of b.
Definition: block.h:319
uint bname
Number of the block tree.
Definition: block.h:317
blockentry * pblockentry
Pointer to a blockentry object.
Definition: block.h:306
pblock build_strict_block(pcluster rc, pcluster cc, void *data, admissible admis)
Build a strict block tree.
pcblockentry father
Pointer to the blockentry object of the father of b.
Definition: block.h:323
pcblock b
block tree.
Definition: block.h:315
pblockentry next
Pointer to the blockentry object of the sucessor of b.
Definition: block.h:325
void iterate_block(pcblock b, uint bname, uint rname, uint cname, void(*pre)(pcblock b, uint bname, uint rname, uint cname, uint pardepth, void *data), void(*post)(pcblock b, uint bname, uint rname, uint cname, uint pardepth, void *data), void *data)
Hierarchical iterator for a block tree.
void draw_cairo_block(cairo_t *cr, pcblock b, int levels)
Draw a block tree.
uint desc
Number of descendants.
Definition: block.h:68
#define HEADER_PREFIX
Prefix for function declarations.
Definition: settings.h:43
uint compute_csp_block(pcblock b)
Compute the sparsity of a block object.
bool(* admissible)(pcluster rc, pcluster cc, void *data)
Callback function for an admissibility condition.
Definition: block.h:76
bool admissible_max_cluster(pcluster rc, pcluster cc, void *data)
Check the admissibility condition in the maximum norm.
pcluster rc
Row cluster.
Definition: block.h:50
pblock build_nonstrict_block(pcluster rc, pcluster cc, void *data, admissible admis)
Build a non strict block tree.
Representation of block trees.
Definition: block.h:48
Representation of cluster trees.
Definition: cluster.h:40
const blockentry * pcblockentry
Pointer to a constant blockentry object.
Definition: block.h:309
uint getdepth_block(pcblock b)
Compute the depth of a block tree object.
block * pblock
Pointer to block object.
Definition: block.h:24
bool admissible_sphere_cluster(pcluster rc, pcluster cc, void *data)
Check the admissibility condition for spherical domains.
uint csons
Number of column sons.
Definition: block.h:65
pblock new_block(pcluster rc, pcluster cc, bool a, uint rsons, uint csons)
Create a new block object.