H2Lib  3.0
Functions
h2arith

Algebraic operations with $ \mathcal H^2$-matrices. More...

Functions

ph2matrix build_from_block_lower_h2matrix (pcblock b, pclusterbasis rb, pclusterbasis cb)
 builds a lower triangular H2-matrix based on block tree b More...
 
ph2matrix build_from_block_upper_h2matrix (pcblock b, pclusterbasis rb, pclusterbasis cb)
 builds a upper triangular H2-matrix based on block tree b More...
 
void tolower_h2matrix (ph2matrix a)
 Clears all upper diagonal blocks of a h2matrix. More...
 
void add_hmatrix_h2matrix (pchmatrix a, ph2matrix B, pclusteroperator rwf, pclusteroperator cwf, ptruncmode tm, real tol)
 $ B \gets B + a $ More...
 
pamatrix convert_h2matrix_amatrix (bool atrans, pch2matrix a)
 converts an h2matrix to a new amatrix More...
 
void fastaddmul_clusterbasis_amatrix (pcclusterbasis cb, pamatrix Yt, pamatrix Y)
 computes $ Y = cb\rightarrow V \cdot Yt_{|cb\rightarrow k \times Yt\rightarrow cols} + Y $
 
prkmatrix convert_uniform_rkmatrix (bool atrans, pcuniform a)
 converts an uniform matrix $ a $ to a new rkmatrix
uses fastaddmul_clusterbasis_amatrix More...
 
phmatrix convert_h2matrix_hmatrix (pch2matrix a)
 converts an h2matrix to a new hmatrix
More...
 
prkmatrix mul_h2matrix_rkmatrix (pch2matrix a, bool btrans, pch2matrix B, real tol)
 computes $ a \cdot B $ and converts it to a new rkmatrix More...
 
void addmul_h2matrix (field alpha, pch2matrix a, bool btrans, pch2matrix B, ph2matrix C, pclusteroperator rwf, pclusteroperator cwf, ptruncmode tm, real tol)
 $ C \gets C + alpha * a * B $ More...
 
ph2matrix mul_h2matrix (field alpha, ph2matrix a, ph2matrix B, ph2matrix h2, ptruncmode tm, real tol)
 computes $ a \cdot B $ and converts it to a new h2matrix More...
 
void invert_h2matrix (ph2matrix a, pclusteroperator arwf, pclusteroperator acwf, ph2matrix B, pclusteroperator brwf, pclusteroperator bcwf, ptruncmode tm, real tol)
 $ B \gets a^{-1} $ More...
 
void lowersolve_h2matrix_avector (bool unit, bool atrans, pch2matrix a, pavector x)
 computes $ x \gets T^{-1} \cdot x $, using forward substitution More...
 
void uppersolve_h2matrix_avector (bool unit, bool atrans, pch2matrix a, pavector x)
 computes $ x \gets T^{-1} \cdot x $, using backward substitution More...
 
void lowersolve_h2matrix_amatrix (bool unit, bool atrans, pch2matrix a, bool xtrans, pamatrix X)
 computes $ X \gets T^{-1} \cdot X $ or $ X^* \gets T^{-1} \cdot X^* $, using forward substitution More...
 
void uppersolve_h2matrix_amatrix (bool unit, bool atrans, pch2matrix a, bool xtrans, pamatrix X)
 computes $ X \gets T^{-1} \cdot X $ or $ X^* \gets T^{-1} \cdot X^* $, using backward substitution More...
 
void lowersolve_amatrix_h2matrix (bool aunit, bool atrans, pcamatrix a, bool xytrans, pch2matrix X, ph2matrix Y, pclusteroperator rwf, pclusteroperator cwf, ptruncmode tm, real tol)
 computes $ Y \gets T^{-1} \cdot X $ or $ Y^* \gets T^{-1} \cdot X^* $, using forward substitution More...
 
void uppersolve_amatrix_h2matrix (bool aunit, bool atrans, pcamatrix a, bool ytrans, ph2matrix Y, pclusteroperator rwf, pclusteroperator cwf, ptruncmode tm, real tol)
 computes $ Y \gets T^{-1} \cdot Y $ or $ Y^* \gets T^{-1} \cdot Y^* $, using backward substitution More...
 
void lowersolve_h2matrix (bool aunit, bool atrans, pch2matrix a, bool xytrans, ph2matrix X, pclusteroperator xrwf, pclusteroperator xcwf, ph2matrix Y, pclusteroperator yrwf, pclusteroperator ycwf, ptruncmode tm, real tol)
 computes $ Y \gets T^{-1} \cdot X $ or $ Y^T \gets T^{-1} \cdot X^T $, using forward substitution More...
 
