Octopus
dablas.c
Go to the documentation of this file.
1/*
2 Copyright (C) 2006 X. Andrade
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18
19*/
20
21#include <config.h>
22
23#include <stdio.h>
24
25#include <fortran_types.h>
26
27/* declare blas functions */
28void FC_FUNC(dscal, DSCAL)(const fint *n, const double *a, const double *x,
29 const fint *incx);
30void FC_FUNC(daxpy, DAXPY)(const fint *n, const double *a, const double *x,
31 const fint *incx, double *y, const fint *incy);
32
33/* interface to apply blas with a real constant over complex vectors */
34
35void FC_FUNC(dazscal, DAZSCAL)(const fint *n, const double *restrict a,
36 double *restrict x) {
37
38 const fint twon = 2 * n[0];
39 const fint one = 1;
40
41 FC_FUNC(dscal, DSCAL)(&twon, a, x, &one);
42}
43
44void FC_FUNC(dazaxpy, DAZAXPY)(const fint *n, const double *restrict a,
45 const double *restrict x, double *restrict y) {
46
47 const fint twon = 2 * n[0];
48 const fint one = 1;
49
50 FC_FUNC(daxpy, DAXPY)(&twon, a, x, &one, y, &one);
51}
53void FC_FUNC(dgemm, DGEMM)(const char *transa, const char *transb,
54 const fint *m, const fint *n, const fint *k,
55 const double *alpha, const double *a,
56 const fint *lda, const double *b, const fint *ldb,
57 const double *beta, double *c, const fint *ldc);
59/* interface to apply dgemm passing complex vectors
60 the same as dgemm, but allows giving each an appropriate Fortan interface
61 in which alpha, beta, a, b, c are actually complex in Fortran
62 Could be inline, but in that case pgcc will not put it in the symbol table.
63 */
64void FC_FUNC(zdgemm, ZDGEMM)(const char *transa, const char *transb,
65 const fint *m, const fint *n, const fint *k,
66 const double *alpha, const double *restrict a,
67 const fint *lda, const double *restrict b,
68 const fint *ldb, const double *beta,
69 double *restrict c, const fint *ldc) {
70 FC_FUNC(dgemm, DGEMM)
71 (transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc);
int fint
Definition: fortran_types.h:14