Qucs-core  0.0.18
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes
qucs::eqnsys< nr_type_t > Class Template Reference

#include <eqnsys.h>

Public Member Functions

 eqnsys ()
 Constructor creates an unnamed instance of the eqnsys class. More...
 
 eqnsys (eqnsys &)
 
 ~eqnsys ()
 Destructor deletes the eqnsys class object. More...
 
void setAlgo (int a)
 
int getAlgo (void)
 
void passEquationSys (tmatrix< nr_type_t > *, tvector< nr_type_t > *, tvector< nr_type_t > *)
 
void solve (void)
 

Private Member Functions

void solve_inverse (void)
 
void solve_gauss (void)
 
void solve_gauss_jordan (void)
 
void solve_lu_crout (void)
 
void solve_lu_doolittle (void)
 
void factorize_lu_crout (void)
 
void factorize_lu_doolittle (void)
 
void substitute_lu_crout (void)
 
void substitute_lu_doolittle (void)
 
void solve_qr (void)
 
void solve_qr_ls (void)
 
void solve_qrh (void)
 
void factorize_qrh (void)
 
void substitute_qrh (void)
 
void factorize_qr_householder (void)
 
void substitute_qr_householder (void)
 
void substitute_qr_householder_ls (void)
 
nr_type_t householder_create_left (int)
 
void householder_apply_left (int, nr_type_t)
 
nr_type_t householder_left (int)
 
nr_type_t householder_create_right (int)
 
void householder_apply_right (int, nr_type_t)
 
void householder_apply_right_extern (int, nr_type_t)
 
nr_type_t householder_right (int)
 
nr_double_t euclidian_c (int, int r=1)
 
nr_double_t euclidian_r (int, int c=1)
 
void givens_apply_u (int, int, nr_double_t, nr_double_t)
 
void givens_apply_v (int, int, nr_double_t, nr_double_t)
 
void solve_svd (void)
 
void chop_svd (void)
 Annihilates near-zero singular values. More...
 
void factorize_svd (void)
 
void substitute_svd (void)
 
void diagonalize_svd (void)
 
void solve_iterative (void)
 
void solve_sor (void)
 
nr_double_t convergence_criteria (void)
 
void ensure_diagonal (void)
 
void ensure_diagonal_MNA (void)
 
int countPairs (int, int &, int &)
 
void preconditioner (void)
 

Private Attributes

int update
 
int algo
 
int pivoting
 
intrMap
 
intcMap
 
int N
 
nr_double_t * nPvt
 
tmatrix< nr_type_t > * A
 
tmatrix< nr_type_t > * V
 
tvector< nr_type_t > * B
 
tvector< nr_type_t > * X
 
tvector< nr_type_t > * R
 
tvector< nr_type_t > * T
 
tvector< nr_double_t > * S
 
tvector< nr_double_t > * E
 

Detailed Description

template<class nr_type_t>
class qucs::eqnsys< nr_type_t >

Definition at line 63 of file eqnsys.h.

Constructor & Destructor Documentation

template<class nr_type_t >
qucs::eqnsys< nr_type_t >::eqnsys ( )

Constructor creates an unnamed instance of the eqnsys class.

Definition at line 51 of file eqnsys.cpp.

template<class nr_type_t >
qucs::eqnsys< nr_type_t >::eqnsys ( eqnsys< nr_type_t > &  e)

The copy constructor creates a new instance of the eqnsys class based on the given eqnsys object.

Definition at line 80 of file eqnsys.cpp.

template<class nr_type_t >
qucs::eqnsys< nr_type_t >::~eqnsys ( )

Destructor deletes the eqnsys class object.

Definition at line 65 of file eqnsys.cpp.

Member Function Documentation

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::chop_svd ( void  )
private

Annihilates near-zero singular values.

Definition at line 1239 of file eqnsys.cpp.

template<class nr_type_t >
nr_double_t qucs::eqnsys< nr_type_t >::convergence_criteria ( void  )
private

The function computes the convergence criteria for iterative methods like Jacobi or Gauss-Seidel as defined by Schmidt and v.Mises.

Definition at line 692 of file eqnsys.cpp.

