AbstractLinAlgPack_sparse_bounds_diff.cpp

Go to the documentation of this file.
00001 #if 0
00002 
00003 // @HEADER
00004 // ***********************************************************************
00005 // 
00006 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
00007 //                  Copyright (2003) Sandia Corporation
00008 // 
00009 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00010 // license for use of this work by or on behalf of the U.S. Government.
00011 // 
00012 // This library is free software; you can redistribute it and/or modify
00013 // it under the terms of the GNU Lesser General Public License as
00014 // published by the Free Software Foundation; either version 2.1 of the
00015 // License, or (at your option) any later version.
00016 //  
00017 // This library is distributed in the hope that it will be useful, but
00018 // WITHOUT ANY WARRANTY; without even the implied warranty of
00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 // Lesser General Public License for more details.
00021 //  
00022 // You should have received a copy of the GNU Lesser General Public
00023 // License along with this library; if not, write to the Free Software
00024 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00025 // USA
00026 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00027 // 
00028 // ***********************************************************************
00029 // @HEADER
00030 
00031 #include "AbstractLinAlgPack_sparse_bounds_diff.hpp"
00032 #include "AbstractLinAlgPack/src/AbstractLinAlgPack_SpVectorClass.hpp"
00033 #include "AbstractLinAlgPack_LinAlgOpPackHack.hpp"
00034 #include "DenseLinAlgPack_AssertOp.hpp"
00035 
00036 void AbstractLinAlgPack::imp_sparse_bnd_diff(
00037     int           sign
00038   , const SpVectorSlice   &sv
00039   , BLAS_Cpp::Uplo      uplo
00040   , const DVectorSlice      &v
00041   , DVectorSlice        *r
00042   )
00043 {
00044   DenseLinAlgPack::Vp_V_assert_sizes(r->size(),sv.size());
00045   DenseLinAlgPack::VopV_assert_sizes(sv.size(),v.size());
00046 
00047   typedef DenseLinAlgPack::value_type value_type;
00048   const value_type
00049     inf = std::numeric_limits<value_type>::max();
00050   *r = ( uplo == BLAS_Cpp::upper ? inf : -inf );
00051   const AbstractLinAlgPack::SpVectorSlice::difference_type o = sv.offset();
00052   for( AbstractLinAlgPack::SpVectorSlice::const_iterator itr = sv.begin();
00053       itr != sv.end(); ++itr )
00054   {
00055     (*r)(itr->indice() + o) = itr->value();
00056   }
00057   DenseLinAlgPack::Vp_StV( r, -1.0, v );
00058   if( sign < 0 )
00059     DenseLinAlgPack::Vt_S( r, -1.0 );
00060 }
00061 
00062 #endif // 0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Apr 13 10:10:57 2011 for MOOCHO (Single Doxygen Collection) by  doxygen 1.6.3