| 1 |
// |
| 2 |
// ZQUATEV: Diagonalization of quaternionic matrices |
| 3 |
// File : f77.h |
| 4 |
// Copyright (c) 2013, Toru Shiozaki ([email protected]) |
| 5 |
// All rights reserved. |
| 6 |
// |
| 7 |
// Redistribution and use in source and binary forms, with or without |
| 8 |
// modification, are permitted provided that the following conditions are met: |
| 9 |
// |
| 10 |
// 1. Redistributions of source code must retain the above copyright notice, this |
| 11 |
// list of conditions and the following disclaimer. |
| 12 |
// 2. Redistributions in binary form must reproduce the above copyright notice, |
| 13 |
// this list of conditions and the following disclaimer in the documentation |
| 14 |
// and/or other materials provided with the distribution. |
| 15 |
// |
| 16 |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 17 |
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 18 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 19 |
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |
| 20 |
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 21 |
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 22 |
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 23 |
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 25 |
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 |
// |
| 27 |
// The views and conclusions contained in the software and documentation are those |
| 28 |
// of the authors and should not be interpreted as representing official policies, |
| 29 |
// either expressed or implied, of the FreeBSD Project. |
| 30 |
// |
| 31 |
|
| 32 |
#ifndef __TS_ZQUATEV_F77_H |
| 33 |
#define __TS_ZQUATEV_F77_H |
| 34 |
|
| 35 |
#include <bagel_config.h> |
| 36 |
#include <complex> |
| 37 |
|
| 38 |
// blas |
| 39 |
extern "C" { |
| 40 |
|
| 41 |
void zscal_(const int*, const std::complex<double>*, std::complex<double>*, const int*); |
| 42 |
void zdotc_(std::complex<double>*, const int*, const std::complex<double>*, const int*, const std::complex<double>*, const int*); |
| 43 |
void zaxpy_(const int*, const std::complex<double>*, const std::complex<double>*, const int*, std::complex<double>*, const int*); |
| 44 |
void zgemv_(const char*, const int*, const int*, const std::complex<double>*, const std::complex<double>*, const int*, const std::complex<double>*, const int*, |
| 45 |
const std::complex<double>*, std::complex<double>*, const int*); |
| 46 |
void ztrmv_(const char*, const char*, const char*, const int*, const std::complex<double>*, const int*, std::complex<double>*, const int*); |
| 47 |
#ifdef HAVE_ZGEMM3M |
| 48 |
void zgemm3m_(const char* transa, const char* transb, const int* m, const int* n, const int* k, |
| 49 |
const std::complex<double>* alpha, const std::complex<double>* a, const int* lda, const std::complex<double>* b, const int* ldb, |
| 50 |
const std::complex<double>* beta, std::complex<double>* c, const int* ldc); |
| 51 |
#else |
| 52 |
void zgemm_(const char* transa, const char* transb, const int* m, const int* n, const int* k, |
| 53 |
const std::complex<double>* alpha, const std::complex<double>* a, const int* lda, const std::complex<double>* b, const int* ldb, |
| 54 |
const std::complex<double>* beta, std::complex<double>* c, const int* ldc); |
| 55 |
#endif |
| 56 |
void zrot_(const int*, std::complex<double>*, const int*, std::complex<double>*, const int*, const double*, const std::complex<double>*); |
| 57 |
void zgerc_(const int*, const int*, const std::complex<double>*, const std::complex<double>*, const int*, const std::complex<double>*, const int*, |
| 58 |
std::complex<double>*, const int*); |
| 59 |
void zgeru_(const int*, const int*, const std::complex<double>*, const std::complex<double>*, const int*, const std::complex<double>*, const int*, |
| 60 |
std::complex<double>*, const int*); |
| 61 |
|
| 62 |
// lapack |
| 63 |
void zheev_(const char*, const char*, const int*, std::complex<double>*, const int*, double*, std::complex<double>*, const int*, double*, int*); |
| 64 |
void zhbev_(const char*, const char*, const int*, const int*, std::complex<double>*, const int*, double*, std::complex<double>*, const int*, |
| 65 |
std::complex<double>*, double*, int*); |
| 66 |
void zlartg_(const std::complex<double>*, const std::complex<double>*, double*, std::complex<double>*, std::complex<double>*); |
| 67 |
void zlarfg_(const int*, const std::complex<double>*, std::complex<double>*, const int*, std::complex<double>*); |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
namespace { |
| 72 |
|
| 73 |
void zgemv_(const char* a, const int b, const int c, const std::complex<double>& d, const std::complex<double>* e, const int f, const std::complex<double>* g, const int h, |
| 74 |
const std::complex<double>& i, std::complex<double>* j, const int k) { ::zgemv_(a,&b,&c,&d,e,&f,g,&h,&i,j,&k); } |
| 75 |
void ztrmv_(const char* a, const char* b, const char* c, const int d, const std::complex<double>* e, const int f, std::complex<double>* g, const int h) |
| 76 |
{ ::ztrmv_(a,b,c,&d,e,&f,g,&h); } |
| 77 |
#ifdef HAVE_ZGEMM3M |
| 78 |
void zgemm3m_(const char* transa, const char* transb, const int m, const int n, const int k, |
| 79 |
const std::complex<double>& alpha, const std::complex<double>* a, const int lda, const std::complex<double>* b, const int ldb, |
| 80 |
const std::complex<double>& beta, std::complex<double>* c, const int ldc) { ::zgemm3m_(transa,transb,&m,&n,&k,&alpha,a,&lda,b,&ldb,&beta,c,&ldc); } |
| 81 |
#else |
| 82 |
void zgemm3m_(const char* transa, const char* transb, const int m, const int n, const int k, |
| 83 |
const std::complex<double> alpha, const std::complex<double>* a, const int lda, const std::complex<double>* b, const int ldb, |
| 84 |
const std::complex<double> beta, std::complex<double>* c, const int ldc) { ::zgemm_(transa,transb,&m,&n,&k,&alpha,a,&lda,b,&ldb,&beta,c,&ldc); } |
| 85 |
#endif |
| 86 |
|
| 87 |
void zaxpy_(const int a, const std::complex<double>& b, const std::complex<double>* c, const int d, std::complex<double>* e, const int f) { ::zaxpy_(&a,&b,c,&d,e,&f); } |
| 88 |
void zscal_(const int a, const std::complex<double>& b, std::complex<double>* c, const int d) { ::zscal_(&a, &b, c, &d); } |
| 89 |
std::complex<double> zdotc_(const int b, const std::complex<double>* c, const int d, const std::complex<double>* e, const int f) { |
| 90 |
std::complex<double> a; |
| 91 |
::zdotc_(&a,&b,c,&d,e,&f); |
| 92 |
return a; |
| 93 |
} |
| 94 |
void zheev_(const char* a, const char* b, const int c, std::complex<double>* d, const int e, double* f, std::complex<double>* g, const int h, double* i, int& j) |
| 95 |
{ ::zheev_(a,b,&c,d,&e,f,g,&h,i,&j); } |
| 96 |
void zhbev_(const char* a, const char* b, const int c, const int d, std::complex<double>* e, const int f, double* g, std::complex<double>* h, const int i, |
| 97 |
std::complex<double>* j, double* k, int& l) { ::zhbev_(a, b, &c, &d, e, &f, g, h, &i, j, k, &l); } |
| 98 |
void zrot_(const int a, std::complex<double>* b, const int c, std::complex<double>* d, const int e, const double f, const std::complex<double>& g) { |
| 99 |
::zrot_(&a, b, &c, d, &e, &f, &g); } |
| 100 |
void zgerc_(const int a, const int b, const std::complex<double>& c, const std::complex<double>* d, const int e, const std::complex<double>* f, const int g, |
| 101 |
std::complex<double>* h, const int i) { ::zgerc_(&a, &b, &c, d, &e, f, &g, h, &i); } |
| 102 |
void zgeru_(const int a, const int b, const std::complex<double>& c, const std::complex<double>* d, const int e, const std::complex<double>* f, const int g, |
| 103 |
std::complex<double>* h, const int i) { ::zgeru_(&a, &b, &c, d, &e, f, &g, h, &i); } |
| 104 |
void zlartg_(const std::complex<double>& a, const std::complex<double>& b, double& c, std::complex<double>& d, std::complex<double>& e) { ::zlartg_(&a, &b, &c, &d, &e); } |
| 105 |
void zlarfg_(const int a, std::complex<double>& b, std::complex<double>* c, const int d, std::complex<double>& e) { ::zlarfg_(&a, &b, c, &d, &e); } |
| 106 |
|
| 107 |
} |
| 108 |
|
| 109 |
#endif |