symcomprow Class Reference

#include <scr.h>

List of all members.

Public Member Functions

void add_entry (double e, long ri, long rci)
void addmat_scr (double c, symcomprow &scr)
void addresses (void)
void allocadr (long m)
void cg (double *x, double *y, long ni, double err, long &ani, double &ares, double limit, long iv)
void cg_prec (double *x, double *y, long ni, double err, long &ani, double &ares, double zero, long iv, long tprec, double par, ISolver *sdirect)
void changedecomp ()
void copy_scr (symcomprow &scr)
long decomp ()
void fillarray (gtopology *top)
void fillarray_elem (long *cn, long ndofe)
double give_entry (long ri, long rci)
long give_negm ()
void incomplete_ldl (double gamma)
void initiate (gtopology *top, long ndof, long mespr)
void localize (matrix &b, long *cn)
void localized (double *b, long *cn, long nc)
long minimize (double limit)
void mxv_scr (double *b, double *c)
void nullmat ()
void numcontr (gtopology *top)
void numcontr_elem (long *cn, long ndofe)
void prec_diag_scr (double *x, double *y)
void prec_ildl_scr (double *x, double *y)
void prec_ssor_scr (double *x, double *y, double omega)
void printdiag (FILE *out)
void printmat (FILE *out)
double rows_mult_ldl_scr (long m, long o)
void scalmat_scr (double c)
void select_submatrix (symcomprow *smscr, long nsdof, long *sdof)
void sort_and_colindex (void)
void sort_and_colindex_tko (void)
double * status ()
 symcomprow (void)
 ~symcomprow (void)

Public Attributes

double * a
 array containing nonzero entries of the matrix
long * adr
 array containing addresses of the beginnings of rows
long * adra
 auxiliary array containing addresses
long * aux
 auxiliary array containing column indices
long * ci
 array containing column indices
long decompid
 decomposition indicator
double * incdec
 array containing incomplete decomposition
double limit
 threshold for entries rejection
long n
 number of rows of the matrix
long negm
 number of entries in the global matrix

Detailed Description

class symcomprow

serves for matrix storage called symmetric compressed rows compressed rows storage is available for symmetric real matrices only non-zero matrix entries are stored row by row from the first entry in the row to the diagonal one

basic data double array a where matrix entries are stored long array ci where column indices of stored non-zero matrix entries are stored long array adr where the first row entries are stored long number n stands for number of rows (columns) of matrix long number negm stands for number of entries of matrix

basic relations array a has negm components array ci has negm components array adr has n+1 components adr[n] is equal to negm

JK

Definition at line 32 of file scr.h.


Constructor & Destructor Documentation

symcomprow ( void   ) 

Definition at line 7 of file scr.cpp.

References a, adr, adra, aux, ci, decompid, incdec, and limit.

~symcomprow ( void   ) 

Definition at line 21 of file scr.cpp.

References a, adr, adra, aux, ci, and incdec.


Member Function Documentation

void add_entry ( double  e,
long  ri,
long  rci 
)

function adds required matrix entry

Parameters:
e - matrix entry
ri,ci - row and column indices

JK, 24.7.2005

Definition at line 575 of file scr.cpp.

References a, adr, and ci.

Referenced by gmatrix::add_entry().

void addmat_scr ( double  c,
symcomprow scr 
)

function adds multiplied matrix stored in scr by coefficient c to actual matrix

Parameters:
c - multiplicative coefficient
scr - another symmetric compressed rows storage

JK

Definition at line 635 of file scr.cpp.

References a, and negm.

void addresses ( void   ) 

function computes addresses of the first entries in the rows

JK, 22.6.2001

Definition at line 197 of file scr.cpp.

References adr, adra, aux, memset(), and n.

Referenced by initiate().

void allocadr ( long  m  ) 

function allocates array containing addresses of the first entries in rows function also allocates auxiliary array

Parameters:
m - number of unknowns in solved problem

JK

Definition at line 61 of file scr.cpp.

References adr, adra, memset(), and n.

Referenced by initiate().

void cg ( double *  x,
double *  y,
long  ni,
double  err,
long &  ani,
double &  ares,
double  zero,
long  iv 
)

function solves system of linear algebraic equations by conjugate gradient method, matrix is stored as compressed rows

Parameters:
x - vector of unknowns
y - vector of right hand side
ni - maximum number of iterations
err - required error (norm of residual vector)
ani - number of performed iterations
ares - attained error (norm of residual vector)
zero - computer zero
iv - initial values indicator

iv=0 - initial vector is zero vector iv=1 - initial vector is taken from x array

JK, 17.7.2001

Definition at line 676 of file scr.cpp.

References mxv_scr(), n, p, print_warning(), and ss().

Referenced by gmatrix::solve_system().

void cg_prec ( double *  x,
double *  y,
long  ni,
double  err,
long &  ani,
double &  ares,
double  zero,
long  iv,
long  tprec,
double  par,
ISolver sdirect 
)

function solves system of linear algebraic equations by preconditioned conjugate gradient method

if incomplete decomposition preconditioner is used, matrix must be incompletely decomposed before this function is called