void uppersolve_h2matrix (bool aunit, bool atrans, pch2matrix a, bool ytrans, ph2matrix Y, pclusteroperator yrwf, pclusteroperator ycwf, ptruncmode tm, real tol)
 computes $ Y \gets T^{-1} \cdot Y $ or $ Y^T \gets T^{-1} \cdot Y^T $, using backward substitution More...
 
void lrdecomp_h2matrix (ph2matrix a, pclusteroperator arwf, pclusteroperator acwf, ph2matrix L, pclusteroperator lrwf, pclusteroperator lcwf, ph2matrix R, pclusteroperator rrwf, pclusteroperator rcwf, ptruncmode tm, real tol)
 computes the LR-decomposition $ L \cdot R \gets a $ of a, L has unit diagonal More...
 
void lrsolve_h2matrix_avector (pch2matrix L, pch2matrix R, pavector x)
 $ x \gets R^{-1} \cdot L^{-1} \cdot x $ More...
 
void init_cholesky_h2matrix (ph2matrix a, pclusteroperator*prwf, pclusteroperator*pcwf, ptruncmode tm)
 initialises a, rwf and cwf for choldecomp_h2matrix More...
 
void choldecomp_h2matrix (ph2matrix a, pclusteroperator arwf, pclusteroperator acwf, ph2matrix L, pclusteroperator lrwf, pclusteroperator lcwf, ptruncmode tm, real tol)
 computes the Cholesky decomposition $ L \cdot L^* \gets$ of a and stores the result in L and R More...
 
void cholsolve_h2matrix_avector (pch2matrix a, pavector x)
 $ x \gets L^{-*} \cdot L^{-1} \cdot x $ More...
 

Detailed Description

Algebraic operations with $ \mathcal H^2$-matrices.

Attention
This is an experimental module, not all functions have been thoroughly tested, some special cases are not yet implemented.

Function Documentation

void add_hmatrix_h2matrix ( pchmatrix  a,
ph2matrix  B,
pclusteroperator  rwf,
pclusteroperator  cwf,
ptruncmode  tm,
real  tol 
)

$ B \gets B + a $

Parameters
a: constant hmatrix
B: overwritten by $ B + a $
rwf: has to be the father of the weights of the row clusterbasis of B,
e.g. initialized by prepare_row_clusteroperator
cwf: has to be the father of the weights of the col clusterbasis of B,
e.g. initialized by prepare_col_clusteroperator
tm: options of truncation
tol: tolerance of truncation
void addmul_h2matrix ( field  alpha,
pch2matrix  a,
bool  btrans,
pch2matrix  B,
ph2matrix  C,
pclusteroperator  rwf,
pclusteroperator  cwf,
ptruncmode  tm,
real  tol 
)

$ C \gets C + alpha * a * B $

Parameters
alpha: field
a: constant h2matrix
btrans: set if B has to be transposed
B: constant h2matrix
C: overwritten by $ C + alpha * a * B $
rwf: has to be the father of the weights of the row clusterbasis of C,
e.g. initialised by prepare_row_clusteroperator
cwf: has to be the father of the weights of the col clusterbasis of C,
e.g. initialised by prepare_col_clusteroperator
tm: options of truncation
tol: tolerance of truncation
ph2matrix build_from_block_lower_h2matrix ( pcblock  b,
pclusterbasis  rb,
pclusterbasis  cb 
)

builds a lower triangular H2-matrix based on block tree b

Returns
new h2matrix a, upper diagonal blocks are set to $ \texttt{a->son} == \texttt{a->f} == \texttt{a->u} = 0 $
Parameters
b: gives the block structure
rb: the row cluster basis of the new h2matrix
cb: the column cluster basis of the new h2matrix
ph2matrix build_from_block_upper_h2matrix ( pcblock  b,
pclusterbasis  rb,
pclusterbasis  cb 
)

builds a upper triangular H2-matrix based on block tree b

Returns
new h2matrix a, lower diagonal blocks are set to $ \texttt{a->son} == \texttt{a->f} == \texttt{a->u} = 0 $
Parameters
b: gives the block structure
rb: the row cluster basis of the new h2matrix
cb: the column cluster basis of the new h2matrix
void choldecomp_h2matrix ( ph2matrix  a,
pclusteroperator  arwf,
pclusteroperator  acwf,
ph2matrix  L,
pclusteroperator  lrwf,
pclusteroperator  lcwf,
ptruncmode  tm,
real  tol 
)

