H2Lib  3.0
Data Structures | Typedefs | Functions
amatrix.h File Reference
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include "basic.h"
#include "settings.h"
#include "blas.h"
#include "avector.h"
#include "realavector.h"
#include "krylov.h"

Go to the source code of this file.

Data Structures

struct  _amatrix
 Representation of a matrix as an array in column-major order. More...
 

Typedefs

typedef struct _amatrix amatrix
 Representation of a matrix as a column-order array.
 
typedef amatrixpamatrix
 Pointer to amatrix object.
 
typedef const amatrixpcamatrix
 Pointer to constant amatrix object.
 

Functions

pamatrix init_amatrix (pamatrix a, uint rows, uint cols)
 Initialize an amatrix object. More...
 
pamatrix init_sub_amatrix (pamatrix a, pamatrix src, uint rows, uint roff, uint cols, uint coff)
 Initialize an amatrix object to represent a submatrix. More...
 
pamatrix init_vec_amatrix (pamatrix a, pavector src, uint rows, uint cols)
 Initialize an amatrix object by a vector. More...
 
pamatrix init_pointer_amatrix (pamatrix a, pfield src, uint rows, uint cols)
 Initialize an amatrix object using a given array for the coefficients. More...
 
pamatrix init_zero_amatrix (pamatrix a, uint rows, uint cols)
 Initialize an amatrix object and set it to zero. More...
 
pamatrix init_identity_amatrix (pamatrix a, uint rows, uint cols)
 Initialize an amatrix object and set it to identity. More...
 
void uninit_amatrix (pamatrix a)
 Uninitialize an amatrix object. More...
 
pamatrix new_amatrix (uint rows, uint cols)
 Create a new amatrix object. More...
 
pamatrix new_sub_amatrix (pamatrix src, uint rows, uint roff, uint cols, uint coff)
 Create a new amatrix object representing a submatrix. More...
 
pamatrix new_pointer_amatrix (field *src, uint rows, uint cols)
 Create a new amatrix object using a given array for the coefficients. More...
 
pamatrix new_zero_amatrix (uint rows, uint cols)
 Create a new amatrix object representing a zero matrix. More...
 
pamatrix new_identity_amatrix (uint rows, uint cols)
 Create a new amatrix object representing the identity. More...
 
void del_amatrix (pamatrix a)
 Delete an amatrix object. More...
 
void resize_amatrix (pamatrix a, uint rows, uint cols)
 Change the dimensions of an amatrix object without preserving its coefficients. More...
 
void resizecopy_amatrix (pamatrix a, uint rows, uint cols)
 Change the dimensions of an amatrix object while preserving as many of its coefficients as possible. More...
 
field getentry_amatrix (pcamatrix a, uint row, uint col)
 Read a matrix entry $a_{ij}$. More...
 
void setentry_amatrix (pamatrix a, uint row, uint col, field x)
 Set a matrix entry, $a_{ij}\gets x$. More...
 
field addentry_amatrix (pamatrix a, uint row, uint col, field x)
 Add to a matrix entry, $a_{ij} \gets a_{ij} + x$. More...
 
uint getactives_amatrix ()
 Get number of currently initialized amatrix objects. More...
 
size_t getsize_amatrix (pcamatrix a)
 Get size of a given amatrix object. More...
 
size_t getsize_heap_amatrix (pcamatrix a)
 Get heap size of a given amatrix object. More...
 
void clear_amatrix (pamatrix a)
 Set a matrix to zero. More...
 
void clear_lower_amatrix (pamatrix a, bool strict)
 Set the lower triangular part of a matrix to zero. More...
 
void clear_upper_amatrix (pamatrix a, bool strict)
 Set the upper triangular part of a matrix to zero. More...
 
void identity_amatrix (pamatrix a)
 Set a matrix to identity. More...
 
void random_amatrix (pamatrix a)
 Fill a matrix with random values. More...
 
void random_invertible_amatrix (pamatrix a, real alpha)
 Fill a square matrix with random values and ensure that it is invertible. More...
 
void random_selfadjoint_amatrix (pamatrix a)
 Fill a matrix with random values and ensure that it is self-adjoint. More...
 
void random_spd_amatrix (pamatrix a, real alpha)
 Fill a matrix with random values and ensure that it is positive definite. More...
 
void copy_amatrix (bool atrans, pcamatrix a, pamatrix b)
 Copy a matrix into another matrix, $B \gets A$ or $B \gets A^*$. More...
 
void copy_colpiv_amatrix (bool atrans, pcamatrix a, const uint *colpiv, pamatrix b)
 Copy a matrix into another matrix, permuting the columns, i.e., $B \gets A P_\pi$ or $B \gets (A P_\pi)^*$. More...
 
pamatrix clone_amatrix (pcamatrix src)
 Create a duplicate of an existing amatrix. More...
 
void copy_sub_amatrix (bool atrans, pcamatrix a, pamatrix b)
 Copy a matrix into another matrix, $B \gets A$ or $B \gets A^*$. More...
 
void print_amatrix (pcamatrix a)
 Print a matrix. More...
 
void print_matlab_amatrix (pcamatrix a)
 Print a matrix in Matlab format. More...
 
real check_ortho_amatrix (bool atrans, pcamatrix a)
 Check whether a matrix $A$ or its adjoint $A^*$ is isometric. More...
 
void scale_amatrix (field alpha, pamatrix a)
 Scale a matrix $A$ by a factor $\alpha$, $A \gets \alpha A$. More...
 
void conjugate_amatrix (pamatrix a)
 compute the complex conjugate $ \bar A $ of a matrix $ A $. More...
 
field dotprod_amatrix (pcamatrix a, pcamatrix b)
 Compute the Frobenius inner product $\langle A, B \rangle_F$ of two matrices $A$ and $B$. More...
 
real norm2_amatrix (pcamatrix A)
 Approximate the spectral norm $\|A\|_2$ of a matrix $A$. More...
 
real normfrob_amatrix (pcamatrix a)
 Compute the Frobenius norm $\|A\|_F$ of a matrix $A$. More...
 
real normfrob2_amatrix (pcamatrix a)
 Compute the squared Frobenius norm $\|A\|_F^2$ of a matrix $A$. More...
 
real norm2diff_amatrix (pcamatrix a, pcamatrix b)
 Approximate the spectral norm $\|A-B\|_2$ of the difference of two matrices $A$ and $B$. More...
 
void addeval_amatrix_avector (field alpha, pcamatrix a, pcavector src, pavector trg)
 Multiply a matrix $A$ by a vector $x$, $y \gets y + \alpha A x$. More...
 
void addevaltrans_amatrix_avector (field alpha, pcamatrix a, pcavector src, pavector trg)
 Multiply the adjoint of a matrix $A$ by a vector $x$, $y \gets y + \alpha A^* x$. More...
 
void mvm_amatrix_avector (field alpha, bool atrans, pcamatrix a, pcavector src, pavector trg)
 Multiply a matrix $A$ or its adjoint $A^*$ by a vector, $y \gets y + \alpha A x$ or $y \gets y + \alpha A^* x$. More...
 
void add_amatrix (field alpha, bool atrans, pcamatrix a, pamatrix b)
 Add two matrices, $B \gets B + \alpha A$ or $B \gets B + \alpha A^*$. More...
 
void addmul_amatrix (field alpha, bool atrans, pcamatrix a, bool btrans, pcamatrix b, pamatrix c)
 Multiply two matrices, $C \gets C + \alpha A B$, $C \gets C + \alpha A^* B$, $C \gets C + \alpha A B^*$ or $C \gets C + \alpha A^* B^*$. More...
 
void bidiagmul_amatrix (field alpha, bool atrans, pamatrix a, pcavector d, pcavector l)
 Multiply a matrix by a bidiagonal matrix, $A \gets \alpha A L$ or $A \gets \alpha L^* A$. More...
 

Detailed Description

Author
Steffen Börm