Parameters:
x - vector of unknowns
y - vector of right hand side
ni - maximum number of iterations
err - required error (norm of residula vector)
ani - number of computed iterations
ares - reached residual norm
zero - computer zero
iv - initial values indicator
tprec - type of preconditioner
par - preconditioning parameter

iv=0 - initial vector is assumed as zero vector iv=1 - initial vector is taken from x array

tprec=1 - diagonal (Jacobi) preconditioner tprec=10 - incomplete decomposition

par: relaxation parameter - for SSOR preconditioner weight coefficient - for incomplete decomposition

JK, 2.12.2001

Definition at line 983 of file scr.cpp.

References h(), mxv_scr(), n, p, prec_diag_scr(), prec_ildl_scr(), prec_ssor_scr(), print_err(), ISolver::Solve(), sparseindec, and ss().

Referenced by gmatrix::solve_system().

void changedecomp (  ) 

function changes indicator of decomposition (factorization)

JK

Definition at line 47 of file scr.cpp.

References decompid.

Referenced by gmatrix::solve_system().

void copy_scr ( symcomprow scr  ) 

function copies data to additional storage

Parameters:
scr - additional storage (it is filled)

JK, 29.9.2006

Definition at line 1150 of file scr.cpp.

References a, adr, ci, n, and negm.

long decomp (  ) 

function returns indicator of decomposition (factorization)

JK

Definition at line 37 of file scr.cpp.

References decompid.

Referenced by gmatrix::solve_system().

void fillarray ( gtopology top  ) 

function fills auxiliary array

Parameters:
top - pointer to general topology

param aux - auxiliary array containing column indices

JK, 22.6.2001

Definition at line 179 of file scr.cpp.

References fillarray_elem(), gtopology::give_code_numbers(), gtopology::give_ndofe(), and gtopology::ne.

Referenced by initiate().

void fillarray_elem ( long *  cn,
long  ndofe 
)

function fills auxiliary array by one element

Parameters:
cn - array containg code numbers of the element
ndofe - number of DOFs on the element

param aux - auxiliary array containing column indexes

JK, 22.6.2001

Definition at line 153 of file scr.cpp.

References adra, and aux.

Referenced by fillarray().

double give_entry ( long  ri,
long  rci 
)

function returns required matrix entry

Parameters:
ri,ci - row and column indices

JK, 24.7.2005

Definition at line 539 of file scr.cpp.

References a, adr, and ci.

Referenced by gmatrix::give_entry().

long give_negm (  ) 

function returns number of stored matrix entries

JK, 16.8.2007

Definition at line 1186 of file scr.cpp.

References negm.

Referenced by gmatrix::give_negm().

void incomplete_ldl ( double  gamma  ) 

function decomposes matrix in symmetric compressed rows storage by incomplete decomposition (factorization)

Parameters:
gamma - weight coefficient

JK, 2.12.2001

Definition at line 880 of file scr.cpp.

References a, adr, ci, incdec, n, negm, and rows_mult_ldl_scr().

Referenced by gmatrix::solve_system().

void initiate ( gtopology top,
long  ndof,
long  mespr 
)

function initiates symmetric compressed rows storage

Parameters:
top - pointer to general topology
ndof - number of rows/columns of the matrix
mespr - indicator of message printing

JK

Definition at line 516 of file scr.cpp.

References addresses(), allocadr(), fillarray(), negm, nullmat(), numcontr(), sort_and_colindex_tko(), and status().

Referenced by gmatrix::initiate().

void localize ( matrix b,
long *  cn 
)

function localizes local matrix b to the global matrix matrix b is stored as dense matrix

Parameters:
b - local matrix in row ordering
cn - array containing code numbers of element

JK, 25.6.2001

Definition at line 386 of file scr.cpp.

References a, adr, ci, ll, and matrix::m.

Referenced by gmatrix::localize().

void localized ( double *  b,
long *  cn,
long  nc 
)

function localizes local matrix b to the global matrix matrix b is stored as dense matrix

Parameters:
b - local matrix in row ordering
cn - array containing code numbers of element
n - order of matrix b (number of rows or columns)

JK, 25.6.2001

Definition at line 434 of file scr.cpp.

References a, adr, ci, and ll.

Referenced by gmatrix::localized().

long minimize ( double  limit  ) 

function rejects zero entries from the global matrix function returns number of rejected entries

Parameters:
limit - threshold for rejection

JK, 25.6.2001

Definition at line 481 of file scr.cpp.

References a, adr, adra, ci, n, and negm.

void mxv_scr ( double *  b,
double *  c 
)

function multiplies matrix by vector

Parameters:
b - array containing vector b
c - array containing resulting vector c = A.b

JK

Definition at line 610 of file scr.cpp.

References a, adr, ci, and n.

Referenced by cg(), cg_prec(), and seqfeti::lumpedprec().

void nullmat (  ) 

function fills array a by zeros

JK

Definition at line 88 of file scr.cpp.

References a, and negm.

Referenced by initiate().

void numcontr ( gtopology top  ) 

function evaluates number of contributions to the matrix

Parameters:
top - pointer to general topology

JK, 22.6.2001

