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 (2008) Sandia Corporation
00006 // 
00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00008 // the U.S. Government retains certain rights in this software.
00009 // 
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00038 // 
00039 // ************************************************************************
00040 //@HEADER
00041 
00042 #include <Tsqr_ConfigDefs.hpp>
00043 #include <Tsqr_CombineFortran.hpp>
00044 #include <Tsqr_FortranCInterface.hpp>
00045 
00046 #include <complex>
00047 
00048 extern "C" void FortranCInterface_MODULE_(tsqrcombine,d_apply_inner, TSQRCOMBINE,D_APPLY_INNER)
00049   (const char* const trans, 
00050    const int m, 
00051    const int ncols_C, 
00052    const int ncols_Q, 
00053    const double A[], 
00054    const int lda, 
00055    const double tau[],
00056    double C_top[], 
00057    const int ldc_top, 
00058    double C_bot[], 
00059    const int ldc_bot, 
00060    double work[]);
00061 
00062 extern "C" void FortranCInterface_MODULE_(tsqrcombine,z_apply_inner, TSQRCOMBINE,Z_APPLY_INNER)
00063   (const char* const trans, 
00064    const int m, 
00065    const int ncols_C, 
00066    const int ncols_Q, 
00067    const std::complex<double> A[], 
00068    const int lda, 
00069    const std::complex<double> tau[],
00070    std::complex<double> C_top[], 
00071    const int ldc_top, 
00072    std::complex<double> C_bot[], 
00073    const int ldc_bot, 
00074    std::complex<double> work[]);
00075 
00076 extern "C" void FortranCInterface_MODULE_(tsqrcombine,s_apply_inner, TSQRCOMBINE,S_APPLY_INNER)
00077   (const char* const trans, 
00078    const int m, 
00079    const int ncols_C, 
00080    const int ncols_Q, 
00081    const float A[], 
00082    const int lda, 
00083    const float tau[],
00084    float C_top[], 
00085    const int ldc_top, 
00086    float C_bot[], 
00087    const int ldc_bot, 
00088    float work[]);
00089 
00090 extern "C" void FortranCInterface_MODULE_(tsqrcombine,c_apply_inner, TSQRCOMBINE,C_APPLY_INNER)
00091   (const char* const trans, 
00092    const int m, 
00093    const int ncols_C, 
00094    const int ncols_Q, 
00095    const std::complex<float> A[], 
00096    const int lda, 
00097    const std::complex<float> tau[],
00098    std::complex<float> C_top[], 
00099    const int ldc_top, 
00100    std::complex<float> C_bot[], 
00101    const int ldc_bot, 
00102    std::complex<float> work[]);
00103 
00105 
00106 extern "C" void FortranCInterface_MODULE_(tsqrcombine,d_factor_inner, TSQRCOMBINE,D_FACTOR_INNER)
00107   (const int m,
00108    const int n,
00109    double R[],
00110    const int ldr,
00111    double A[],
00112    const int lda, 
00113    double tau[],
00114    double work[]);
00115 
00116 extern "C" void FortranCInterface_MODULE_(tsqrcombine,z_factor_inner, TSQRCOMBINE,Z_FACTOR_INNER)
00117   (const int m,
00118    const int n,
00119    std::complex<double> R[],
00120    const int ldr,
00121    std::complex<double> A[],
00122    const int lda, 
00123    std::complex<double> tau[],
00124    std::complex<double> work[]);
00125 
00126 extern "C" void FortranCInterface_MODULE_(tsqrcombine,s_factor_inner, TSQRCOMBINE,S_FACTOR_INNER)
00127   (const int m,
00128    const int n,
00129    float R[],
00130    const int ldr,
00131    float A[],
00132    const int lda, 
00133    float tau[],
00134    float work[]);
00135 
00136 extern "C" void FortranCInterface_MODULE_(tsqrcombine,c_factor_inner, TSQRCOMBINE,C_FACTOR_INNER)
00137   (const int m,
00138    const int n,
00139    std::complex<float> R[],
00140    const int ldr,
00141    std::complex<float> A[],
00142    const int lda, 
00143    std::complex<float> tau[],
00144    std::complex<float> work[]);
00145 
00147 
00148 extern "C" void FortranCInterface_MODULE_(tsqrcombine,d_factor_pair, TSQRCOMBINE,D_FACTOR_PAIR)
00149   (const int n, 
00150    double R_top[], 
00151    const int ldr_top, 
00152    double R_bot[], 
00153    const int ldr_bot, 
00154    double tau[], 
00155    double work[]);
00156 
00157 extern "C" void FortranCInterface_MODULE_(tsqrcombine,z_factor_pair, TSQRCOMBINE,Z_FACTOR_PAIR)
00158   (const int n, 
00159    std::complex<double> R_top[], 
00160    const int ldr_top, 
00161    std::complex<double> R_bot[], 
00162    const int ldr_bot, 
00163    std::complex<double> tau[], 
00164    std::complex<double> work[]);
00165 
00166 extern "C" void FortranCInterface_MODULE_(tsqrcombine,s_factor_pair, TSQRCOMBINE,S_FACTOR_PAIR)
00167   (const int n, 
00168    float R_top[], 
00169    const int ldr_top, 
00170    float R_bot[], 
00171    const int ldr_bot, 
00172    float tau[], 
00173    float work[]);
00174 
00175 extern "C" void FortranCInterface_MODULE_(tsqrcombine,c_factor_pair, TSQRCOMBINE,C_FACTOR_PAIR)
00176   (const int n, 
00177    std::complex<float> R_top[], 
00178    const int ldr_top, 
00179    std::complex<float> R_bot[], 
00180    const int ldr_bot, 
00181    std::complex<float> tau[], 
00182    std::complex<float> work[]);
00183 
00185 
00186 extern "C" void FortranCInterface_MODULE_(tsqrcombine,d_apply_pair, TSQRCOMBINE,D_APPLY_PAIR)
00187 (const char* const trans, 
00188  const int ncols_C, 
00189  const int ncols_Q, 
00190  const double R_bot[], 
00191  const int ldr_bot,
00192  const double tau[], 
00193  double C_top[], 
00194  const int ldc_top, 
00195  double C_bot[], 
00196  const int ldc_bot, 
00197  double work[]);
00198 
00199 extern "C" void FortranCInterface_MODULE_(tsqrcombine,z_apply_pair, TSQRCOMBINE,Z_APPLY_PAIR)
00200 (const char* const trans, 
00201  const int ncols_C, 
00202  const int ncols_Q, 
00203  const std::complex<double> R_bot[], 
00204  const int ldr_bot,
00205  const std::complex<double> tau[], 
00206  std::complex<double> C_top[], 
00207  const int ldc_top, 
00208  std::complex<double> C_bot[], 
00209  const int ldc_bot, 
00210  std::complex<double> work[]);
00211 
00212 extern "C" void FortranCInterface_MODULE_(tsqrcombine,s_apply_pair, TSQRCOMBINE,S_APPLY_PAIR)
00213 (const char* const trans, 
00214  const int ncols_C, 
00215  const int ncols_Q, 
00216  const float R_bot[], 
00217  const int ldr_bot,
00218  const float tau[], 
00219  float C_top[], 
00220  const int ldc_top, 
00221  float C_bot[], 
00222  const int ldc_bot, 
00223  float work[]);
00224 
00225 extern "C" void FortranCInterface_MODULE_(tsqrcombine,c_apply_pair, TSQRCOMBINE,C_APPLY_PAIR)
00226 (const char* const trans, 
00227  const int ncols_C, 
00228  const int ncols_Q, 
00229  const std::complex<float> R_bot[], 
00230  const int ldr_bot,
00231  const std::complex<float> tau[], 
00232  std::complex<float> C_top[], 
00233  const int ldc_top, 
00234  std::complex<float> C_bot[], 
00235  const int ldc_bot, 
00236  std::complex<float> work[]);
00237 
00240 
00241 namespace TSQR {
00242 
00243   template<>
00244   void
00245   CombineFortran< double, false >::
00246   factor_inner (const int m,
00247       const int n,
00248       double R[],
00249       const int ldr,
00250       double A[],
00251       const int lda, 
00252       double tau[],
00253       double work[]) const
00254   {
00255     FortranCInterface_MODULE_(tsqrcombine,d_factor_inner, TSQRCOMBINE,D_FACTOR_INNER) 
00256       (m, n, R, ldr, A, lda, tau, work);
00257   }
00258 
00259   template<>
00260   void
00261   CombineFortran< double, false >::
00262   apply_inner (const ApplyType& apply_type,
00263            const int m, 
00264            const int ncols_C, 
00265            const int ncols_Q, 
00266            const double A[], 
00267            const int lda, 
00268            const double tau[],
00269            double C_top[], 
00270            const int ldc_top, 
00271            double C_bot[], 
00272            const int ldc_bot, 
00273            double work[]) const
00274   {
00275     FortranCInterface_MODULE_(tsqrcombine,d_apply_inner, TSQRCOMBINE,D_APPLY_INNER) 
00276       (apply_type.toString().c_str(), m, ncols_C, ncols_Q, 
00277        A, lda, tau, C_top, ldc_top, C_bot, ldc_bot, work);
00278   }
00279 
00280   template<>
00281   void
00282   CombineFortran< double, false >::
00283   factor_pair (const int n, 
00284            double R_top[], 
00285            const int ldr_top, 
00286            double R_bot[], 
00287            const int ldr_bot, 
00288            double tau[], 
00289            double work[]) const
00290   {
00291     FortranCInterface_MODULE_(tsqrcombine,d_factor_pair, TSQRCOMBINE,D_FACTOR_PAIR) 
00292       (n, R_top, ldr_top, R_bot, ldr_bot, tau, work);
00293   }
00294 
00295   template<>
00296   void
00297   CombineFortran< double, false >::
00298   apply_pair (const ApplyType& apply_type,
00299           const int ncols_C, 
00300           const int ncols_Q, 
00301           const double R_bot[], 
00302           const int ldr_bot,
00303           const double tau[], 
00304           double C_top[], 
00305           const int ldc_top, 
00306           double C_bot[], 
00307           const int ldc_bot, 
00308           double work[]) const
00309   {
00310     FortranCInterface_MODULE_(tsqrcombine,d_apply_pair, TSQRCOMBINE,D_APPLY_PAIR)
00311       (apply_type.toString().c_str(), ncols_C, ncols_Q, 
00312        R_bot, ldr_bot, tau, C_top, ldc_top, C_bot, ldc_bot, work);
00313   }
00314 
00317 
00318   template<>
00319   void
00320   CombineFortran< float, false >::
00321   factor_inner (const int m,
00322       const int n,
00323       float R[],
00324       const int ldr,
00325       float A[],
00326       const int lda, 
00327       float tau[],
00328       float work[]) const
00329   {
00330     FortranCInterface_MODULE_(tsqrcombine,s_factor_inner, TSQRCOMBINE,S_FACTOR_INNER) 
00331       (m, n, R, ldr, A, lda, tau, work);
00332   }
00333 
00334   template<>
00335   void
00336   CombineFortran< float, false >::
00337   apply_inner (const ApplyType& apply_type,
00338            const int m, 
00339            const int ncols_C, 
00340            const int ncols_Q, 
00341            const float A[], 
00342            const int lda, 
00343            const float tau[],
00344            float C_top[], 
00345            const int ldc_top, 
00346            float C_bot[], 
00347            const int ldc_bot, 
00348            float work[]) const
00349   {
00350     FortranCInterface_MODULE_(tsqrcombine,s_apply_inner, TSQRCOMBINE,S_APPLY_INNER) 
00351       (apply_type.toString().c_str(), m, ncols_C, ncols_Q, 
00352        A, lda, tau, C_top, ldc_top, C_bot, ldc_bot, work);
00353   }
00354 
00355   template<>
00356   void
00357   CombineFortran< float, false >::
00358   factor_pair (const int n, 
00359            float R_top[], 
00360            const int ldr_top, 
00361            float R_bot[], 
00362            const int ldr_bot, 
00363            float tau[], 
00364            float work[]) const
00365   {
00366     FortranCInterface_MODULE_(tsqrcombine,s_factor_pair, TSQRCOMBINE,S_FACTOR_PAIR) 
00367       (n, R_top, ldr_top, R_bot, ldr_bot, tau, work);
00368   }
00369 
00370   template<>
00371   void
00372   CombineFortran< float, false >::
00373   apply_pair (const ApplyType& apply_type,
00374           const int ncols_C, 
00375           const int ncols_Q, 
00376           const float R_bot[], 
00377           const int ldr_bot,
00378           const float tau[], 
00379           float C_top[], 
00380           const int ldc_top, 
00381           float C_bot[], 
00382           const int ldc_bot, 
00383           float work[]) const
00384   {
00385     FortranCInterface_MODULE_(tsqrcombine,s_apply_pair, TSQRCOMBINE,S_APPLY_PAIR)
00386       (apply_type.toString().c_str(), ncols_C, ncols_Q, 
00387        R_bot, ldr_bot, tau, C_top, ldc_top, C_bot, ldc_bot, work);
00388   }
00389   
00392 
00393   template<>
00394   void
00395   CombineFortran< std::complex<double>, true >::
00396   factor_inner (const int m,
00397       const int n,
00398       std::complex<double> R[],
00399       const int ldr,
00400       std::complex<double> A[],
00401       const int lda, 
00402       std::complex<double> tau[],
00403       std::complex<double> work[]) const
00404   {
00405     FortranCInterface_MODULE_(tsqrcombine,z_factor_inner, TSQRCOMBINE,Z_FACTOR_INNER) 
00406       (m, n, R, ldr, A, lda, tau, work);
00407   }
00408 
00409   template<>
00410   void
00411   CombineFortran< std::complex<double>, true >::
00412   apply_inner (const ApplyType& apply_type,
00413            const int m, 
00414            const int ncols_C, 
00415            const int ncols_Q, 
00416            const std::complex<double> A[], 
00417            const int lda, 
00418            const std::complex<double> tau[],
00419            std::complex<double> C_top[], 
00420            const int ldc_top, 
00421            std::complex<double> C_bot[], 
00422            const int ldc_bot, 
00423            std::complex<double> work[]) const
00424   {
00425     FortranCInterface_MODULE_(tsqrcombine,z_apply_inner, TSQRCOMBINE,Z_APPLY_INNER) 
00426       (apply_type.toString().c_str(), m, ncols_C, ncols_Q, 
00427        A, lda, tau, C_top, ldc_top, C_bot, ldc_bot, work);
00428   }
00429 
00430   template<>
00431   void
00432   CombineFortran< std::complex<double>, true >::
00433   factor_pair (const int n, 
00434            std::complex<double> R_top[], 
00435            const int ldr_top, 
00436            std::complex<double> R_bot[], 
00437            const int ldr_bot, 
00438            std::complex<double> tau[], 
00439            std::complex<double> work[]) const
00440   {
00441     FortranCInterface_MODULE_(tsqrcombine,z_factor_pair, TSQRCOMBINE,Z_FACTOR_PAIR) 
00442       (n, R_top, ldr_top, R_bot, ldr_bot, tau, work);
00443   }
00444 
00445   template<>
00446   void
00447   CombineFortran< std::complex<double>, true >::
00448   apply_pair (const ApplyType& apply_type,
00449           const int ncols_C, 
00450           const int ncols_Q, 
00451           const std::complex<double> R_bot[], 
00452           const int ldr_bot,
00453           const std::complex<double> tau[], 
00454           std::complex<double> C_top[], 
00455           const int ldc_top, 
00456           std::complex<double> C_bot[], 
00457           const int ldc_bot, 
00458           std::complex<double> work[]) const
00459   {
00460     FortranCInterface_MODULE_(tsqrcombine,z_apply_pair, TSQRCOMBINE,Z_APPLY_PAIR)
00461       (apply_type.toString().c_str(), ncols_C, ncols_Q, 
00462        R_bot, ldr_bot, tau, C_top, ldc_top, C_bot, ldc_bot, work);
00463   }
00464 
00467 
00468   template<>
00469   void
00470   CombineFortran< std::complex<float>, true >::
00471   factor_inner (const int m,
00472       const int n,
00473       std::complex<float> R[],
00474       const int ldr,
00475       std::complex<float> A[],
00476       const int lda, 
00477       std::complex<float> tau[],
00478       std::complex<float> work[]) const
00479   {
00480     FortranCInterface_MODULE_(tsqrcombine,c_factor_inner, TSQRCOMBINE,C_FACTOR_INNER) 
00481       (m, n, R, ldr, A, lda, tau, work);
00482   }
00483 
00484   template<>
00485   void
00486   CombineFortran< std::complex<float>, true >::
00487   apply_inner (const ApplyType& apply_type,
00488            const int m, 
00489            const int ncols_C, 
00490            const int ncols_Q, 
00491            const std::complex<float> A[], 
00492            const int lda, 
00493            const std::complex<float> tau[],
00494            std::complex<float> C_top[], 
00495            const int ldc_top, 
00496            std::complex<float> C_bot[], 
00497            const int ldc_bot, 
00498            std::complex<float> work[]) const
00499   {
00500     FortranCInterface_MODULE_(tsqrcombine,c_apply_inner, TSQRCOMBINE,C_APPLY_INNER) 
00501       (apply_type.toString().c_str(), m, ncols_C, ncols_Q, 
00502        A, lda, tau, C_top, ldc_top, C_bot, ldc_bot, work);
00503   }
00504 
00505   template<>
00506   void
00507   CombineFortran< std::complex<float>, true >::
00508   factor_pair (const int n, 
00509            std::complex<float> R_top[], 
00510            const int ldr_top, 
00511            std::complex<float> R_bot[], 
00512            const int ldr_bot, 
00513            std::complex<float> tau[], 
00514            std::complex<float> work[]) const
00515   {
00516     FortranCInterface_MODULE_(tsqrcombine,c_factor_pair, TSQRCOMBINE,C_FACTOR_PAIR) 
00517       (n, R_top, ldr_top, R_bot, ldr_bot, tau, work);
00518   }
00519 
00520   template<>
00521   void
00522   CombineFortran< std::complex<float>, true >::
00523   apply_pair (const ApplyType& apply_type,
00524           const int ncols_C, 
00525           const int ncols_Q, 
00526           const std::complex<float> R_bot[], 
00527           const int ldr_bot,
00528           const std::complex<float> tau[], 
00529           std::complex<float> C_top[], 
00530           const int ldc_top, 
00531           std::complex<float> C_bot[], 
00532           const int ldc_bot, 
00533           std::complex<float> work[]) const
00534   {
00535     FortranCInterface_MODULE_(tsqrcombine,c_apply_pair, TSQRCOMBINE,C_APPLY_PAIR)
00536       (apply_type.toString().c_str(), ncols_C, ncols_Q, 
00537        R_bot, ldr_bot, tau, C_top, ldc_top, C_bot, ldc_bot, work);
00538   }
00539 
00540 } // namespace TSQR
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends