H2Lib  3.0
clusterbasis.h
Go to the documentation of this file.
1 
2 /* ------------------------------------------------------------
3  * This is the file "clusterbasis.h" of the H2Lib package.
4  * All rights reserved, Steffen Boerm 2009
5  * ------------------------------------------------------------ */
6 
11 #ifndef CLUSTERBASIS_H
12 #define CLUSTERBASIS_H
13 
26 typedef struct _clusterbasis clusterbasis;
27 
30 
33 
34 #include "cluster.h"
35 #include "clusteroperator.h"
36 #include "uniform.h"
37 #include "amatrix.h"
38 
40 struct _clusterbasis {
43 
50 
55 
60 
63 
66 
71 };
72 
73 /* Now the "clusterbasis" type is completely defined */
74 #define CLUSTERBASIS_TYPE_COMPLETE
75 
76 /* ------------------------------------------------------------
77  * Constructors and destructors
78  * ------------------------------------------------------------ */
79 
93 
107 
126  uint off);
127 
139 HEADER_PREFIX void
141 
155 
169 
179 HEADER_PREFIX void
181 
182 /* ------------------------------------------------------------
183  * Reference counting
184  * ------------------------------------------------------------ */
185 
192 HEADER_PREFIX void
194 
203 HEADER_PREFIX void
205 
206 /* ------------------------------------------------------------
207  * Low-level management
208  * ------------------------------------------------------------ */
209 
217 HEADER_PREFIX void
219 
227 HEADER_PREFIX void
229 
238 HEADER_PREFIX void
240 
249 HEADER_PREFIX void
251 
252 /* ------------------------------------------------------------
253  * Build clusterbasis based on cluster
254  * ------------------------------------------------------------ */
255 
265 
266 /* ------------------------------------------------------------
267  * Clone a cluster basis
268  * ------------------------------------------------------------ */
269 
278 
289 
290 /* ------------------------------------------------------------
291  * Statistics
292  * ------------------------------------------------------------ */
293 
299 
306 HEADER_PREFIX size_t
308 
309 /* ------------------------------------------------------------
310  * Simple utility functions
311  * ------------------------------------------------------------ */
312 
317 HEADER_PREFIX void
319 
320 /* ------------------------------------------------------------
321  * Hierarchical iterator
322  * ------------------------------------------------------------ */
323 
343 HEADER_PREFIX void
345  void (*pre)(pcclusterbasis cb, uint cbname, void *data),
346  void (*post)(pcclusterbasis cb, uint cbname, void *data),
347  void *data);
348 
369 HEADER_PREFIX void
371  void (*pre)(pcclusterbasis cb, uint cbname, void *data),
372  void (*post)(pcclusterbasis cb, uint cbname, void *data),
373  void *data);
374 
375 /* ------------------------------------------------------------
376  * Enumeration by cluster number
377  * ------------------------------------------------------------ */
378 
395 
396 /* ------------------------------------------------------------
397  * Forward and backward transformation
398  * ------------------------------------------------------------ */
399 
410 
445 HEADER_PREFIX void
447 
458 HEADER_PREFIX void
460  uint pardepth);
461 
473 HEADER_PREFIX void
475  pavector xt);
476 
491 HEADER_PREFIX void
493 
530 HEADER_PREFIX void
532 
543 HEADER_PREFIX void
545  pavector y, uint pardepth);
546 
558 HEADER_PREFIX void
560  pavector yp);
561 
576 HEADER_PREFIX void
578 
579 /* ------------------------------------------------------------
580  * Forward and backward transformation for the root only
581  * ------------------------------------------------------------ */
582 
601 HEADER_PREFIX void
603 
621 HEADER_PREFIX void
623 
636 HEADER_PREFIX void
638 
650 void
652  pamatrix Xt, uint pardepth);
653 
654 /* ------------------------------------------------------------
655  * Forward and backward transformation for matrices
656  * ------------------------------------------------------------ */
657 
671 HEADER_PREFIX void
673 
687 HEADER_PREFIX void
689 
703 HEADER_PREFIX void
705 
719 HEADER_PREFIX void
721 
722 /* ------------------------------------------------------------
723  * Simple computations
724  * ------------------------------------------------------------ */
725 
736 HEADER_PREFIX void
738  pcavector yc, pavector yp);
739 
750 HEADER_PREFIX void
752  pcavector xp, pavector xc);
753 
754 /* ------------------------------------------------------------
755  * Orthogonalization
756  * ------------------------------------------------------------ */
757 
773 HEADER_PREFIX void
775 
789 
805 
823 
824 /* ------------------------------------------------------------
825  * File I/O
826  * ------------------------------------------------------------ */
827 
828 #ifdef USE_NETCDF
829 
833 HEADER_PREFIX void
834 write_cdf_clusterbasis(pcclusterbasis cb, const char *name);
835 
841 HEADER_PREFIX void
842 write_cdfpart_clusterbasis(pcclusterbasis cb, int nc_file, const char *prefix);
843 
850 read_cdf_clusterbasis(const char *name, pccluster t);
851 
859 read_cdfpart_clusterbasis(int nc_file, const char *prefix, pccluster t);
860 #endif
861 
862 #endif
863 
864 /* ------------------------------------------------------------
865  * Access methods
866  * ------------------------------------------------------------ */
867 
868 /* Avoid problems with incomplete type definitions */
869 #if defined(CLUSTERBASIS_TYPE_COMPLETE) && !defined(CLUSTERBASIS_COMPLETE)
870 #define CLUSTERBASIS_COMPLETE
871 
872 #ifdef __GNUC__
874 getE_clusterbasis(pclusterbasis) __attribute__ ((unused));
876 getV_clusterbasis(pclusterbasis) __attribute__ ((unused));
877 #endif
878 
885 getE_clusterbasis(pclusterbasis cb)
886 {
887  return &cb->E;
888 }
889 
895 getV_clusterbasis(pclusterbasis cb)
896 {
897  return &cb->V;
898 }
899 
900 #endif
901 
uint kbranch
Maximal rank sum for all branches below t
Definition: clusterbasis.h:49
void backward_notransfer_clusterbasis_avector(pcclusterbasis cb, pavector yt, pavector y)
Backward transformation without transfer matrices.
pclusterbasis init_leaf_clusterbasis(pclusterbasis cb, pccluster t)
Initialize a clusterbasis object for a leaf.
void compress_clusterbasis_avector(pcclusterbasis cb, pcavector xp, pavector xt)
Compute .
void update_tree_clusterbasis(pclusterbasis cb)
Updates bookkeeping information, e.g., cb->ktree, for a clusterbasis object and all its descendants...
void backward_clusterbasis_trans_amatrix(pcclusterbasis cb, pamatrix Yt, pamatrix Yp)
Adjoint matrix backward transformation.
void ref_clusterbasis(pclusterbasis *ptr, pclusterbasis cb)
Set a pointer to a clusterbasis object, increase its reference counter, and decrease reference counte...
pclusterbasis init_sub_clusterbasis(pclusterbasis cb, pclusterbasis src, pccluster t, uint off)
Initialize a clusterbasis object representing a leaf son cluster for a leaf cluster basis...
real check_ortho_clusterbasis(pcclusterbasis cb)
Check whether a cluster basis is orthogonal.
Representation of a cluster operator.
Definition: clusteroperator.h:44
uint sons
Number of sons, either t->sons or zero.
Definition: clusterbasis.h:57
Definition: avector.h:39
pclusterbasis new_clusterbasis(pccluster t)
Create a new clusterbasis object.
void compress_clusterbasis_amatrix(pcclusterbasis cb, pcamatrix Xp, pamatrix Xt)
Compute .
void ortho_clusterbasis(pclusterbasis cb, pclusteroperator co)
Orthogonalize a cluster basis.
pclusterbasis * son
Pointers to sons.
Definition: clusterbasis.h:59
amatrix E
Transfer matrix to father.
Definition: clusterbasis.h:54
puniform clist
List of matrices using this basis as column basis.
Definition: clusterbasis.h:70
void clear_weight_clusterbasis(pclusterbasis cb)
Delete all weight matrices of the clusterbasis and its descendants.
pclusterbasis init_clusterbasis(pclusterbasis cb, pccluster t)
Initialize a clusterbasis object.
Representation of a cluster basis.
Definition: clusterbasis.h:40
pclusterbasis * enumerate_clusterbasis(pccluster t, pclusterbasis cb)
Enumerate clusterbasis according to cluster tree.
const clusterbasis * pcclusterbasis
Pointer to constant clusterbasis object.
Definition: clusterbasis.h:32
unsigned uint
Unsigned integer type.
Definition: settings.h:70
void setrank_clusterbasis(pclusterbasis cb, uint k)
Change the rank of a cluster basis and resize cb->V, while cb->son[i]->E is resized for all sons...
clusterbasis * pclusterbasis
Pointer to clusterbasis object.
Definition: clusterbasis.h:29
pclusterbasis clone_clusterbasis(pcclusterbasis cb)
Create a copy of a clusterbasis.
void iterate_parallel_clusterbasis(pcclusterbasis cb, uint cbname, uint pardepth, void(*pre)(pcclusterbasis cb, uint cbname, void *data), void(*post)(pcclusterbasis cb, uint cbname, void *data), void *data)
Parallel hierarchical iterator for a clusterbasis.
void forward_notransfer_clusterbasis_avector(pcclusterbasis cb, pcavector x, pavector xt)
Forward transformation without transfer matrices.
void forward_clusterbasis_avector(pcclusterbasis cb, pcavector x, pavector xt)
Forward transformation.
double _Complex field
Field type.
Definition: settings.h:171
pccluster t
Corresponding cluster.
Definition: clusterbasis.h:42
pclusterbasis read_cdf_clusterbasis(const char *name, pccluster t)
Read clusterbasis from NetCdf file.
void backward_nopermutation_clusterbasis_avector(pcclusterbasis cb, pavector yt, pavector yp)
Backward transformation for vectors in cluster numbering.
uint ktree
Sum of ranks in entire subtree below t
Definition: clusterbasis.h:47
#define INLINE_PREFIX
Prefix for inline functions.
Definition: settings.h:36
pclusterbasis build_from_cluster_clusterbasis(pccluster t)
Construct a clusterbasis from a cluster tree.
pamatrix weight_enum_clusterbasis_clusteroperator(pcclusterbasis cb)
Compute weight matrices for a cluster basis using an iterator over the cluster tree.
size_t getsize_clusterbasis(pcclusterbasis cb)
Get the size of a given clusterbasis object.
pclusterbasis clonestructure_clusterbasis(pcclusterbasis cb)
Copy the tree structure of a clusterbasis.
void backward_clusterbasis_avector(pcclusterbasis cb, pavector yt, pavector y)
Backward transformation.
void addevaltrans_clusterbasis_avector(field alpha, pcclusterbasis cb, pcavector xp, pavector xc)
Compute .
void forward_parallel_clusterbasis_avector(pcclusterbasis cb, pcavector x, pavector xt, uint pardepth)
Parallel forward transformation.
pavector new_coeffs_clusterbasis_avector(pcclusterbasis cb)
Create coefficient vector for cluster basis.
void backward_parallel_clusterbasis_avector(pcclusterbasis cb, pavector yt, pavector y, uint pardepth)
Parallel backward transformation.
pclusteroperator weight_clusterbasis_clusteroperator(pcclusterbasis cb, pclusteroperator co)
Compute weight matrices for a cluster basis.
void unref_clusterbasis(pclusterbasis cb)
Reduce the reference counter of a clusterbasis object.
void backward_clusterbasis_amatrix(pcclusterbasis cb, pamatrix Yt, pamatrix Yp)
Matrix backward transformation.
void write_cdfpart_clusterbasis(pcclusterbasis cb, int nc_file, const char *prefix)
Write clusterbasis to part of NetCDF file.
void update_clusterbasis(pclusterbasis cb)
Updates bookkeeping information, e.g., cb->ktree, for a clusterbasis object after its sons have been ...
#define HEADER_PREFIX
Prefix for function declarations.
Definition: settings.h:43
double real
real floating point type.
Definition: settings.h:97
void compress_parallel_clusterbasis_amatrix(pcclusterbasis cb, pcamatrix Xp, pamatrix Xt, uint pardepth)
Compute .
uint k
Maximal rank.
Definition: clusterbasis.h:45
uint refs
References to this cluster basis.
Definition: clusterbasis.h:65
void forward_nopermutation_clusterbasis_avector(pcclusterbasis cb, pcavector xp, pavector xt)
Forward transformation for vectors using cluster numbering.
void expand_clusterbasis_avector(pcclusterbasis cb, pavector yt, pavector yp)
Add to target vector .
puniform rlist
List of matrices using this basis as row basis.
Definition: clusterbasis.h:68
void forward_clusterbasis_amatrix(pcclusterbasis cb, pcamatrix Xp, pamatrix Xt)
Matrix forward transformation.
void resize_clusterbasis(pclusterbasis cb, uint k)
Change the rank of a cluster basis and resize cb->V, cb->son[i]->E is resized for all sons...
pclusterbasis new_leaf_clusterbasis(pccluster t)
Create a new clusterbasis object for a leaf.
uint getactives_clusterbasis()
Get number of active clusterbasis objects.
pclusterbasis read_cdfpart_clusterbasis(int nc_file, const char *prefix, pccluster t)
Read clusterbasis from part of a NetCdf file.
Representation of cluster trees.
Definition: cluster.h:40
void forward_clusterbasis_trans_amatrix(pcclusterbasis cb, pcamatrix Xp, pamatrix Xt)
Adjoint matrix forward transformation.
Representation of an admissible block for -matrices.
Definition: uniform.h:69
amatrix V
Leaf matrix .
Definition: clusterbasis.h:52
void addeval_clusterbasis_avector(field alpha, pcclusterbasis cb, pcavector yc, pavector yp)
Compute .
void iterate_clusterbasis(pcclusterbasis cb, uint cbname, void(*pre)(pcclusterbasis cb, uint cbname, void *data), void(*post)(pcclusterbasis cb, uint cbname, void *data), void *data)
Hierarchical iterator for a clusterbasis.
Representation of a matrix as an array in column-major order.
Definition: amatrix.h:43
pamatrix Z
Weight matrix used to represent total cluster basis.
Definition: clusterbasis.h:62
void uninit_clusterbasis(pclusterbasis cb)
Uninitializes a clusterbasis object.
void del_clusterbasis(pclusterbasis cb)
Delete a clusterbasis object.
void write_cdf_clusterbasis(pcclusterbasis cb, const char *name)
Write clusterbasis to NetCDF file.