DenseLinAlgPack_MatVecCompare.hpp

Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
00005 //                  Copyright (2003) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #ifndef MAT_VEC_COMPARE_H
00030 #define MAT_VEC_COMPARE_H
00031 
00032 #include <limits>
00033 #if defined(_GNU_GXX)
00034 #include <cmath>
00035 #else
00036 #include <math.h>
00037 #endif
00038 
00039 #include "DenseLinAlgPack_Types.hpp"
00040 #include "TestingHelperPack_update_success.hpp"
00041 
00042 namespace DenseLinAlgPack {
00043 
00044 using TestingHelperPack::update_success;
00045 
00046 /* * @name DVectorSlice and DMatrixSlice comparison functions.
00047   *
00048   * These functions compare the elements of two DVectorSlice or DMatrixSlice
00049   * objects.  If any of the corresponding elements does not obey
00050   * abs(ele1 - ele2) < sqrt(eps) then the functions return false, otherwise
00051   * they return true.  An exact test (bits) is not performed to allow for some round-off
00052   * error to occur and still equate.
00053   */
00054 // @{
00055 
00057 const value_type sqrt_eps
00058 #if defined(_GNU_GXX)
00059   = std::sqrt(std::numeric_limits<value_type>::epsilon());
00060 #elif defined(_CPQ_CXX)
00061   = ::sqrt(std::numeric_limits<value_type>::epsilon());
00062 #else
00063   = ::sqrt(std::numeric_limits<value_type>::epsilon());
00064 #endif
00065 
00067 bool comp(const DVectorSlice& vs1, const DVectorSlice& vs2);
00068 
00070 bool comp(const DVectorSlice& vs, value_type alpha);
00071 
00073 bool comp(const DMatrixSlice& gms1, BLAS_Cpp::Transp trans1
00074   , const DMatrixSlice& gms2, BLAS_Cpp::Transp trans2);
00075 
00077 //bool comp(const DMatrixSlice& gms1, const DMatrixSlice& gms2);
00078 
00079 inline
00081 bool comp(const DMatrixSlice& gms1, const DMatrixSlice& gms2)
00082 {
00083   return comp(gms1, BLAS_Cpp::no_trans, gms2, BLAS_Cpp::no_trans);
00084 }
00085 
00087 bool comp(const DMatrixSlice& gms1, value_type alpha);
00088 
00090 bool comp(const DMatrixSliceTriEle& tri_gms1, const DMatrixSliceTriEle& tri_gms2);
00091 
00093 bool comp(const DMatrixSliceTriEle& tri_gms1, value_type alpha);
00094 
00096 bool comp_less(const DVectorSlice& vs, value_type alpha);
00097 
00098 // @}
00099 
00100 } // end namespace DenseLinAlgPack
00101 
00102 // ////////////////////////////////////
00103 // Inline definitions
00104 
00105 //inline
00106 //bool DenseLinAlgPack::comp(const DMatrixSlice& gms1, const DMatrixSlice& gms2)
00107 //{
00108 //  return comp(gms1, BLAS_Cpp::no_trans, gms2, BLAS_Cpp::no_trans);
00109 //}
00110 
00111 
00112 #endif  // MAT_VEC_COMPARE_H

Generated on Wed May 12 21:52:29 2010 for MOOCHO (Single Doxygen Collection) by  doxygen 1.4.7