rust_blas/matrix/
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 functions.
6
7pub mod cblas_s {
8    use crate::attribute::{Diagonal, Order, Side, Symmetry, Transpose};
9    use libc::c_float;
10
11    pub use self::cblas_sgemm as gemm;
12    pub use self::cblas_ssymm as symm;
13    pub use self::cblas_ssyr2k as syr2k;
14    pub use self::cblas_ssyrk as syrk;
15    pub use self::cblas_strmm as trmm;
16    pub use self::cblas_strsm as strsm;
17
18    extern "C" {
19        pub fn cblas_sgemm(
20            order: Order,
21            trans_a: Transpose,
22            trans_b: Transpose,
23            m: u32,
24            n: u32,
25            k: u32,
26            alpha: c_float,
27            a: *const c_float,
28            lda: u32,
29            b: *const c_float,
30            ldb: u32,
31            beta: c_float,
32            c: *mut c_float,
33            ldc: u32,
34        );
35        pub fn cblas_ssymm(
36            order: Order,
37            side: Side,
38            sym: Symmetry,
39            m: u32,
40            n: u32,
41            alpha: c_float,
42            a: *const c_float,
43            lda: u32,
44            b: *const c_float,
45            ldb: u32,
46            beta: c_float,
47            c: *mut c_float,
48            ldc: u32,
49        );
50        pub fn cblas_strmm(
51            order: Order,
52            side: Side,
53            sym: Symmetry,
54            trans: Transpose,
55            diag: Diagonal,
56            m: u32,
57            n: u32,
58            alpha: c_float,
59            a: *const c_float,
60            lda: u32,
61            b: *mut c_float,
62            ldb: u32,
63        );
64        pub fn cblas_strsm(
65            order: Order,
66            side: Side,
67            sym: Symmetry,
68            trans: Transpose,
69            diag: Diagonal,
70            m: u32,
71            n: u32,
72            alpha: c_float,
73            a: *const c_float,
74            lda: u32,
75            b: *mut c_float,
76            ldb: u32,
77        );
78        pub fn cblas_ssyrk(
79            order: Order,
80            sym: Symmetry,
81            Trans: Transpose,
82            n: u32,
83            k: u32,
84            alpha: c_float,
85            a: *const c_float,
86            lda: u32,
87            beta: c_float,
88            c: *mut c_float,
89            ldc: u32,
90        );
91        pub fn cblas_ssyr2k(
92            order: Order,
93            sym: Symmetry,
94            Trans: Transpose,
95            n: u32,
96            k: u32,
97            alpha: c_float,
98            a: *const c_float,
99            lda: u32,
100            b: *const c_float,
101            ldb: u32,
102            beta: c_float,
103            c: *mut c_float,
104            ldc: u32,
105        );
106    }
107}
108
109pub mod cblas_d {
110    use crate::attribute::{Diagonal, Order, Side, Symmetry, Transpose};
111    use libc::c_double;
112
113    pub use self::cblas_dgemm as gemm;
114    pub use self::cblas_dsymm as symm;
115    pub use self::cblas_dsyr2k as syr2k;
116    pub use self::cblas_dsyrk as syrk;
117    pub use self::cblas_dtrmm as trmm;
118    pub use self::cblas_dtrsm as strsm;
119
120    extern "C" {
121        pub fn cblas_dgemm(
122            order: Order,
123            trans_a: Transpose,
124            trans_b: Transpose,
125            m: u32,
126            n: u32,
127            k: u32,
128            alpha: c_double,
129            a: *const c_double,
130            lda: u32,
131            b: *const c_double,
132            ldb: u32,
133            beta: c_double,
134            c: *mut c_double,
135            ldc: u32,
136        );
137        pub fn cblas_dsymm(
138            order: Order,
139            side: Side,
140            sym: Symmetry,
141            m: u32,
142            n: u32,
143            alpha: c_double,
144            a: *const c_double,
145            lda: u32,
146            b: *const c_double,
147            ldb: u32,
148            beta: c_double,
149            c: *mut c_double,
150            ldc: u32,
151        );
152        pub fn cblas_dtrmm(
153            order: Order,
154            side: Side,
155            sym: Symmetry,
156            trans: Transpose,
157            diag: Diagonal,
158            m: u32,
159            n: u32,
160            alpha: c_double,
161            a: *const c_double,
162            lda: u32,
163            b: *mut c_double,
164            ldb: u32,
165        );
166        pub fn cblas_dtrsm(
167            order: Order,
168            side: Side,
169            sym: Symmetry,
170            trans: Transpose,
171            diag: Diagonal,
172            m: u32,
173            n: u32,
174            alpha: c_double,
175            a: *const c_double,
176            lda: u32,
177            b: *mut c_double,
178            ldb: u32,
179        );
180        pub fn cblas_dsyrk(
181            order: Order,
182            sym: Symmetry,
183            Trans: Transpose,
184            n: u32,
185            k: u32,
186            alpha: c_double,
187            a: *const c_double,
188            lda: u32,
189            beta: c_double,
190            c: *mut c_double,
191            ldc: u32,
192        );
193        pub fn cblas_dsyr2k(
194            order: Order,
195            sym: Symmetry,
196            Trans: Transpose,
197            n: u32,
198            k: u32,
199            alpha: c_double,
200            a: *const c_double,
201            lda: u32,
202            b: *const c_double,
203            ldb: u32,
204            beta: c_double,
205            c: *mut c_double,
206            ldc: u32,
207        );
208    }
209}
210
211pub mod cblas_c {
212    use crate::attribute::{Diagonal, Order, Side, Symmetry, Transpose};
213    use libc::{c_float, c_void};
214
215    pub use self::cblas_cgemm as gemm;
216    pub use self::cblas_chemm as hemm;
217    pub use self::cblas_cher2k as her2k;
218    pub use self::cblas_cherk as herk;
219    pub use self::cblas_csymm as symm;
220    pub use self::cblas_csyr2k as syr2k;
221    pub use self::cblas_csyrk as syrk;
222    pub use self::cblas_ctrmm as trmm;
223    pub use self::cblas_ctrsm as trsm;
224
225    extern "C" {
226        pub fn cblas_cgemm(
227            order: Order,
228            trans_a: Transpose,
229            trans_b: Transpose,
230            m: u32,
231            n: u32,
232            k: u32,
233            alpha: *const c_void,
234            a: *const c_void,
235            lda: u32,
236            b: *const c_void,
237            ldb: u32,
238            beta: *const c_void,
239            c: *mut c_void,
240            ldc: u32,
241        );
242        pub fn cblas_csymm(
243            order: Order,
244            side: Side,
245            sym: Symmetry,
246            m: u32,
247            n: u32,
248            alpha: *const c_void,
249            a: *const c_void,
250            lda: u32,
251            b: *const c_void,
252            ldb: u32,
253            beta: *const c_void,
254            c: *mut c_void,
255            ldc: u32,
256        );
257        pub fn cblas_chemm(
258            order: Order,
259            side: Side,
260            sym: Symmetry,
261            m: u32,
262            n: u32,
263            alpha: *const c_void,
264            a: *const c_void,
265            lda: u32,
266            b: *const c_void,
267            ldb: u32,
268            beta: *const c_void,
269            c: *mut c_void,
270            ldc: u32,
271        );
272        pub fn cblas_ctrmm(
273            order: Order,
274            side: Side,
275            sym: Symmetry,
276            trans: Transpose,
277            diag: Diagonal,
278            m: u32,
279            n: u32,
280            alpha: *const c_void,
281            a: *const c_void,
282            lda: u32,
283            b: *mut c_void,
284            ldb: u32,
285        );
286        pub fn cblas_ctrsm(
287            order: Order,
288            side: Side,
289            sym: Symmetry,
290            trans: Transpose,
291            diag: Diagonal,
292            m: u32,
293            n: u32,
294            alpha: *const c_void,
295            a: *const c_void,
296            lda: u32,
297            b: *mut c_void,
298            ldb: u32,
299        );
300        pub fn cblas_cherk(
301            order: Order,
302            sym: Symmetry,
303            Trans: Transpose,
304            n: u32,
305            k: u32,
306            alpha: c_float,
307            a: *const c_void,
308            lda: u32,
309            beta: c_float,
310            c: *mut c_void,
311            ldc: u32,
312        );
313        pub fn cblas_cher2k(
314            order: Order,
315            sym: Symmetry,
316            Trans: Transpose,
317            n: u32,
318            k: u32,
319            alpha: *const c_void,
320            a: *const c_void,
321            lda: u32,
322            b: *const c_void,
323            ldb: u32,
324            beta: c_float,
325            c: *mut c_void,
326            ldc: u32,
327        );
328        pub fn cblas_csyrk(
329            order: Order,
330            sym: Symmetry,
331            Trans: Transpose,
332            n: u32,
333            k: u32,
334            alpha: *const c_void,
335            a: *const c_void,
336            lda: u32,
337            beta: *const c_void,
338            c: *mut c_void,
339            ldc: u32,
340        );
341        pub fn cblas_csyr2k(
342            order: Order,
343            sym: Symmetry,
344            Trans: Transpose,
345            n: u32,
346            k: u32,
347            alpha: *const c_void,
348            a: *const c_void,
349            lda: u32,
350            b: *const c_void,
351            ldb: u32,
352            beta: *const c_void,
353            c: *mut c_void,
354            ldc: u32,
355        );
356    }
357}
358
359pub mod cblas_z {
360    use crate::attribute::{Diagonal, Order, Side, Symmetry, Transpose};
361    use libc::{c_double, c_void};
362
363    pub use self::cblas_zgemm as gemm;
364    pub use self::cblas_zhemm as hemm;
365    pub use self::cblas_zher2k as her2k;
366    pub use self::cblas_zherk as herk;
367    pub use self::cblas_zsymm as symm;
368    pub use self::cblas_zsyr2k as syr2k;
369    pub use self::cblas_zsyrk as syrk;
370    pub use self::cblas_ztrmm as trmm;
371    pub use self::cblas_ztrsm as trsm;
372
373    extern "C" {
374        pub fn cblas_zgemm(
375            order: Order,
376            trans_a: Transpose,
377            trans_b: Transpose,
378            m: u32,
379            n: u32,
380            k: u32,
381            alpha: *const c_void,
382            a: *const c_void,
383            lda: u32,
384            b: *const c_void,
385            ldb: u32,
386            beta: *const c_void,
387            c: *mut c_void,
388            ldc: u32,
389        );
390        pub fn cblas_zsymm(
391            order: Order,
392            side: Side,
393            sym: Symmetry,
394            m: u32,
395            n: u32,
396            alpha: *const c_void,
397            a: *const c_void,
398            lda: u32,
399            b: *const c_void,
400            ldb: u32,
401            beta: *const c_void,
402            c: *mut c_void,
403            ldc: u32,
404        );
405        pub fn cblas_zhemm(
406            order: Order,
407            side: Side,
408            sym: Symmetry,
409            m: u32,
410            n: u32,
411            alpha: *const c_void,
412            a: *const c_void,
413            lda: u32,
414            b: *const c_void,
415            ldb: u32,
416            beta: *const c_void,
417            c: *mut c_void,
418            ldc: u32,
419        );
420        pub fn cblas_ztrmm(
421            order: Order,
422            side: Side,
423            sym: Symmetry,
424            trans: Transpose,
425            diag: Diagonal,
426            m: u32,
427            n: u32,
428            alpha: *const c_void,
429            a: *const c_void,
430            lda: u32,
431            b: *mut c_void,
432            ldb: u32,
433        );
434        pub fn cblas_ztrsm(
435            order: Order,
436            side: Side,
437            sym: Symmetry,
438            trans: Transpose,
439            diag: Diagonal,
440            m: u32,
441            n: u32,
442            alpha: *const c_void,
443            a: *const c_void,
444            lda: u32,
445            b: *mut c_void,
446            ldb: u32,
447        );
448        pub fn cblas_zherk(
449            order: Order,
450            sym: Symmetry,
451            Trans: Transpose,
452            n: u32,
453            k: u32,
454            alpha: c_double,
455            a: *const c_void,
456            lda: u32,
457            beta: c_double,
458            c: *mut c_void,
459            ldc: u32,
460        );
461        pub fn cblas_zher2k(
462            order: Order,
463            sym: Symmetry,
464            Trans: Transpose,
465            n: u32,
466            k: u32,
467            alpha: *const c_void,
468            a: *const c_void,
469            lda: u32,
470            b: *const c_void,
471            ldb: u32,
472            beta: c_double,
473            c: *mut c_void,
474            ldc: u32,
475        );
476        pub fn cblas_zsyrk(
477            order: Order,
478            sym: Symmetry,
479            Trans: Transpose,
480            n: u32,
481            k: u32,
482            alpha: *const c_void,
483            a: *const c_void,
484            lda: u32,
485            beta: *const c_void,
486            c: *mut c_void,
487            ldc: u32,
488        );
489        pub fn cblas_zsyr2k(
490            order: Order,
491            sym: Symmetry,
492            Trans: Transpose,
493            n: u32,
494            k: u32,
495            alpha: *const c_void,
496            a: *const c_void,
497            lda: u32,
498            b: *const c_void,
499            ldb: u32,
500            beta: *const c_void,
501            c: *mut c_void,
502            ldc: u32,
503        );
504    }
505}