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
33void FC_FUNC(dazaxpy, DAZAXPY)(const fint *n, const double *restrict a,
34 const double *restrict x, double *restrict y) {
35
36 const fint twon = 2 * n[0];
37 const fint one = 1;
38
39 FC_FUNC(daxpy, DAXPY)(&twon, a, x, &one, y, &one);
40}
41
42void FC_FUNC(dgemm, DGEMM)(const char *transa, const char *transb,
43 const fint *m, const fint *n, const fint *k,
44 const double *alpha, const double *a,
45 const fint *lda, const double *b, const fint *ldb,
46 const double *beta, double *c, const fint *ldc);
47
48/* interface to apply dgemm passing complex vectors
49 the same as dgemm, but allows giving each an appropriate Fortan interface
50 in which alpha, beta, a, b, c are actually complex in Fortran
51 Could be inline, but in that case pgcc will not put it in the symbol table.
52 */
53void FC_FUNC(zdgemm, ZDGEMM)(const char *transa, const char *transb,
54 const fint *m, const fint *n, const fint *k,
55 const double *alpha, const double *restrict a,
56 const fint *lda, const double *restrict b,
57 const fint *ldb, const double *beta,
58 double *restrict c, const fint *ldc) {
59 FC_FUNC(dgemm, DGEMM)
60 (transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc);
61}
int fint
Definition: fortran_types.h:14