Cantera  2.0
Functions
BasisOptimize.cpp File Reference

Functions which calculation optimized basis of the
stoichiometric coefficient matrix (see /ref equil functions)
More...

#include "cantera/base/ct_defs.h"
#include "cantera/base/global.h"
#include "cantera/thermo/ThermoPhase.h"
#include "cantera/equil/MultiPhase.h"
#include <cstring>
Include dependency graph for BasisOptimize.cpp:

Go to the source code of this file.

Functions

static size_t amax (double *x, size_t j, size_t n)
 Finds the location of the maximum component in a double vector INPUT.
 
static int mlequ (double *c, size_t idem, size_t n, double *b, size_t m)
 Invert an nxn matrix and solve m rhs's.
 

Detailed Description

Functions which calculation optimized basis of the
stoichiometric coefficient matrix (see /ref equil functions)

Definition in file BasisOptimize.cpp.

Function Documentation

static size_t amax ( double *  x,
size_t  j,
size_t  n 
)
static

Finds the location of the maximum component in a double vector INPUT.

Parameters
xVector to search
jj <= i < n : i is the range of indices to search in X(*)
nLength of the vector
Returns
index of the greatest value on X(*) searched

Definition at line 539 of file BasisOptimize.cpp.

Referenced by Cantera::absmax().

static int mlequ ( double *  c,
size_t  idem,
size_t  n,
double *  b,
size_t  m 
)
static

Invert an nxn matrix and solve m rhs's.

Solve C X + B = 0;

This routine uses Gauss elimination and is optimized for the solution of lots of rhs's. A crude form of row pivoting is used here.

Parameters
cC is the matrix to be inverted
idemfirst dimension in the calling routine idem >= n must be true
nnumber of rows and columns in the matrix
brhs of the matrix problem
mnumber of rhs to be solved for

c[i+j*idem] = c_i_j = Matrix to be inverted: i = row number j = column number b[i+j*idem] = b_i_j = vectors of rhs's: i = row number j = column number (each column is a new rhs)

Returns
Retuns the value 1 : Matrix is singular 0 : solution is OK

The solution is returned in the matrix b.

Definition at line 580 of file BasisOptimize.cpp.

References Cantera::writelogf().