computes the Cholesky decomposition $ L \cdot L^* \gets$ of a and stores the result in L and R

Parameters
a: original matrix, overwritten by auxilliary results,
e.g. initialised by init_cholesky_h2matrix
arwf: has to be the father of the weights of the row clusterbasis of a,
e.g. initialised by init_cholesky_h2matrix
acwf: has to be the father of the weights of the column clusterbasis of a,
e.g. initialised by init_cholesky_h2matrix
L: cleared (lower) H2-matrix, has to have the same block tree structure as a,
e.g. initialised by build_fromcluster_clusterbasis and build_from_block_lower_h2matrix
lrwf: has to be the father of the weights of the row clusterbasis of L,
e.g. initialised by prepare_row_clusteroperator
lcwf: has to be the father of the weights of the column clusterbasis of L,
e.g. initialised by prepare_col_clusteroperator
tm: options of truncation
tol: tolerance of truncation
void cholsolve_h2matrix_avector ( pch2matrix  a,
pavector  x 
)

$ x \gets L^{-*} \cdot L^{-1} \cdot x $

Parameters
a: L is the lower triangular part of a with non-unit diagonal
x: overwritten by $ L^{-*} \cdot L^{-1} \cdot x $
pamatrix convert_h2matrix_amatrix ( bool  atrans,
pch2matrix  a 
)

converts an h2matrix to a new amatrix

Returns
new amatrix $ B = a $
Parameters
atrans: set if a has to be transposed
a: constant h2matrix
Todo:
replace by add_h2matrix_amatrix
phmatrix convert_h2matrix_hmatrix ( pch2matrix  a)

converts an h2matrix to a new hmatrix

Returns
new hmatrix $ B = a $,
B has the same block structure as a
Parameters
aconstant h2matrix
Todo:
replace by add_h2matrix_hmatrix
prkmatrix convert_uniform_rkmatrix ( bool  atrans,
pcuniform  a 
)

converts an uniform matrix $ a $ to a new rkmatrix
uses fastaddmul_clusterbasis_amatrix

Returns
new rkmatrix $ B = a $
Parameters
atransset if $ a $ has to be transposed, i.e. $ B = a^* $
aconstant h2matrix
Todo:
replace by add_uniform_rkmatrix
void init_cholesky_h2matrix ( ph2matrix  a,
pclusteroperator prwf,
pclusteroperator pcwf,
ptruncmode  tm 
)

initialises a, rwf and cwf for choldecomp_h2matrix

Parameters
a: upper diagonal blocks are set to $ \texttt{a->son} == \texttt{a->f} == \texttt{a->u} = 0 $
prwf: *prwf is initialised by prepare_row_clusteroperator for new a
pcwf: *pcwf is initialised by prepare_col_clusteroperator for new a
tm: used in prepare_row/col_clusteroperator
void invert_h2matrix ( ph2matrix  a,
pclusteroperator  arwf,
pclusteroperator  acwf,
ph2matrix  B,
pclusteroperator  brwf,
pclusteroperator  bcwf,
ptruncmode  tm,
real  tol 
)

$ B \gets a^{-1} $

Parameters
a: original matrix, overwritten by auxilliary results
arwf: has to be the father of the weights of the row clusterbasis of a,
e.g. initialised by prepare_row_clusteroperator
acwf: has to be the father of the weights of the col clusterbasis of a,
e.g. initialised by prepare_col_clusteroperator
B: has to have zero entries and the same block tree structure as a,
e.g. initialised by build_fromcluster_clusterbasis, buildfromblock_h2matrix and clear_h2matrix
brwf: has to be the father of the weights of the row clusterbasis of B,
e.g. initialised by prepare_row_clusteroperator
bcwf: has to be the father of the weights of the col clusterbasis of B,
e.g. initialised by prepare_col_clusteroperator
tm: options of truncation
tol: tolerance of truncation
void lowersolve_amatrix_h2matrix ( bool  aunit,
bool  atrans,
pcamatrix  a,
bool  xytrans,
pch2matrix  X,
ph2matrix  Y,
pclusteroperator  rwf,
pclusteroperator  cwf,
ptruncmode  tm,
real  tol 
)

computes $ Y \gets T^{-1} \cdot X $ or $ Y^* \gets T^{-1} \cdot X^* $, using forward substitution

