LTI-Lib latest version v1.9 - last update 10 Apr 2010

ltiLogarithm.h

00001 /*
00002  * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
00003  * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany
00004  *
00005  * This file is part of the LTI-Computer Vision Library (LTI-Lib)
00006  *
00007  * The LTI-Lib is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License (LGPL)
00009  * as published by the Free Software Foundation; either version 2.1 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * The LTI-Lib is distributed in the hope that it will be
00013  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00014  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with the LTI-Lib; see the file LICENSE.  If
00019  * not, write to the Free Software Foundation, Inc., 59 Temple Place -
00020  * Suite 330, Boston, MA 02111-1307, USA.
00021  */
00022 
00023 
00024 /*----------------------------------------------------------------
00025  * project ....: LTI Digital Image/Signal Processing Library
00026  * file .......: ltiLogarithm.h
00027  * authors ....: Thomas Rusert
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 16.04.99
00030  * revisions ..: $Id: ltiLogarithm.h,v 1.4 2006/02/08 12:32:17 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_LOGARITHM_H_
00034 #define _LTI_LOGARITHM_H_
00035 
00036 #include "ltiIteratingFunctor.h"
00037 #include "ltiMath.h"
00038 
00039 namespace lti {
00040   /** logarithm functor class.
00041       apply sets each element of the T-object to it's logarithm.*/
00042   template<class T>
00043   class logarithm : public iteratingFunctor<T> {
00044   public:
00045     /// default constructor
00046     logarithm() {};
00047     /// destructor
00048     virtual ~logarithm() {};
00049 
00050     /** onPlace version of apply.
00051   applies the functor's function to <em>theObject</em>. */
00052     virtual vector<T>& apply(vector<T>& theObject) const;
00053 
00054     /** onCopy version of apply.
00055   applies the functor's function to the copy of <em>theObject</em>,
00056   <em>newObject</em>. */
00057     virtual vector<T>& apply(const vector<T>& theObject,
00058                                    vector<T>& newObject) const;
00059 
00060     /** onPlace version of apply.
00061   applies the functor's function to <em>theObject</em>. */
00062     virtual matrix<T>& apply(matrix<T>& theObject) const;
00063 
00064     /** onCopy version of apply.
00065   applies the functor's function to the copy of <em>theObject</em>,
00066   <em>newObject</em>. */
00067     virtual matrix<T>& apply(const matrix<T>& theObject,
00068                                    matrix<T>& newObject) const;
00069 
00070     /// returns a pointer to a clone of the functor.
00071     virtual functor* clone() const { return (new logarithm(*this));};
00072 
00073     /// returns the name of this type
00074     virtual const char* getTypeName() const {return "logarithm";};
00075 
00076   protected:
00077     inline static T logT(const T& value);
00078   };
00079 
00080   template<class T>
00081     inline T logarithm<T>::logT(const T& value) {
00082     return static_cast<T>(log(static_cast<double>(value)));
00083   }
00084 
00085 }
00086 
00087 #include "ltiLogarithm_template.h"
00088 
00089 #endif

Generated on Sat Apr 10 15:25:48 2010 for LTI-Lib by Doxygen 1.6.1