scsolver::numeric::Matrix Class Reference

#include <matrix.hxx>

List of all members.

Public Types

typedef
::boost::numeric::ublas::matrix
< double,
::boost::numeric::ublas::row_major,
::std::vector
< double > > 
NumericMatrixType
typedef
::boost::numeric::ublas::matrix
< ::std::string > 
StringMatrixType

Public Member Functions

 Matrix ()
 Matrix (size_t row, size_t col, bool identity_matrix=false)
 Matrix (const Matrix &)
 Matrix (const Matrix *)
 Matrix (::boost::numeric::ublas::matrix< double >)
 ~Matrix () throw ()
void setResizable (bool resizable)
void swap (Matrix &) throw ()
void clear ()
void copy (const Matrix &)
Matrix clone () const
const double getValue (size_t row, size_t col) const
double & getValue (size_t row, size_t col)
void setValue (size_t row, size_t col, double val)
StringMatrixType getDisplayElements (int prec, size_t colspace, bool formula) const
void print (size_t prec=2, size_t colspace=1) const
Matrix getColumn (size_t col)
Matrix getRow (size_t row)
void deleteColumn (size_t)
void deleteColumns (const std::vector< size_t > &)
void deleteRow (size_t)
void deleteRows (const std::vector< size_t > &)
double det () const
const Matrix inverse () const
const Matrix trans () const
double minors (size_t, size_t) const
void resize (size_t row, size_t col)
size_t rows () const
size_t cols () const
bool empty () const
bool isRowEmpty (size_t) const
bool isColumnEmpty (size_t) const
bool isSameSize (const Matrix &) const
bool isSquare () const
Matrixoperator= (const Matrix &)
const Matrix operator+ (const Matrix &) const
const Matrix operator- (const Matrix &) const
const Matrix operator * (double) const
const Matrix operator * (const Matrix &) const
const Matrix operator/ (double) const
Matrixoperator+= (const Matrix &)
Matrixoperator+= (double)
Matrixoperator-= (const Matrix &)
Matrixoperator *= (double)
Matrixoperator/= (double)
const double operator() (size_t row, size_t col) const
double & operator() (size_t row, size_t col)
bool operator== (const Matrix &) const
bool operator!= (const Matrix &) const

Private Member Functions

const Matrix adj () const
double cofactor (size_t, size_t) const
void maybeExpand (size_t row, size_t col)
void throwIfEmpty () const

Private Attributes

bool m_bResizable
NumericMatrixType m_aArray


Detailed Description

Definition at line 80 of file matrix.hxx.


Member Typedef Documentation

typedef ::boost::numeric::ublas::matrix<double, ::boost::numeric::ublas::row_major, ::std::vector<double> > scsolver::numeric::Matrix::NumericMatrixType

Definition at line 84 of file matrix.hxx.

typedef ::boost::numeric::ublas::matrix< ::std::string > scsolver::numeric::Matrix::StringMatrixType

Definition at line 85 of file matrix.hxx.


Constructor & Destructor Documentation

scsolver::numeric::Matrix::Matrix (  ) 

Definition at line 373 of file matrix.cxx.

References m_aArray.

scsolver::numeric::Matrix::Matrix ( size_t  row,
size_t  col,
bool  identity_matrix = false 
)

Definition at line 380 of file matrix.cxx.

References m_aArray.

scsolver::numeric::Matrix::Matrix ( const Matrix other  ) 

Definition at line 397 of file matrix.cxx.

scsolver::numeric::Matrix::Matrix ( const Matrix p  ) 

Definition at line 403 of file matrix.cxx.

scsolver::numeric::Matrix::Matrix ( ::boost::numeric::ublas::matrix< double >   ) 

scsolver::numeric::Matrix::~Matrix (  )  throw ()

Definition at line 414 of file matrix.cxx.


Member Function Documentation

void scsolver::numeric::Matrix::setResizable ( bool  resizable  ) 

Definition at line 418 of file matrix.cxx.

References m_bResizable.

Referenced by getColumn(), getRow(), inverse(), minors(), and scsolver::numeric::lp::BaseAlgorithmImpl::setCanonicalSolution().

void scsolver::numeric::Matrix::swap ( Matrix other  )  throw ()

Definition at line 423 of file matrix.cxx.

References m_aArray, and m_bResizable.

