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