blas_sys/
lib.rs

1//! Bindings to [BLAS] \(Fortran).
2//!
3//! ## [Architecture]
4//!
5//! [architecture]: https://blas-lapack-rs.github.io/architecture
6//! [blas]: https://en.wikipedia.org/wiki/BLAS
7
8#![no_std]
9
10use core::ffi::{c_char, c_double, c_float, c_int};
11
12/// A complex number with 64-bit parts.
13#[allow(bad_style)]
14pub type c_double_complex = [c_double; 2];
15
16/// A complex number with 32-bit parts.
17#[allow(bad_style)]
18pub type c_float_complex = [c_float; 2];
19
20// Level 1
21//
22// http://www.netlib.org/blas/#_level_1
23extern "C" {
24    // Single
25    pub fn srotg_(a: *mut c_float, b: *mut c_float, c: *mut c_float, s: *mut c_float);
26    pub fn srotmg_(
27        d1: *mut c_float,
28        d2: *mut c_float,
29        x1: *mut c_float,
30        y1: *const c_float,
31        param: *mut c_float,
32    );
33    pub fn srot_(
34        n: *const c_int,
35        x: *mut c_float,
36        incx: *const c_int,
37        y: *mut c_float,
38        incy: *const c_int,
39        c: *const c_float,
40        s: *const c_float,
41    );
42    pub fn srotm_(
43        n: *const c_int,
44        x: *mut c_float,
45        incx: *const c_int,
46        y: *mut c_float,
47        incy: *const c_int,
48        param: *const c_float,
49    );
50    pub fn sswap_(
51        n: *const c_int,
52        x: *mut c_float,
53        incx: *const c_int,
54        y: *mut c_float,
55        incy: *const c_int,
56    );
57    pub fn sscal_(n: *const c_int, a: *const c_float, x: *mut c_float, incx: *const c_int);
58    pub fn scopy_(
59        n: *const c_int,
60        x: *const c_float,
61        incx: *const c_int,
62        y: *mut c_float,
63        incy: *const c_int,
64    );
65    pub fn saxpy_(
66        n: *const c_int,
67        alpha: *const c_float,
68        x: *const c_float,
69        incx: *const c_int,
70        y: *mut c_float,
71        incy: *const c_int,
72    );
73    pub fn sdot_(
74        n: *const c_int,
75        x: *const c_float,
76        incx: *const c_int,
77        y: *const c_float,
78        incy: *const c_int,
79    ) -> c_float;
80    pub fn sdsdot_(
81        n: *const c_int,
82        sb: *const c_float,
83        x: *const c_float,
84        incx: *const c_int,
85        y: *const c_float,
86        incy: *const c_int,
87    ) -> c_float;
88    pub fn snrm2_(n: *const c_int, x: *const c_float, incx: *const c_int) -> c_float;
89    pub fn scnrm2_(n: *const c_int, x: *const c_float_complex, incx: *const c_int) -> c_float;
90    pub fn sasum_(n: *const c_int, x: *const c_float, incx: *const c_int) -> c_float;
91    pub fn isamax_(n: *const c_int, x: *const c_float, incx: *const c_int) -> c_int;
92
93    // Double
94    pub fn drotg_(a: *mut c_double, b: *mut c_double, c: *mut c_double, s: *mut c_double);
95    pub fn drotmg_(
96        d1: *mut c_double,
97        d2: *mut c_double,
98        x1: *mut c_double,
99        y1: *const c_double,
100        param: *mut c_double,
101    );
102    pub fn drot_(
103        n: *const c_int,
104        x: *mut c_double,
105        incx: *const c_int,
106        y: *mut c_double,
107        incy: *const c_int,
108        c: *const c_double,
109        s: *const c_double,
110    );
111    pub fn drotm_(
112        n: *const c_int,
113        x: *mut c_double,
114        incx: *const c_int,
115        y: *mut c_double,
116        incy: *const c_int,
117        param: *const c_double,
118    );
119    pub fn dswap_(
120        n: *const c_int,
121        x: *mut c_double,
122        incx: *const c_int,
123        y: *mut c_double,
124        incy: *const c_int,
125    );
126    pub fn dscal_(n: *const c_int, a: *const c_double, x: *mut c_double, incx: *const c_int);
127    pub fn dcopy_(
128        n: *const c_int,
129        x: *const c_double,
130        incx: *const c_int,
131        y: *mut c_double,
132        incy: *const c_int,
133    );
134    pub fn daxpy_(
135        n: *const c_int,
136        alpha: *const c_double,
137        x: *const c_double,
138        incx: *const c_int,
139        y: *mut c_double,
140        incy: *const c_int,
141    );
142    pub fn ddot_(
143        n: *const c_int,
144        x: *const c_double,
145        incx: *const c_int,
146        y: *const c_double,
147        incy: *const c_int,
148    ) -> c_double;
149    pub fn dsdot_(
150        n: *const c_int,
151        x: *const c_float,
152        incx: *const c_int,
153        y: *const c_float,
154        incy: *const c_int,
155    ) -> c_double;
156    pub fn dnrm2_(n: *const c_int, x: *const c_double, incx: *const c_int) -> c_double;
157    pub fn dznrm2_(n: *const c_int, x: *const c_double_complex, incx: *const c_int) -> c_double;
158    pub fn dasum_(n: *const c_int, x: *const c_double, incx: *const c_int) -> c_double;
159    pub fn idamax_(n: *const c_int, x: *const c_double, incx: *const c_int) -> c_int;
160
161    // Complex
162    pub fn crotg_(
163        a: *mut c_float_complex,
164        b: *const c_float_complex,
165        c: *mut c_float,
166        s: *mut c_float_complex,
167    );
168    pub fn csrot_(
169        n: *const c_int,
170        x: *mut c_float_complex,
171        incx: *const c_int,
172        y: *mut c_float_complex,
173        incy: *const c_int,
174        c: *const c_float,
175        s: *const c_float,
176    );
177    pub fn cswap_(
178        n: *const c_int,
179        x: *mut c_float_complex,
180        incx: *const c_int,
181        y: *mut c_float_complex,
182        incy: *const c_int,
183    );
184    pub fn cscal_(
185        n: *const c_int,
186        a: *const c_float_complex,
187        x: *mut c_float_complex,
188        incx: *const c_int,
189    );
190    pub fn csscal_(n: *const c_int, a: *const c_float, x: *mut c_float_complex, incx: *const c_int);
191    pub fn ccopy_(
192        n: *const c_int,
193        x: *const c_float_complex,
194        incx: *const c_int,
195        y: *mut c_float_complex,
196        incy: *const c_int,
197    );
198    pub fn caxpy_(
199        n: *const c_int,
200        alpha: *const c_float_complex,
201        x: *const c_float_complex,
202        incx: *const c_int,
203        y: *mut c_float_complex,
204        incy: *const c_int,
205    );
206    pub fn cdotu_(
207        pres: *mut c_float_complex,
208        n: *const c_int,
209        x: *const c_float_complex,
210        incx: *const c_int,
211        y: *const c_float_complex,
212        incy: *const c_int,
213    );
214    pub fn cdotc_(
215        pres: *mut c_float_complex,
216        n: *const c_int,
217        x: *const c_float_complex,
218        incx: *const c_int,
219        y: *const c_float_complex,
220        incy: *const c_int,
221    );
222    pub fn scasum_(n: *const c_int, x: *const c_float_complex, incx: *const c_int) -> c_float;
223    pub fn icamax_(n: *const c_int, x: *const c_float_complex, incx: *const c_int) -> c_int;
224
225    // Double complex
226    pub fn zrotg_(
227        a: *mut c_double_complex,
228        b: *const c_double_complex,
229        c: *mut c_double,
230        s: *mut c_double_complex,
231    );
232    pub fn zdrot_(
233        n: *const c_int,
234        x: *mut c_double_complex,
235        incx: *const c_int,
236        y: *mut c_double_complex,
237        incy: *const c_int,
238        c: *const c_double,
239        s: *const c_double,
240    );
241    pub fn zswap_(
242        n: *const c_int,
243        x: *mut c_double_complex,
244        incx: *const c_int,
245        y: *mut c_double_complex,
246        incy: *const c_int,
247    );
248    pub fn zscal_(
249        n: *const c_int,
250        a: *const c_double_complex,
251        x: *mut c_double_complex,
252        incx: *const c_int,
253    );
254    pub fn zdscal_(
255        n: *const c_int,
256        a: *const c_double,
257        x: *mut c_double_complex,
258        incx: *const c_int,
259    );
260    pub fn zcopy_(
261        n: *const c_int,
262        x: *const c_double_complex,
263        incx: *const c_int,
264        y: *mut c_double_complex,
265        incy: *const c_int,
266    );
267    pub fn zaxpy_(
268        n: *const c_int,
269        alpha: *const c_double_complex,
270        x: *const c_double_complex,
271        incx: *const c_int,
272        y: *mut c_double_complex,
273        incy: *const c_int,
274    );
275    pub fn zdotu_(
276        pres: *mut c_double_complex,
277        n: *const c_int,
278        x: *const c_double_complex,
279        incx: *const c_int,
280        y: *const c_double_complex,
281        incy: *const c_int,
282    );
283    pub fn zdotc_(
284        pres: *mut c_double_complex,
285        n: *const c_int,
286        x: *const c_double_complex,
287        incx: *const c_int,
288        y: *const c_double_complex,
289        incy: *const c_int,
290    );
291    pub fn dzasum_(n: *const c_int, x: *const c_double_complex, incx: *const c_int) -> c_double;
292    pub fn izamax_(n: *const c_int, x: *const c_double_complex, incx: *const c_int) -> c_int;
293}
294
295// Level 2
296//
297// http://www.netlib.org/blas/#_level_2
298extern "C" {
299    // Single
300    pub fn sgemv_(
301        trans: *const c_char,
302        m: *const c_int,
303        n: *const c_int,
304        alpha: *const c_float,
305        a: *const c_float,
306        lda: *const c_int,
307        x: *const c_float,
308        incx: *const c_int,
309        beta: *const c_float,
310        y: *mut c_float,
311        incy: *const c_int,
312    );
313    pub fn sgbmv_(
314        trans: *const c_char,
315        m: *const c_int,
316        n: *const c_int,
317        kl: *const c_int,
318        ku: *const c_int,
319        alpha: *const c_float,
320        a: *const c_float,
321        lda: *const c_int,
322        x: *const c_float,
323        incx: *const c_int,
324        beta: *const c_float,
325        y: *mut c_float,
326        incy: *const c_int,
327    );
328    pub fn ssymv_(
329        uplo: *const c_char,
330        n: *const c_int,
331        alpha: *const c_float,
332        a: *const c_float,
333        lda: *const c_int,
334        x: *const c_float,
335        incx: *const c_int,
336        beta: *const c_float,
337        y: *mut c_float,
338        incy: *const c_int,
339    );
340    pub fn ssbmv_(
341        uplo: *const c_char,
342        n: *const c_int,
343        k: *const c_int,
344        alpha: *const c_float,
345        a: *const c_float,
346        lda: *const c_int,
347        x: *const c_float,
348        incx: *const c_int,
349        beta: *const c_float,
350        y: *mut c_float,
351        incy: *const c_int,
352    );
353    pub fn sspmv_(
354        uplo: *const c_char,
355        n: *const c_int,
356        alpha: *const c_float,
357        ap: *const c_float,
358        x: *const c_float,
359        incx: *const c_int,
360        beta: *const c_float,
361        y: *mut c_float,
362        incy: *const c_int,
363    );
364    pub fn strmv_(
365        uplo: *const c_char,
366        transa: *const c_char,
367        diag: *const c_char,
368        n: *const c_int,
369        a: *const c_float,
370        lda: *const c_int,
371        b: *mut c_float,
372        incx: *const c_int,
373    );
374    pub fn stbmv_(
375        uplo: *const c_char,
376        trans: *const c_char,
377        diag: *const c_char,
378        n: *const c_int,
379        k: *const c_int,
380        a: *const c_float,
381        lda: *const c_int,
382        x: *mut c_float,
383        incx: *const c_int,
384    );
385    pub fn stpmv_(
386        uplo: *const c_char,
387        trans: *const c_char,
388        diag: *const c_char,
389        n: *const c_int,
390        ap: *const c_float,
391        x: *mut c_float,
392        incx: *const c_int,
393    );
394    pub fn strsv_(
395        uplo: *const c_char,
396        trans: *const c_char,
397        diag: *const c_char,
398        n: *const c_int,
399        a: *const c_float,
400        lda: *const c_int,
401        x: *mut c_float,
402        incx: *const c_int,
403    );
404    pub fn stbsv_(
405        uplo: *const c_char,
406        trans: *const c_char,
407        diag: *const c_char,
408        n: *const c_int,
409        k: *const c_int,
410        a: *const c_float,
411        lda: *const c_int,
412        x: *mut c_float,
413        incx: *const c_int,
414    );
415    pub fn stpsv_(
416        uplo: *const c_char,
417        trans: *const c_char,
418        diag: *const c_char,
419        n: *const c_int,
420        ap: *const c_float,
421        x: *mut c_float,
422        incx: *const c_int,
423    );
424    pub fn sger_(
425        m: *const c_int,
426        n: *const c_int,
427        alpha: *const c_float,
428        x: *const c_float,
429        incx: *const c_int,
430        y: *const c_float,
431        incy: *const c_int,
432        a: *mut c_float,
433        lda: *const c_int,
434    );
435    pub fn ssyr_(
436        uplo: *const c_char,
437        n: *const c_int,
438        alpha: *const c_float,
439        x: *const c_float,
440        incx: *const c_int,
441        a: *mut c_float,
442        lda: *const c_int,
443    );
444    pub fn sspr_(
445        uplo: *const c_char,
446        n: *const c_int,
447        alpha: *const c_float,
448        x: *const c_float,
449        incx: *const c_int,
450        ap: *mut c_float,
451    );
452    pub fn ssyr2_(
453        uplo: *const c_char,
454        n: *const c_int,
455        alpha: *const c_float,
456        x: *const c_float,
457        incx: *const c_int,
458        y: *const c_float,
459        incy: *const c_int,
460        a: *mut c_float,
461        lda: *const c_int,
462    );
463    pub fn sspr2_(
464        uplo: *const c_char,
465        n: *const c_int,
466        alpha: *const c_float,
467        x: *const c_float,
468        incx: *const c_int,
469        y: *const c_float,
470        incy: *const c_int,
471        ap: *mut c_float,
472    );
473
474    // Double
475    pub fn dgemv_(
476        trans: *const c_char,
477        m: *const c_int,
478        n: *const c_int,
479        alpha: *const c_double,
480        a: *const c_double,
481        lda: *const c_int,
482        x: *const c_double,
483        incx: *const c_int,
484        beta: *const c_double,
485        y: *mut c_double,
486        incy: *const c_int,
487    );
488    pub fn dgbmv_(
489        trans: *const c_char,
490        m: *const c_int,
491        n: *const c_int,
492        kl: *const c_int,
493        ku: *const c_int,
494        alpha: *const c_double,
495        a: *const c_double,
496        lda: *const c_int,
497        x: *const c_double,
498        incx: *const c_int,
499        beta: *const c_double,
500        y: *mut c_double,
501        incy: *const c_int,
502    );
503    pub fn dsymv_(
504        uplo: *const c_char,
505        n: *const c_int,
506        alpha: *const c_double,
507        a: *const c_double,
508        lda: *const c_int,
509        x: *const c_double,
510        incx: *const c_int,
511        beta: *const c_double,
512        y: *mut c_double,
513        incy: *const c_int,
514    );
515    pub fn dsbmv_(
516        uplo: *const c_char,
517        n: *const c_int,
518        k: *const c_int,
519        alpha: *const c_double,
520        a: *const c_double,
521        lda: *const c_int,
522        x: *const c_double,
523        incx: *const c_int,
524        beta: *const c_double,
525        y: *mut c_double,
526        incy: *const c_int,
527    );
528    pub fn dspmv_(
529        uplo: *const c_char,
530        n: *const c_int,
531        alpha: *const c_double,
532        ap: *const c_double,
533        x: *const c_double,
534        incx: *const c_int,
535        beta: *const c_double,
536        y: *mut c_double,
537        incy: *const c_int,
538    );
539    pub fn dtrmv_(
540        uplo: *const c_char,
541        transa: *const c_char,
542        diag: *const c_char,
543        n: *const c_int,
544        a: *const c_double,
545        lda: *const c_int,
546        b: *mut c_double,
547        incx: *const c_int,
548    );
549    pub fn dtbmv_(
550        uplo: *const c_char,
551        trans: *const c_char,
552        diag: *const c_char,
553        n: *const c_int,
554        k: *const c_int,
555        a: *const c_double,
556        lda: *const c_int,
557        x: *mut c_double,
558        incx: *const c_int,
559    );
560    pub fn dtpmv_(
561        uplo: *const c_char,
562        trans: *const c_char,
563        diag: *const c_char,
564        n: *const c_int,
565        ap: *const c_double,
566        x: *mut c_double,
567        incx: *const c_int,
568    );
569    pub fn dtrsv_(
570        uplo: *const c_char,
571        trans: *const c_char,
572        diag: *const c_char,
573        n: *const c_int,
574        a: *const c_double,
575        lda: *const c_int,
576        x: *mut c_double,
577        incx: *const c_int,
578    );
579    pub fn dtbsv_(
580        uplo: *const c_char,
581        trans: *const c_char,
582        diag: *const c_char,
583        n: *const c_int,
584        k: *const c_int,
585        a: *const c_double,
586        lda: *const c_int,
587        x: *mut c_double,
588        incx: *const c_int,
589    );
590    pub fn dtpsv_(
591        uplo: *const c_char,
592        trans: *const c_char,
593        diag: *const c_char,
594        n: *const c_int,
595        ap: *const c_double,
596        x: *mut c_double,
597        incx: *const c_int,
598    );
599    pub fn dger_(
600        m: *const c_int,
601        n: *const c_int,
602        alpha: *const c_double,
603        x: *const c_double,
604        incx: *const c_int,
605        y: *const c_double,
606        incy: *const c_int,
607        a: *mut c_double,
608        lda: *const c_int,
609    );
610    pub fn dsyr_(
611        uplo: *const c_char,
612        n: *const c_int,
613        alpha: *const c_double,
614        x: *const c_double,
615        incx: *const c_int,
616        a: *mut c_double,
617        lda: *const c_int,
618    );
619    pub fn dspr_(
620        uplo: *const c_char,
621        n: *const c_int,
622        alpha: *const c_double,
623        x: *const c_double,
624        incx: *const c_int,
625        ap: *mut c_double,
626    );
627    pub fn dsyr2_(
628        uplo: *const c_char,
629        n: *const c_int,
630        alpha: *const c_double,
631        x: *const c_double,
632        incx: *const c_int,
633        y: *const c_double,
634        incy: *const c_int,
635        a: *mut c_double,
636        lda: *const c_int,
637    );
638    pub fn dspr2_(
639        uplo: *const c_char,
640        n: *const c_int,
641        alpha: *const c_double,
642        x: *const c_double,
643        incx: *const c_int,
644        y: *const c_double,
645        incy: *const c_int,
646        ap: *mut c_double,
647    );
648
649    // Complex
650    pub fn cgemv_(
651        trans: *const c_char,
652        m: *const c_int,
653        n: *const c_int,
654        alpha: *const c_float_complex,
655        a: *const c_float_complex,
656        lda: *const c_int,
657        x: *const c_float_complex,
658        incx: *const c_int,
659        beta: *const c_float_complex,
660        y: *mut c_float_complex,
661        incy: *const c_int,
662    );
663    pub fn cgbmv_(
664        trans: *const c_char,
665        m: *const c_int,
666        n: *const c_int,
667        kl: *const c_int,
668        ku: *const c_int,
669        alpha: *const c_float_complex,
670        a: *const c_float_complex,
671        lda: *const c_int,
672        x: *const c_float_complex,
673        incx: *const c_int,
674        beta: *const c_float_complex,
675        y: *mut c_float_complex,
676        incy: *const c_int,
677    );
678    pub fn chemv_(
679        uplo: *const c_char,
680        n: *const c_int,
681        alpha: *const c_float_complex,
682        a: *const c_float_complex,
683        lda: *const c_int,
684        x: *const c_float_complex,
685        incx: *const c_int,
686        beta: *const c_float_complex,
687        y: *mut c_float_complex,
688        incy: *const c_int,
689    );
690    pub fn chbmv_(
691        uplo: *const c_char,
692        n: *const c_int,
693        k: *const c_int,
694        alpha: *const c_float_complex,
695        a: *const c_float_complex,
696        lda: *const c_int,
697        x: *const c_float_complex,
698        incx: *const c_int,
699        beta: *const c_float_complex,
700        y: *mut c_float_complex,
701        incy: *const c_int,
702    );
703    pub fn chpmv_(
704        uplo: *const c_char,
705        n: *const c_int,
706        alpha: *const c_float_complex,
707        ap: *const c_float_complex,
708        x: *const c_float_complex,
709        incx: *const c_int,
710        beta: *const c_float_complex,
711        y: *mut c_float_complex,
712        incy: *const c_int,
713    );
714    pub fn ctrmv_(
715        uplo: *const c_char,
716        transa: *const c_char,
717        diag: *const c_char,
718        n: *const c_int,
719        a: *const c_float_complex,
720        lda: *const c_int,
721        b: *mut c_float_complex,
722        incx: *const c_int,
723    );
724    pub fn ctbmv_(
725        uplo: *const c_char,
726        trans: *const c_char,
727        diag: *const c_char,
728        n: *const c_int,
729        k: *const c_int,
730        a: *const c_float_complex,
731        lda: *const c_int,
732        x: *mut c_float_complex,
733        incx: *const c_int,
734    );
735    pub fn ctpmv_(
736        uplo: *const c_char,
737        trans: *const c_char,
738        diag: *const c_char,
739        n: *const c_int,
740        ap: *const c_float_complex,
741        x: *mut c_float_complex,
742        incx: *const c_int,
743    );
744    pub fn ctrsv_(
745        uplo: *const c_char,
746        trans: *const c_char,
747        diag: *const c_char,
748        n: *const c_int,
749        a: *const c_float_complex,
750        lda: *const c_int,
751        x: *mut c_float_complex,
752        incx: *const c_int,
753    );
754    pub fn ctbsv_(
755        uplo: *const c_char,
756        trans: *const c_char,
757        diag: *const c_char,
758        n: *const c_int,
759        k: *const c_int,
760        a: *const c_float_complex,
761        lda: *const c_int,
762        x: *mut c_float_complex,
763        incx: *const c_int,
764    );
765    pub fn ctpsv_(
766        uplo: *const c_char,
767        trans: *const c_char,
768        diag: *const c_char,
769        n: *const c_int,
770        ap: *const c_float_complex,
771        x: *mut c_float_complex,
772        incx: *const c_int,
773    );
774    pub fn cgeru_(
775        m: *const c_int,
776        n: *const c_int,
777        alpha: *const c_float_complex,
778        x: *const c_float_complex,
779        incx: *const c_int,
780        y: *const c_float_complex,
781        incy: *const c_int,
782        a: *mut c_float_complex,
783        lda: *const c_int,
784    );
785    pub fn cgerc_(
786        m: *const c_int,
787        n: *const c_int,
788        alpha: *const c_float_complex,
789        x: *const c_float_complex,
790        incx: *const c_int,
791        y: *const c_float_complex,
792        incy: *const c_int,
793        a: *mut c_float_complex,
794        lda: *const c_int,
795    );
796    pub fn cher_(
797        uplo: *const c_char,
798        n: *const c_int,
799        alpha: *const c_float,
800        x: *const c_float_complex,
801        incx: *const c_int,
802        a: *mut c_float_complex,
803        lda: *const c_int,
804    );
805    pub fn chpr_(
806        uplo: *const c_char,
807        n: *const c_int,
808        alpha: *const c_float,
809        x: *const c_float_complex,
810        incx: *const c_int,
811        ap: *mut c_float_complex,
812    );
813    pub fn chpr2_(
814        uplo: *const c_char,
815        n: *const c_int,
816        alpha: *const c_float_complex,
817        x: *const c_float_complex,
818        incx: *const c_int,
819        y: *const c_float_complex,
820        incy: *const c_int,
821        ap: *mut c_float_complex,
822    );
823    pub fn cher2_(
824        uplo: *const c_char,
825        n: *const c_int,
826        alpha: *const c_float_complex,
827        x: *const c_float_complex,
828        incx: *const c_int,
829        y: *const c_float_complex,
830        incy: *const c_int,
831        a: *mut c_float_complex,
832        lda: *const c_int,
833    );
834
835    // Double complex
836    pub fn zgemv_(
837        trans: *const c_char,
838        m: *const c_int,
839        n: *const c_int,
840        alpha: *const c_double_complex,
841        a: *const c_double_complex,
842        lda: *const c_int,
843        x: *const c_double_complex,
844        incx: *const c_int,
845        beta: *const c_double_complex,
846        y: *mut c_double_complex,
847        incy: *const c_int,
848    );
849    pub fn zgbmv_(
850        trans: *const c_char,
851        m: *const c_int,
852        n: *const c_int,
853        kl: *const c_int,
854        ku: *const c_int,
855        alpha: *const c_double_complex,
856        a: *const c_double_complex,
857        lda: *const c_int,
858        x: *const c_double_complex,
859        incx: *const c_int,
860        beta: *const c_double_complex,
861        y: *mut c_double_complex,
862        incy: *const c_int,
863    );
864    pub fn zhemv_(
865        uplo: *const c_char,
866        n: *const c_int,
867        alpha: *const c_double_complex,
868        a: *const c_double_complex,
869        lda: *const c_int,
870        x: *const c_double_complex,
871        incx: *const c_int,
872        beta: *const c_double_complex,
873        y: *mut c_double_complex,
874        incy: *const c_int,
875    );
876    pub fn zhbmv_(
877        uplo: *const c_char,
878        n: *const c_int,
879        k: *const c_int,
880        alpha: *const c_double_complex,
881        a: *const c_double_complex,
882        lda: *const c_int,
883        x: *const c_double_complex,
884        incx: *const c_int,
885        beta: *const c_double_complex,
886        y: *mut c_double_complex,
887        incy: *const c_int,
888    );
889    pub fn zhpmv_(
890        uplo: *const c_char,
891        n: *const c_int,
892        alpha: *const c_double_complex,
893        ap: *const c_double_complex,
894        x: *const c_double_complex,
895        incx: *const c_int,
896        beta: *const c_double_complex,
897        y: *mut c_double_complex,
898        incy: *const c_int,
899    );
900    pub fn ztrmv_(
901        uplo: *const c_char,
902        transa: *const c_char,
903        diag: *const c_char,
904        n: *const c_int,
905        a: *const c_double_complex,
906        lda: *const c_int,
907        b: *mut c_double_complex,
908        incx: *const c_int,
909    );
910    pub fn ztbmv_(
911        uplo: *const c_char,
912        trans: *const c_char,
913        diag: *const c_char,
914        n: *const c_int,
915        k: *const c_int,
916        a: *const c_double_complex,
917        lda: *const c_int,
918        x: *mut c_double_complex,
919        incx: *const c_int,
920    );
921    pub fn ztpmv_(
922        uplo: *const c_char,
923        trans: *const c_char,
924        diag: *const c_char,
925        n: *const c_int,
926        ap: *const c_double_complex,
927        x: *mut c_double_complex,
928        incx: *const c_int,
929    );
930    pub fn ztrsv_(
931        uplo: *const c_char,
932        trans: *const c_char,
933        diag: *const c_char,
934        n: *const c_int,
935        a: *const c_double_complex,
936        lda: *const c_int,
937        x: *mut c_double_complex,
938        incx: *const c_int,
939    );
940    pub fn ztbsv_(
941        uplo: *const c_char,
942        trans: *const c_char,
943        diag: *const c_char,
944        n: *const c_int,
945        k: *const c_int,
946        a: *const c_double_complex,
947        lda: *const c_int,
948        x: *mut c_double_complex,
949        incx: *const c_int,
950    );
951    pub fn ztpsv_(
952        uplo: *const c_char,
953        trans: *const c_char,
954        diag: *const c_char,
955        n: *const c_int,
956        ap: *const c_double_complex,
957        x: *mut c_double_complex,
958        incx: *const c_int,
959    );
960    pub fn zgeru_(
961        m: *const c_int,
962        n: *const c_int,
963        alpha: *const c_double_complex,
964        x: *const c_double_complex,
965        incx: *const c_int,
966        y: *const c_double_complex,
967        incy: *const c_int,
968        a: *mut c_double_complex,
969        lda: *const c_int,
970    );
971    pub fn zgerc_(
972        m: *const c_int,
973        n: *const c_int,
974        alpha: *const c_double_complex,
975        x: *const c_double_complex,
976        incx: *const c_int,
977        y: *const c_double_complex,
978        incy: *const c_int,
979        a: *mut c_double_complex,
980        lda: *const c_int,
981    );
982    pub fn zher_(
983        uplo: *const c_char,
984        n: *const c_int,
985        alpha: *const c_double,
986        x: *const c_double_complex,
987        incx: *const c_int,
988        a: *mut c_double_complex,
989        lda: *const c_int,
990    );
991    pub fn zhpr_(
992        uplo: *const c_char,
993        n: *const c_int,
994        alpha: *const c_double,
995        x: *const c_double_complex,
996        incx: *const c_int,
997        ap: *mut c_double_complex,
998    );
999    pub fn zher2_(
1000        uplo: *const c_char,
1001        n: *const c_int,
1002        alpha: *const c_double_complex,
1003        x: *const c_double_complex,
1004        incx: *const c_int,
1005        y: *const c_double_complex,
1006        incy: *const c_int,
1007        a: *mut c_double_complex,
1008        lda: *const c_int,
1009    );
1010    pub fn zhpr2_(
1011        uplo: *const c_char,
1012        n: *const c_int,
1013        alpha: *const c_double_complex,
1014        x: *const c_double_complex,
1015        incx: *const c_int,
1016        y: *const c_double_complex,
1017        incy: *const c_int,
1018        ap: *mut c_double_complex,
1019    );
1020}
1021
1022// Level 3
1023//
1024// http://www.netlib.org/blas/#_level_3
1025extern "C" {
1026    // Single
1027    pub fn sgemm_(
1028        transa: *const c_char,
1029        transb: *const c_char,
1030        m: *const c_int,
1031        n: *const c_int,
1032        k: *const c_int,
1033        alpha: *const c_float,
1034        a: *const c_float,
1035        lda: *const c_int,
1036        b: *const c_float,
1037        ldb: *const c_int,
1038        beta: *const c_float,
1039        c: *mut c_float,
1040        ldc: *const c_int,
1041    );
1042    pub fn ssymm_(
1043        side: *const c_char,
1044        uplo: *const c_char,
1045        m: *const c_int,
1046        n: *const c_int,
1047        alpha: *const c_float,
1048        a: *const c_float,
1049        lda: *const c_int,
1050        b: *const c_float,
1051        ldb: *const c_int,
1052        beta: *const c_float,
1053        c: *mut c_float,
1054        ldc: *const c_int,
1055    );
1056    pub fn ssyrk_(
1057        uplo: *const c_char,
1058        trans: *const c_char,
1059        n: *const c_int,
1060        k: *const c_int,
1061        alpha: *const c_float,
1062        a: *const c_float,
1063        lda: *const c_int,
1064        beta: *const c_float,
1065        c: *mut c_float,
1066        ldc: *const c_int,
1067    );
1068    pub fn ssyr2k_(
1069        uplo: *const c_char,
1070        trans: *const c_char,
1071        n: *const c_int,
1072        k: *const c_int,
1073        alpha: *const c_float,
1074        a: *const c_float,
1075        lda: *const c_int,
1076        b: *const c_float,
1077        ldb: *const c_int,
1078        beta: *const c_float,
1079        c: *mut c_float,
1080        ldc: *const c_int,
1081    );
1082    pub fn strmm_(
1083        side: *const c_char,
1084        uplo: *const c_char,
1085        transa: *const c_char,
1086        diag: *const c_char,
1087        m: *const c_int,
1088        n: *const c_int,
1089        alpha: *const c_float,
1090        a: *const c_float,
1091        lda: *const c_int,
1092        b: *mut c_float,
1093        ldb: *const c_int,
1094    );
1095    pub fn strsm_(
1096        side: *const c_char,
1097        uplo: *const c_char,
1098        transa: *const c_char,
1099        diag: *const c_char,
1100        m: *const c_int,
1101        n: *const c_int,
1102        alpha: *const c_float,
1103        a: *const c_float,
1104        lda: *const c_int,
1105        b: *mut c_float,
1106        ldb: *const c_int,
1107    );
1108
1109    // Double
1110    pub fn dgemm_(
1111        transa: *const c_char,
1112        transb: *const c_char,
1113        m: *const c_int,
1114        n: *const c_int,
1115        k: *const c_int,
1116        alpha: *const c_double,
1117        a: *const c_double,
1118        lda: *const c_int,
1119        b: *const c_double,
1120        ldb: *const c_int,
1121        beta: *const c_double,
1122        c: *mut c_double,
1123        ldc: *const c_int,
1124    );
1125    pub fn dsymm_(
1126        side: *const c_char,
1127        uplo: *const c_char,
1128        m: *const c_int,
1129        n: *const c_int,
1130        alpha: *const c_double,
1131        a: *const c_double,
1132        lda: *const c_int,
1133        b: *const c_double,
1134        ldb: *const c_int,
1135        beta: *const c_double,
1136        c: *mut c_double,
1137        ldc: *const c_int,
1138    );
1139    pub fn dsyrk_(
1140        uplo: *const c_char,
1141        trans: *const c_char,
1142        n: *const c_int,
1143        k: *const c_int,
1144        alpha: *const c_double,
1145        a: *const c_double,
1146        lda: *const c_int,
1147        beta: *const c_double,
1148        c: *mut c_double,
1149        ldc: *const c_int,
1150    );
1151    pub fn dsyr2k_(
1152        uplo: *const c_char,
1153        trans: *const c_char,
1154        n: *const c_int,
1155        k: *const c_int,
1156        alpha: *const c_double,
1157        a: *const c_double,
1158        lda: *const c_int,
1159        b: *const c_double,
1160        ldb: *const c_int,
1161        beta: *const c_double,
1162        c: *mut c_double,
1163        ldc: *const c_int,
1164    );
1165    pub fn dtrmm_(
1166        side: *const c_char,
1167        uplo: *const c_char,
1168        transa: *const c_char,
1169        diag: *const c_char,
1170        m: *const c_int,
1171        n: *const c_int,
1172        alpha: *const c_double,
1173        a: *const c_double,
1174        lda: *const c_int,
1175        b: *mut c_double,
1176        ldb: *const c_int,
1177    );
1178    pub fn dtrsm_(
1179        side: *const c_char,
1180        uplo: *const c_char,
1181        transa: *const c_char,
1182        diag: *const c_char,
1183        m: *const c_int,
1184        n: *const c_int,
1185        alpha: *const c_double,
1186        a: *const c_double,
1187        lda: *const c_int,
1188        b: *mut c_double,
1189        ldb: *const c_int,
1190    );
1191
1192    // Complex
1193    pub fn cgemm_(
1194        transa: *const c_char,
1195        transb: *const c_char,
1196        m: *const c_int,
1197        n: *const c_int,
1198        k: *const c_int,
1199        alpha: *const c_float_complex,
1200        a: *const c_float_complex,
1201        lda: *const c_int,
1202        b: *const c_float_complex,
1203        ldb: *const c_int,
1204        beta: *const c_float_complex,
1205        c: *mut c_float_complex,
1206        ldc: *const c_int,
1207    );
1208    pub fn csymm_(
1209        side: *const c_char,
1210        uplo: *const c_char,
1211        m: *const c_int,
1212        n: *const c_int,
1213        alpha: *const c_float_complex,
1214        a: *const c_float_complex,
1215        lda: *const c_int,
1216        b: *const c_float_complex,
1217        ldb: *const c_int,
1218        beta: *const c_float_complex,
1219        c: *mut c_float_complex,
1220        ldc: *const c_int,
1221    );
1222    pub fn chemm_(
1223        side: *const c_char,
1224        uplo: *const c_char,
1225        m: *const c_int,
1226        n: *const c_int,
1227        alpha: *const c_float_complex,
1228        a: *const c_float_complex,
1229        lda: *const c_int,
1230        b: *const c_float_complex,
1231        ldb: *const c_int,
1232        beta: *const c_float_complex,
1233        c: *mut c_float_complex,
1234        ldc: *const c_int,
1235    );
1236    pub fn csyrk_(
1237        uplo: *const c_char,
1238        trans: *const c_char,
1239        n: *const c_int,
1240        k: *const c_int,
1241        alpha: *const c_float_complex,
1242        a: *const c_float_complex,
1243        lda: *const c_int,
1244        beta: *const c_float_complex,
1245        c: *mut c_float_complex,
1246        ldc: *const c_int,
1247    );
1248    pub fn cherk_(
1249        uplo: *const c_char,
1250        trans: *const c_char,
1251        n: *const c_int,
1252        k: *const c_int,
1253        alpha: *const c_float,
1254        a: *const c_float_complex,
1255        lda: *const c_int,
1256        beta: *const c_float,
1257        c: *mut c_float_complex,
1258        ldc: *const c_int,
1259    );
1260    pub fn csyr2k_(
1261        uplo: *const c_char,
1262        trans: *const c_char,
1263        n: *const c_int,
1264        k: *const c_int,
1265        alpha: *const c_float_complex,
1266        a: *const c_float_complex,
1267        lda: *const c_int,
1268        b: *const c_float_complex,
1269        ldb: *const c_int,
1270        beta: *const c_float_complex,
1271        c: *mut c_float_complex,
1272        ldc: *const c_int,
1273    );
1274    pub fn cher2k_(
1275        uplo: *const c_char,
1276        trans: *const c_char,
1277        n: *const c_int,
1278        k: *const c_int,
1279        alpha: *const c_float_complex,
1280        a: *const c_float_complex,
1281        lda: *const c_int,
1282        b: *const c_float_complex,
1283        ldb: *const c_int,
1284        beta: *const c_float,
1285        c: *mut c_float_complex,
1286        ldc: *const c_int,
1287    );
1288    pub fn ctrmm_(
1289        side: *const c_char,
1290        uplo: *const c_char,
1291        transa: *const c_char,
1292        diag: *const c_char,
1293        m: *const c_int,
1294        n: *const c_int,
1295        alpha: *const c_float_complex,
1296        a: *const c_float_complex,
1297        lda: *const c_int,
1298        b: *mut c_float_complex,
1299        ldb: *const c_int,
1300    );
1301    pub fn ctrsm_(
1302        side: *const c_char,
1303        uplo: *const c_char,
1304        transa: *const c_char,
1305        diag: *const c_char,
1306        m: *const c_int,
1307        n: *const c_int,
1308        alpha: *const c_float_complex,
1309        a: *const c_float_complex,
1310        lda: *const c_int,
1311        b: *mut c_float_complex,
1312        ldb: *const c_int,
1313    );
1314
1315    // Double complex
1316    pub fn zgemm_(
1317        transa: *const c_char,
1318        transb: *const c_char,
1319        m: *const c_int,
1320        n: *const c_int,
1321        k: *const c_int,
1322        alpha: *const c_double_complex,
1323        a: *const c_double_complex,
1324        lda: *const c_int,
1325        b: *const c_double_complex,
1326        ldb: *const c_int,
1327        beta: *const c_double_complex,
1328        c: *mut c_double_complex,
1329        ldc: *const c_int,
1330    );
1331    pub fn zsymm_(
1332        side: *const c_char,
1333        uplo: *const c_char,
1334        m: *const c_int,
1335        n: *const c_int,
1336        alpha: *const c_double_complex,
1337        a: *const c_double_complex,
1338        lda: *const c_int,
1339        b: *const c_double_complex,
1340        ldb: *const c_int,
1341        beta: *const c_double_complex,
1342        c: *mut c_double_complex,
1343        ldc: *const c_int,
1344    );
1345    pub fn zhemm_(
1346        side: *const c_char,
1347        uplo: *const c_char,
1348        m: *const c_int,
1349        n: *const c_int,
1350        alpha: *const c_double_complex,
1351        a: *const c_double_complex,
1352        lda: *const c_int,
1353        b: *const c_double_complex,
1354        ldb: *const c_int,
1355        beta: *const c_double_complex,
1356        c: *mut c_double_complex,
1357        ldc: *const c_int,
1358    );
1359    pub fn zsyrk_(
1360        uplo: *const c_char,
1361        trans: *const c_char,
1362        n: *const c_int,
1363        k: *const c_int,
1364        alpha: *const c_double_complex,
1365        a: *const c_double_complex,
1366        lda: *const c_int,
1367        beta: *const c_double_complex,
1368        c: *mut c_double_complex,
1369        ldc: *const c_int,
1370    );
1371    pub fn zherk_(
1372        uplo: *const c_char,
1373        trans: *const c_char,
1374        n: *const c_int,
1375        k: *const c_int,
1376        alpha: *const c_double,
1377        a: *const c_double_complex,
1378        lda: *const c_int,
1379        beta: *const c_double,
1380        c: *mut c_double_complex,
1381        ldc: *const c_int,
1382    );
1383    pub fn zsyr2k_(
1384        uplo: *const c_char,
1385        trans: *const c_char,
1386        n: *const c_int,
1387        k: *const c_int,
1388        alpha: *const c_double_complex,
1389        a: *const c_double_complex,
1390        lda: *const c_int,
1391        b: *const c_double_complex,
1392        ldb: *const c_int,
1393        beta: *const c_double_complex,
1394        c: *mut c_double_complex,
1395        ldc: *const c_int,
1396    );
1397    pub fn zher2k_(
1398        uplo: *const c_char,
1399        trans: *const c_char,
1400        n: *const c_int,
1401        k: *const c_int,
1402        alpha: *const c_double_complex,
1403        a: *const c_double_complex,
1404        lda: *const c_int,
1405        b: *const c_double_complex,
1406        ldb: *const c_int,
1407        beta: *const c_double,
1408        c: *mut c_double_complex,
1409        ldc: *const c_int,
1410    );
1411    pub fn ztrmm_(
1412        side: *const c_char,
1413        uplo: *const c_char,
1414        transa: *const c_char,
1415        diag: *const c_char,
1416        m: *const c_int,
1417        n: *const c_int,
1418        alpha: *const c_double_complex,
1419        a: *const c_double_complex,
1420        lda: *const c_int,
1421        b: *mut c_double_complex,
1422        ldb: *const c_int,
1423    );
1424    pub fn ztrsm_(
1425        side: *const c_char,
1426        uplo: *const c_char,
1427        transa: *const c_char,
1428        diag: *const c_char,
1429        m: *const c_int,
1430        n: *const c_int,
1431        alpha: *const c_double_complex,
1432        a: *const c_double_complex,
1433        lda: *const c_int,
1434        b: *mut c_double_complex,
1435        ldb: *const c_int,
1436    );
1437}