rust_blas/matrix_vector/
ll.rs

1// Copyright 2014 Michael Yang. All rights reserved.
2// Use of this source code is governed by a MIT-style
3// license that can be found in the LICENSE file.
4
5//! Bindings for matrix-vector functions.
6
7pub mod cblas_s {
8    use crate::attribute::{Diagonal, Order, Symmetry, Transpose};
9    use libc::c_float;
10
11    pub use self::cblas_sgbmv as gbmv;
12    pub use self::cblas_sgemv as gemv;
13    pub use self::cblas_sger as ger;
14    pub use self::cblas_ssbmv as sbmv;
15    pub use self::cblas_sspmv as spmv;
16    pub use self::cblas_sspr as spr;
17    pub use self::cblas_sspr2 as spr2;
18    pub use self::cblas_ssymv as symv;
19    pub use self::cblas_ssyr as syr;
20    pub use self::cblas_ssyr2 as syr2;
21    pub use self::cblas_stbmv as tbmv;
22    pub use self::cblas_stbsv as tbsv;
23    pub use self::cblas_stpmv as tpmv;
24    pub use self::cblas_stpsv as tpsv;
25    pub use self::cblas_strmv as trmv;
26    pub use self::cblas_strsv as trsv;
27
28    extern "C" {
29        pub fn cblas_sgemv(
30            order: Order,
31            trans: Transpose,
32            m: u32,
33            n: u32,
34            alpha: c_float,
35            a: *const c_float,
36            lda: u32,
37            x: *const c_float,
38            inc_x: u32,
39            beta: c_float,
40            y: *mut c_float,
41            inc_y: u32,
42        );
43        pub fn cblas_ssymv(
44            order: Order,
45            sym: Symmetry,
46            n: u32,
47            alpha: c_float,
48            a: *const c_float,
49            lda: u32,
50            x: *const c_float,
51            inc_x: u32,
52            beta: c_float,
53            y: *mut c_float,
54            inc_y: u32,
55        );
56        pub fn cblas_strmv(
57            order: Order,
58            sym: Symmetry,
59            trans: Transpose,
60            diag: Diagonal,
61            n: u32,
62            a: *const c_float,
63            lda: u32,
64            x: *mut c_float,
65            inc_x: u32,
66        );
67        pub fn cblas_strsv(
68            order: Order,
69            sym: Symmetry,
70            trans: Transpose,
71            diag: Diagonal,
72            n: u32,
73            a: *const c_float,
74            lda: u32,
75            x: *mut c_float,
76            inc_x: u32,
77        );
78        pub fn cblas_sger(
79            order: Order,
80            m: u32,
81            n: u32,
82            alpha: c_float,
83            x: *const c_float,
84            inc_x: u32,
85            y: *const c_float,
86            inc_y: u32,
87            a: *mut c_float,
88            lda: u32,
89        );
90        pub fn cblas_ssyr(
91            order: Order,
92            sym: Symmetry,
93            n: u32,
94            alpha: c_float,
95            x: *const c_float,
96            inc_x: u32,
97            a: *mut c_float,
98            lda: u32,
99        );
100        pub fn cblas_ssyr2(
101            order: Order,
102            sym: Symmetry,
103            n: u32,
104            alpha: c_float,
105            x: *const c_float,
106            inc_x: u32,
107            y: *const c_float,
108            inc_y: u32,
109            a: *mut c_float,
110            lda: u32,
111        );
112        pub fn cblas_sspmv(
113            order: Order,
114            sym: Symmetry,
115            n: u32,
116            alpha: c_float,
117            a: *const c_float,
118            x: *const c_float,
119            inc_x: u32,
120            beta: c_float,
121            y: *mut c_float,
122            inc_y: u32,
123        );
124        pub fn cblas_sgbmv(
125            order: Order,
126            trans: Transpose,
127            m: u32,
128            n: u32,
129            kl: u32,
130            ku: u32,
131            alpha: c_float,
132            a: *const c_float,
133            lda: u32,
134            x: *const c_float,
135            inc_x: u32,
136            beta: c_float,
137            y: *mut c_float,
138            inc_y: u32,
139        );
140        pub fn cblas_ssbmv(
141            order: Order,
142            sym: Symmetry,
143            n: u32,
144            k: u32,
145            alpha: c_float,
146            a: *const c_float,
147            lda: u32,
148            x: *const c_float,
149            inc_x: u32,
150            beta: c_float,
151            y: *mut c_float,
152            inc_y: u32,
153        );
154        pub fn cblas_stbmv(
155            order: Order,
156            sym: Symmetry,
157            trans: Transpose,
158            diag: Diagonal,
159            n: u32,
160            k: u32,
161            a: *const c_float,
162            x: *mut c_float,
163            inc_x: u32,
164        );
165        pub fn cblas_stbsv(
166            order: Order,
167            sym: Symmetry,
168            trans: Transpose,
169            diag: Diagonal,
170            n: u32,
171            k: u32,
172            a: *const c_float,
173            x: *mut c_float,
174            inc_x: u32,
175        );
176        pub fn cblas_stpmv(
177            order: Order,
178            sym: Symmetry,
179            trans: Transpose,
180            diag: Diagonal,
181            n: u32,
182            a: *const c_float,
183            x: *mut c_float,
184            inc_x: u32,
185        );
186        pub fn cblas_stpsv(
187            order: Order,
188            sym: Symmetry,
189            trans: Transpose,
190            diag: Diagonal,
191            n: u32,
192            a: *const c_float,
193            x: *mut c_float,
194            inc_x: u32,
195        );
196        pub fn cblas_sspr(
197            order: Order,
198            sym: Symmetry,
199            n: u32,
200            alpha: c_float,
201            x: *const c_float,
202            inc_x: u32,
203            a: *mut c_float,
204        );
205        pub fn cblas_sspr2(
206            order: Order,
207            sym: Symmetry,
208            n: u32,
209            alpha: c_float,
210            x: *const c_float,
211            inc_x: u32,
212            y: *const c_float,
213            inc_y: u32,
214            a: *mut c_float,
215        );
216    }
217}
218
219pub mod cblas_d {
220    use crate::attribute::{Diagonal, Order, Symmetry, Transpose};
221    use libc::c_double;
222
223    pub use self::cblas_dgbmv as gbmv;
224    pub use self::cblas_dgemv as gemv;
225    pub use self::cblas_dger as ger;
226    pub use self::cblas_dsbmv as sbmv;
227    pub use self::cblas_dspmv as spmv;
228    pub use self::cblas_dspr as spr;
229    pub use self::cblas_dspr2 as spr2;
230    pub use self::cblas_dsymv as symv;
231    pub use self::cblas_dsyr as syr;
232    pub use self::cblas_dsyr2 as syr2;
233    pub use self::cblas_dtbmv as tbmv;
234    pub use self::cblas_dtbsv as tbsv;
235    pub use self::cblas_dtpmv as tpmv;
236    pub use self::cblas_dtpsv as tpsv;
237    pub use self::cblas_dtrmv as trmv;
238    pub use self::cblas_dtrsv as trsv;
239
240    extern "C" {
241        pub fn cblas_dgemv(
242            order: Order,
243            trans: Transpose,
244            m: u32,
245            n: u32,
246            alpha: c_double,
247            a: *const c_double,
248            lda: u32,
249            x: *const c_double,
250            inc_x: u32,
251            beta: c_double,
252            y: *mut c_double,
253            inc_y: u32,
254        );
255        pub fn cblas_dsymv(
256            order: Order,
257            sym: Symmetry,
258            n: u32,
259            alpha: c_double,
260            a: *const c_double,
261            lda: u32,
262            x: *const c_double,
263            inc_x: u32,
264            beta: c_double,
265            y: *mut c_double,
266            inc_y: u32,
267        );
268        pub fn cblas_dtrmv(
269            order: Order,
270            sym: Symmetry,
271            trans: Transpose,
272            diag: Diagonal,
273            n: u32,
274            a: *const c_double,
275            lda: u32,
276            x: *mut c_double,
277            inc_x: u32,
278        );
279        pub fn cblas_dtrsv(
280            order: Order,
281            sym: Symmetry,
282            trans: Transpose,
283            diag: Diagonal,
284            n: u32,
285            a: *const c_double,
286            lda: u32,
287            x: *mut c_double,
288            inc_x: u32,
289        );
290        pub fn cblas_dger(
291            order: Order,
292            m: u32,
293            n: u32,
294            alpha: c_double,
295            x: *const c_double,
296            inc_x: u32,
297            y: *const c_double,
298            inc_y: u32,
299            a: *mut c_double,
300            lda: u32,
301        );
302        pub fn cblas_dsyr(
303            order: Order,
304            sym: Symmetry,
305            n: u32,
306            alpha: c_double,
307            x: *const c_double,
308            inc_x: u32,
309            a: *mut c_double,
310            lda: u32,
311        );
312        pub fn cblas_dsyr2(
313            order: Order,
314            sym: Symmetry,
315            n: u32,
316            alpha: c_double,
317            x: *const c_double,
318            inc_x: u32,
319            y: *const c_double,
320            inc_y: u32,
321            a: *mut c_double,
322            lda: u32,
323        );
324        pub fn cblas_dspmv(
325            order: Order,
326            sym: Symmetry,
327            n: u32,
328            alpha: c_double,
329            a: *const c_double,
330            x: *const c_double,
331            inc_x: u32,
332            beta: c_double,
333            y: *mut c_double,
334            inc_y: u32,
335        );
336        pub fn cblas_dgbmv(
337            order: Order,
338            trans: Transpose,
339            m: u32,
340            n: u32,
341            kl: u32,
342            ku: u32,
343            alpha: c_double,
344            a: *const c_double,
345            lda: u32,
346            x: *const c_double,
347            inc_x: u32,
348            beta: c_double,
349            y: *mut c_double,
350            inc_y: u32,
351        );
352        pub fn cblas_dsbmv(
353            order: Order,
354            sym: Symmetry,
355            n: u32,
356            k: u32,
357            alpha: c_double,
358            a: *const c_double,
359            lda: u32,
360            x: *const c_double,
361            inc_x: u32,
362            beta: c_double,
363            y: *mut c_double,
364            inc_y: u32,
365        );
366        pub fn cblas_dtbmv(
367            order: Order,
368            sym: Symmetry,
369            trans: Transpose,
370            diag: Diagonal,
371            n: u32,
372            k: u32,
373            a: *const c_double,
374            x: *mut c_double,
375            inc_x: u32,
376        );
377        pub fn cblas_dtbsv(
378            order: Order,
379            sym: Symmetry,
380            trans: Transpose,
381            diag: Diagonal,
382            n: u32,
383            k: u32,
384            a: *const c_double,
385            x: *mut c_double,
386            inc_x: u32,
387        );
388        pub fn cblas_dtpmv(
389            order: Order,
390            sym: Symmetry,
391            trans: Transpose,
392            diag: Diagonal,
393            n: u32,
394            a: *const c_double,
395            x: *mut c_double,
396            inc_x: u32,
397        );
398        pub fn cblas_dtpsv(
399            order: Order,
400            sym: Symmetry,
401            trans: Transpose,
402            diag: Diagonal,
403            n: u32,
404            a: *const c_double,
405            x: *mut c_double,
406            inc_x: u32,
407        );
408        pub fn cblas_dspr(
409            order: Order,
410            sym: Symmetry,
411            n: u32,
412            alpha: c_double,
413            x: *const c_double,
414            inc_x: u32,
415            a: *mut c_double,
416        );
417        pub fn cblas_dspr2(
418            order: Order,
419            sym: Symmetry,
420            n: u32,
421            alpha: c_double,
422            x: *const c_double,
423            inc_x: u32,
424            y: *const c_double,
425            inc_y: u32,
426            a: *mut c_double,
427        );
428    }
429}
430
431pub mod cblas_c {
432    use crate::attribute::{Diagonal, Order, Symmetry, Transpose};
433    use libc::{c_float, c_void};
434
435    pub use self::cblas_cgbmv as gbmv;
436    pub use self::cblas_cgemv as gemv;
437    pub use self::cblas_cgerc as gerc;
438    pub use self::cblas_cgeru as geru;
439    pub use self::cblas_chbmv as hbmv;
440    pub use self::cblas_chemv as hemv;
441    pub use self::cblas_cher as her;
442    pub use self::cblas_cher2 as her2;
443    pub use self::cblas_chpmv as hpmv;
444    pub use self::cblas_chpr as hpr;
445    pub use self::cblas_chpr2 as hpr2;
446    pub use self::cblas_csymv as symv;
447    pub use self::cblas_ctbmv as tbmv;
448    pub use self::cblas_ctbsv as tbsv;
449    pub use self::cblas_ctpmv as tpmv;
450    pub use self::cblas_ctpsv as tpsv;
451    pub use self::cblas_ctrmv as trmv;
452    pub use self::cblas_ctrsv as trsv;
453
454    extern "C" {
455        pub fn cblas_cgemv(
456            order: Order,
457            trans: Transpose,
458            m: u32,
459            n: u32,
460            alpha: *const c_void,
461            a: *const c_void,
462            lda: u32,
463            x: *const c_void,
464            inc_x: u32,
465            beta: *const c_void,
466            y: *mut c_void,
467            inc_y: u32,
468        );
469        pub fn cblas_csymv(
470            order: Order,
471            sym: Symmetry,
472            n: u32,
473            alpha: *const c_void,
474            a: *const c_void,
475            lda: u32,
476            x: *const c_void,
477            inc_x: u32,
478            beta: *const c_void,
479            y: *mut c_void,
480            inc_y: u32,
481        );
482        pub fn cblas_chemv(
483            order: Order,
484            sym: Symmetry,
485            n: u32,
486            alpha: *const c_void,
487            a: *const c_void,
488            lda: u32,
489            x: *const c_void,
490            inc_x: u32,
491            beta: *const c_void,
492            y: *mut c_void,
493            inc_y: u32,
494        );
495        pub fn cblas_ctrmv(
496            order: Order,
497            sym: Symmetry,
498            trans: Transpose,
499            diag: Diagonal,
500            n: u32,
501            a: *const c_void,
502            lda: u32,
503            x: *mut c_void,
504            inc_x: u32,
505        );
506        pub fn cblas_ctrsv(
507            order: Order,
508            sym: Symmetry,
509            trans: Transpose,
510            diag: Diagonal,
511            n: u32,
512            a: *const c_void,
513            lda: u32,
514            x: *mut c_void,
515            inc_x: u32,
516        );
517        pub fn cblas_cgeru(
518            order: Order,
519            m: u32,
520            n: u32,
521            alpha: *const c_void,
522            x: *const c_void,
523            inc_x: u32,
524            y: *const c_void,
525            inc_y: u32,
526            a: *mut c_void,
527            lda: u32,
528        );
529        pub fn cblas_cgerc(
530            order: Order,
531            m: u32,
532            n: u32,
533            alpha: *const c_void,
534            x: *const c_void,
535            inc_x: u32,
536            y: *const c_void,
537            inc_y: u32,
538            a: *mut c_void,
539            lda: u32,
540        );
541        pub fn cblas_cher(
542            order: Order,
543            sym: Symmetry,
544            n: u32,
545            alpha: c_float,
546            x: *const c_void,
547            inc_x: u32,
548            a: *mut c_void,
549            lda: u32,
550        );
551        pub fn cblas_cher2(
552            order: Order,
553            sym: Symmetry,
554            n: u32,
555            alpha: *const c_void,
556            x: *const c_void,
557            inc_x: u32,
558            y: *const c_void,
559            inc_y: u32,
560            a: *mut c_void,
561            lda: u32,
562        );
563        pub fn cblas_cgbmv(
564            order: Order,
565            trans: Transpose,
566            m: u32,
567            n: u32,
568            kl: u32,
569            ku: u32,
570            alpha: *const c_void,
571            a: *const c_void,
572            lda: u32,
573            x: *const c_void,
574            inc_x: u32,
575            beta: *const c_void,
576            y: *mut c_void,
577            inc_y: u32,
578        );
579        pub fn cblas_chbmv(
580            order: Order,
581            sym: Symmetry,
582            n: u32,
583            k: u32,
584            alpha: *const c_void,
585            a: *const c_void,
586            lda: u32,
587            x: *const c_void,
588            inc_x: u32,
589            beta: *const c_void,
590            y: *mut c_void,
591            inc_y: u32,
592        );
593        pub fn cblas_ctbmv(
594            order: Order,
595            sym: Symmetry,
596            trans: Transpose,
597            diag: Diagonal,
598            n: u32,
599            k: u32,
600            a: *const c_void,
601            x: *mut c_void,
602            inc_x: u32,
603        );
604        pub fn cblas_ctbsv(
605            order: Order,
606            sym: Symmetry,
607            trans: Transpose,
608            diag: Diagonal,
609            n: u32,
610            k: u32,
611            a: *const c_void,
612            x: *mut c_void,
613            inc_x: u32,
614        );
615        pub fn cblas_chpmv(
616            order: Order,
617            sym: Symmetry,
618            n: u32,
619            alpha: *const c_void,
620            a: *const c_void,
621            x: *const c_void,
622            inc_x: u32,
623            beta: *const c_void,
624            y: *mut c_void,
625            inc_y: u32,
626        );
627        pub fn cblas_ctpmv(
628            order: Order,
629            sym: Symmetry,
630            trans: Transpose,
631            diag: Diagonal,
632            n: u32,
633            a: *const c_void,
634            x: *mut c_void,
635            inc_x: u32,
636        );
637        pub fn cblas_ctpsv(
638            order: Order,
639            sym: Symmetry,
640            trans: Transpose,
641            diag: Diagonal,
642            n: u32,
643            a: *const c_void,
644            x: *mut c_void,
645            inc_x: u32,
646        );
647        pub fn cblas_chpr(
648            order: Order,
649            sym: Symmetry,
650            n: u32,
651            alpha: c_float,
652            x: *const c_void,
653            inc_x: u32,
654            a: *mut c_void,
655        );
656        pub fn cblas_chpr2(
657            order: Order,
658            sym: Symmetry,
659            n: u32,
660            alpha: *const c_void,
661            x: *const c_void,
662            inc_x: u32,
663            y: *const c_void,
664            inc_y: u32,
665            a: *mut c_void,
666        );
667    }
668}
669
670pub mod cblas_z {
671    use crate::attribute::{Diagonal, Order, Symmetry, Transpose};
672    use libc::{c_double, c_void};
673
674    pub use self::cblas_zgbmv as gbmv;
675    pub use self::cblas_zgemv as gemv;
676    pub use self::cblas_zgerc as gerc;
677    pub use self::cblas_zgeru as geru;
678    pub use self::cblas_zhbmv as hbmv;
679    pub use self::cblas_zhemv as hemv;
680    pub use self::cblas_zher as her;
681    pub use self::cblas_zher2 as her2;
682    pub use self::cblas_zhpmv as hpmv;
683    pub use self::cblas_zhpr as hpr;
684    pub use self::cblas_zhpr2 as hpr2;
685    pub use self::cblas_zsymv as symv;
686    pub use self::cblas_ztbmv as tbmv;
687    pub use self::cblas_ztbsv as tbsv;
688    pub use self::cblas_ztpmv as tpmv;
689    pub use self::cblas_ztpsv as tpsv;
690    pub use self::cblas_ztrmv as trmv;
691    pub use self::cblas_ztrsv as trsv;
692
693    extern "C" {
694        pub fn cblas_zgemv(
695            order: Order,
696            trans: Transpose,
697            m: u32,
698            n: u32,
699            alpha: *const c_void,
700            a: *const c_void,
701            lda: u32,
702            x: *const c_void,
703            inc_x: u32,
704            beta: *const c_void,
705            y: *mut c_void,
706            inc_y: u32,
707        );
708        pub fn cblas_zsymv(
709            order: Order,
710            sym: Symmetry,
711            n: u32,
712            alpha: *const c_void,
713            a: *const c_void,
714            lda: u32,
715            x: *const c_void,
716            inc_x: u32,
717            beta: *const c_void,
718            y: *mut c_void,
719            inc_y: u32,
720        );
721        pub fn cblas_zhemv(
722            order: Order,
723            sym: Symmetry,
724            n: u32,
725            alpha: *const c_void,
726            a: *const c_void,
727            lda: u32,
728            x: *const c_void,
729            inc_x: u32,
730            beta: *const c_void,
731            y: *mut c_void,
732            inc_y: u32,
733        );
734        pub fn cblas_ztrmv(
735            order: Order,
736            sym: Symmetry,
737            trans: Transpose,
738            diag: Diagonal,
739            n: u32,
740            a: *const c_void,
741            lda: u32,
742            x: *mut c_void,
743            inc_x: u32,
744        );
745        pub fn cblas_ztrsv(
746            order: Order,
747            sym: Symmetry,
748            trans: Transpose,
749            diag: Diagonal,
750            n: u32,
751            a: *const c_void,
752            lda: u32,
753            x: *mut c_void,
754            inc_x: u32,
755        );
756        pub fn cblas_zgeru(
757            order: Order,
758            m: u32,
759            n: u32,
760            alpha: *const c_void,
761            x: *const c_void,
762            inc_x: u32,
763            y: *const c_void,
764            inc_y: u32,
765            a: *mut c_void,
766            lda: u32,
767        );
768        pub fn cblas_zgerc(
769            order: Order,
770            m: u32,
771            n: u32,
772            alpha: *const c_void,
773            x: *const c_void,
774            inc_x: u32,
775            y: *const c_void,
776            inc_y: u32,
777            a: *mut c_void,
778            lda: u32,
779        );
780        pub fn cblas_zher(
781            order: Order,
782            sym: Symmetry,
783            n: u32,
784            alpha: c_double,
785            x: *const c_void,
786            inc_x: u32,
787            a: *mut c_void,
788            lda: u32,
789        );
790        pub fn cblas_zher2(
791            order: Order,
792            sym: Symmetry,
793            n: u32,
794            alpha: *const c_void,
795            x: *const c_void,
796            inc_x: u32,
797            y: *const c_void,
798            inc_y: u32,
799            a: *mut c_void,
800            lda: u32,
801        );
802        pub fn cblas_zgbmv(
803            order: Order,
804            trans: Transpose,
805            m: u32,
806            n: u32,
807            kl: u32,
808            ku: u32,
809            alpha: *const c_void,
810            a: *const c_void,
811            lda: u32,
812            x: *const c_void,
813            inc_x: u32,
814            beta: *const c_void,
815            y: *mut c_void,
816            inc_y: u32,
817        );
818        pub fn cblas_zhbmv(
819            order: Order,
820            sym: Symmetry,
821            n: u32,
822            k: u32,
823            alpha: *const c_void,
824            a: *const c_void,
825            lda: u32,
826            x: *const c_void,
827            inc_x: u32,
828            beta: *const c_void,
829            y: *mut c_void,
830            inc_y: u32,
831        );
832        pub fn cblas_ztbmv(
833            order: Order,
834            sym: Symmetry,
835            trans: Transpose,
836            diag: Diagonal,
837            n: u32,
838            k: u32,
839            a: *const c_void,
840            x: *mut c_void,
841            inc_x: u32,
842        );
843        pub fn cblas_ztbsv(
844            order: Order,
845            sym: Symmetry,
846            trans: Transpose,
847            diag: Diagonal,
848            n: u32,
849            k: u32,
850            a: *const c_void,
851            x: *mut c_void,
852            inc_x: u32,
853        );
854        pub fn cblas_zhpmv(
855            order: Order,
856            sym: Symmetry,
857            n: u32,
858            alpha: *const c_void,
859            a: *const c_void,
860            x: *const c_void,
861            inc_x: u32,
862            beta: *const c_void,
863            y: *mut c_void,
864            inc_y: u32,
865        );
866        pub fn cblas_ztpmv(
867            order: Order,
868            sym: Symmetry,
869            trans: Transpose,
870            diag: Diagonal,
871            n: u32,
872            a: *const c_void,
873            x: *mut c_void,
874            inc_x: u32,
875        );
876        pub fn cblas_ztpsv(
877            order: Order,
878            sym: Symmetry,
879            trans: Transpose,
880            diag: Diagonal,
881            n: u32,
882            a: *const c_void,
883            x: *mut c_void,
884            inc_x: u32,
885        );
886        pub fn cblas_zhpr(
887            order: Order,
888            sym: Symmetry,
889            n: u32,
890            alpha: c_double,
891            x: *const c_void,
892            inc_x: u32,
893            a: *mut c_void,
894        );
895        pub fn cblas_zhpr2(
896            order: Order,
897            sym: Symmetry,
898            n: u32,
899            alpha: *const c_void,
900            x: *const c_void,
901            inc_x: u32,
902            y: *const c_void,
903            inc_y: u32,
904            a: *mut c_void,
905        );
906    }
907}