Referenced by scsolver::numeric::lp::BoundedRevisedSimplexImpl::buildInitialVars(), scsolver::numeric::nlp::QuasiNewtonImpl::calcDefMatrix(), copy(), operator+=(), operator=(), scsolver::numeric::lp::BaseAlgorithmImpl::setCanonicalSolution(), scsolver::numeric::lp::BaseAlgorithmImpl::setSolution(), scsolver::numeric::lp::UnoAlgorithmImpl::solve(), scsolver::numeric::lp::LpSolveImpl::solve(), scsolver::LpModelBuilderImpl::stripConstConstraint(), scsolver::LpModelBuilderImpl::stripZeroCostDecisionVar(), and scsolver::numeric::nlp::updateCoordinateVectors().

void scsolver::numeric::Matrix::clear (  ) 

Definition at line 429 of file matrix.cxx.

References m_aArray.

Referenced by scsolver::numeric::lp::BoundedRevisedSimplexImpl::initialize(), scsolver::numeric::nlp::QuasiNewtonImpl::solve(), and scsolver::numeric::lp::RevisedSimplexImpl::solve().

void scsolver::numeric::Matrix::copy ( const Matrix other  ) 

Definition at line 434 of file matrix.cxx.

References swap().

Matrix scsolver::numeric::Matrix::clone (  )  const

Definition at line 440 of file matrix.cxx.

const double scsolver::numeric::Matrix::getValue ( size_t  row,
size_t  col 
) const

Definition at line 446 of file matrix.cxx.

References m_aArray.

Referenced by det(), getColumn(), getRow(), minors(), operator *(), operator!=(), operator()(), operator+(), operator+=(), operator-(), and operator/().

double & scsolver::numeric::Matrix::getValue ( size_t  row,
size_t  col 
)

Definition at line 458 of file matrix.cxx.

References m_aArray.

void scsolver::numeric::Matrix::setValue ( size_t  row,
size_t  col,
double  val 
)

Definition at line 470 of file matrix.cxx.

References m_aArray, and maybeExpand().

Referenced by adj(), minors(), operator *(), operator+(), operator+=(), operator-(), and operator/().

Matrix::StringMatrixType scsolver::numeric::Matrix::getDisplayElements ( int  prec,
size_t  colspace,
bool  formula 
) const

Definition at line 879 of file matrix.cxx.

References m_aArray, and scsolver::repeatString().

Referenced by print(), and scsolver::numeric::lp::ModelImpl::print().

void scsolver::numeric::Matrix::print ( size_t  prec = 2,
size_t  colspace = 1 
) const

Print the content of a matrix in to standard output.

Parameters:
prec desired precision
colspace desired column space for each column.

Definition at line 974 of file matrix.cxx.

References getDisplayElements(), and scsolver::repeatString().

Referenced by scsolver::numeric::lp::BoundedRevisedSimplexImpl::buildInitialVars(), scsolver::numeric::nlp::QuasiNewtonImpl::calcDefMatrix(), scsolver::numeric::lp::BoundedRevisedSimplexImpl::calculateNewX(), scsolver::numeric::nlp::QuasiNewtonImpl::evaluateFunc(), scsolver::numeric::lp::BoundedRevisedSimplexImpl::initialize(), scsolver::numeric::lp::RevisedSimplexImpl::iterate(), scsolver::numeric::lp::BoundedRevisedSimplexImpl::printIterateHeader(), scsolver::numeric::lp::RevisedSimplexImpl::printIterateHeader(), scsolver::numeric::nlp::QuasiNewtonImpl::runIteration(), scsolver::numeric::QuadFitLineSearch::solve(), scsolver::numeric::lp::BoundedRevisedSimplexImpl::solve(), scsolver::numeric::lp::RevisedSimplexImpl::solve(), scsolver::LpModelBuilderImpl::stripZeroCostDecisionVar(), and scsolver::numeric::nlp::updateCoordinateVectors().

Matrix scsolver::numeric::Matrix::getColumn ( size_t  col  ) 

Definition at line 476 of file matrix.cxx.

References getValue(), rows(), and setResizable().

Referenced by scsolver::numeric::lp::BoundedRevisedSimplexImpl::calculateNewX(), scsolver::numeric::lp::RevisedSimplexImpl::iterate(), and scsolver::numeric::lp::BoundedRevisedSimplexImpl::queryEnteringNBVar().

Matrix scsolver::numeric::Matrix::getRow ( size_t  row  ) 

Definition at line 486 of file matrix.cxx.

References cols(), getValue(), and setResizable().

void scsolver::numeric::Matrix::deleteColumn ( size_t  nColId  ) 

