Anasazi Version of the Day
Tsqr_CombineFortran.cpp
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 #include <Tsqr_CombineFortran.hpp>
00030 #include <Tsqr_FortranCInterface.hpp>
00031 #include <Tsqr_Config.hpp>
00032 
00033 #include <complex>
00034 
00037 
00038 extern "C" void FortranCInterface_MODULE_(tsqrcombine,d_apply_inner, TSQRCOMBINE,D_APPLY_INNER)
00039   (const char* const trans, 
00040    const int m, 
00041    const int ncols_C, 
00042    const int ncols_Q, 
00043    const double A[], 
00044    const int lda, 
00045    const double tau[],
00046    double C_top[], 
00047    const int ldc_top, 
00048    double C_bot[], 
00049    const int ldc_bot, 
00050    double work[]);
00051 
00052 extern "C" void FortranCInterface_MODULE_(tsqrcombine,z_apply_inner, TSQRCOMBINE,Z_APPLY_INNER)
00053   (const char* const trans, 
00054    const int m, 
00055    const int ncols_C, 
00056    const int ncols_Q, 
00057    const std::complex<double> A[], 
00058    const int lda, 
00059    const std::complex<double> tau[],
00060    std::complex<double> C_top[], 
00061    const int ldc_top, 
00062    std::complex<double> C_bot[], 
00063    const int ldc_bot, 
00064    std::complex<double> work[]);
00065 
00066 extern "C" void FortranCInterface_MODULE_(tsqrcombine,s_apply_inner, TSQRCOMBINE,S_APPLY_INNER)
00067   (const char* const trans, 
00068    const int m, 
00069    const int ncols_C, 
00070    const int ncols_Q, 
00071    const float A[], 
00072    const int lda, 
00073    const float tau[],
00074    float C_top[], 
00075    const int ldc_top, 
00076    float C_bot[], 
00077    const int ldc_bot, 
00078    float work[]);
00079 
00080 extern "C" void FortranCInterface_MODULE_(tsqrcombine,c_apply_inner, TSQRCOMBINE,C_APPLY_INNER)
00081   (const char* const trans, 
00082    const int m, 
00083    const int ncols_C, 
00084    const int ncols_Q, 
00085    const std::complex<float> A[], 
00086    const int lda, 
00087    const std::complex<float> tau[],
00088    std::complex<float> C_top[], 
00089    const int ldc_top, 
00090    std::complex<float> C_bot[], 
00091    const int ldc_bot, 
00092    std::complex<float> work[]);
00093 
00095 
00096 extern "C" void FortranCInterface_MODULE_(tsqrcombine,d_factor_inner, TSQRCOMBINE,D_FACTOR_INNER)
00097   (const int m,
00098    const int n,
00099    double R[],
00100    const int ldr,
00101    double A[],
00102    const int lda, 
00103    double tau[],
00104    double work[]);
00105 
00106 extern "C" void FortranCInterface_MODULE_(tsqrcombine,z_factor_inner, TSQRCOMBINE,Z_FACTOR_INNER)
00107   (const int m,
00108    const int n,
00109    std::complex<double> R[],
00110    const int ldr,
00111    std::complex<double> A[],
00112    const int lda, 
00113    std::complex<double> tau[],
00114    std::complex<double> work[]);
00115 
00116 extern "C" void FortranCInterface_MODULE_(tsqrcombine,s_factor_inner, TSQRCOMBINE,S_FACTOR_INNER)
00117   (const int m,
00118    const int n,
00119    float R[],
00120    const int ldr,
00121    float A[],
00122    const int lda, 
00123    float tau[],
00124    float work[]);
00125 
00126 extern "C" void FortranCInterface_MODULE_(tsqrcombine,c_factor_inner, TSQRCOMBINE,C_FACTOR_INNER)
00127   (const int m,
00128    const int n,
00129    std::complex<float> R[],
00130    const int ldr,
00131    std::complex<float> A[],
00132    const int lda, 
00133    std::complex<float> tau[],
00134    std::complex<float> work[]);
00135 
00137 
00138 extern "C" void FortranCInterface_MODULE_(tsqrcombine,d_factor_pair, TSQRCOMBINE,D_FACTOR_PAIR)
00139   (const int n, 
00140    double R_top[], 
00141    const int ldr_top, 
00142    double R_bot[], 
00143    const int ldr_bot, 
00144    double tau[], 
00145    double work[]);
00146 
00147 extern "C" void FortranCInterface_MODULE_(tsqrcombine,z_factor_pair, TSQRCOMBINE,Z_FACTOR_PAIR)
00148   (const int n, 
00149    std::complex<double> R_top[], 
00150    const int ldr_top, 
00151    std::complex<double> R_bot[], 
00152    const int ldr_bot, 
00153    std::complex<double> tau[], 
00154    std::complex<double> work[]);
00155 
00156 extern "C" void FortranCInterface_MODULE_(tsqrcombine,s_factor_pair, TSQRCOMBINE,S_FACTOR_PAIR)
00157   (const int n, 
00158    float R_top[], 
00159    const int ldr_top, 
00160    float R_bot[], 
00161    const int ldr_bot, 
00162    float tau[], 
00163    float work[]);
00164 
00165 extern "C" void FortranCInterface_MODULE_(tsqrcombine,c_factor_pair, TSQRCOMBINE,C_FACTOR_PAIR)
00166   (const int n, 
00167    std::complex<float> R_top[], 
00168    const int ldr_top, 
00169    std::complex<float> R_bot[], 
00170    const int ldr_bot, 
00171    std::complex<float> tau[], 
00172    std::complex<float> work[]);
00173 
00175 
00176 extern "C" void FortranCInterface_MODULE_(tsqrcombine,d_apply_pair, TSQRCOMBINE,D_APPLY_PAIR)
00177 (const char* const trans, 
00178  const int ncols_C, 
00179  const int ncols_Q, 
00180  const double R_bot[], 
00181  const int ldr_bot,
00182  const double tau[], 
00183  double C_top[], 
00184  const int ldc_top, 
00185  double C_bot[], 
00186  const int ldc_bot, 
00187  double work[]);
00188 
00189 extern "C" void FortranCInterface_MODULE_(tsqrcombine,z_apply_pair, TSQRCOMBINE,Z_APPLY_PAIR)
00190 (const char* const trans, 
00191  const int ncols_C, 
00192  const int ncols_Q, 
00193  const std::complex<double> R_bot[], 
00194  const int ldr_bot,
00195  const std::complex<double> tau[], 
00196  std::complex<double> C_top[], 
00197  const int ldc_top, 
00198  std::complex<double> C_bot[], 
00199  const int ldc_bot, 
00200  std::complex<double> work[]);
00201 
00202 extern "C" void FortranCInterface_MODULE_(tsqrcombine,s_apply_pair, TSQRCOMBINE,S_APPLY_PAIR)
00203 (const char* const trans, 
00204  const int ncols_C, 
00205  const int ncols_Q, 
00206  const float R_bot[], 
00207  const int ldr_bot,
00208  const float tau[], 
00209  float C_top[], 
00210  const int ldc_top, 
00211  float C_bot[], 
00212  const int ldc_bot, 
00213  float work[]);
00214 
00215 extern "C" void FortranCInterface_MODULE_(tsqrcombine,c_apply_pair, TSQRCOMBINE,C_APPLY_PAIR)
00216 (const char* const trans, 
00217  const int ncols_C, 
00218  const int ncols_Q, 
00219  const std::complex<float> R_bot[], 
00220  const int ldr_bot,
00221  const std::complex<float> tau[], 
00222  std::complex<float> C_top[], 
00223  const int ldc_top, 
00224  std::complex<float> C_bot[], 
00225  const int ldc_bot, 
00226  std::complex<float> work[]);
00227 
00230 
00231 namespace TSQR {
00232 
00233   template<>
00234   void
00235   CombineFortran< double, false >::
00236   factor_inner (const int m,
00237       const int n,
00238       double R[],
00239       const int ldr,
00240       double A[],
00241       const int lda, 
00242       double tau[],
00243       double work[]) const
00244   {
00245     FortranCInterface_MODULE_(tsqrcombine,d_factor_inner, TSQRCOMBINE,D_FACTOR_INNER) 
00246       (m, n, R, ldr, A, lda, tau, work);
00247   }
00248 
00249   template<>
00250   void
00251   CombineFortran< double, false >::
00252   apply_inner (const ApplyType& apply_type,
00253            const int m, 
00254            const int ncols_C, 
00255            const int ncols_Q, 
00256            const double A[], 
00257            const int lda, 
00258            const double tau[],
00259            double C_top[], 
00260            const int ldc_top, 
00261            double C_bot[], 
00262            const int ldc_bot, 
00263            double work[]) const
00264   {
00265     FortranCInterface_MODULE_(tsqrcombine,d_apply_inner, TSQRCOMBINE,D_APPLY_INNER) 
00266       (apply_type.toString().c_str(), m, ncols_C, ncols_Q, 
00267        A, lda, tau, C_top, ldc_top, C_bot, ldc_bot, work);
00268   }
00269 
00270   template<>
00271   void
00272   CombineFortran< double, false >::
00273   factor_pair (const int n, 
00274            double R_top[], 
00275            const int ldr_top, 
00276            double R_bot[], 
00277            const int ldr_bot, 
00278            double tau[], 
00279            double work[]) const
00280   {
00281     FortranCInterface_MODULE_(tsqrcombine,d_factor_pair, TSQRCOMBINE,D_FACTOR_PAIR) 
00282       (n, R_top, ldr_top, R_bot, ldr_bot, tau, work);
00283   }
00284 
00285   template<>
00286   void
00287   CombineFortran< double, false >::
00288   apply_pair (const ApplyType& apply_type,
00289           const int ncols_C, 
00290           const int ncols_Q, 
00291           const double R_bot[], 
00292           const int ldr_bot,
00293           const double tau[], 
00294           double C_top[], 
00295           const int ldc_top, 
00296           double C_bot[], 
00297           const int ldc_bot, 
00298           double work[]) const
00299   {
00300     FortranCInterface_MODULE_(tsqrcombine,d_apply_pair, TSQRCOMBINE,D_APPLY_PAIR)
00301       (apply_type.toString().c_str(), ncols_C, ncols_Q, 
00302        R_bot, ldr_bot, tau, C_top, ldc_top, C_bot, ldc_bot, work);
00303   }
00304 
00307 
00308   template<>
00309   void
00310   CombineFortran< float, false >::
00311   factor_inner (const int m,
00312       const int n,
00313       float R[],
00314       const int ldr,
00315       float A[],
00316       const int lda, 
00317       float tau[],
00318       float work[]) const
00319   {
00320     FortranCInterface_MODULE_(tsqrcombine,s_factor_inner, TSQRCOMBINE,S_FACTOR_INNER) 
00321       (m, n, R, ldr, A, lda, tau, work);
00322   }
00323 
00324   template<>
00325   void
00326   CombineFortran< float, false >::
00327   apply_inner (const ApplyType& apply_type,
00328            const int m, 
00329            const int ncols_C, 
00330            const int ncols_Q, 
00331            const float A[], 
00332            const int lda, 
00333            const float tau[],
00334            float C_top[], 
00335            const int ldc_top, 
00336            float C_bot[], 
00337            const int ldc_bot, 
00338            float work[]) const
00339   {
00340     FortranCInterface_MODULE_(tsqrcombine,s_apply_inner, TSQRCOMBINE,S_APPLY_INNER) 
00341       (apply_type.toString().c_str(), m, ncols_C, ncols_Q, 
00342        A, lda, tau, C_top, ldc_top, C_bot, ldc_bot, work);
00343   }
00344 
00345   template<>
00346   void
00347   CombineFortran< float, false >::
00348   factor_pair (const int n, 
00349            float R_top[], 
00350            const int ldr_top, 
00351            float R_bot[], 
00352            const int ldr_bot, 
00353            float tau[], 
00354            float work[]) const
00355   {
00356     FortranCInterface_MODULE_(tsqrcombine,s_factor_pair, TSQRCOMBINE,S_FACTOR_PAIR) 
00357       (n, R_top, ldr_top, R_bot, ldr_bot, tau, work);
00358   }
00359 
00360   template<>
00361   void
00362   CombineFortran< float, false >::
00363   apply_pair (const ApplyType& apply_type,
00364           const int ncols_C, 
00365           const int ncols_Q, 
00366           const float R_bot[], 
00367           const int ldr_bot,
00368           const float tau[], 
00369           float C_top[], 
00370           const int ldc_top, 
00371           float C_bot[], 
00372           const int ldc_bot, 
00373           float work[]) const
00374   {
00375     FortranCInterface_MODULE_(tsqrcombine,s_apply_pair, TSQRCOMBINE,S_APPLY_PAIR)
00376       (apply_type.toString().c_str(), ncols_C, ncols_Q, 
00377        R_bot, ldr_bot, tau, C_top, ldc_top, C_bot, ldc_bot, work);
00378   }
00379   
00382 
00383   template<>
00384   void
00385   CombineFortran< std::complex<double>, true >::
00386   factor_inner (const int m,
00387       const int n,
00388       std::complex<double> R[],
00389       const int ldr,
00390       std::complex<double> A[],
00391       const int lda, 
00392       std::complex<double> tau[],
00393       std::complex<double> work[]) const
00394   {
00395     FortranCInterface_MODULE_(tsqrcombine,z_factor_inner, TSQRCOMBINE,Z_FACTOR_INNER) 
00396       (m, n, R, ldr, A, lda, tau, work);
00397   }
00398 
00399   template<>
00400   void
00401   CombineFortran< std::complex<double>, true >::
00402   apply_inner (const ApplyType& apply_type,
00403            const int m, 
00404            const int ncols_C, 
00405            const int ncols_Q, 
00406            const std::complex<double> A[], 
00407            const int lda, 
00408            const std::complex<double> tau[],
00409            std::complex<double> C_top[], 
00410            const int ldc_top, 
00411            std::complex<double> C_bot[], 
00412            const int ldc_bot, 
00413            std::complex<double> work[]) const
00414   {
00415     FortranCInterface_MODULE_(tsqrcombine,z_apply_inner, TSQRCOMBINE,Z_APPLY_INNER) 
00416       (apply_type.toString().c_str(), m, ncols_C, ncols_Q, 
00417        A, lda, tau, C_top, ldc_top, C_bot, ldc_bot, work);
00418   }
00419 
00420   template<>
00421   void
00422   CombineFortran< std::complex<double>, true >::
00423   factor_pair (const int n, 
00424            std::complex<double> R_top[], 
00425            const int ldr_top, 
00426            std::complex<double> R_bot[], 
00427            const int ldr_bot, 
00428            std::complex<double> tau[], 
00429            std::complex<double> work[]) const
00430   {
00431     FortranCInterface_MODULE_(tsqrcombine,z_factor_pair, TSQRCOMBINE,Z_FACTOR_PAIR) 
00432       (n, R_top, ldr_top, R_bot, ldr_bot, tau, work);
00433   }
00434 
00435   template<>
00436   void
00437   CombineFortran< std::complex<double>, true >::
00438   apply_pair (const ApplyType& apply_type,
00439           const int ncols_C, 
00440           const int ncols_Q, 
00441           const std::complex<double> R_bot[], 
00442           const int ldr_bot,
00443           const std::complex<double> tau[], 
00444           std::complex<double> C_top[], 
00445           const int ldc_top, 
00446           std::complex<double> C_bot[], 
00447           const int ldc_bot, 
00448           std::complex<double> work[]) const
00449   {
00450     FortranCInterface_MODULE_(tsqrcombine,z_apply_pair, TSQRCOMBINE,Z_APPLY_PAIR)
00451       (apply_type.toString().c_str(), ncols_C, ncols_Q, 
00452        R_bot, ldr_bot, tau, C_top, ldc_top, C_bot, ldc_bot, work);
00453   }
00454 
00457 
00458   template<>
00459   void
00460   CombineFortran< std::complex<float>, true >::
00461   factor_inner (const int m,
00462       const int n,
00463       std::complex<float> R[],
00464       const int ldr,
00465       std::complex<float> A[],
00466       const int lda, 
00467       std::complex<float> tau[],
00468       std::complex<float> work[]) const
00469   {
00470     FortranCInterface_MODULE_(tsqrcombine,c_factor_inner, TSQRCOMBINE,C_FACTOR_INNER) 
00471       (m, n, R, ldr, A, lda, tau, work);
00472   }
00473 
00474   template<>
00475   void
00476   CombineFortran< std::complex<float>, true >::
00477   apply_inner (const ApplyType& apply_type,
00478            const int m, 
00479            const int ncols_C, 
00480            const int ncols_Q, 
00481            const std::complex<float> A[], 
00482            const int lda, 
00483            const std::complex<float> tau[],
00484            std::complex<float> C_top[], 
00485            const int ldc_top, 
00486            std::complex<float> C_bot[], 
00487            const int ldc_bot, 
00488            std::complex<float> work[]) const
00489   {
00490     FortranCInterface_MODULE_(tsqrcombine,c_apply_inner, TSQRCOMBINE,C_APPLY_INNER) 
00491       (apply_type.toString().c_str(), m, ncols_C, ncols_Q, 
00492        A, lda, tau, C_top, ldc_top, C_bot, ldc_bot, work);
00493   }
00494 
00495   template<>
00496   void
00497   CombineFortran< std::complex<float>, true >::
00498   factor_pair (const int n, 
00499            std::complex<float> R_top[], 
00500            const int ldr_top, 
00501            std::complex<float> R_bot[], 
00502            const int ldr_bot, 
00503            std::complex<float> tau[], 
00504            std::complex<float> work[]) const
00505   {
00506     FortranCInterface_MODULE_(tsqrcombine,c_factor_pair, TSQRCOMBINE,C_FACTOR_PAIR) 
00507       (n, R_top, ldr_top, R_bot, ldr_bot, tau, work);
00508   }
00509 
00510   template<>
00511   void
00512   CombineFortran< std::complex<float>, true >::
00513   apply_pair (const ApplyType& apply_type,
00514           const int ncols_C, 
00515           const int ncols_Q, 
00516           const std::complex<float> R_bot[], 
00517           const int ldr_bot,
00518           const std::complex<float> tau[], 
00519           std::complex<float> C_top[], 
00520           const int ldc_top, 
00521           std::complex<float> C_bot[], 
00522           const int ldc_bot, 
00523           std::complex<float> work[]) const
00524   {
00525     FortranCInterface_MODULE_(tsqrcombine,c_apply_pair, TSQRCOMBINE,C_APPLY_PAIR)
00526       (apply_type.toString().c_str(), ncols_C, ncols_Q, 
00527        R_bot, ldr_bot, tau, C_top, ldc_top, C_bot, ldc_bot, work);
00528   }
00529 
00530 } // namespace TSQR
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends