The OpenD Programming Language

1 /++
2 $(H2 BLAS API for GLAS)
3 
4 Please read $(LINK2 http://www.netlib.org/blas/ , Netlib BLAS) for more details.
5 
6 Note: Standard (fortran) BLAS API is column major.
7 
8 Copyright: Copyright © 2016-, Ilya Yaroshenko.
9 License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0).
10 Authors: Ilya Yaroshenko
11 +/
12 module glas.fortran;
13 
14 /// Alias for Fortran77 integer.
15 alias FortranInt = int;
16 
17 extern(C) nothrow @nogc @system:
18 
19 /++
20  `gemm_`  performs one of the matrix-matrix operations
21 
22     `C := alpha*op( A )*op( B ) + beta*C`,
23 
24  where  `op( X )` is one of
25 
26     `op( X ) = X   or   op( X ) = X**T or op( X ) = X**H`,
27 
28  alpha and beta are scalars, and `A`, `B` and `C` are matrices, with `op( A )`
29  an `m ⨉ k` matrix,  `op( B )`  a  `k ⨉ n` matrix and  `C` an `m ⨉ n` matrix.
30 
31 Unified_alias: `gemm_`
32 +/
33 int sgemm_(ref const char transa, ref const char transb, ref const FortranInt m, ref const FortranInt  n, ref const FortranInt k, ref const float alpha, const(float)* a, ref const FortranInt lda, const(float)* b, ref const FortranInt ldb, ref const float beta, float* c, ref const FortranInt ldc);
34 /// ditto
35 int dgemm_(ref const char transa, ref const char transb, ref const FortranInt m, ref const FortranInt  n, ref const FortranInt k, ref const double alpha, const(double)* a, ref const FortranInt lda, const(double)* b, ref const FortranInt ldb, ref const double beta, double* c, ref const FortranInt ldc);
36 /// ditto
37 int cgemm_(ref const char transa, ref const char transb, ref const FortranInt m, ref const FortranInt  n, ref const FortranInt k, ref const cfloat alpha, const(cfloat)* a, ref const FortranInt lda, const(cfloat)* b, ref const FortranInt ldb, ref const cfloat beta, cfloat* c, ref const FortranInt ldc);
38 /// ditto
39 int zgemm_(ref const char transa, ref const char transb, ref const FortranInt m, ref const FortranInt  n, ref const FortranInt k, ref const cdouble alpha, const(cdouble)* a, ref const FortranInt lda, const(cdouble)* b, ref const FortranInt ldb, ref const cdouble beta, cdouble* c, ref const FortranInt ldc);
40 
41 alias gemm_ = sgemm_;
42 alias gemm_ = dgemm_;
43 alias gemm_ = cgemm_;
44 alias gemm_ = zgemm_;
45 
46 /++
47  `symm_`  performs one of the matrix-matrix operations
48 
49     `C := alpha*A*B + beta*C`,
50 
51  where  `op( X )` is one of
52 
53     `C := alpha*B*A + beta*C`,
54 
55  alpha and beta are scalars, `A` is a symmetric matrix and `B` and
56  `C` are `m ⨉ n` matrices..
57 
58 Unified_alias: `symm_`
59 +/
60 int ssymm_(ref const char side, ref const char uplo, ref const FortranInt m, ref const FortranInt  n, ref const float alpha, const(float)* a, ref const FortranInt lda, const(float)* b, ref const FortranInt ldb, ref const float beta, float* c, ref const FortranInt ldc);
61 /// ditto
62 int dsymm_(ref const char side, ref const char uplo, ref const FortranInt m, ref const FortranInt  n, ref const double alpha, const(double)* a, ref const FortranInt lda, const(double)* b, ref const FortranInt ldb, ref const double beta, double* c, ref const FortranInt ldc);
63 /// ditto
64 int csymm_(ref const char side, ref const char uplo, ref const FortranInt m, ref const FortranInt  n, ref const cfloat alpha, const(cfloat)* a, ref const FortranInt lda, const(cfloat)* b, ref const FortranInt ldb, ref const cfloat beta, cfloat* c, ref const FortranInt ldc);
65 /// ditto
66 int zsymm_(ref const char side, ref const char uplo, ref const FortranInt m, ref const FortranInt  n, ref const cdouble alpha, const(cdouble)* a, ref const FortranInt lda, const(cdouble)* b, ref const FortranInt ldb, ref const cdouble beta, cdouble* c, ref const FortranInt ldc);
67 
68 alias symm_ = ssymm_;
69 alias symm_ = dsymm_;
70 alias symm_ = csymm_;
71 alias symm_ = zsymm_;
72 
73 /++
74  `hemm_`  performs one of the matrix-matrix operations
75 
76     `C := alpha*A*B + beta*C`,
77 
78  where  `op( X )` is one of
79 
80     `C := alpha*B*A + beta*C`,
81 
82  alpha and beta are scalars, `A` is a hermitian matrix and `B` and
83  `C` are `m ⨉ n` matrices..
84 
85 Unified_alias: `hemm_`
86 +/
87 int chemm_(ref const char side, ref const char uplo, ref const FortranInt m, ref const FortranInt  n, ref const cfloat alpha, const(cfloat)* a, ref const FortranInt lda, const(cfloat)* b, ref const FortranInt ldb, ref const cfloat beta, cfloat* c, ref const FortranInt ldc);
88 /// ditto
89 int zhemm_(ref const char side, ref const char uplo, ref const FortranInt m, ref const FortranInt  n, ref const cdouble alpha, const(cdouble)* a, ref const FortranInt lda, const(cdouble)* b, ref const FortranInt ldb, ref const cdouble beta, cdouble* c, ref const FortranInt ldc);
90 
91 alias hemm_ = chemm_;
92 alias hemm_ = zhemm_;
93 
94 /++
95 Copies a vector, `x`, to a vector, `y`.
96 
97 Unified_alias: `copy_`
98 +/
99 int scopy_(ref const FortranInt n, const(float)* x, ref const FortranInt incx, float* y, ref const FortranInt incy);
100 /// ditto 
101 int dcopy_(ref const FortranInt n, const(double)* x, ref const FortranInt incx, double* y, ref const FortranInt incy);
102 /// ditto 
103 int ccopy_(ref const FortranInt n, const(cfloat)* x, ref const FortranInt incx, cfloat* y, ref const FortranInt incy);
104 /// ditto 
105 int zcopy_(ref const FortranInt n, const(cdouble)* x, ref const FortranInt incx, cdouble* y, ref const FortranInt incy);
106 
107 alias copy_ = scopy_;
108 alias copy_ = dcopy_;
109 alias copy_ = ccopy_;
110 alias copy_ = zcopy_;
111 
112 /++
113 Interchanges two vectors.
114 
115 Unified_alias: `swap_`
116 +/
117 int sswap_(ref const FortranInt n, float* x, ref const FortranInt incx, float* y, ref const FortranInt incy);
118 /// ditto 
119 int dswap_(ref const FortranInt n, double* x, ref const FortranInt incx, double* y, ref const FortranInt incy);
120 /// ditto 
121 int cswap_(ref const FortranInt n, cfloat* x, ref const FortranInt incx, cfloat* y, ref const FortranInt incy);
122 /// ditto 
123 int zswap_(ref const FortranInt n, cdouble* x, ref const FortranInt incx, cdouble* y, ref const FortranInt incy);
124 
125 alias swap_ = sswap_;
126 alias swap_ = dswap_;
127 alias swap_ = cswap_;
128 alias swap_ = zswap_;
129 
130 /++
131 Copies a vector, `x`, to a vector, `y`.
132 
133 Unified_alias: `axpy_`
134 +/
135 int saxpy_(ref const FortranInt n, ref const float a, const(float)* x, ref const FortranInt incx, float* y, ref const FortranInt incy);
136 /// ditto 
137 int daxpy_(ref const FortranInt n, ref const double a, const(double)* x, ref const FortranInt incx, double* y, ref const FortranInt incy);
138 /// ditto 
139 int caxpy_(ref const FortranInt n, ref const cfloat a, const(cfloat)* x, ref const FortranInt incx, cfloat* y, ref const FortranInt incy);
140 /// ditto 
141 int zaxpy_(ref const FortranInt n, ref const cdouble a, const(cdouble)* x, ref const FortranInt incx, cdouble* y, ref const FortranInt incy);
142 
143 alias axpy_ = saxpy_;
144 alias axpy_ = daxpy_;
145 alias axpy_ = caxpy_;
146 alias axpy_ = zaxpy_;
147 
148 /++
149 Returns the euclidean norm of a vector via the function.
150 
151 Unified_alias: `nrm2_`
152 +/
153 int snrm2_(ref const FortranInt n, const(float)* x, ref const FortranInt incx);
154 /// ditto 
155 int dnrm2_(ref const FortranInt n, const(double)* x, ref const FortranInt incx);
156 /// ditto 
157 int scnrm2_(ref const FortranInt n, const(cfloat)* x, ref const FortranInt incx);
158 /// ditto 
159 int dznrm2_(ref const FortranInt n, const(cdouble)* x, ref const FortranInt incx);
160 
161 alias nrm2_ = snrm2_;
162 alias nrm2_ = dnrm2_;
163 alias nrm2_ = scnrm2_;
164 alias nrm2_ = dznrm2_;
165 
166 /++
167 Takes the sum of the absolute values.
168 
169 Unified_alias: `asum_`
170 +/
171 int sasum_(ref const FortranInt n, const(float)* x, ref const FortranInt incx);
172 /// ditto 
173 int dasum_(ref const FortranInt n, const(double)* x, ref const FortranInt incx);
174 /// ditto 
175 int scasum_(ref const FortranInt n, const(cfloat)* x, ref const FortranInt incx);
176 /// ditto 
177 int dzasum_(ref const FortranInt n, const(cdouble)* x, ref const FortranInt incx);
178 
179 alias asum_ = sasum_;
180 alias asum_ = dasum_;
181 alias asum_ = scasum_;
182 alias asum_ = dzasum_;
183 
184 /++
185 Finds the index of the first element having maximum `|Re(.)| + |Im(.)|`.
186 
187 Unified_alias: `iamax_`
188 +/
189 int isamax_(ref const FortranInt n, const(float)* x, ref const FortranInt incx);
190 /// ditto 
191 int idamax_(ref const FortranInt n, const(double)* x, ref const FortranInt incx);
192 /// ditto 
193 int icamax_(ref const FortranInt n, const(cfloat)* x, ref const FortranInt incx);
194 /// ditto 
195 int izamax_(ref const FortranInt n, const(cdouble)* x, ref const FortranInt incx);
196 
197 alias iamax_ = isamax_;
198 alias iamax_ = idamax_;
199 alias iamax_ = icamax_;
200 alias iamax_ = izamax_;
201 
202 /++
203 `scal_` scales a vector by a constant.
204 
205 Unified_alias: `scal_`
206 +/
207 int sscal_(ref const FortranInt n, ref const float a, float* x, ref const FortranInt incx);
208 /// ditto 
209 int dscal_(ref const FortranInt n, ref const double a, double* x, ref const FortranInt incx);
210 /// ditto 
211 int csscal_(ref const FortranInt n, ref const float a, cfloat* x, ref const FortranInt incx);
212 /// ditto 
213 int cscal_(ref const FortranInt n, ref const cfloat a, cfloat* x, ref const FortranInt incx);
214 /// ditto 
215 int csIscal_(ref const FortranInt n, ref const ifloat a, cfloat* x, ref const FortranInt incx);
216 /// ditto 
217 int zdscal_(ref const FortranInt n, ref const double a, cdouble* x, ref const FortranInt incx);
218 /// ditto 
219 int zscal_(ref const FortranInt n, ref const cdouble a, cdouble* x, ref const FortranInt incx);
220 /// ditto 
221 int zdIscal_(ref const FortranInt n, ref const idouble a, cdouble* x, ref const FortranInt incx);
222 
223 alias scal_ = sscal_;
224 alias scal_ = dscal_;
225 alias scal_ = csscal_;
226 alias scal_ = cscal_;
227 alias scal_ = csIscal_;
228 alias scal_ = zdscal_;
229 alias scal_ = zscal_;
230 alias scal_ = zdIscal_;
231 
232 /++
233  XERBLA  is an error handler for the LAPACK routines.
234  It is called by an LAPACK routine if an input parameter has an
235  invalid value.  A message is printed and execution stops.
236 
237  Installers may consider modifying the STOP statement in order to
238  call system-specific exception-handling facilities.
239 +/
240 int xerbla_(in char* srname, ref FortranInt info);