Parameters
aunit: set if T has unit diagonal
atrans: set if T is the transposed upper triangular part of a,
else T is the lower triangular part of a
a: constant amatrix
xytrans: set if X and Y has to be transposed
X: constant h2matrix
Y: overwritten by $ T^{-1} \cdot X $ or $ X \cdot T^{-*} $
rwf: has to be the father of the weights of the row clusterbasis of Y,
e.g. initialised by prepare_row_clusteroperator
cwf: has to be the father of the weights of the col clusterbasis of Y,
e.g. initialised by prepare_col_clusteroperator
tm: options of truncation
tol: tolerance of truncation
Todo:
((atrans == true) && (xytrans == false)) is not implemented yet
void lowersolve_h2matrix ( bool  aunit,
bool  atrans,
pch2matrix  a,
bool  xytrans,
ph2matrix  X,
pclusteroperator  xrwf,
pclusteroperator  xcwf,
ph2matrix  Y,
pclusteroperator  yrwf,
pclusteroperator  ycwf,
ptruncmode  tm,
real  tol 
)

computes $ Y \gets T^{-1} \cdot X $ or $ Y^T \gets T^{-1} \cdot X^T $, using forward substitution

Parameters
aunit: set if T has unit diagonal
atrans: set if T is the transposed upper triangular part of a,
else T is the lower triangular part of a
a: constant h2matrix
xytrans: set if X and Y has to be transposed
X: overwritten by auxilliary results
xrwf: has to be the father of the weights of the row clusterbasis of X,
e.g. initialised by prepare_row_clusteroperator
xcwf: has to be the father of the weights of the col clusterbasis of X,
e.g. initialised by prepare_col_clusteroperator
Y: overwritten by $ T^{-1} \cdot X $ or $ X \cdot T^{-*} $
yrwf: has to be the father of the weights of the row clusterbasis of R,
e.g. initialised by prepare_row_clusteroperator
ycwf: has to be the father of the weights of the col clusterbasis of R,
e.g. initialised by prepare_col_clusteroperator
tm: options of truncation
tol: tolerance of truncation
Todo:
((atrans == true) && (xtrans == false)) is not implemented yet
void lowersolve_h2matrix_amatrix ( bool  unit,
bool  atrans,
pch2matrix  a,
bool  xtrans,
pamatrix  X 
)

computes $ X \gets T^{-1} \cdot X $ or $ X^* \gets T^{-1} \cdot X^* $, using forward substitution

Parameters
unit: set if T has unit diagonal
atrans: set if T is the transposed upper triangular part of a,
else T is the lower triangular part of a
a: constant h2matrix
xtrans: set if X has to be transposed
X: overwritten by $ T^{-1} \cdot X $ or $ X \cdot T^{-*} $
void lowersolve_h2matrix_avector ( bool  unit,
bool  atrans,
pch2matrix  a,
pavector  x 
)

computes $ x \gets T^{-1} \cdot x $, using forward substitution

Parameters
unit: set if T has unit diagonal
a: constant h2matrix
atrans: set if T is the transposed upper triangular part of a,
else T is the lower triangular part of a
x: overwritten by $ T^{-1} \cdot x $
void lrdecomp_h2matrix ( ph2matrix  a,
pclusteroperator  arwf,
pclusteroperator  acwf,
ph2matrix  L,
pclusteroperator  lrwf,
pclusteroperator  lcwf,
ph2matrix  R,
pclusteroperator  rrwf,
pclusteroperator  rcwf,
ptruncmode  tm,
real  tol 
)

computes the LR-decomposition $ L \cdot R \gets a $ of a, L has unit diagonal

Parameters
a: original matrix, overwritten by auxilliary results
arwf: has to be the father of the weights of the row clusterbasis of a,
e.g. initialised by prepare_row_clusteroperator
acwf: has to be the father of the weights of the column clusterbasis of a,
e.g. initialised by prepare_col_clusteroperator
L: cleared (lower) H2-matrix, has to have the same block tree structure as a,
e.g. initialised by build_fromcluster_clusterbasis and build_from_block_lower_h2matrix
lrwf: has to be the father of the weights of the row clusterbasis of L,
e.g. initialised by prepare_row_clusteroperator
lcwf: has to be the father of the weights of the column clusterbasis of L,
e.g. initialised by prepare_col_clusteroperator
R: cleared (upper) H2-matrix, has to have the same block tree structure as a,
e.g. initialised by build_fromcluster_clusterbasis and build_from_block_upper_h2matrix
rrwf: has to be the father of the weights of the row clusterbasis of L,
e.g. initialised by prepare_row_clusteroperator
rcwf: has to be the father of the weights of the column clusterbasis of R,
e.g. initialised by prepare_col_clusteroperator
tm: options of truncation
tol: tolerance of truncation
void lrsolve_h2matrix_avector ( pch2matrix  L,
pch2matrix  R,
pavector  x 
)

