H2Lib
3.0
|
Representation of a low-rank matrix in factorized form . More...
Data Structures | |
struct | _rkmatrix |
Representation of a low-rank matrix in factorized form . More... | |
Typedefs | |
typedef struct _rkmatrix | rkmatrix |
Representation of a low-rank matrix in factorized form. | |
typedef rkmatrix * | prkmatrix |
Pointer to rkmatrix object. | |
typedef const rkmatrix * | pcrkmatrix |
Pointer to constant rkmatrix object. | |
Functions | |
prkmatrix | init_rkmatrix (prkmatrix r, uint rows, uint cols, uint k) |
Initialize an rkmatrix object. More... | |
pcrkmatrix | init_sub_rkmatrix (prkmatrix r, pcrkmatrix src, uint rows, uint roff, uint cols, uint coff) |
Initialize an rkmatrix object to represent a submatrix. More... | |
void | uninit_rkmatrix (prkmatrix r) |
Uninitialize an rkmatrix object. More... | |
prkmatrix | new_rkmatrix (uint rows, uint cols, uint k) |
Create a new rkmatrix object. More... | |
pcrkmatrix | new_sub_rkmatrix (pcrkmatrix src, uint rows, uint roff, uint cols, uint coff) |
Create a new rkmatrix object representing a submatrix. More... | |
void | del_rkmatrix (prkmatrix r) |
Delete an rkmatrix object. More... | |
void | setrank_rkmatrix (prkmatrix r, uint k) |
Change the rank of an rkmatrix. More... | |
void | resize_rkmatrix (prkmatrix r, uint rows, uint cols, uint k) |
Change the size of an rkmatrix. More... | |
size_t | getsize_rkmatrix (pcrkmatrix r) |
Get size of a given rkmatrix object. More... | |
size_t | getsize_heap_rkmatrix (pcrkmatrix r) |
Get heap size of a given rkmatrix object. More... | |
prkmatrix | clone_rkmatrix (pcrkmatrix r) |
Create a copy of an rkmatrix. More... | |
void | copy_rkmatrix (bool atrans, pcrkmatrix a, prkmatrix b) |
Copy an rkmatrix into another rkmatrix. More... | |
void | scale_rkmatrix (field alpha, prkmatrix r) |
Scale an rkmatrix by a factor. More... | |
void | random_rkmatrix (prkmatrix r, uint kmax) |
Fill an rkmatrix with random values. More... | |
void | addeval_rkmatrix_avector (field alpha, pcrkmatrix r, pcavector x, pavector y) |
Multiply a low-rank matrix by a vector , . More... | |
void | addevaltrans_rkmatrix_avector (field alpha, pcrkmatrix r, pcavector x, pavector y) |
Multiply the adjoint of a low-rank matrix by a vector , . More... | |
void | mvm_rkmatrix_avector (field alpha, bool rtrans, pcrkmatrix r, pcavector x, pavector y) |
Multiply a low-rank matrix or its adjoint by a vector, or . More... | |
real | norm2_rkmatrix (pcrkmatrix R) |
Approximate the spectral norm of a matrix . More... | |
real | norm2diff_rkmatrix (pcrkmatrix a, pcrkmatrix b) |
Approximate the spectral norm of the difference of two low-rank matrices and . More... | |
uint | getrows_rkmatrix (pcrkmatrix r) |
Get the number of rows of an rkmatrix . More... | |
uint | getcols_rkmatrix (pcrkmatrix r) |
Get the number of columns of an rkmatrix . More... | |
uint | getrank_rkmatrix (pcrkmatrix r) |
Get the rank of an rkmatrix . More... | |
pamatrix | getA_rkmatrix (prkmatrix r) |
Get the factor A of an rkmatrix . More... | |
pamatrix | getB_rkmatrix (prkmatrix r) |
Get the factor B of an rkmatrix . More... | |
Representation of a low-rank matrix in factorized form .
The rkmatrix class is used to approximate admissible blocks in hierarchical matrices.
void addeval_rkmatrix_avector | ( | field | alpha, |
pcrkmatrix | r, | ||
pcavector | x, | ||
pavector | y | ||
) |
Multiply a low-rank matrix by a vector , .
The matrix is multiplied by the source vector , the result is scaled by and added to the target vector .
alpha | Scaling factor . |
r | Matrix . |
x | Source vector . |
y | Target vector . |
void addevaltrans_rkmatrix_avector | ( | field | alpha, |
pcrkmatrix | r, | ||
pcavector | x, | ||
pavector | y | ||
) |
Multiply the adjoint of a low-rank matrix by a vector , .
The adjoint is multiplied by the source vector , the result is scaled by and added to the target vector .
alpha | Scaling factor . |
r | Matrix . |
x | Source vector . |
y | Target vector . |
prkmatrix clone_rkmatrix | ( | pcrkmatrix | r | ) |
void copy_rkmatrix | ( | bool | atrans, |
pcrkmatrix | a, | ||
prkmatrix | b | ||
) |
void del_rkmatrix | ( | prkmatrix | r | ) |
Delete an rkmatrix object.
Releases the storage corresponding to the object.
r | Object to be deleted. |
uint getcols_rkmatrix | ( | pcrkmatrix | r | ) |
Get the number of columns of an rkmatrix .
r | Matrix . |
uint getrank_rkmatrix | ( | pcrkmatrix | r | ) |
Get the rank of an rkmatrix .
r | Matrix . |
uint getrows_rkmatrix | ( | pcrkmatrix | r | ) |
Get the number of rows of an rkmatrix .
r | Matrix . |
size_t getsize_heap_rkmatrix | ( | pcrkmatrix | r | ) |
Get heap size of a given rkmatrix object.
Computes the size of storage allocated for the coefficients on the heap, but not for the rkmatrix object itself. If the object uses the coefficients of another object (e.g., if it was created using new_sub_rkmatrix), no storage is required.
r | Matrix object. |
size_t getsize_rkmatrix | ( | pcrkmatrix | r | ) |
Get size of a given rkmatrix object.
Computes the size of the rkmatrix object and the storage allocated for the coefficients. If the object uses the coefficients of another object (e.g., if it was created using init_sub_rkmatrix), no coefficient storage is added.
r | Matrix object. |
Initialize an rkmatrix object.
Sets up the components of the object and allocates storage for the matrices and .
r | Object to be initialized. |
rows | Number of rows. |
cols | Number of columns. |
k | Rank. |
pcrkmatrix init_sub_rkmatrix | ( | prkmatrix | r, |
pcrkmatrix | src, | ||
uint | rows, | ||
uint | roff, | ||
uint | cols, | ||
uint | coff | ||
) |
Initialize an rkmatrix object to represent a submatrix.
Sets up the components of the object and uses part of the storage of another rkmatrix for the matrix factors, leading to a new matrix representing a submatrix of the source.
r | Object to be initialized. |
src | Source matrix. |
rows | Number of rows. |
roff | Row offset, should satisfy rows+roff<=src->rows . |
cols | Number of columns. |
coff | Column offset, should satisfy cols+coff<=src->cols . |
void mvm_rkmatrix_avector | ( | field | alpha, |
bool | rtrans, | ||
pcrkmatrix | r, | ||
pcavector | x, | ||
pavector | y | ||
) |
Multiply a low-rank matrix or its adjoint by a vector, or .
The matrix or its adjoint is multiplied by the source vector , the result is scaled by and added to the target vector .
alpha | Scaling factor . |
rtrans | Set if is to be used instead of . |
r | Matrix . |
x | Source vector . |
y | Target vector . |
Create a new rkmatrix object.
Allocates storage for the object and sets up its components.
rows | Number of rows. |
cols | Number of columns. |
k | Rank. |
pcrkmatrix new_sub_rkmatrix | ( | pcrkmatrix | src, |
uint | rows, | ||
uint | roff, | ||
uint | cols, | ||
uint | coff | ||
) |
Create a new rkmatrix object representing a submatrix.
Allocates storage for the object and uses part of the storage of another rkmatrix for the matrix factors, leading to a new matrix representing a submatrix of the source.
src | Source matrix. |
rows | Number of rows. |
roff | Row offset, should satisfy rows+roff<=src->rows . |
cols | Number of columns. |
coff | Column offset, should satisfy cols+coff<=src->cols . |
real norm2_rkmatrix | ( | pcrkmatrix | R | ) |
Approximate the spectral norm of a matrix .
The spectral norm is approximated by applying a few steps of the power iteration to the matrix and computing the square root of the resulting eigenvalue approximation.
R | Low rank matrix . |
real norm2diff_rkmatrix | ( | pcrkmatrix | a, |
pcrkmatrix | b | ||
) |
Approximate the spectral norm of the difference of two low-rank matrices and .
The spectral norm is approximated by applying a few steps of the power iteration to the matrix and computing the square root of the resulting eigenvalue approximation.
a | Low rank matrix . |
b | Low rank matrix . |
Fill an rkmatrix with random values.
r | Target matrix. |
kmax | Maximal rank. |
Change the size of an rkmatrix.
This function resizes the matrices and without preserving their contents. The caller is responsible for ensuring that these matrices are initialized properly after they have been resized.
r | Target matrix. |
rows | New number of rows. |
cols | New number of columns. |
k | New rank. |
Change the rank of an rkmatrix.
This function resizes the matrices and without preserving their contents. The caller is responsible for ensuring that these matrices are initialized properly after they have been resized.
r | Target matrix. |
k | New rank. |