Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

characteristic.h

00001 /***************************************************************************
00002                           characteristic.h  -  description
00003                              -------------------
00004     begin                : Wed May 24 2000
00005     copyright            : (C) 2000 by Michael Peeters
00006     email                : Michael.Peeters@vub.ac.be
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef CHARACTERISTIC_H
00019 #define CHARACTERISTIC_H
00020 
00021 #include "invariant.h"
00022 #include "utility.h"
00023 
00024 namespace MODEL{
00028   template<integer dims, typename nelem=number, class NT = NumericTraits<nelem,dims> >
00029   class Characteristic
00030   {
00031   public:
00032         
00033         typedef typename NT::number     numT;
00034         typedef typename NT::vect       vect;
00035         typedef typename NT::matrix matrix;
00036         typedef typename NT::vf         vf;
00037 
00040         Characteristic(const matrix& ma)
00041         {
00042           Invariant<dims,NT>    inv(ma);
00043           for(integer u=0;u<dims;u++) poly[u]=inv.calculate(u);
00044         }
00045 
00052         template <typename n>   
00053         n       operator()(const n& l)
00054         {
00055           n     res(0.);
00056           n     power(1.);
00057           numT  sign=((dims%2)==0)?1.:-1.;
00058           for(integer u=dims-1;u>=0;u--)
00059                 {
00060                   res+=sign*poly[u]*power;
00061                   sign*=-1.;
00062                   power*=l;
00063                 }       
00064           res+=power;
00065           return res;
00066         }       
00067                         
00069         NO_COPY(Characteristic);
00070         
00071   private:
00072         vect                            poly;
00073   };
00074 } // end namespace
00075 #endif
00076 
00077 /*********************************************************************
00078 $Id: characteristic.h,v 1.1 2001/05/22 10:54:55 mpeeters Exp $
00079 **********************************************************************
00080 
00081 $Log: characteristic.h,v $
00082 Revision 1.1  2001/05/22 10:54:55  mpeeters
00083 Moved sources and headers for libModel to model/ subdirectory, in an attempt to rationalize the source tree. This should make things "netter".
00084 
00085 Revision 1.2  2000/09/15 10:26:31  mpeeters
00086 Cleaned out header and added CVS tails to files, removed superfuous
00087 @author comments, inserted dates
00088 
00089 *********************************************************************/

To get the sources or tarballs, please go to SourceForge or you can use the CVS repository.

More Info? Michael Peeters. Also, check our research website: www.alna.vub.ac.be

Last update: June 2002.


Looking for Open Source? Check out SourceForge Logo !