Generated on Tue Dec 16 12:49:16 2008 for BIU-2.2.0 by doxygen 1.5.1

src/biu/DistanceEnergyFunction.hh

Go to the documentation of this file.
00001 #ifndef DISTANCEENERGYFUNCTION_HH_
00002 #define DISTANCEENERGYFUNCTION_HH_
00003 
00004 #include "biu/Alphabet.hh"
00005 #include "biu/LatticeModel.hh"
00006 
00007 namespace biu
00008 {
00009 
00019     class DistanceEnergyFunction
00020     {
00021     public:
00022         virtual ~DistanceEnergyFunction();
00023         
00024         
00032         virtual
00033         double getEnergy(   const Alphabet::AlphElem& seq_i, 
00034                             const Alphabet::AlphElem& seq_j,
00035                             const double & distance ) const = 0;
00036                                     
00045         virtual
00046         double getEnergy(   const Alphabet::AlphElem & seq_i, 
00047                             const Alphabet::AlphElem & seq_j,
00048                             const IntPoint & cor_i,
00049                             const IntPoint & cor_j  ) const = 0;
00050                                     
00059         virtual
00060         double getEnergy(   const Alphabet::AlphElem & seq_i, 
00061                             const Alphabet::AlphElem & seq_j,
00062                             const DblPoint & cor_i,
00063                             const DblPoint & cor_j  ) const = 0;
00064                                     
00070         virtual
00071         const Alphabet* const getAlphabet() const = 0;
00072         
00073         virtual
00074         bool operator == (const DistanceEnergyFunction& cef2) const = 0;
00075         virtual
00076         bool operator != (const DistanceEnergyFunction& cef2) const = 0;
00077         
00078     };
00079 
00080 } // biu
00081 
00082 #include "biu/Matrix.hh"
00083 
00084 namespace biu {
00085 
00087     typedef biu::Matrix<double> EnergyMatrix;
00088 
00089 } // biu
00090 
00091 
00092 namespace biu
00093 {
00094 
00095 
00102     class ContactEnergyFunction : public DistanceEnergyFunction
00103     {
00104     private:
00105     
00107         const Alphabet* const alphabet;
00110         const EnergyMatrix* const energyMat;
00112         const LatticeModel* const lattice;
00115         const double firstBaseVecLength;
00116 
00117     public:
00118     
00132         ContactEnergyFunction(  const Alphabet* const alphabet, 
00133                                 const EnergyMatrix* const energyMat,
00134                                 const LatticeModel* const lattice);
00135                                 
00136         virtual ~ContactEnergyFunction();
00137             
00141         virtual
00142         double getContactEnergy(    const Alphabet::AlphElem& first, 
00143                                     const Alphabet::AlphElem& second) const;
00144                                     
00152         virtual
00153         double getEnergy(   const Alphabet::AlphElem& seq_i, 
00154                             const Alphabet::AlphElem& seq_j,
00155                             const double & distance ) const;
00156                                     
00165         virtual
00166         double getEnergy(   const Alphabet::AlphElem & seq_i, 
00167                             const Alphabet::AlphElem & seq_j,
00168                             const IntPoint & cor_i,
00169                             const IntPoint & cor_j  ) const;
00170                                     
00179         virtual
00180         double getEnergy(   const Alphabet::AlphElem & seq_i, 
00181                             const Alphabet::AlphElem & seq_j,
00182                             const DblPoint & cor_i,
00183                             const DblPoint & cor_j  ) const;
00184                                     
00186         virtual
00187         const Alphabet* const getAlphabet() const { 
00188             return alphabet; 
00189         }
00190         
00191         virtual
00192         bool operator == (const DistanceEnergyFunction& ef2) const;
00193         virtual
00194         bool operator != (const DistanceEnergyFunction& ef2) const;
00195         
00196     }; // class
00197 
00198 } // namespace biu
00199 
00200 
00201 namespace biu
00202 {
00203 
00210     class IntervalEnergyFunction : public DistanceEnergyFunction
00211     {
00212         
00213     protected:
00214         
00216         const Alphabet* const alphabet;
00217 
00219         std::vector<const biu::EnergyMatrix*> energyMat;
00220         
00222         std::vector< double > intervalMax;
00223         
00224         
00225     public:
00226         
00227         
00233         IntervalEnergyFunction( const Alphabet* const alphabet );
00234 
00239         IntervalEnergyFunction( const IntervalEnergyFunction& toCopy );
00240         
00241         virtual ~IntervalEnergyFunction();
00242         
00243             
00251         virtual
00252         double getEnergy(   const Alphabet::AlphElem& seq_i, 
00253                             const Alphabet::AlphElem& seq_j,
00254                             const double & distance ) const;
00255                                     
00264         virtual
00265         double getEnergy(   const Alphabet::AlphElem & seq_i, 
00266                             const Alphabet::AlphElem & seq_j,
00267                             const IntPoint & cor_i,
00268                             const IntPoint & cor_j  ) const;
00269                                     
00278         virtual
00279         double getEnergy(   const Alphabet::AlphElem & seq_i, 
00280                             const Alphabet::AlphElem & seq_j,
00281                             const DblPoint & cor_i,
00282                             const DblPoint & cor_j  ) const;
00283                                     
00289         virtual
00290         const Alphabet* const getAlphabet() const;
00291         
00292         bool operator == (const DistanceEnergyFunction& cef2) const;
00293         bool operator != (const DistanceEnergyFunction& cef2) const;
00294         
00295 
00296         
00310         virtual 
00311         size_t
00312         addInterval(    const biu::EnergyMatrix& energies,
00313                         const double upperBound );
00314         
00319         virtual
00320         size_t
00321         getIntervalNum(void) const;
00322         
00323         
00330         virtual
00331         double
00332         getIntervalMax(const size_t index) const;
00333         
00334         
00341         virtual
00342         const biu::EnergyMatrix* const
00343         getIntervalMatrix(const size_t index) const;
00344         
00345         
00352         virtual
00353         size_t
00354         getInterval( double distance) const;
00355     };
00356 
00357 } // biu
00358 
00359 
00360 
00361 #endif /*DISTANCEENERGYFUNCTION_HH_*/