#include <matrix.h>
Collaboration diagram for Matrix:

Public Member Functions | |
| Matrix (uint n, uint size) | |
| ~Matrix () | |
| void | zero () |
| void | setUse (const uint i, const uint j, Map::e_type type, bool big) |
| void | setUse_b (const uint i, const uint j, Map::e_type type, bool big) |
| void | setUse_c (const uint i, const uint j, Map::e_type type, bool big) |
| void | setUse_d (const uint i, const uint j, Map::e_type type, bool big) |
| void | createMap () |
| bool | isChanged () const |
| void | performLU () |
| void | fbSub (QuickVector *x) |
| void | displayMatrix () |
| void | displayLU () |
| double & | g (uint i, uint j) |
| double & | b (uint i, uint j) |
| double & | c (uint i, uint j) |
| double & | d (uint i, uint j) |
| const double | g (uint i, uint j) const |
| const double | b (uint i, uint j) const |
| const double | c (uint i, uint j) const |
| const double | d (uint i, uint j) const |
| const double | m (uint i, uint j) const |
| void | multiply (QuickVector *rhs, QuickVector *result) |
| void | operator= (Matrix *const m) |
| void | operator+= (Matrix *const m) |
This class performs matrix storage, lu decomposition, forward and backward substitution, and a few other useful operations. Steps in using class: (1) Create an instance of this class with the correct size (2) Define the matrix pattern as neccessary: (1) Call zero (unnecessary after initial ceration) to reset the pattern & matrix (2) Call setUse to set the use of each element in the matrix (3) Call createMap to generate the row-wise permutation mapping for use in partial pivoting (3) Add the values to the matrix (4) Call performLU, and get the results with fbSub (5) Repeat 2, 3, 4 or 5 as necessary.
Definition at line 78 of file matrix.h.
| Matrix::Matrix | ( | uint | n, | |
| uint | size | |||
| ) |
Creates a size x size square matrix m, with all values zero, and a right side vector x of size m+n
Definition at line 24 of file matrix.cpp.
References zero().
| void Matrix::zero | ( | ) |
Sets all elements to zero
Definition at line 42 of file matrix.cpp.
References QuickMatrix::fillWithZero().
Referenced by Matrix().
| void Matrix::setUse | ( | const uint | i, | |
| const uint | j, | |||
| Map::e_type | type, | |||
| bool | big | |||
| ) |
Sets the type of (matrix-) element at the position i, j.
| type | Describes how often the value changes | |
| big | Set this true if the value is likely to be >= 1, else false |
Definition at line 52 of file matrix.cpp.
References Map::setUse().
Referenced by Resistance::add_map(), LogicOut::add_map(), Diode::add_map(), Capacitance::add_map(), BJT::add_map(), setUse_b(), setUse_c(), and setUse_d().
| void Matrix::createMap | ( | ) |
Generates the row-wise permutation mapping from the values set by setUse
Definition at line 57 of file matrix.cpp.
References Map::createMap().
Referenced by ElementSet::createMatrixMap().
| bool Matrix::isChanged | ( | ) | const [inline] |
Returns true if the matrix is changed since last calling performLU()
Definition at line 117 of file matrix.h.
Referenced by ElementSet::doLinear(), and Circuit::doNonLogic().
| void Matrix::performLU | ( | ) |
Performs LU decomposition. Going along the rows, the value of the decomposed LU matrix depends only on the previous values.
Definition at line 111 of file matrix.cpp.
Referenced by ElementSet::doLinear(), and ElementSet::doNonLinear().
| void Matrix::fbSub | ( | QuickVector * | x | ) |
Applies the right side vector (x) to the decomposed matrix, with the solution returned in x.
Definition at line 151 of file matrix.cpp.
References b().
Referenced by ElementSet::doLinear(), and ElementSet::doNonLinear().
| void Matrix::displayMatrix | ( | ) |
Prints the matrix to stdout
Definition at line 198 of file matrix.cpp.
References QuickMatrix::dumpToAux().
| void Matrix::displayLU | ( | ) |
Prints the LU-decomposed matrix to stdout
Definition at line 203 of file matrix.cpp.
References QuickMatrix::dumpToAux().
Referenced by ElementSet::displayEquations().
| double& Matrix::g | ( | uint | i, | |
| uint | j | |||
| ) | [inline] |
Sets the element matrix at row i, col j to value x
Definition at line 140 of file matrix.h.
Referenced by Element::A_g(), b(), c(), d(), and ElementSet::displayEquations().
| const double Matrix::m | ( | uint | i, | |
| uint | j | |||
| ) | const [inline] |
Returns the value of matrix at row i, col j.
Definition at line 161 of file matrix.h.
Referenced by operator+=(), and operator=().
| void Matrix::multiply | ( | QuickVector * | rhs, | |
| QuickVector * | result | |||
| ) |
Multiplies this matrix by the Vector rhs, and places the result in the vector pointed to by result. Will fail if wrong size.
Definition at line 186 of file matrix.cpp.
References QuickVector::fillWithZeros().
Referenced by ElementSet::doLinear(), and ElementSet::doNonLinear().
| void Matrix::operator= | ( | Matrix *const | m | ) |
Sets the values of this matrix to that of the given matrix
Definition at line 91 of file matrix.cpp.
References m().
| void Matrix::operator+= | ( | Matrix *const | m | ) |
Adds the values of the given matrix to this matrix
Definition at line 104 of file matrix.cpp.
References m().
1.5.1