H2Lib  3.0
Data Structures | Macros | Typedefs | Functions
clusteroperator

Representation of cluster operators used to describe weights and transformations of cluster bases. More...

Data Structures

struct  _clusteroperator
 Representation of a cluster operator. More...
 

Typedefs

typedef struct _clusteroperator clusteroperator
 Representation of a cluster operator.
 
typedef clusteroperatorpclusteroperator
 Pointer to clusteroperator object.
 
typedef const clusteroperatorpcclusteroperator
 Pointer to constant clusterbasis object.
 

Functions

pclusteroperator init_clusteroperator (pclusteroperator co, pccluster t)
 Initialize a clusteroperator object. More...
 
pclusteroperator init_leaf_clusteroperator (pclusteroperator co, pccluster t)
 Initialize a clusteroperator object for a leaf. More...
 
void uninit_clusteroperator (pclusteroperator co)
 Uninitializes a clusteroperator object. More...
 
pclusteroperator new_clusteroperator (pccluster t)
 Create a new clusteroperator object. More...
 
pclusteroperator new_leaf_clusteroperator (pccluster t)
 Creates a new clusteroperator object for a leaf. More...
 
void del_clusteroperator (pclusteroperator co)
 Delete a clusteroperator object. More...
 
void removesons_clusteroperator (pclusteroperator co)
 Turn this clusteroperator into a leaf. More...
 
void ref_clusteroperator (pclusteroperator*ptr, pclusteroperator co)
 Set a pointer to a clusterbasis object, increase its reference counter, and decrease reference counter of original pointer target. More...
 
void unref_clusteroperator (pclusteroperator co)
 Reduce the reference counter of a clusteroperator object. More...
 
void update_clusteroperator (pclusteroperator co)
 Updates bookkeeping information. More...
 
void resize_clusteroperator (pclusteroperator co, uint krow, uint kcol)
 Change the number of rows and columns of a cluster operator and resize cb->C accordingly. More...
 
pclusteroperator identify_son_clusterweight_clusteroperator (pcclusteroperator cwf, pccluster t)
 Find son clusteroperator matching a given cluster. More...
 
pclusteroperator build_from_cluster_clusteroperator (pccluster t)
 Construct a clusteroperator matching a cluster tree. More...
 
pclusteroperator build_from_clusterbasis_clusteroperator (pcclusterbasis cb)
 Construct a clusteroperator matching a clusterbasis. More...
 
uint getactives_clusteroperator ()
 Get number of active clusteroperator objects. More...
 
size_t getsize_clusteroperator (pcclusteroperator co)
 Get the size of a given clusteroperator object. More...
 
void print_tree_clusteroperator (pcclusteroperator co)
 Print the tree structure of a clusteroperator. More...
 
void norm2diff_clusteroperator (pcclusteroperator co1, pcclusteroperator co2)
 Compute and print the norms and norm differences of the coefficient matrices of two cluster operators. More...
 
real compareweights_clusteroperator (pcclusteroperator co1, pcclusteroperator co2)
 Compare two cluster weights. More...
 
pclusteroperatorenumerate_clusteroperator (pccluster t, pclusteroperator co)
 Enumerate clusteroperator according to cluster tree. More...
 
void basisproduct_clusteroperator (pcclusterbasis cb1, pcclusterbasis cb2, pclusteroperator pr)
 Compute the cluster basis product $Z_t = V_{1,t}^* V_{2,t}$. More...
 

Detailed Description

Representation of cluster operators used to describe weights and transformations of cluster bases.

The clusteroperator class represents a cluster operator $(Z_t)_{t\in\mathcal{T}_{\mathcal{I}}}$ corresponding to a cluster basis $(V_t)_{t\in\mathcal{T}_{\mathcal{I}}}$ such that $Z_t$ and $V_t$ have the same number of columns.

Weight matrices for a cluster basis can be obtained using weight_clusterbasis_clusteroperator , total weight matrices for an h2matrix are available via totalweights_h2matrix.

Function Documentation

void basisproduct_clusteroperator ( pcclusterbasis  cb1,
pcclusterbasis  cb2,
pclusteroperator  pr 
)

Compute the cluster basis product $Z_t = V_{1,t}^* V_{2,t}$.

pr can only have sons if both cb1 and cb2 do. If pr is a leaf, currently either cb1 or cb2 has to be a leaf.

Parameters
cb1First cluster basis.
cb2Second cluster basis.
prTarget cluster operator.
pclusteroperator build_from_cluster_clusteroperator ( pccluster  t)

Construct a clusteroperator matching a cluster tree.

Constructs a clusteroperator for a cluster and its descendants.

Row and column numbers will be set to zero.

Parameters
tRoot cluster.
Returns
clusteroperator for t and its descendants.
pclusteroperator build_from_clusterbasis_clusteroperator ( pcclusterbasis  cb)

Construct a clusteroperator matching a clusterbasis.

Constructs a clusteroperator for a clusterbasis and its descendants.

Row numbers will be set to zero, column numbers will be set to the ranks of the corresponding cluster basis.

Parameters
cbRoot clusterbasis.
Returns
clusteroperator for cb and its descendants.
real compareweights_clusteroperator ( pcclusteroperator  co1,
pcclusteroperator  co2 
)

Compare two cluster weights.

Compare the Gramians of two cluster operators $(Z_{t,1})_t$ and $(Z_{2,t})_t$, i.e., compute $\frac{\|Z_{t,1}^* Z_{t,1} - Z_{t,2}^* Z_{t,2}\|_2} {\|Z_{t,1}^* Z_{t,1}\|_2\|_2}$ for all clusters and return the maximum. This approach makes the result invariant under orthogonal transformations applied to the rows.

