File: cblas_wrappers.cc

package info (click to toggle)
blaspp 2024.10.26-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,636 kB
  • sloc: cpp: 29,332; ansic: 8,448; python: 2,192; xml: 182; perl: 101; makefile: 53; sh: 7
file content (82 lines) | stat: -rw-r--r-- 2,091 bytes parent folder | download
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
// 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.

// Function definitions moved from cblas_wrappers.hh for ESSL compatability.

// get BLAS_FORTRAN_NAME and blas_int
#include "blas/fortran.h"

// Including a variant of <cblas.h> can cause conflicts in BLAS_*rot[g]
// Fortran prototypes, e.g., on macOS Ventura. So we define these without
// including their prototypes.
//#include "cblas_wrappers.hh"

#include <complex>

// -----------------------------------------------------------------------------
void
cblas_rotg(
    std::complex<float> *a, std::complex<float> *b,
    float *c, std::complex<float> *s )
{
    BLAS_crotg(
        (blas_complex_float*) a,
        (blas_complex_float*) b,
        c,
        (blas_complex_float*) s );
}

void
cblas_rotg(
    std::complex<double> *a, std::complex<double> *b,
    double *c, std::complex<double> *s )
{
    BLAS_zrotg(
        (blas_complex_double*) a,
        (blas_complex_double*) b,
        c,
        (blas_complex_double*) s );
}

// -----------------------------------------------------------------------------
void
cblas_rot(
    int n,
    std::complex<float> *x, int incx,
    std::complex<float> *y, int incy,
    float c, std::complex<float> s )
{
    blas_int n_ = n;
    blas_int incx_ = incx;
    blas_int incy_ = incy;
    BLAS_crot(
        &n_,
        (blas_complex_float*) x,
        &incx_,
        (blas_complex_float*) y,
        &incy_,
        &c,
        (blas_complex_float*) &s );
}

void
cblas_rot(
    int n,
    std::complex<double> *x, int incx,
    std::complex<double> *y, int incy,
    double c, std::complex<double> s )
{
    blas_int n_ = n;
    blas_int incx_ = incx;
    blas_int incy_ = incy;
    BLAS_zrot(
        &n_,
        (blas_complex_double*) x,
        &incx_,
        (blas_complex_double*) y,
        &incy_,
        &c,
        (blas_complex_double*) &s );
}