Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/Beta/Math/Vector/NotDone/Gauss/Eqsystem.hpp

Go to the documentation of this file.
00001 //  EqSystem.h
00002 //  A system of equations and unknowns.
00003 
00004 #include "Vector.h" // Added by ClassView
00005 #include "Matrix.h" // Added by ClassView
00006 
00007 #include <vector>
00008 
00009 // Represent an unknown.
00010 // The solver gets and sets its values.
00011 class IEqUnknown
00012 {
00013 public:
00014     virtual double GetValue() = 0;
00015     virtual void SetValue(double dValue) = 0;
00016 };
00017 
00018 // Represents an equation.
00019 // The solver calculates equations and
00020 // queries its dependencies.
00021 class IEqEquation
00022 {
00023 public:
00024     virtual double CalculateValue() = 0;
00025     virtual bool DependsUpon(IEqUnknown *pUnknown) = 0;
00026 };
00027 
00028 // The solver engine.
00029 // The application implements the above interfaces
00030 // and adds them to the system object, then kicks
00031 // off the solution.
00032 class CEqSystem  
00033 {
00034 public:
00035     CEqSystem();
00036 
00037     void AddUnknown(IEqUnknown *pUnknown);
00038     void AddEquation(IEqEquation *pEquation);
00039     bool Solve();
00040 
00041 private:
00042     void CalcNorm( CVector &vY );
00043     bool Converged( const CVector &vY );
00044     CMatrix CalcJacobian(
00045         const CVector &vX,
00046         const CVector &vY );
00047     bool LineSearch(
00048         const CVector &vX,
00049         CVector &vXNew,
00050         CVector &vY,
00051         const CVector &vStep,
00052         const CVector &vGradF);
00053 
00054 private:
00055     std::vector<IEqUnknown *>   m_vUnknowns;
00056     std::vector<IEqEquation *>  m_vEquations;
00057 
00058     double                      m_dMaxLength;
00059     double                      m_dNorm;
00060 };
00061 

Generated on Sun Oct 14 18:46:14 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001