last update 20 Sep 2009 |
00001 /* 00002 * Copyright (C) 1998 - 2004 00003 * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany 00004 * 00005 * 00006 * This file is part of the Computer Vision and Robotics Library (CVR-Lib) 00007 * 00008 * The CVR-Lib is free software; you can redistribute it and/or 00009 * modify it under the terms of the BSD License. 00010 * 00011 * All rights reserved. 00012 * 00013 * Redistribution and use in source and binary forms, with or without 00014 * modification, are permitted provided that the following conditions are met: 00015 * 00016 * 1. Redistributions of source code must retain the above copyright notice, 00017 * this list of conditions and the following disclaimer. 00018 * 00019 * 2. Redistributions in binary form must reproduce the above copyright notice, 00020 * this list of conditions and the following disclaimer in the documentation 00021 * and/or other materials provided with the distribution. 00022 * 00023 * 3. Neither the name of the authors nor the names of its contributors may be 00024 * used to endorse or promote products derived from this software without 00025 * specific prior written permission. 00026 * 00027 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00028 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00029 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00030 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00031 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00032 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00033 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00034 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00035 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00036 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00037 * POSSIBILITY OF SUCH DAMAGE. 00038 */ 00039 00040 00041 /** 00042 * \file cvrLinearAlgebraFunctor.h 00043 * Contains the class cvr::linearAlgebraFunctor which is the base 00044 * class of all linear algebra functors and defines the global type 00045 * cvr::integer 00046 * \author Thomas Rusert 00047 * \date 01.06.1999 00048 * 00049 * $Id: cvrLinearAlgebraFunctor.h,v 1.7 2006/09/07 11:43:53 doerfler Exp $ 00050 */ 00051 00052 #ifndef _CVR_LINEAR_ALGEBRA_FUNCTOR_H_ 00053 #define _CVR_LINEAR_ALGEBRA_FUNCTOR_H_ 00054 00055 #include "cvrFunctor.h" 00056 00057 namespace cvr { 00058 00059 /** 00060 * Type of integer as defined in f2c.h 00061 * 00062 * This is a type used to adapt different implementations of Fortran-C 00063 * adapters. 00064 */ 00065 typedef _CVR_F2C_INTEGER integer; 00066 00067 /** 00068 * Base class for all lti linear algebra functors. 00069 * 00070 * This class is abstract. 00071 * 00072 * @ingroup gLinearAlgebra 00073 */ 00074 class linearAlgebraFunctor : public functor { 00075 public: 00076 00077 /** 00078 * The parameters for the linear algebra functors 00079 */ 00080 class parameters : public functor::parameters { 00081 public: 00082 /** 00083 * default constructor 00084 */ 00085 parameters(); 00086 00087 /** 00088 * copy constructor 00089 * @param other the parameters object to be copied 00090 */ 00091 parameters(const parameters& other); 00092 00093 /** 00094 * destructor 00095 */ 00096 virtual ~parameters(); 00097 00098 /** 00099 * copy the contents of a parameters object 00100 * @param other the parameters object to be copied 00101 * @return a reference to this parameters object 00102 */ 00103 parameters& copy(const parameters& other); 00104 00105 /** 00106 * Copy the contents of a parameters object 00107 * @param other the parameters object to be copied 00108 * @return a reference to this parameters object 00109 */ 00110 parameters& operator=(const parameters& other); 00111 00112 /** 00113 * Returns the name of this type 00114 */ 00115 virtual const std::string& name() const; 00116 00117 /** 00118 * Returns a pointer to a clone of the parameters 00119 */ 00120 virtual parameters* clone() const; 00121 00122 /** 00123 * Returns a pointer to a new instance of the parameters 00124 */ 00125 virtual parameters* newInstance() const; 00126 00127 /** 00128 * Write the parameters in the given ioHandler 00129 * @param handler the ioHandler to be used 00130 * @param complete if true (the default) the enclosing begin/end will 00131 * be also written, otherwise only the data block will be written. 00132 * @return true if write was successful 00133 */ 00134 virtual bool write(ioHandler& handler,const bool complete=true) const; 00135 00136 /** 00137 * Read the parameters from the given ioHandler 00138 * @param handler the ioHandler to be used 00139 * @param complete if true (the default) the enclosing begin/end will 00140 * be also written, otherwise only the data block will be written. 00141 * @return true if write was successful 00142 */ 00143 virtual bool read(ioHandler& handler,const bool complete=true); 00144 00145 //-------------------------------------------------- 00146 // the parameters 00147 //-------------------------------------------------- 00148 00149 /** 00150 * Many linear algebra functors offer (besides the CVR-Lib 00151 * implementation) to use LAPACK functions for solving a certain 00152 * problem. If you have LAPACK installed and configured the 00153 * CVR-Lib to make use of it (e.g. through changing a config 00154 * file or by just using autoconf) useLapack==true carries out 00155 * that implementation. 00156 * 00157 * If a linear algebra functor does not provide a LAPACK version 00158 * the setting of this parameter has no effect. Such 00159 * linearAlgebraFunctors should state that fact in their class 00160 * description. 00161 * 00162 * Since mostly LAPACK methods are faster that those provided in 00163 * the CVR-Lib the default is true whenever LAPACK was detected 00164 * and false otherwise. The latter really doesn't have any 00165 * effect but looks more informative. 00166 * 00167 * Sometimes it can be slower to use LAPACK because it uses 00168 * column-wise scanning of matrices while the CVR-Lib uses 00169 * rows. This comes from the predominant orientation in the two 00170 * programming languages (FORTRAN and C++). Thus, often it is 00171 * necessary to transpose data before and after using 00172 * LAPACK. For small problems this might be significant. 00173 * 00174 * Default: true if LAPACK is available, false otherwise 00175 */ 00176 bool useLapack; 00177 00178 }; 00179 00180 00181 /** 00182 * Default constructor 00183 */ 00184 linearAlgebraFunctor(); 00185 00186 /** 00187 * Construct a functor using the given parameters 00188 */ 00189 linearAlgebraFunctor(const parameters& par); 00190 00191 /** 00192 * Copy constructor 00193 * @param other the object to be copied 00194 */ 00195 linearAlgebraFunctor(const linearAlgebraFunctor& other); 00196 00197 /** 00198 * Destructor 00199 */ 00200 virtual ~linearAlgebraFunctor(); 00201 00202 /** 00203 * Copy data of "other" functor. 00204 * @param other the functor to be copied 00205 * @return a reference to this functor object 00206 */ 00207 linearAlgebraFunctor& copy(const linearAlgebraFunctor& other); 00208 00209 /** 00210 * Alias for copy member 00211 * @param other the functor to be copied 00212 * @return a reference to this functor object 00213 */ 00214 linearAlgebraFunctor& operator=(const linearAlgebraFunctor& other); 00215 00216 /** 00217 * Returns used parameters 00218 */ 00219 const parameters& getParameters() const; 00220 }; 00221 } 00222 00223 00224 #endif 00225