template<class nr_type_t >
int qucs::eqnsys< nr_type_t >::countPairs ( int  i,
int r1,
int r2 
)
private

Helper function for the above ensure_diagonal_MNA() function. It looks for the pairs of 1 and -1 on the given row and column index.

Definition at line 756 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::diagonalize_svd ( void  )
private

This function diagonalizes the upper bidiagonal matrix fromed by the diagonal S and the super-diagonal vector E. Both vectors are real valued. Thus real valued calculations even when solving a complex valued equation systems is possible except for the matrix updates of U and V'.

Definition at line 1372 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::ensure_diagonal ( void  )
private

The function tries to ensure that there are non-zero diagonal elements in the equation system matrix A. This is required for iterative solution methods.

Definition at line 706 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::ensure_diagonal_MNA ( void  )
private

The function ensures that there are non-zero diagonal elements in the equation system matrix A. It achieves this condition for non-singular matrices which have been produced by the modified nodal analysis. It takes advantage of the fact that the zero diagonal elements have pairs of 1 and -1 on the same column and row.

Definition at line 717 of file eqnsys.cpp.

template<class nr_type_t >
nr_double_t qucs::eqnsys< nr_type_t >::euclidian_c ( int  c,
int  r = 1 
)
private

The following function computes the euclidian norm of the given column vector of the matrix A starting from the given row.

Definition at line 847 of file eqnsys.cpp.

template<class nr_type_t >
nr_double_t qucs::eqnsys< nr_type_t >::euclidian_r ( int  r,
int  c = 1 
)
private

The following function computes the euclidian norm of the given row vector of the matrix A starting from the given column.

Definition at line 859 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::factorize_lu_crout ( void  )
private

