|
MoochoPack: Miscellaneous Utilities for MOOCHO Version of the Day
|
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 // Types for BLAS_Cpp namespace 00030 // 00031 00032 #ifndef BLAS_CPP_TYPES_H 00033 #define BLAS_CPP_TYPES_H 00034 00035 #include "Moocho_ConfigDefs.hpp" 00036 00037 namespace BLAS_Cpp { 00038 00047 00049 typedef size_t size_type; 00050 00053 00055 enum Side{ 00056 left 00057 ,right 00058 }; 00060 enum Transp{ 00061 no_trans 00062 ,trans 00063 ,conj_trans 00064 }; 00066 enum Uplo {upper, lower}; 00068 inline Uplo operator!(Uplo uplo) 00069 { return uplo == upper ? lower : upper; } 00071 enum Diag {unit, nonunit}; 00072 00074 00077 00079 inline Transp bool_to_trans(bool return_trans) { 00080 return return_trans ? trans : no_trans; 00081 } 00082 00084 inline bool trans_to_bool(Transp _trans) { 00085 return ( _trans == trans ); 00086 } 00087 00089 inline Transp operator!(Transp _trans) // does not work with conj_trans 00090 { return _trans == no_trans ? trans : no_trans; } 00091 00093 inline Transp trans_not(Transp _trans) // does not work with conj_trans 00094 { return _trans == no_trans ? trans : no_trans; } 00095 00097 inline Transp trans_trans(Transp _trans1, Transp _trans2) // does not work with conj_trans 00098 { return _trans1 == _trans2 ? no_trans : trans; } 00099 00101 inline const char* trans_to_string(Transp _trans) 00102 { 00103 return _trans == no_trans ? "no_trans" : "trans"; 00104 } 00105 00107 inline size_type rows(size_type rows, size_type cols 00108 , BLAS_Cpp::Transp _trans) 00109 { 00110 return _trans == BLAS_Cpp::no_trans ? rows : cols; 00111 } 00112 00114 inline size_type cols(size_type rows, size_type cols 00115 , BLAS_Cpp::Transp _trans) 00116 { 00117 return _trans == BLAS_Cpp::no_trans ? cols : rows; 00118 } 00119 00121 00123 00124 } // end namespace BLAS_Cpp 00125 00126 #endif // BLAS_CPP_TYPES_H
1.7.4