|
Anasazi Version of the Day
|
00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Anasazi: Block Eigensolvers Package 00005 // Copyright (2010) 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 Michael A. Heroux (maherou@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 00028 00029 #ifndef __TSQR_Combine_hpp 00030 #define __TSQR_Combine_hpp 00031 00032 #include <Tsqr_ApplyType.hpp> 00033 #include <Tsqr_MatView.hpp> 00034 #include <Tsqr_ScalarTraits.hpp> 00035 #include <Tsqr_CombineNative.hpp> 00036 00039 00040 namespace TSQR { 00041 00062 template< class Ordinal, 00063 class Scalar, 00064 class CombineImpl = CombineNative< Ordinal, Scalar, ScalarTraits< Scalar >::is_complex > > 00065 class Combine { 00066 public: 00067 typedef Scalar scalar_type; 00068 typedef Ordinal ordinal_type; 00069 typedef CombineImpl combine_impl_type; 00070 00071 Combine () {} 00072 00076 static bool QR_produces_R_factor_with_nonnegative_diagonal() { 00077 return combine_impl_type::QR_produces_R_factor_with_nonnegative_diagonal(); 00078 } 00079 00096 void 00097 factor_first (const Ordinal nrows, 00098 const Ordinal ncols, 00099 Scalar A[], 00100 const Ordinal lda, 00101 Scalar tau[], 00102 Scalar work[]) const 00103 { 00104 return impl_.factor_first (nrows, ncols, A, lda, tau, work); 00105 } 00106 00109 void 00110 apply_first (const ApplyType& applyType, 00111 const Ordinal nrows, 00112 const Ordinal ncols_C, 00113 const Ordinal ncols_A, 00114 const Scalar A[], 00115 const Ordinal lda, 00116 const Scalar tau[], 00117 Scalar C[], 00118 const Ordinal ldc, 00119 Scalar work[]) const 00120 { 00121 return impl_.apply_first (applyType, nrows, ncols_C, ncols_A, 00122 A, lda, tau, C, ldc, work); 00123 } 00124 00151 void 00152 apply_inner (const ApplyType& apply_type, 00153 const Ordinal m, 00154 const Ordinal ncols_C, 00155 const Ordinal ncols_Q, 00156 const Scalar A[], 00157 const Ordinal lda, 00158 const Scalar tau[], 00159 Scalar C_top[], 00160 const Ordinal ldc_top, 00161 Scalar C_bot[], 00162 const Ordinal ldc_bot, 00163 Scalar work[]) const 00164 { 00165 impl_.apply_inner (apply_type, m, ncols_C, ncols_Q, 00166 A, lda, tau, 00167 C_top, ldc_top, C_bot, ldc_bot, work); 00168 } 00169 00207 void 00208 factor_inner (const Ordinal m, 00209 const Ordinal n, 00210 Scalar R[], 00211 const Ordinal ldr, 00212 Scalar A[], 00213 const Ordinal lda, 00214 Scalar tau[], 00215 Scalar work[]) const 00216 { 00217 impl_.factor_inner (m, n, R, ldr, A, lda, tau, work); 00218 } 00219 00231 void 00232 factor_pair (const Ordinal n, 00233 Scalar R_top[], 00234 const Ordinal ldr_top, 00235 Scalar R_bot[], 00236 const Ordinal ldr_bot, 00237 Scalar tau[], 00238 Scalar work[]) const 00239 { 00240 impl_.factor_pair (n, R_top, ldr_top, R_bot, ldr_bot, tau, work); 00241 } 00242 00251 void 00252 apply_pair (const ApplyType& apply_type, 00253 const Ordinal ncols_C, 00254 const Ordinal ncols_Q, 00255 const Scalar R_bot[], 00256 const Ordinal ldr_bot, 00257 const Scalar tau[], 00258 Scalar C_top[], 00259 const Ordinal ldc_top, 00260 Scalar C_bot[], 00261 const Ordinal ldc_bot, 00262 Scalar work[]) const 00263 { 00264 impl_.apply_pair (apply_type, ncols_C, ncols_Q, 00265 R_bot, ldr_bot, tau, 00266 C_top, ldc_top, C_bot, ldc_bot, work); 00267 } 00268 00269 private: 00270 combine_impl_type impl_; 00271 }; 00272 00273 } // namespace TSQR 00274 00275 #endif // __TSQR_Combine_hpp
1.7.4