$ x \gets R^{-1} \cdot L^{-1} \cdot x $

Parameters
L: L is the lower triangular part with unit diagonal
RR is the upper triangular part.
x: overwritten by $ R^{-1} \cdot L^{-1} \cdot x $
ph2matrix mul_h2matrix ( field  alpha,
ph2matrix  a,
ph2matrix  B,
ph2matrix  h2,
ptruncmode  tm,
real  tol 
)

computes $ a \cdot B $ and converts it to a new h2matrix

Returns
new h2matrix $ C = alpha \cdot a \cdot B $
Parameters
alpha: field
a: constant h2matrix
B: constant h2matrix
h2: the new h2matrix has the block structure as h2
tm: options of truncation
tol: tolerance of truncation
prkmatrix mul_h2matrix_rkmatrix ( pch2matrix  a,
bool  btrans,
pch2matrix  B,
real  tol 
)

computes $ a \cdot B $ and converts it to a new rkmatrix

Returns
new rkmatrix $ C = a \cdot B $
Parameters
a: constant h2matrix
btrans: set if B has to be transposed
B: constant h2matrix
tol: tolerance of truncation
void tolower_h2matrix ( ph2matrix  a)

Clears all upper diagonal blocks of a h2matrix.

Parameters
ah2matrix.
void uppersolve_amatrix_h2matrix ( bool  aunit,
bool  atrans,
pcamatrix  a,
bool  ytrans,
ph2matrix  Y,
pclusteroperator  rwf,
pclusteroperator  cwf,
ptruncmode  tm,
real  tol 
)

computes $ Y \gets T^{-1} \cdot Y $ or $ Y^* \gets T^{-1} \cdot Y^* $, using backward substitution

Parameters
aunit: set if T has unit diagonal
atrans: set if T is the transposed lower triangular part of a,
else T is the upper triangular part of a
a: constant amatrix
ytrans: set if Y has to be transposed
Y: overwritten by $ T^{-1} \cdot Y $ or $ Y \cdot T^{-*} $
rwf: has to be the father of the weights of the row clusterbasis of Y,
e.g. initialised by prepare_row_clusteroperator
cwf: has to be the father of the weights of the col clusterbasis of Y,
e.g. initialised by prepare_col_clusteroperator
tm: options of truncation
tol: tolerance of truncation
Todo:

not tested yet

((atrans == false) && (xytrans == true)) is not implemented yet

((atrans == true) && (xytrans == false)) is not implemented yet

void uppersolve_h2matrix ( bool  aunit,
bool  atrans,
pch2matrix  a,
bool  ytrans,
ph2matrix  Y,
pclusteroperator  yrwf,
pclusteroperator  ycwf,
ptruncmode  tm,
real  tol 
)

computes $ Y \gets T^{-1} \cdot Y $ or $ Y^T \gets T^{-1} \cdot Y^T $, using backward substitution

Parameters
aunit: set if T has unit diagonal
atrans: set if T is the transposed lower triangular part of a,
else T is the upper triangular part of a
a: constant h2matrix
ytrans: set if Y has to be transposed
Y: overwritten by $ T^{-1} \cdot Y $ or $ Y \cdot T^{-*} $
yrwf: has to be the father of the weights of the row clusterbasis of R,
e.g. initialised by prepare_row_clusteroperator
ycwf: has to be the father of the weights of the col clusterbasis of R,
e.g. initialised by prepare_col_clusteroperator
tm: options of truncation
tol: tolerance of truncation
Todo:

not tested yet

((atrans == true) && (xytrans == false)) is not implemented yet

void uppersolve_h2matrix_amatrix ( bool  unit,
bool  atrans,
pch2matrix  a,
bool  xtrans,
pamatrix  X 
)

computes $ X \gets T^{-1} \cdot X $ or $ X^* \gets T^{-1} \cdot X^* $, using backward substitution

Parameters
unit: set if T has unit diagonal
atrans: set if T is the transposed lower triangular part of a,
else T is the upper triangular part of a
a: constant h2matrix
xtrans: set if X has to be transposed
X: overwritten by $ T^{-1} \cdot X $
Todo:
not tested yet
void uppersolve_h2matrix_avector ( bool  unit,
bool  atrans,
pch2matrix  a,
pavector  x 
)

computes $ x \gets T^{-1} \cdot x $, using backward substitution

Parameters
unit: set if T has unit diagonal
a: constant h2matrix
atrans: set if T is the transposed lower triangular part of a,
else T is the upper triangular part of a
x: overwritten by $ T^{-1} \cdot x $