latest version v1.9 - last update 10 Apr 2010 |
00001 /* 00002 * Copyright (C) 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 .......: ltiStrassenMultiplication.h 00027 * authors ....: Xin Gu 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 17.12.00 00030 * revisions ..: $Id: ltiStrassenMultiplication.h,v 1.4 2006/02/08 12:47:06 ltilib Exp $ 00031 * description.: 00032 * The Program implements the Winograd's variant of Strassen'algorithm 00033 * The matrix multiplication is represented in the divide-and-conquer form 00034 * There are 15 matrix additions and 7 matrix multiplications. 00035 */ 00036 00037 #ifndef _LTI_STRASSEN_MULTIPLICATAION_H_ 00038 #define _LTI_STRASSEN_MULTIPLICATAION_H_ 00039 00040 #include "ltiMatrix.h" 00041 #include "ltiLinearAlgebraFunctor.h" 00042 00043 namespace lti { 00044 /** 00045 * Implementation for the addtion forms: 00046 * 00047 * @ingroup gLinearAlgebra 00048 */ 00049 template<class T> class strassenMultiplication: public linearAlgebraFunctor { 00050 public: 00051 00052 /** 00053 * default constructor 00054 */ 00055 strassenMultiplication(); 00056 /** 00057 * copy constructor 00058 */ 00059 strassenMultiplication(const strassenMultiplication<T>& other); 00060 00061 00062 /** 00063 * destructor 00064 */ 00065 virtual ~strassenMultiplication(); 00066 00067 /** 00068 * multiple funktion for the matrixmultiplcation under the 00069 * strassen's algorithm 00070 */ 00071 matrix<T>& multiply(const matrix<T>& one, 00072 const matrix<T>& other, 00073 matrix<T>& result); 00074 00075 /** 00076 * Handling of highly rectangular matrices 00077 */ 00078 bool multiplyHighlyRectangularMatrix(const matrix<T>& one, 00079 const matrix<T>& other, 00080 matrix<T>& product); 00081 00082 00083 /// onCopy version of apply. 00084 inline matrix<T>& apply(const matrix<T>& mult1, 00085 const matrix<T>& mult2, 00086 matrix<T>& result) { 00087 return multiply(mult1,mult2,result); 00088 } 00089 00090 /// returns a pointer to a clone of the functor. 00091 virtual functor* clone() const; 00092 /// returns the name of this type 00093 virtual const char* getTypeName() const; 00094 00095 private: 00096 /** 00097 * test funktion for the odd number 00098 */ 00099 inline bool isodd(const int& num) { return (num%2 != 0); }; 00100 00101 }; 00102 } 00103 #include "ltiStrassenMultiplication_template.h" 00104 00105 #endif