Definition at line 496 of file matrix.cxx.

References scsolver::Debug(), and m_aArray.

Referenced by deleteColumns().

void scsolver::numeric::Matrix::deleteColumns ( const std::vector< size_t > &  cnColIds  ) 

Definition at line 516 of file matrix.cxx.

References deleteColumn().

Referenced by scsolver::numeric::lp::BoundedRevisedSimplexImpl::buildInitialVars(), scsolver::numeric::lp::ModelImpl::deleteConstraintMatrixColumns(), scsolver::numeric::lp::ModelImpl::deleteCostVectorElements(), scsolver::numeric::lp::RevisedSimplexImpl::runNormalInitSearch(), and scsolver::LpModelBuilderImpl::stripZeroCostDecisionVar().

void scsolver::numeric::Matrix::deleteRow ( size_t  nRowId  ) 

Definition at line 531 of file matrix.cxx.

References scsolver::Debug(), and m_aArray.

Referenced by deleteRows().

void scsolver::numeric::Matrix::deleteRows ( const std::vector< size_t > &  cnRowIds  ) 

Definition at line 550 of file matrix.cxx.

References deleteRow().

Referenced by scsolver::LpModelBuilderImpl::stripConstConstraint().

double scsolver::numeric::Matrix::det (  )  const

This method calculates the determinant of a square matrix. It throws a NonSquareMatrix exception of the matrix being operated upon is not square.

Returns:
double determinant.

Definition at line 585 of file matrix.cxx.

References cols(), scsolver::Debug(), getValue(), isSquare(), minors(), and throwIfEmpty().

Referenced by minors().

const Matrix scsolver::numeric::Matrix::inverse (  )  const

Definition at line 623 of file matrix.cxx.

References cols(), scsolver::Debug(), scsolver::numeric::mxhelper::inverse(), isSquare(), m_aArray, m_bResizable, rows(), setResizable(), and throwIfEmpty().

Referenced by scsolver::numeric::lp::BoundedRevisedSimplexImpl::buildInitialVars(), scsolver::numeric::lp::RevisedSimplexImpl::runNormalInitSearch(), and scsolver::numeric::PolyEqnSolver::solve().

const Matrix scsolver::numeric::Matrix::trans (  )  const

Definition at line 641 of file matrix.cxx.

References m_aArray, m_bResizable, and throwIfEmpty().

Referenced by scsolver::numeric::lp::BoundedRevisedSimplexImpl::buildInitialVars(), scsolver::numeric::nlp::QuasiNewtonImpl::calcDefMatrix(), scsolver::numeric::lp::BoundedRevisedSimplexImpl::calculateNewX(), scsolver::numeric::nlp::QuasiNewtonImpl::evaluateFunc(), scsolver::numeric::lp::RevisedSimplexImpl::iterate(), scsolver::numeric::lp::BoundedRevisedSimplexImpl::printIterateHeader(), scsolver::numeric::lp::RevisedSimplexImpl::printIterateHeader(), scsolver::numeric::nlp::QuasiNewtonImpl::runIteration(), scsolver::numeric::QuadFitLineSearch::solve(), scsolver::numeric::lp::BoundedRevisedSimplexImpl::solve(), scsolver::numeric::lp::RevisedSimplexImpl::solve(), and scsolver::numeric::nlp::updateCoordinateVectors().

double scsolver::numeric::Matrix::minors ( size_t  iSkip,
size_t  jSkip 
) const

Definition at line 649 of file matrix.cxx.

References cols(), det(), getValue(), rows(), setResizable(), setValue(), and throwIfEmpty().

Referenced by cofactor(), and det().

void scsolver::numeric::Matrix::resize ( size_t  row,
size_t  col 
)

Definition at line 668 of file matrix.cxx.

References m_aArray.

Referenced by scsolver::numeric::lp::BoundedRevisedSimplexImpl::initialize(), maybeExpand(), and scsolver::LpModelBuilderImpl::setConstraintMatrixSize().

size_t scsolver::numeric::Matrix::rows (  )  const

Returns:
size_t current row size

Definition at line 687 of file matrix.cxx.

References m_aArray.

