[Numerics] BandMatrix does not silently do LU when QR is specified
Change GeneralMatrix to allow derived classes to not implement QR factorization. BandMatrix does not implement QR because this LAPACK does not contain a QR algorithm for this matrix type.
This commit is contained in:
parent
1ec72f3171
commit
7fef1b0051
3 changed files with 12 additions and 51 deletions
|
|
@ -218,22 +218,6 @@ public:
|
|||
|
||||
virtual void zero();
|
||||
|
||||
//! Factors the A matrix using the QR algorithm, overwriting A
|
||||
/*!
|
||||
* we set m_factored to 2 to indicate the matrix is now QR factored
|
||||
*
|
||||
* @return Returns the info variable from lapack
|
||||
*/
|
||||
virtual int factorQR();
|
||||
|
||||
//! Returns an estimate of the inverse of the condition number for the matrix
|
||||
/*!
|
||||
* The matrix must have been previously factored using the QR algorithm
|
||||
*
|
||||
* @return returns the inverse of the condition number
|
||||
*/
|
||||
virtual doublereal rcondQR();
|
||||
|
||||
//! Returns an estimate of the inverse of the condition number for the matrix
|
||||
/*!
|
||||
* The matrix must have been previously factored using the LU algorithm
|
||||
|
|
@ -244,21 +228,8 @@ public:
|
|||
*/
|
||||
virtual doublereal rcond(doublereal a1norm);
|
||||
|
||||
//! Change the way the matrix is factored
|
||||
/*!
|
||||
* @param fAlgorithm integer
|
||||
* 0 LU factorization
|
||||
* 1 QR factorization
|
||||
*/
|
||||
virtual void useFactorAlgorithm(int fAlgorithm);
|
||||
|
||||
//! Returns the factor algorithm used
|
||||
/*!
|
||||
* 0 LU decomposition
|
||||
* 1 QR decomposition
|
||||
*
|
||||
* This routine will always return 0
|
||||
*/
|
||||
//! Returns the factor algorithm used. This method will always return 0
|
||||
//! (LU) for band matrices.
|
||||
virtual int factorAlgorithm() const;
|
||||
|
||||
//! Returns the one norm of the matrix
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#define CT_GENERALMATRIX_H
|
||||
|
||||
#include "cantera/base/ct_defs.h"
|
||||
#include "cantera/base/ctexceptions.h"
|
||||
|
||||
namespace Cantera
|
||||
{
|
||||
|
|
@ -77,7 +78,9 @@ public:
|
|||
*
|
||||
* @return Returns the info variable from lapack
|
||||
*/
|
||||
virtual int factorQR() = 0;
|
||||
virtual int factorQR() {
|
||||
throw NotImplementedError("GeneralMatrix::factorQR");
|
||||
}
|
||||
|
||||
//! Returns an estimate of the inverse of the condition number for the matrix
|
||||
/*!
|
||||
|
|
@ -85,7 +88,9 @@ public:
|
|||
*
|
||||
* @return returns the inverse of the condition number
|
||||
*/
|
||||
virtual doublereal rcondQR() = 0;
|
||||
virtual doublereal rcondQR() {
|
||||
throw NotImplementedError("GeneralMatrix::rcondQR");
|
||||
}
|
||||
|
||||
//! Returns an estimate of the inverse of the condition number for the matrix
|
||||
/*!
|
||||
|
|
@ -103,7 +108,9 @@ public:
|
|||
* 0 LU factorization
|
||||
* 1 QR factorization
|
||||
*/
|
||||
virtual void useFactorAlgorithm(int fAlgorithm) = 0;
|
||||
virtual void useFactorAlgorithm(int fAlgorithm) {
|
||||
throw NotImplementedError("GeneralMatrix::useFactorAlgorithm");
|
||||
};
|
||||
|
||||
//! Return the factor algorithm used
|
||||
virtual int factorAlgorithm() const = 0;
|
||||
|
|
|
|||
|
|
@ -333,18 +333,6 @@ void BandMatrix::err(const std::string& msg) const
|
|||
throw CanteraError("BandMatrix() unimplemented function", msg);
|
||||
}
|
||||
|
||||
int BandMatrix::factorQR()
|
||||
{
|
||||
factor();
|
||||
return 0;
|
||||
}
|
||||
|
||||
doublereal BandMatrix::rcondQR()
|
||||
{
|
||||
double a1norm = oneNorm();
|
||||
return rcond(a1norm);
|
||||
}
|
||||
|
||||
doublereal BandMatrix::rcond(doublereal a1norm)
|
||||
{
|
||||
int printLevel = 0;
|
||||
|
|
@ -376,11 +364,6 @@ doublereal BandMatrix::rcond(doublereal a1norm)
|
|||
return rcond;
|
||||
}
|
||||
|
||||
void BandMatrix::useFactorAlgorithm(int fAlgorithm)
|
||||
{
|
||||
// QR algorithm isn't implemented for banded matrix.
|
||||
}
|
||||
|
||||
int BandMatrix::factorAlgorithm() const
|
||||
{
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue