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

ltiLinearMixer.h

00001 /*
00002  * Copyright (C) 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-Lib: Image Processing and Computer Vision Library
00026  * file .......: ltiLinearMixer.h
00027  * authors ....: Jochen Wickel
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 21.1.2002
00030  * revisions ..: $Id: ltiLinearMixer.h,v 1.6 2006/02/08 12:31:12 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_LINEAR_MIXER_H_
00034 #define _LTI_LINEAR_MIXER_H_
00035 
00036 #include <vector>
00037 #include "ltiFunctor.h"
00038 #include "ltiMatrix.h"
00039 #include "ltiVector.h"
00040 
00041 
00042 namespace lti {
00043   /**
00044    * Implements a mixing operator for vectors and matrices. Mixing
00045    * means that you have a mixing matrix M and a list of vectors
00046    * (or matrices) v[i].
00047    * Then the result of a mix is another list of vectors.
00048    * Example: Let the Mixing matrix be
00049    * <pre>
00050    *     [ 1 0 1 ]
00051    * M = [ 0 1 0 ]
00052    * </pre>
00053    * Let the source vector list be
00054    * <pre>
00055    * v = { [ 0 0 1 1 ], [ 0 1 0 1 ], [ 1 0 0 0 ] }
00056    * </pre>
00057    * Then, the result is:
00058    * <pre>
00059    * v= { [ 0 0 1 1 ] + [ 1 0 0 0 ] , [ 0 1 0 1 ] } = { [ 1 0 1 1 ], [ 0 1 0 1 ] }
00060    * </pre>
00061    * So, the number of rows of the mixing matrix is the number of
00062    * result vectors, and the number of columns of the mixing
00063    * matrix must be the number of source vectors.
00064    */
00065   template <class T>
00066   class linearMixer : public functor {
00067   public:
00068 
00069     /**
00070      * default constructor
00071      */
00072     linearMixer();
00073 
00074     /**
00075      * copy constructor
00076      * @param other the object to be copied
00077      */
00078     linearMixer(const linearMixer& other);
00079 
00080     /**
00081      * destructor
00082      */
00083     virtual ~linearMixer();
00084 
00085     /**
00086      * returns the name of this type ("linearMixer")
00087      */
00088     virtual const char* getTypeName() const;
00089 
00090     /**
00091      * copy data of "other" functor.
00092      * @param other the functor to be copied
00093      * @return a reference to this functor object
00094      */
00095     linearMixer<T>& copy(const linearMixer<T>& other);
00096 
00097     /**
00098      * alias for copy member
00099      * @param other the functor to be copied
00100      * @return a reference to this functor object
00101      */
00102     linearMixer<T>& operator=(const linearMixer<T>& other);
00103 
00104     /**
00105      * returns a pointer to a clone of this functor.
00106      */
00107     virtual functor* clone() const;
00108 
00109     /**
00110      * On-Copy Apply method for the mixing functor.
00111      * The functor takes the mixing matrix and the source vectors.
00112      * The result is returned in the second list. This list must contain
00113      * pointers to already allocated vector objects. Its size must be
00114      * equal to the number of rows of the mixing matrix. The size of the
00115      * list of source vectors must be equal to the number of columns of
00116      * the mixing matrix.
00117      * @param mixer the mixing matrix
00118      * @param src the source vector list
00119      * @param dest the destination vector list.
00120      * @return true if the function could be performed, false otherwise.
00121      */
00122     bool apply(const matrix<T>& mixer,
00123                const std::vector< const vector<T> * > & src,
00124                const std::vector< vector<T> * > & dest) const;
00125 
00126     /**
00127      * On-Copy Apply method for the mixing functor.
00128      * The functor takes the mixing matrix and the source matrices.
00129      * The result is returned in the second list. This list must contain
00130      * pointers to already allocated matrix objects. Its size must be
00131      * equal to the number of rows of the mixing matrix. The size of the
00132      * list of source matrices must be equal to the number of columns of
00133      * the mixing matrix.
00134      * @param mixer the mixing matrix
00135      * @param src the source matrix list
00136      * @param dest the destination matrix list.
00137      * @return true if the function could be performed, false otherwise.
00138      */
00139     bool apply(const matrix<T>& mixer,
00140                const std::vector< const matrix<T> * > & src,
00141                const std::vector< matrix<T> * > & dest
00142 #ifdef _LTI_MSC_6
00143                // this is very ugly: MSC cannot distinguish between the formal
00144                // argument list of both apply methods (another %$&,! MS bug)
00145                // therefore we have to define a dummy argument here
00146                , bool msbug = true
00147 #endif
00148                ) const;
00149   };
00150 
00151 }
00152 
00153 #include "ltiLinearMixer_template.h"
00154 
00155 
00156 #endif

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