Package libPyless :: Module pylessPyscesStoich :: Class Stoich
[hide private]
[frames] | no frames]

Class Stoich

source code


PySCeS stoichiometric analysis class: initialized with a stoichiometric matrix N (input)


Version: 0.1.8

Instance Methods [hide private]
 
__init__(self, input)
Initialize class variables
source code
 
AnalyseK()
Evaluate the stoichiometric matrix and calculate the nullspace using LU decomposition and backsubstitution .
source code
 
AnalyseL()
Evaluate the stoichiometric matrix and calculate the left nullspace using LU factorization and backsubstitution.
source code
 
PivotSort(a, row_vector, column_vector)
This is a sorting routine that accepts a matrix and row/colum vectors and then sorts them so that: there are no zero rows (by swapping with first non-zero row) The abs(largest) pivots are moved onto the diagonal to maintain numerical stability.
source code
 
PivotSort_initial(a, row_vector, column_vector)
This is a sorting routine that accepts a matrix and row/colum vectors and then sorts them so that: the abs(largest) pivots are moved onto the diagonal to maintain numerical stability i.e.
source code
 
PLUfactorize(a_in)
Performs an LU factorization using LAPACK D/ZGetrf.
source code
 
SplitLU(plu, row, col, t)
PLU takes the combined LU factorization computed by PLUfactorize and extracts the upper matrix.
source code
 
GetUpperMatrix(a)
Core analysis algorithm; an input is preconditioned using PivotSort_initial and then cycles of PLUfactorize and PivotSort are run until the factorization is completed.
source code
 
ScalePivots(a_one)
Given an upper triangular matrix U, this method scales the diagonal (pivot values) to one.
source code
 
BackSubstitution(res_a, row_vector, column_vector)
Jordan reduction of a scaled upper triangular matrix.
source code
 
K_split_R(R_a, row_vector, column_vector)
Using the R factorized form of the stoichiometric matrix we now form the K and Ko matrices.
source code
 
L_split_R(Nfull, R_a, row_vector, column_vector)
Takes the Gauss-Jordan factorized N^T and extract the L, Lo, conservation (I -Lo) and reduced stoichiometric matrices.
source code
 
SVD_Rank_Check(matrix=None, factor=1.0e4, resultback=0)
Calculates the dimensions of L/L0/K/K) by way of SVD and compares them to the Guass-Jordan results.
source code

Inherited from MathArrayFunc: MatrixFloatFix, MatrixValueCompare, SwapCol, SwapCold, SwapColz, SwapElem, SwapRow, SwapRowd, SwapRowz, assertRank2, castCopyAndTranspose, commonType

Class Variables [hide private]
  __stoichdiagmode__ = 0
  __TimeFormat = '%H:%M:%S'

Inherited from MathArrayFunc: LinAlgError, __doc__, array_kind, array_precision, array_type

Method Details [hide private]

AnalyseK()

source code 

Evaluate the stoichiometric matrix and calculate the nullspace using LU decomposition and backsubstitution . Generates the MCA K and Ko arrays and associated row and column vectors

Arguments: None

AnalyseL()

source code 

Evaluate the stoichiometric matrix and calculate the left nullspace using LU factorization and backsubstitution. Generates the MCA L, Lo, Nr and Conservation matrix and associated row and column vectors

Arguments: None

PivotSort(a, row_vector, column_vector)

source code 

This is a sorting routine that accepts a matrix and row/colum vectors and then sorts them so that: there are no zero rows (by swapping with first non-zero row) The abs(largest) pivots are moved onto the diagonal to maintain numerical stability. Row and column swaps are recorded in the tracking vectors.

Arguments: ========= a: the input array row_vector: row tracking vector column_vector: column tracking vector

PivotSort_initial(a, row_vector, column_vector)

source code 

This is a sorting routine that accepts a matrix and row/colum vectors and then sorts them so that: the abs(largest) pivots are moved onto the diagonal to maintain numerical stability i.e. the matrix diagonal is in descending max(abs(value)). Row and column swaps are recorded in the tracking vectors.

Arguments: ========= a: the input array row_vector: row tracking vector column_vector: column tracking vector

PLUfactorize(a_in)

source code 

Performs an LU factorization using LAPACK D/ZGetrf. Returns LU - combined factorization, IP - rowswap information and info - Getrf error control.

Arguments: ========= a_in: the matrix to be factorized

SplitLU(plu, row, col, t)

source code 

PLU takes the combined LU factorization computed by PLUfactorize and extracts the upper matrix. Returns U.

Arguments: ========= plu: LU factorization row: row tracking vector col: column tracking vector t [default=None)]: typecode argument (currently not used)

GetUpperMatrix(a)

source code 

Core analysis algorithm; an input is preconditioned using PivotSort_initial and then cycles of PLUfactorize and PivotSort are run until the factorization is completed. During this process the matrix is reordered by column swaps which emulates a full pivoting LU factorization. Returns the pivot matrix P, upper factorization U as well as the row/col tracking vectors.

Arguments: ========= a: a stoichiometric matrix

ScalePivots(a_one)

source code 

Given an upper triangular matrix U, this method scales the diagonal (pivot values) to one.

Arguments: ========= a_one: an upper triangular matrix U

BackSubstitution(res_a, row_vector, column_vector)

source code 

Jordan reduction of a scaled upper triangular matrix. The returned array is now in the form [I R] and can be used for nullspace determination. Modified row and column tracking vetors are also returned.

Arguments: ========= res_a: unitary pivot upper triangular matrix row_vector: row tracking vector column_vector: column tracking vector

K_split_R(R_a, row_vector, column_vector)

source code 

Using the R factorized form of the stoichiometric matrix we now form the K and Ko matrices. Returns the r_ipart,Komatrix,Krow,Kcolumn,Kmatrix,Korow,info

Arguments: ========= R_a: the Gauss-Jordan reduced stoichiometric matrix row_vector: row tracking vector column_vector: column tracking vector

L_split_R(Nfull, R_a, row_vector, column_vector)

source code 

Takes the Gauss-Jordan factorized N^T and extract the L, Lo, conservation (I -Lo) and reduced stoichiometric matrices. Returns: lmatrix_col_vector, lomatrix, lomatrix_row, lomatrix_co, nrmatrix, Nred_vector_row, Nred_vector_col, info

Arguments: ========= Nfull: the original stoichiometric matrix N R_a: gauss-jordan factorized form of N^T row_vector: row tracking vector column_vector: column tracking vector

SVD_Rank_Check(matrix=None, factor=1.0e4, resultback=0)

source code 

Calculates the dimensions of L/L0/K/K) by way of SVD and compares them to the Guass-Jordan results. Please note that for LARGE ill conditioned matrices the SVD can become numerically unstable when used for nullspace determinations

Arguments: ========= matrix [default=None]: the stoichiometric matrix default is self.Nmatrix factor [default=1.0e4]: factor used to calculate the 'zero pivot' mask = mach_eps*factor resultback [default=0]: return the SVD results, U, S, vh