This function decomposes the left hand matrix into an upper U and lower L matrix. The algorithm is called LU decomposition (Crout's definition). The function performs the actual LU decomposition of the matrix A using (implicit) partial row pivoting.

Definition at line 319 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::factorize_lu_doolittle ( void  )
private

This function decomposes the left hand matrix into an upper U and lower L matrix. The algorithm is called LU decomposition (Doolittle's definition). The function performs the actual LU decomposition of the matrix A using (implicit) partial row pivoting.

Definition at line 385 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::factorize_qr_householder ( void  )
private

The function decomposes the matrix A into two matrices, the orthonormal matrix Q and the upper triangular matrix R. The original matrix is replaced by the householder vectors in the lower triangular and the upper triangular R matrix (including the diagonal). The householder vectors are normalized to have one in their first position.

Definition at line 949 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::factorize_qrh ( void  )
private

The function decomposes the matrix A into two matrices, the orthonormal matrix Q and the upper triangular matrix R. The original matrix is replaced by the householder vectors in the lower triangular (including the diagonal) and the upper triangular R matrix with its diagonal elements stored in the R vector.

Definition at line 884 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::factorize_svd ( void  )
private

The function decomposes the matrix A into three other matrices U, S and V'. The matrix A is overwritten by the U matrix, S is stored in a separate vector and V in a separate matrix.

Definition at line 1278 of file eqnsys.cpp.

template<class nr_type_t>
int qucs::eqnsys< nr_type_t >::getAlgo ( void  )
inline

Definition at line 70 of file eqnsys.h.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::givens_apply_u ( int  c1,
int  c2,
nr_double_t  c,
nr_double_t  s 
)
private

Definition at line 1345 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::givens_apply_v ( int  r1,
int  r2,
nr_double_t  c,
nr_double_t  s 
)
private

Definition at line 1356 of file eqnsys.cpp.

template<class nr_type_t>
void qucs::eqnsys< nr_type_t >::householder_apply_left ( int  c,
nr_type_t  t 
)
private

Applies the householder vector stored in the given column to the right-hand columns using the given normalization factor.

Definition at line 1173 of file eqnsys.cpp.

template<class nr_type_t>
void qucs::eqnsys< nr_type_t >::householder_apply_right ( int  r,
nr_type_t  t 
)
private

Applies the householder vector stored in the given row to the downward rows using the given normalization factor.

Definition at line 1190 of file eqnsys.cpp.

template<class nr_type_t>
void qucs::eqnsys< nr_type_t >::householder_apply_right_extern ( int  r,
nr_type_t  t 
)
private

The function does exactly the same as householder_apply_right() except that it applies the householder transformations to another matrix.

Definition at line 1214 of file eqnsys.cpp.

template<class nr_type_t >
nr_type_t qucs::eqnsys< nr_type_t >::householder_create_left ( int  c)
private

The function creates the left-hand householder vector for a given column which eliminates the column except the first element. The householder vector is normalized to have one in the first position. The diagonal element is replaced by the applied householder vector and the vector itself is located in the free matrix positions. The function returns the normalization factor.

Definition at line 1091 of file eqnsys.cpp.

template<class nr_type_t >
nr_type_t qucs::eqnsys< nr_type_t >::householder_create_right ( int  r)
private

The function creates the right-hand householder vector for a given row which eliminates the row except the first element. The householder vector is normalized to have one in the first position. The super-diagonal element is replaced by the applied householder vector and the vector itself is located in the free matrix positions. The function returns the normalization factor.

Definition at line 1149 of file eqnsys.cpp.

template<class nr_type_t >
nr_type_t qucs::eqnsys< nr_type_t >::householder_left ( int  c)
private

The function computes a Householder vector to zero-out the matrix entries in the given column, stores it in the annihilated vector space (in a packed form) and applies the transformation to the remaining right-hand columns.

Definition at line 1117 of file eqnsys.cpp.

template<class nr_type_t >
nr_type_t qucs::eqnsys< nr_type_t >::householder_right ( int  r)
private

The function computes a Householder vector to zero-out the matrix entries in the given row, stores it in the annihilated vector space (in a packed form) and applies the transformation to the remaining downward rows.

Definition at line 1132 of file eqnsys.cpp.

template<class nr_type_t>
void qucs::eqnsys< nr_type_t >::passEquationSys ( tmatrix< nr_type_t > *  nA,
tvector< nr_type_t > *  refX,
tvector< nr_type_t > *  nB 
)

With this function the describing matrices for the equation system is passed to the equation system solver class. Matrix A is the left hand side of the equation system and B the right hand side vector. The reference pointer to the X vector is going to be the solution vector. The B vector will be locally copied.

Definition at line 99 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::preconditioner ( void  )
private

The function tries to raise the absolute value of diagonal elements by swapping rows and thereby make the A matrix diagonally dominant.

Definition at line 777 of file eqnsys.cpp.

template<class nr_type_t>
void qucs::eqnsys< nr_type_t >::setAlgo ( int  a)
inline

Definition at line 69 of file eqnsys.h.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::solve ( void  )

Depending on the algorithm applied to the equation system solver the function stores the solution of the system into the matrix pointed to by the X matrix reference.

Definition at line 124 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::solve_gauss ( void  )
private

The function solves the equation system applying Gaussian elimination with full column pivoting only (no row pivoting).

Definition at line 194 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::solve_gauss_jordan ( void  )
private

The function solves the equation system applying a modified Gaussian elimination with full column pivoting only (no row pivoting).

Definition at line 234 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::solve_inverse ( void  )
private

Simple matrix inversion is used to solve the equation system.

Definition at line 183 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::solve_iterative ( void  )
private

The function solves the equation system using a full-step iterative method (called Jacobi's method) or a single-step method (called Gauss-Seidel) depending on the given algorithm. If the current X vector (the solution vector) is the solution within a Newton-Raphson iteration it is a good initial guess and the method is very likely to converge. On divergence the method falls back to LU decomposition.

Definition at line 509 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::solve_lu_crout ( void  )
private

The function uses LU decomposition and the appropriate forward and backward substitutions in order to solve the linear equation system. It is very useful when dealing with equation systems where the left hand side (the A matrix) does not change but the right hand side (the B vector) only.

Definition at line 288 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::solve_lu_doolittle ( void  )
private

The other LU decomposition.

Definition at line 302 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::solve_qr ( void  )
private

This function uses the QR decomposition using householder transformations in order to solve the given equation system.

Definition at line 811 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::solve_qr_ls ( void  )
private

The function uses the QR decomposition using householder transformations in order to solve the given under-determined equation system in its minimum norm (least square) sense.

Definition at line 820 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::solve_qrh ( void  )
private

This function uses the QR decomposition using householder transformations in order to solve the given equation system.

Definition at line 803 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::solve_sor ( void  )
private

The function solves the linear equation system using a single-step iterative algorithm. It is a modification of the Gauss-Seidel method and is called successive over relaxation. The function uses an adaptive scheme to adjust the relaxation parameter.

Definition at line 598 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::solve_svd ( void  )
private

This function solves the equation system AX = B using the singular value decomposition (Golub-Reinsch-SVD).

Definition at line 1231 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::substitute_lu_crout ( void  )
private

The function is used in order to run the forward and backward substitutions using the LU decomposed matrix (Crout's definition - Uii are ones).

Definition at line 456 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::substitute_lu_doolittle ( void  )
private

The function is used in order to run the forward and backward substitutions using the LU decomposed matrix (Doolittle's definition - Lii are ones). This function is here because of transposed LU matrices as used in the AC noise analysis.

Definition at line 481 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::substitute_qr_householder ( void  )
private

The function uses the householder vectors in order to compute Q'B, then the equation system RX = B is solved by backward substitution.

Definition at line 1024 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::substitute_qr_householder_ls ( void  )
private

The function uses the householder vectors in order to the solve the equation system R'X = B by forward substitution, then QX is computed to obtain the least square solution of the under-determined equation system AX = B.

Definition at line 1054 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::substitute_qrh ( void  )
private

The function uses the householder vectors in order to compute Q'B, then the equation system RX = B is solved by backward substitution.

Definition at line 998 of file eqnsys.cpp.

template<class nr_type_t >
void qucs::eqnsys< nr_type_t >::substitute_svd ( void  )
private

The function uses the singular value decomposition A = USV' to solve the equation system AX = B by simple matrix multiplications. Remember that the factorization actually computed U, S and V'.

Definition at line 1252 of file eqnsys.cpp.

Field Documentation

template<class nr_type_t>
tmatrix<nr_type_t>* qucs::eqnsys< nr_type_t >::A
private

Definition at line 84 of file eqnsys.h.

template<class nr_type_t>
int qucs::eqnsys< nr_type_t >::algo
private

Definition at line 77 of file eqnsys.h.

template<class nr_type_t>
tvector<nr_type_t>* qucs::eqnsys< nr_type_t >::B
private

Definition at line 86 of file eqnsys.h.

template<class nr_type_t>
int* qucs::eqnsys< nr_type_t >::cMap
private

Definition at line 80 of file eqnsys.h.

template<class nr_type_t>
tvector<nr_double_t>* qucs::eqnsys< nr_type_t >::E
private

Definition at line 91 of file eqnsys.h.

template<class nr_type_t>
int qucs::eqnsys< nr_type_t >::N
private

Definition at line 81 of file eqnsys.h.

template<class nr_type_t>
nr_double_t* qucs::eqnsys< nr_type_t >::nPvt
private

Definition at line 82 of file eqnsys.h.

template<class nr_type_t>
int qucs::eqnsys< nr_type_t >::pivoting
private

Definition at line 78 of file eqnsys.h.

template<class nr_type_t>
tvector<nr_type_t>* qucs::eqnsys< nr_type_t >::R
private

Definition at line 88 of file eqnsys.h.

template<class nr_type_t>
int* qucs::eqnsys< nr_type_t >::rMap
private

Definition at line 79 of file eqnsys.h.

template<class nr_type_t>
tvector<nr_double_t>* qucs::eqnsys< nr_type_t >::S
private

Definition at line 90 of file eqnsys.h.

template<class nr_type_t>
tvector<nr_type_t>* qucs::eqnsys< nr_type_t >::T
private

Definition at line 89 of file eqnsys.h.

template<class nr_type_t>
int qucs::eqnsys< nr_type_t >::update
private

Definition at line 76 of file eqnsys.h.

template<class nr_type_t>
tmatrix<nr_type_t>* qucs::eqnsys< nr_type_t >::V
private

Definition at line 85 of file eqnsys.h.

template<class nr_type_t>
tvector<nr_type_t>* qucs::eqnsys< nr_type_t >::X
private

Definition at line 87 of file eqnsys.h.


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