CVR-Lib last update 20 Sep 2009

cvrLuSolution.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 1998
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   cvrLuSolution.h
00043  * \author Thomas Rusert
00044  * \date   02.06.1999
00045  *
00046  * $Id: cvrLuSolution.h,v 1.2 2006/09/07 13:38:37 doerfler Exp $
00047  */
00048 
00049 #ifndef _CVR_LU_SOLUTION_H_
00050 #define _CVR_LU_SOLUTION_H_
00051 
00052 #include "cvrDecompositionSolution.h"
00053 
00054 namespace cvr {
00055 
00056   /**
00057    * LU solution functor.
00058    * Solves the linear equation Ax=b using LU decomposition.
00059    *
00060    * @ingroup gCVR-Lib FormatRequired
00061    */
00062   template<class T>
00063   class luSolution : public decompositionSolution<T> {
00064   public:
00065     typedef typename decompositionSolution<T>::parameters parameters;
00066 
00067     /**
00068      * default constructor
00069      */
00070     luSolution();
00071 
00072     /**
00073      * copy constructor
00074      */
00075     luSolution(const luSolution<T>& other);
00076 
00077     /**
00078      * constructor, sets the parameters
00079      * @see decompositionSolution::parameters
00080      */
00081     luSolution(const parameters& theParams);
00082 
00083     /**
00084      * constructor, sets the matrix A
00085      */
00086     luSolution(const matrix<T>& theMatrix);
00087 
00088     /**
00089      * onPlace version of apply.
00090      * Solves the set of n linear equations Ax=b. For use with multiple right
00091      * sides b of a set of equation systems Ax=b, the matrix decomposition is
00092      * computed only on calling apply the first time.
00093      * After that the existing decomposition will be used until calling
00094      * setParameters.*/
00095     bool apply(vector<T>& b);
00096 
00097     /**
00098      * onCopy version of apply.
00099      * Solves the set of n linear equations Ax=b. For use with multiple right
00100      * sides b of a set of equation systems Ax=b, the matrix decomposition is
00101      * computed only on calling apply the first time.
00102      * After that the existing decomposition will be used until calling
00103      * setParameters.
00104      */
00105     bool apply(const vector<T>& b,vector<T>& x);
00106 
00107     /**
00108      * onPlace version of apply.  Solves the set of n linear equations
00109      * A x=b where x is the i-th _column_ vector of X and b the i-th
00110      * _column_ vector of B. For use with multiple right sides b of a
00111      * set of equation systems Ax=b, the matrix decomposition is
00112      * computed only on calling apply the first time.  After that the
00113      * existing decomposition will be used until calling
00114      * setParameters.
00115      */
00116     bool apply(matrix<T>& B);
00117 
00118     /**
00119      * onCopy version of apply.  Solves the set of n linear equations
00120      * A x=b where x is the i-th _column_ vector of X and b the i-th
00121      * _column_ vector of B. For use with multiple right sides b of a
00122      * set of equation systems Ax=b, the matrix decomposition is
00123      * computed only on calling apply the first time.  After that the
00124      * existing decomposition will be used until calling
00125      * setParameters.
00126      */
00127     bool apply(const matrix<T>& B,matrix<T>& X);
00128 
00129     /**
00130      * copy data of "other" functor.
00131      */
00132     luSolution& copy(const luSolution& other);
00133 
00134     /**
00135      * Returns the name of this class.
00136      */
00137     const std::string& name() const;
00138 
00139     /**
00140      * Returns a pointer to a clone of this functor.
00141      */
00142     virtual luSolution* clone() const;
00143 
00144     /**
00145      * Returns a pointer to a new instance of this functor.
00146      */
00147     virtual luSolution* newInstance() const;
00148 
00149   protected:
00150     //luSolution<T>& copy(const luSolution<T>& other);
00151 
00152     vector<integer> dcmpVec_;
00153   };
00154 
00155 }
00156 
00157 #endif

Generated on Sun Sep 20 22:08:00 2009 for CVR-Lib by Doxygen 1.5.8