Referenced by scsolver::numeric::lp::ModelImpl::addConstraint(), adj(), scsolver::numeric::lp::BoundedRevisedSimplexImpl::buildInitialVars(), scsolver::numeric::nlp::QuasiNewtonImpl::calcDefMatrix(), scsolver::numeric::nlp::calcNorm(), empty(), scsolver::numeric::nlp::QuasiNewtonImpl::evalF(), scsolver::numeric::lp::BoundedRevisedSimplexImpl::findInitialSolution(), getColumn(), scsolver::numeric::lp::ModelImpl::getConstraintCount(), scsolver::numeric::lp::BoundedRevisedSimplexImpl::getLambda(), scsolver::numeric::lp::RevisedSimplexImpl::getLambda(), scsolver::LpModelBuilderImpl::getModel(), scsolver::numeric::lp::BoundedRevisedSimplexImpl::initialize(), inverse(), isSameSize(), scsolver::numeric::lp::BoundedRevisedSimplexImpl::isSolutionFeasible(), isSquare(), scsolver::numeric::lp::RevisedSimplexImpl::iterate(), minors(), scsolver::numeric::nlp::QuasiNewtonImpl::norm(), operator *(), operator!=(), operator+(), operator+=(), operator-(), operator/(), scsolver::numeric::lp::ModelImpl::print(), scsolver::numeric::lp::ModelImpl::setStandardConstraintMatrix(), scsolver::numeric::lp::UnoAlgorithmImpl::solve(), scsolver::LpModelBuilderImpl::stripConstConstraint(), scsolver::LpModelBuilderImpl::stripZeroCostDecisionVar(), scsolver::SolveModelImpl::updateCells(), and scsolver::numeric::lp::BoundedRevisedSimplexImpl::updateInverseBasicMatrix().

size_t scsolver::numeric::Matrix::cols (  )  const

Returns:
size_t current column size

Definition at line 692 of file matrix.cxx.

References m_aArray.

Referenced by adj(), scsolver::numeric::lp::BoundedRevisedSimplexImpl::buildInitialVars(), scsolver::numeric::nlp::calcNorm(), scsolver::numeric::lp::RevisedSimplexImpl::convertVarRange(), det(), empty(), scsolver::numeric::lp::BoundedRevisedSimplexImpl::findInitialSolution(), scsolver::numeric::lp::ModelImpl::getDecisionVarSize(), scsolver::LpModelBuilderImpl::getModel(), getRow(), scsolver::numeric::lp::BoundedRevisedSimplexImpl::initialize(), scsolver::numeric::lp::BaseAlgorithmImpl::initPermIndex(), inverse(), isSameSize(), scsolver::numeric::lp::BoundedRevisedSimplexImpl::isSolutionFeasible(), isSquare(), scsolver::numeric::lp::RevisedSimplexImpl::iterate(), scsolver::numeric::lp::BoundedRevisedSimplexImpl::iterateVarBoundary(), minors(), operator *(), operator!=(), operator+(), operator+=(), operator-(), operator/(), scsolver::numeric::lp::ModelImpl::print(), scsolver::numeric::lp::RevisedSimplexImpl::runNormalInitSearch(), scsolver::numeric::lp::BaseAlgorithmImpl::setCanonicalSolution(), scsolver::numeric::lp::ModelImpl::setStandardConstraintMatrix(), scsolver::numeric::lp::UnoAlgorithmImpl::solve(), scsolver::LpModelBuilderImpl::stripZeroCostDecisionVar(), scsolver::numeric::nlp::updateCoordinateVectors(), and scsolver::numeric::lp::BoundedRevisedSimplexImpl::updateInverseBasicMatrix().

bool scsolver::numeric::Matrix::empty (  )  const

Definition at line 697 of file matrix.cxx.

References cols(), and rows().

Referenced by scsolver::numeric::nlp::QuasiNewtonImpl::calcDefMatrix(), scsolver::numeric::nlp::calcNorm(), and throwIfEmpty().

bool scsolver::numeric::Matrix::isRowEmpty ( size_t  nRow  )  const

Definition at line 702 of file matrix.cxx.

References scsolver::numeric::mxhelper::isRowEmpty(), and m_aArray.

bool scsolver::numeric::Matrix::isColumnEmpty ( size_t  nCol  )  const

Definition at line 707 of file matrix.cxx.

References scsolver::numeric::mxhelper::isColumnEmpty(), and m_aArray.

Referenced by scsolver::LpModelBuilderImpl::stripZeroCostDecisionVar().

bool scsolver::numeric::Matrix::isSameSize ( const Matrix r  )  const

Definition at line 712 of file matrix.cxx.

References cols(), and rows().

Referenced by operator+(), and operator-().

bool scsolver::numeric::Matrix::isSquare (  )  const