Definition at line 130 of file scr.cpp.

References gtopology::give_code_numbers(), gtopology::give_ndofe(), gtopology::ne, and numcontr_elem().

Referenced by initiate().

void numcontr_elem ( long *  cn,
long  ndofe 
)

function evaluates number of contributions to the matrix from one element

Parameters:
cn - array containing code numbers of the element
ndofe - number of DOFs on the element

JK, 22.6.2001

Definition at line 106 of file scr.cpp.

References adr.

Referenced by numcontr().

void prec_diag_scr ( double *  x,
double *  y 
)

function computes preconditioned vector via Jacobi method new vector is computed from equation A.x = y, where A is diagonal matrix and contains diagonal entries of system matrix

Parameters:
x - vector of unknowns
y - vector of right hand side

JK, 2.12.2001

Definition at line 787 of file scr.cpp.

References a, adr, and n.

Referenced by cg_prec().

void prec_ildl_scr ( double *  x,
double *  y 
)

function computes preconditioned vector via incomplete decomposition new vector is computed from equation A.x = y matrix A is incompletely decomposed in scr storage

Parameters:
x - vector of unknowns
y - vector of right hand side

JK, 2.12.2001

Definition at line 919 of file scr.cpp.

References adr, ci, incdec, n, and p.

Referenced by cg_prec().

void prec_ssor_scr ( double *  x,
double *  y,
double  omega 
)

function computes preconditioned vector via SSOR method new vector is computed approximately from equation A.x = y computation is done like one step of SSOR method

Parameters:
x - vector of unknowns
y - vector of right hand side
omega - relaxation parameter

JK, 2.12.2001

Definition at line 809 of file scr.cpp.

References a, adr, ci, memset(), and n.

Referenced by cg_prec().

void printdiag ( FILE *  out  ) 

function prints diagonal entries of matrix stored in the symmetric compressed row storage scheme

Parameters:
out - output stream

JK, 17.3.2007

Definition at line 1132 of file scr.cpp.

References a, adr, and n.

Referenced by gmatrix::printdiag().

void printmat ( FILE *  out  ) 

function prints matrix in the compressed rows storage

10.10.2003, JK

Definition at line 1098 of file scr.cpp.

References a, adr, ci, n, and negm.

Referenced by gmatrix::printmat().

double rows_mult_ldl_scr ( long  m,
long  o 
)

function computes multiplication of two matrix rows in scr storage

Parameters:
m,o - row numbers, equality m>=o must be satisfied

JK, 2.12.2001

Definition at line 849 of file scr.cpp.

References adr, ci, incdec, and print_err().

Referenced by incomplete_ldl().

void scalmat_scr ( double  c  ) 

function multiplies matrix by coefficient c

Parameters:
c - multiplicative coefficient

JK

Definition at line 650 of file scr.cpp.

References a, and negm.

void select_submatrix ( symcomprow smscr,
long  nsdof,
long *  sdof 
)

Funkce vybere prvky z matice na zaklade pole sdof, kde jsou umisteny prvky, ktere se maji vybrat Podminka pouziti funkce - pole sdof je serazeno od nejmensiho kodoveho cisla po nejvetsi kodove cislo

JB, 11.10.2007

Definition at line 1201 of file scr.cpp.

References a, adr, ci, n, and negm.

Referenced by seqfeti::subdomain_matrices().

void sort_and_colindex ( void   ) 

function sortes array aux function also allocates array for matrix storage

JK, 8.7.2001

Definition at line 224 of file scr.cpp.

References a, adr, adra, aux, ci, memset(), n, and negm.

void sort_and_colindex_tko ( void   ) 

function sortes array aux function also allocates array for matrix storage

TKo according JK, 2.2.2015

Definition at line 303 of file scr.cpp.

References a, adr, adra, aux, ci, memset(), n, and negm.

Referenced by initiate().

double * status (  ) 

function returns status of array s

JK

Definition at line 78 of file scr.cpp.

References a.

Referenced by initiate().


Member Data Documentation

double* a
long* adr
long* adra

auxiliary array containing addresses

Definition at line 87 of file scr.h.

Referenced by addresses(), allocadr(), fillarray_elem(), minimize(), sort_and_colindex(), sort_and_colindex_tko(), symcomprow(), and ~symcomprow().

long* aux

auxiliary array containing column indices

Definition at line 89 of file scr.h.

Referenced by addresses(), fillarray_elem(), sort_and_colindex(), sort_and_colindex_tko(), symcomprow(), and ~symcomprow().

long* ci
long decompid

decomposition indicator

Definition at line 99 of file scr.h.

Referenced by changedecomp(), decomp(), gmatrix::prepmat(), and symcomprow().

double* incdec

array containing incomplete decomposition

Definition at line 95 of file scr.h.

Referenced by incomplete_ldl(), prec_ildl_scr(), rows_mult_ldl_scr(), symcomprow(), and ~symcomprow().

double limit

threshold for entries rejection

Definition at line 97 of file scr.h.

Referenced by symcomprow().

long n
long negm

The documentation for this class was generated from the following files:

Generated by  doxygen 1.6.2