libflame
revision_anchor
|
00001 /* 00002 libflame 00003 An object-based infrastructure for developing high-performance 00004 dense linear algebra libraries. 00005 00006 Copyright (C) 2011, The University of Texas 00007 00008 libflame is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU Lesser General Public License as 00010 published by the Free Software Foundation; either version 2.1 of 00011 the License, or (at your option) any later version. 00012 00013 libflame is distributed in the hope that it will be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public 00019 License along with libflame; if you did not receive a copy, see 00020 http://www.gnu.org/licenses/. 00021 00022 For more information, please contact us at flame@cs.utexas.edu or 00023 send mail to: 00024 00025 Field G. Van Zee and/or 00026 Robert A. van de Geijn 00027 The University of Texas at Austin 00028 Department of Computer Sciences 00029 1 University Station C0500 00030 Austin TX 78712 00031 */ 00032 00033 FLA_Error FLA_Givens2( FLA_Obj chi_1, FLA_Obj chi_2, FLA_Obj gamma, FLA_Obj sigma, FLA_Obj chi_1_new ); 00034 FLA_Error FLA_Givens2_ops( float* chi_1, 00035 float* chi_2, 00036 float* gamma, 00037 float* sigma, 00038 float* chi_1_new ); 00039 FLA_Error FLA_Givens2_opd( double* chi_1, 00040 double* chi_2, 00041 double* gamma, 00042 double* sigma, 00043 double* chi_1_new ); 00044 #define MAC_Givens2_ops( chi_1, chi_2, gamma, sigma, chi_1_new ) \ 00045 { \ 00046 float chi_1_orig = *(chi_1); \ 00047 float chi_2_orig = *(chi_2); \ 00048 float g, s; \ 00049 float norm_x; \ 00050 \ 00051 norm_x = ( float ) sqrt( ( float ) ( chi_1_orig * chi_1_orig + \ 00052 chi_2_orig * chi_2_orig ) ); \ 00053 \ 00054 g = chi_1_orig / norm_x; \ 00055 s = chi_2_orig / norm_x; \ 00056 \ 00057 if ( fabs( chi_1_orig ) > fabs( chi_2_orig ) && g < 0.0F ) \ 00058 { \ 00059 g = -g; \ 00060 s = -s; \ 00061 norm_x = -norm_x; \ 00062 } \ 00063 \ 00064 *(gamma) = g; \ 00065 *(sigma) = s; \ 00066 *(chi_1_new) = norm_x; \ 00067 \ 00068 } 00069 00070 #define MAC_Givens2_opd( chi_1, chi_2, gamma, sigma, chi_1_new ) \ 00071 { \ 00072 double chi_1_orig = *(chi_1); \ 00073 double chi_2_orig = *(chi_2); \ 00074 double g, s; \ 00075 double norm_x; \ 00076 \ 00077 norm_x = ( double ) sqrt( chi_1_orig * chi_1_orig + \ 00078 chi_2_orig * chi_2_orig ); \ 00079 \ 00080 g = chi_1_orig / norm_x; \ 00081 s = chi_2_orig / norm_x; \ 00082 \ 00083 if ( fabs( chi_1_orig ) > fabs( chi_2_orig ) && g < 0.0 ) \ 00084 { \ 00085 g = -g; \ 00086 s = -s; \ 00087 norm_x = -norm_x; \ 00088 } \ 00089 \ 00090 *(gamma) = g; \ 00091 *(sigma) = s; \ 00092 *(chi_1_new) = norm_x; \ 00093 \ 00094 } 00095