Parameters
co1First clusteroperator $Z_{1,t}$.
co2Second clusteroperator $Z_{2,t}$.
Returns
Maximum of relative errors for all clusters in subtree.
void del_clusteroperator ( pclusteroperator  co)

Delete a clusteroperator object.

Releases the storage corresponding to the object. If this clusteroperator references sons, these sons are unreferenced.

Only objects with cb->refs==0 may be deleted.

Parameters
coObject to be deleted.
pclusteroperator* enumerate_clusteroperator ( pccluster  t,
pclusteroperator  co 
)

Enumerate clusteroperator according to cluster tree.

The clusteroperator elements are enumerated in an array of size t->desc. The enumeration starts with 0 assigned to the root and then proceeds with co->son[0] corresponding to the entries 1 to cb->son[0]->desc in the array and ending with co->son[sons-1] corresponding to the last t->son[sons-1]->desc entries.

Parameters
tCluster tree.
coCluster operator matching the cluster tree given by t.
Returns
Array of size t->desc containing pointers to the clusteroperator objects corresponding to co and its descendants.
uint getactives_clusteroperator ( )

Get number of active clusteroperator objects.

Returns
Number of active clusteroperator objects.
size_t getsize_clusteroperator ( pcclusteroperator  co)

Get the size of a given clusteroperator object.

Yields the total size of this object and all its descendants.

Parameters
coclusteroperator root.
Returns
Size of allocated storage in bytes.
pclusteroperator identify_son_clusterweight_clusteroperator ( pcclusteroperator  cwf,
pccluster  t 
)

Find son clusteroperator matching a given cluster.

Find a son of cwf matching the cluster t. Returns cwf if no son was found.

Parameters
cwfFather clusteroperator.
tSon cluster.
Returns
Son of cwf with cwf->son[i]->t==t if it exists and cwf otherwise.
pclusteroperator init_clusteroperator ( pclusteroperator  co,
pccluster  t 
)

Initialize a clusteroperator object.

Sets up the components of the object. If t is not a leaf, the array son is allocated, otherwise it is set to null.

Remarks
Should always be matched by a call to uninit_clusteroperator.
Parameters
coObject to be initialized.
tCorresponding cluster.
Returns
Initialized clusteroperator object.
pclusteroperator init_leaf_clusteroperator ( pclusteroperator  co,
pccluster  t 
)

Initialize a clusteroperator object for a leaf.

Sets up the components of the object. Sets son to null. If t->sons>0, this yields a partial cluster operator.

Remarks
Should always be matched by a call to uninit_clusteroperator.
Parameters
coObject to be initialized.
tCorresponding cluster.
Returns
Initialized clusteroperator object.
pclusteroperator new_clusteroperator ( pccluster  t)

Create a new clusteroperator object.

Allocates storage for the object and sets up its components.

Remarks
Should always be matched by a call to del_clusteroperator. This call happens automatically if the last object referencing this object (see ref_clusteroperator) is deleted.
Parameters
tcorresponding cluster.
Returns
Returns the newly created clusteroperator object.
pclusteroperator new_leaf_clusteroperator ( pccluster  t)

Creates a new clusteroperator object for a leaf.

Allocates storage for the object and sets up its components.

Remarks
Should always be matched by a call to del_clusteroperator. This call happens automatically if the last object referencing this object (see ref_clusteroperator) is deleted.
Parameters
tCorresponding cluster.
Returns
Returns the newly created clusteroperator object.
void norm2diff_clusteroperator ( pcclusteroperator  co1,
pcclusteroperator  co2 
)

Compute and print the norms and norm differences of the coefficient matrices of two cluster operators.

Todo:
Usually a function called norm2diff should return a value, e.g., the maximal norm, instead of printing to stdout.
Parameters
co1First clusteroperator.
co2Second clusteroperator.
void print_tree_clusteroperator ( pcclusteroperator  co)

Print the tree structure of a clusteroperator.

Parameters
coRoot clusteroperator.
void ref_clusteroperator ( pclusteroperator ptr,
pclusteroperator  co 
)

Set a pointer to a clusterbasis object, increase its reference counter, and decrease reference counter of original pointer target.

Parameters
ptrPointer to the pclusteroperator variable that will be changed.
coclusteroperator that will be referenced.
void removesons_clusteroperator ( pclusteroperator  co)

Turn this clusteroperator into a leaf.

Unreferences all sons, sets co->sons to zero and co->son to null.

Parameters
coTarget cluster operator.
void resize_clusteroperator ( pclusteroperator  co,
uint  krow,
uint  kcol 
)

Change the number of rows and columns of a cluster operator and resize cb->C accordingly.

Parameters
coCluster operator that will be changed.
krowNew number of rows.
kcolNew number of columns.
void uninit_clusteroperator ( pclusteroperator  co)

Uninitializes a clusteroperator object.

Invalidates pointers, freeing corresponding storage if appropriate, and prepares the object for deletion.

If this clusteroperator references sons, these sons are unreferenced.

Only objects with cb->refs==0 may be uninitialized.

Parameters
coObject to be uninitialized.
void unref_clusteroperator ( pclusteroperator  co)

Reduce the reference counter of a clusteroperator object.

If the reference counter reaches zero, the object is deleted.

Remarks
Use ref_clusteroperator with cb=NULL instead, since this guarantees that the pointer is properly invalidated.
Parameters
coclusteroperator that will be unreferenced.
void update_clusteroperator ( pclusteroperator  co)

Updates bookkeeping information.

This function should be called after the sons of a clusteroperator have been changed.

Remarks
This function will not update the sons recursively.
Parameters
coclusteroperator that will be updated.