Definition at line 717 of file matrix.cxx.

References cols(), and rows().

Referenced by det(), inverse(), and scsolver::numeric::lp::BoundedRevisedSimplexImpl::updateInverseBasicMatrix().

Matrix & scsolver::numeric::Matrix::operator= ( const Matrix r  ) 

Definition at line 725 of file matrix.cxx.

References swap().

const Matrix scsolver::numeric::Matrix::operator+ ( const Matrix r  )  const

Definition at line 736 of file matrix.cxx.

References cols(), scsolver::Debug(), getValue(), isSameSize(), rows(), and setValue().

const Matrix scsolver::numeric::Matrix::operator- ( const Matrix r  )  const

Definition at line 751 of file matrix.cxx.

References cols(), scsolver::Debug(), getValue(), isSameSize(), rows(), and setValue().

const Matrix scsolver::numeric::Matrix::operator * ( double  fMul  )  const

Definition at line 766 of file matrix.cxx.

References cols(), getValue(), rows(), and setValue().

const Matrix scsolver::numeric::Matrix::operator * ( const Matrix r  )  const

Definition at line 775 of file matrix.cxx.

References cols(), scsolver::Debug(), m_aArray, and rows().

const Matrix scsolver::numeric::Matrix::operator/ ( double  fDiv  )  const

Definition at line 787 of file matrix.cxx.

References cols(), getValue(), rows(), and setValue().

Matrix & scsolver::numeric::Matrix::operator+= ( const Matrix r  ) 

Definition at line 796 of file matrix.cxx.

Matrix & scsolver::numeric::Matrix::operator+= ( double  f  ) 

Definition at line 802 of file matrix.cxx.

References cols(), getValue(), rows(), setValue(), and swap().

Matrix & scsolver::numeric::Matrix::operator-= ( const Matrix r  ) 

Definition at line 812 of file matrix.cxx.

Matrix & scsolver::numeric::Matrix::operator *= ( double  f  ) 

Definition at line 818 of file matrix.cxx.

Matrix & scsolver::numeric::Matrix::operator/= ( double  f  ) 

Definition at line 824 of file matrix.cxx.

const double scsolver::numeric::Matrix::operator() ( size_t  row,
size_t  col 
) const

Definition at line 830 of file matrix.cxx.

References getValue().

double & scsolver::numeric::Matrix::operator() ( size_t  row,
size_t  col 
)

Definition at line 835 of file matrix.cxx.

References getValue(), and maybeExpand().

bool scsolver::numeric::Matrix::operator== ( const Matrix other  )  const

Definition at line 841 of file matrix.cxx.

References operator!=().

bool scsolver::numeric::Matrix::operator!= ( const Matrix other  )  const

Definition at line 846 of file matrix.cxx.

References cols(), getValue(), and rows().

Referenced by operator==().

const Matrix scsolver::numeric::Matrix::adj (  )  const [private]

Definition at line 561 of file matrix.cxx.

References cofactor(), cols(), rows(), setValue(), and throwIfEmpty().

double scsolver::numeric::Matrix::cofactor ( size_t  i,
size_t  j 
) const [private]

Definition at line 574 of file matrix.cxx.

References minors(), and throwIfEmpty().

Referenced by adj().

void scsolver::numeric::Matrix::maybeExpand ( size_t  row,
size_t  col 
) [private]

Definition at line 858 of file matrix.cxx.

References m_aArray, m_bResizable, and resize().

Referenced by operator()(), and setValue().

void scsolver::numeric::Matrix::throwIfEmpty (  )  const [private]

Definition at line 873 of file matrix.cxx.

References empty().

Referenced by adj(), cofactor(), det(), inverse(), minors(), and trans().


Member Data Documentation

bool scsolver::numeric::Matrix::m_bResizable [private]

Definition at line 177 of file matrix.hxx.

Referenced by inverse(), maybeExpand(), setResizable(), swap(), and trans().

NumericMatrixType scsolver::numeric::Matrix::m_aArray [private]

Definition at line 178 of file matrix.hxx.

Referenced by clear(), cols(), deleteColumn(), deleteRow(), getDisplayElements(), getValue(), inverse(), isColumnEmpty(), isRowEmpty(), Matrix(), maybeExpand(), operator *(), resize(), rows(), setValue(), swap(), and trans().


The documentation for this class was generated from the following files:
Generated on Mon Jul 28 09:13:50 2008 for scsolver by  doxygen 1.5.3