1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
|
// Copyright (c) 2017-2023, University of Tennessee. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause
// This program is free software: you can redistribute it and/or modify it under
// the terms of the BSD 3-Clause license. See the accompanying LICENSE file.
#ifndef LAPACK_WRAPPERS_HH
#define LAPACK_WRAPPERS_HH
// get BLAS_FORTRAN_NAME and int64_t
#include <cassert>
#include <complex>
// This is a temporary file giving simple LAPACK wrappers,
// until the real lapackpp wrappers are available.
// -----------------------------------------------------------------------------
template <typename TX>
void lapack_larnv( int64_t idist, int iseed[4], int64_t size, TX *x )
{
for (int64_t i = 0; i < size; ++i) {
x[i] = rand() / TX ( RAND_MAX );
}
}
template <typename TX>
void lapack_larnv( int64_t idist, int iseed[4], int64_t size, std::complex <TX> *x )
{
for (int64_t i = 0; i < size; ++i) {
x[i] = std::complex <TX>( rand() / TX ( RAND_MAX ), rand() / TX ( RAND_MAX ));
}
}
// -----------------------------------------------------------------------------
float lapack_lange( char const *norm,
int64_t m, int64_t n,
float const *A, int64_t lda,
float *work );
double lapack_lange( char const *norm,
int64_t m, int64_t n,
double const *A, int64_t lda,
double *work );
float lapack_lange( char const *norm,
int64_t m, int64_t n,
std::complex<float> const *A, int64_t lda,
float *work );
double lapack_lange( char const *norm,
int64_t m, int64_t n,
std::complex<double> const *A, int64_t lda,
double *work );
// -----------------------------------------------------------------------------
float lapack_lansy( char const *norm, char const *uplo,
int64_t n,
float const *A, int64_t lda,
float *work );
double lapack_lansy( char const *norm, char const *uplo,
int64_t n,
double const *A, int64_t lda,
double *work );
float lapack_lansy( char const *norm, char const *uplo,
int64_t n,
std::complex<float> const *A, int64_t lda,
float *work );
double lapack_lansy( char const *norm, char const *uplo,
int64_t n,
std::complex<double> const *A, int64_t lda,
double *work );
// -----------------------------------------------------------------------------
float lapack_lanhe( char const *norm, char const *uplo,
int64_t n,
float const *A, int64_t lda,
float *work );
double lapack_lanhe( char const *norm, char const *uplo,
int64_t n,
double const *A, int64_t lda,
double *work );
float lapack_lanhe( char const *norm, char const *uplo,
int64_t n,
std::complex<float> const *A, int64_t lda,
float *work );
double lapack_lanhe( char const *norm, char const *uplo,
int64_t n,
std::complex<double> const *A, int64_t lda,
double *work );
// -----------------------------------------------------------------------------
float lapack_lantr( char const *norm, char const *uplo, char const *diag,
int64_t m, int64_t n,
float const *A, int64_t lda,
float *work );
double lapack_lantr( char const *norm, char const *uplo, char const *diag,
int64_t m, int64_t n,
double const *A, int64_t lda,
double *work );
float lapack_lantr( char const *norm, char const *uplo, char const *diag,
int64_t m, int64_t n,
std::complex<float> const *A, int64_t lda,
float *work );
double lapack_lantr( char const *norm, char const *uplo, char const *diag,
int64_t m, int64_t n,
std::complex<double> const *A, int64_t lda,
double *work );
// -----------------------------------------------------------------------------
template <typename TA, typename TB>
void lapack_lacpy( char const* uplo,
int64_t m, int64_t n,
TA const *A, int64_t lda,
TB *B, int64_t ldb )
{
assert( tolower(*uplo) == 'g' );
for (int64_t j = 0; j < n; ++j) {
for (int64_t i = 0; i < m; ++i) {
B[i + j * ldb] = A[i + j * lda];
}
}
}
// -----------------------------------------------------------------------------
void lapack_potrf( char const *uplo, int64_t n,
float *A, int64_t lda,
int64_t *info );
void lapack_potrf( char const *uplo, int64_t n,
double *A, int64_t lda,
int64_t *info );
void lapack_potrf( char const *uplo, int64_t n,
std::complex<float> *A, int64_t lda,
int64_t *info );
void lapack_potrf( char const *uplo, int64_t n,
std::complex<double> *A, int64_t lda,
int64_t *info );
#endif // #ifndef LAPACK_WRAPPERS_HH
|