mdarray_linalg_blas/matvec/
scalar.rs

1// This file is auto-generated. Do not edit manually.
2//! Abstracting the BLAS scalar types
3use cblas_sys::{CBLAS_DIAG, CBLAS_LAYOUT, CBLAS_TRANSPOSE, CBLAS_UPLO};
4use num_complex::{Complex, ComplexFloat};
5
6#[allow(clippy::too_many_arguments, unused_variables)]
7pub trait BlasScalar: Sized + ComplexFloat {
8    /// # Safety
9    /// Calls must respect BLAS conventions.
10    unsafe fn cblas_dot(n: i32, x: *const Self, incx: i32, y: *const Self, incy: i32) -> Self
11    where
12        Self: Sized,
13    {
14        unimplemented!("")
15    }
16    /// # Safety
17    /// Calls must respect BLAS conventions.
18    unsafe fn cblas_dotu_sub(
19        n: i32,
20        x: *const Self,
21        incx: i32,
22        y: *const Self,
23        incy: i32,
24        dotu: *mut Self,
25    ) where
26        Self: Sized,
27    {
28        unimplemented!("")
29    }
30    /// # Safety
31    /// Calls must respect BLAS conventions.
32    unsafe fn cblas_dotc_sub(
33        n: i32,
34        x: *const Self,
35        incx: i32,
36        y: *const Self,
37        incy: i32,
38        dotc: *mut Self,
39    ) where
40        Self: Sized,
41    {
42        unimplemented!("")
43    }
44    /// # Safety
45    /// Calls must respect BLAS conventions.
46    unsafe fn cblas_nrm2(n: i32, x: *const Self, incx: i32) -> Self::Real
47    where
48        Self: Sized,
49    {
50        unimplemented!("")
51    }
52    /// # Safety
53    /// Calls must respect BLAS conventions.
54    unsafe fn cblas_asum(n: i32, x: *const Self, incx: i32) -> Self::Real
55    where
56        Self: Sized,
57    {
58        unimplemented!("")
59    }
60    /// # Safety
61    /// Calls must respect BLAS conventions.
62    unsafe fn cblas_swap(n: i32, x: *mut Self, incx: i32, y: *mut Self, incy: i32)
63    where
64        Self: Sized,
65    {
66        unimplemented!("")
67    }
68    /// # Safety
69    /// Calls must respect BLAS conventions.
70    unsafe fn cblas_copy(n: i32, x: *const Self, incx: i32, y: *mut Self, incy: i32)
71    where
72        Self: Sized,
73    {
74        unimplemented!("")
75    }
76    /// # Safety
77    /// Calls must respect BLAS conventions.
78    unsafe fn cblas_axpy(n: i32, alpha: Self, x: *const Self, incx: i32, y: *mut Self, incy: i32)
79    where
80        Self: Sized,
81    {
82        unimplemented!("")
83    }
84    /// # Safety
85    /// Calls must respect BLAS conventions.
86    unsafe fn cblas_scal(n: i32, alpha: Self, x: *mut Self, incx: i32)
87    where
88        Self: Sized,
89    {
90        unimplemented!("")
91    }
92    /// # Safety
93    /// Calls must respect BLAS conventions.
94    unsafe fn cblas_rscal(n: i32, alpha: Self::Real, x: *mut Self, incx: i32)
95    where
96        Self: Sized,
97    {
98        unimplemented!("")
99    }
100    /// # Safety
101    /// Calls must respect BLAS conventions.
102    unsafe fn cblas_gemv(
103        layout: CBLAS_LAYOUT,
104        transa: CBLAS_TRANSPOSE,
105        m: i32,
106        n: i32,
107        alpha: Self,
108        a: *const Self,
109        lda: i32,
110        x: *const Self,
111        incx: i32,
112        beta: Self,
113        y: *mut Self,
114        incy: i32,
115    ) where
116        Self: Sized,
117    {
118        unimplemented!("")
119    }
120    /// # Safety
121    /// Calls must respect BLAS conventions.
122    unsafe fn cblas_trmv(
123        layout: CBLAS_LAYOUT,
124        uplo: CBLAS_UPLO,
125        transa: CBLAS_TRANSPOSE,
126        diag: CBLAS_DIAG,
127        n: i32,
128        a: *const Self,
129        lda: i32,
130        x: *mut Self,
131        incx: i32,
132    ) where
133        Self: Sized,
134    {
135        unimplemented!("")
136    }
137    /// # Safety
138    /// Calls must respect BLAS conventions.
139    unsafe fn cblas_symv(
140        layout: CBLAS_LAYOUT,
141        uplo: CBLAS_UPLO,
142        n: i32,
143        alpha: Self,
144        a: *const Self,
145        lda: i32,
146        x: *const Self,
147        incx: i32,
148        beta: Self,
149        y: *mut Self,
150        incy: i32,
151    ) where
152        Self: Sized,
153    {
154        unimplemented!("")
155    }
156    /// # Safety
157    /// Calls must respect BLAS conventions.
158    unsafe fn cblas_ger(
159        layout: CBLAS_LAYOUT,
160        m: i32,
161        n: i32,
162        alpha: Self,
163        x: *const Self,
164        incx: i32,
165        y: *const Self,
166        incy: i32,
167        a: *mut Self,
168        lda: i32,
169    ) where
170        Self: Sized,
171    {
172        unimplemented!("")
173    }
174    /// # Safety
175    /// Calls must respect BLAS conventions.
176    unsafe fn cblas_syr(
177        layout: CBLAS_LAYOUT,
178        uplo: CBLAS_UPLO,
179        n: i32,
180        alpha: Self,
181        x: *const Self,
182        incx: i32,
183        a: *mut Self,
184        lda: i32,
185    ) where
186        Self: Sized,
187    {
188        unimplemented!("")
189    }
190    /// # Safety
191    /// Calls must respect BLAS conventions.
192    unsafe fn cblas_syr2(
193        layout: CBLAS_LAYOUT,
194        uplo: CBLAS_UPLO,
195        n: i32,
196        alpha: Self,
197        x: *const Self,
198        incx: i32,
199        y: *const Self,
200        incy: i32,
201        a: *mut Self,
202        lda: i32,
203    ) where
204        Self: Sized,
205    {
206        unimplemented!("")
207    }
208    /// # Safety
209    /// Calls must respect BLAS conventions.
210    unsafe fn cblas_geru(
211        layout: CBLAS_LAYOUT,
212        m: i32,
213        n: i32,
214        alpha: Self,
215        x: *const Self,
216        incx: i32,
217        y: *const Self,
218        incy: i32,
219        a: *mut Self,
220        lda: i32,
221    ) where
222        Self: Sized,
223    {
224        unimplemented!("")
225    }
226    /// # Safety
227    /// Calls must respect BLAS conventions.
228    unsafe fn cblas_gerc(
229        layout: CBLAS_LAYOUT,
230        m: i32,
231        n: i32,
232        alpha: Self,
233        x: *const Self,
234        incx: i32,
235        y: *const Self,
236        incy: i32,
237        a: *mut Self,
238        lda: i32,
239    ) where
240        Self: Sized,
241    {
242        unimplemented!("")
243    }
244    /// # Safety
245    /// Calls must respect BLAS conventions.
246    unsafe fn cblas_her(
247        layout: CBLAS_LAYOUT,
248        uplo: CBLAS_UPLO,
249        n: i32,
250        alpha: Self::Real,
251        x: *const Self,
252        incx: i32,
253        a: *mut Self,
254        lda: i32,
255    ) where
256        Self: Sized,
257    {
258        unimplemented!("")
259    }
260    /// # Safety
261    /// Calls must respect BLAS conventions.
262    unsafe fn cblas_her2(
263        layout: CBLAS_LAYOUT,
264        uplo: CBLAS_UPLO,
265        n: i32,
266        alpha: Self,
267        x: *const Self,
268        incx: i32,
269        y: *const Self,
270        incy: i32,
271        a: *mut Self,
272        lda: i32,
273    ) where
274        Self: Sized,
275    {
276        unimplemented!("")
277    }
278    /// # Safety
279    /// Calls must respect BLAS conventions.
280    unsafe fn cblas_syrk(
281        layout: CBLAS_LAYOUT,
282        uplo: CBLAS_UPLO,
283        trans: CBLAS_TRANSPOSE,
284        n: i32,
285        k: i32,
286        alpha: Self,
287        a: *const Self,
288        lda: i32,
289        beta: Self,
290        c: *mut Self,
291        ldc: i32,
292    ) where
293        Self: Sized,
294    {
295        unimplemented!("")
296    }
297    /// # Safety
298    /// Calls must respect BLAS conventions.
299    unsafe fn cblas_syr2k(
300        layout: CBLAS_LAYOUT,
301        uplo: CBLAS_UPLO,
302        trans: CBLAS_TRANSPOSE,
303        n: i32,
304        k: i32,
305        alpha: Self,
306        a: *const Self,
307        lda: i32,
308        b: *const Self,
309        ldb: i32,
310        beta: Self,
311        c: *mut Self,
312        ldc: i32,
313    ) where
314        Self: Sized,
315    {
316        unimplemented!("")
317    }
318    /// # Safety
319    /// Calls must respect BLAS conventions.
320    unsafe fn cblas_herk(
321        layout: CBLAS_LAYOUT,
322        uplo: CBLAS_UPLO,
323        trans: CBLAS_TRANSPOSE,
324        n: i32,
325        k: i32,
326        alpha: Self::Real,
327        a: *const Self,
328        lda: i32,
329        beta: Self::Real,
330        c: *mut Self,
331        ldc: i32,
332    ) where
333        Self: Sized,
334    {
335        unimplemented!("")
336    }
337    /// # Safety
338    /// Calls must respect BLAS conventions.
339    unsafe fn cblas_her2k(
340        layout: CBLAS_LAYOUT,
341        uplo: CBLAS_UPLO,
342        trans: CBLAS_TRANSPOSE,
343        n: i32,
344        k: i32,
345        alpha: Self,
346        a: *const Self,
347        lda: i32,
348        b: *const Self,
349        ldb: i32,
350        beta: Self::Real,
351        c: *mut Self,
352        ldc: i32,
353    ) where
354        Self: Sized,
355    {
356        unimplemented!("")
357    }
358}
359
360impl BlasScalar for f32 {
361    unsafe fn cblas_dot(n: i32, x: *const f32, incx: i32, y: *const f32, incy: i32) -> f32 {
362        unsafe { cblas_sys::cblas_sdot(n, x as *const _, incx, y as *const _, incy) }
363    }
364
365    unsafe fn cblas_nrm2(n: i32, x: *const f32, incx: i32) -> f32 {
366        unsafe { cblas_sys::cblas_snrm2(n, x as *const _, incx) }
367    }
368
369    unsafe fn cblas_asum(n: i32, x: *const f32, incx: i32) -> f32 {
370        unsafe { cblas_sys::cblas_sasum(n, x as *const _, incx) }
371    }
372
373    unsafe fn cblas_swap(n: i32, x: *mut f32, incx: i32, y: *mut f32, incy: i32) {
374        unsafe { cblas_sys::cblas_sswap(n, x as *mut _, incx, y as *mut _, incy) }
375    }
376
377    unsafe fn cblas_copy(n: i32, x: *const f32, incx: i32, y: *mut f32, incy: i32) {
378        unsafe { cblas_sys::cblas_scopy(n, x as *const _, incx, y as *mut _, incy) }
379    }
380
381    unsafe fn cblas_axpy(n: i32, alpha: f32, x: *const f32, incx: i32, y: *mut f32, incy: i32) {
382        unsafe { cblas_sys::cblas_saxpy(n, alpha, x as *const _, incx, y as *mut _, incy) }
383    }
384
385    unsafe fn cblas_scal(n: i32, alpha: f32, x: *mut f32, incx: i32) {
386        unsafe { cblas_sys::cblas_sscal(n, alpha, x as *mut _, incx) }
387    }
388
389    unsafe fn cblas_gemv(
390        layout: CBLAS_LAYOUT,
391        transa: CBLAS_TRANSPOSE,
392        m: i32,
393        n: i32,
394        alpha: f32,
395        a: *const f32,
396        lda: i32,
397        x: *const f32,
398        incx: i32,
399        beta: f32,
400        y: *mut f32,
401        incy: i32,
402    ) {
403        unsafe {
404            cblas_sys::cblas_sgemv(
405                layout,
406                transa,
407                m,
408                n,
409                alpha,
410                a as *const _,
411                lda,
412                x as *const _,
413                incx,
414                beta,
415                y as *mut _,
416                incy,
417            )
418        }
419    }
420
421    unsafe fn cblas_trmv(
422        layout: CBLAS_LAYOUT,
423        uplo: CBLAS_UPLO,
424        transa: CBLAS_TRANSPOSE,
425        diag: CBLAS_DIAG,
426        n: i32,
427        a: *const f32,
428        lda: i32,
429        x: *mut f32,
430        incx: i32,
431    ) {
432        unsafe {
433            cblas_sys::cblas_strmv(
434                layout,
435                uplo,
436                transa,
437                diag,
438                n,
439                a as *const _,
440                lda,
441                x as *mut _,
442                incx,
443            )
444        }
445    }
446
447    unsafe fn cblas_symv(
448        layout: CBLAS_LAYOUT,
449        uplo: CBLAS_UPLO,
450        n: i32,
451        alpha: f32,
452        a: *const f32,
453        lda: i32,
454        x: *const f32,
455        incx: i32,
456        beta: f32,
457        y: *mut f32,
458        incy: i32,
459    ) {
460        unsafe {
461            cblas_sys::cblas_ssymv(
462                layout,
463                uplo,
464                n,
465                alpha,
466                a as *const _,
467                lda,
468                x as *const _,
469                incx,
470                beta,
471                y as *mut _,
472                incy,
473            )
474        }
475    }
476
477    unsafe fn cblas_ger(
478        layout: CBLAS_LAYOUT,
479        m: i32,
480        n: i32,
481        alpha: f32,
482        x: *const f32,
483        incx: i32,
484        y: *const f32,
485        incy: i32,
486        a: *mut f32,
487        lda: i32,
488    ) {
489        unsafe {
490            cblas_sys::cblas_sger(
491                layout,
492                m,
493                n,
494                alpha,
495                x as *const _,
496                incx,
497                y as *const _,
498                incy,
499                a as *mut _,
500                lda,
501            )
502        }
503    }
504
505    unsafe fn cblas_syr(
506        layout: CBLAS_LAYOUT,
507        uplo: CBLAS_UPLO,
508        n: i32,
509        alpha: f32,
510        x: *const f32,
511        incx: i32,
512        a: *mut f32,
513        lda: i32,
514    ) {
515        unsafe {
516            cblas_sys::cblas_ssyr(
517                layout,
518                uplo,
519                n,
520                alpha,
521                x as *const _,
522                incx,
523                a as *mut _,
524                lda,
525            )
526        }
527    }
528
529    unsafe fn cblas_syr2(
530        layout: CBLAS_LAYOUT,
531        uplo: CBLAS_UPLO,
532        n: i32,
533        alpha: f32,
534        x: *const f32,
535        incx: i32,
536        y: *const f32,
537        incy: i32,
538        a: *mut f32,
539        lda: i32,
540    ) {
541        unsafe {
542            cblas_sys::cblas_ssyr2(
543                layout,
544                uplo,
545                n,
546                alpha,
547                x as *const _,
548                incx,
549                y as *const _,
550                incy,
551                a as *mut _,
552                lda,
553            )
554        }
555    }
556
557    unsafe fn cblas_syrk(
558        layout: CBLAS_LAYOUT,
559        uplo: CBLAS_UPLO,
560        trans: CBLAS_TRANSPOSE,
561        n: i32,
562        k: i32,
563        alpha: f32,
564        a: *const f32,
565        lda: i32,
566        beta: f32,
567        c: *mut f32,
568        ldc: i32,
569    ) {
570        unsafe {
571            cblas_sys::cblas_ssyrk(
572                layout,
573                uplo,
574                trans,
575                n,
576                k,
577                alpha,
578                a as *const _,
579                lda,
580                beta,
581                c as *mut _,
582                ldc,
583            )
584        }
585    }
586
587    unsafe fn cblas_syr2k(
588        layout: CBLAS_LAYOUT,
589        uplo: CBLAS_UPLO,
590        trans: CBLAS_TRANSPOSE,
591        n: i32,
592        k: i32,
593        alpha: f32,
594        a: *const f32,
595        lda: i32,
596        b: *const f32,
597        ldb: i32,
598        beta: f32,
599        c: *mut f32,
600        ldc: i32,
601    ) {
602        unsafe {
603            cblas_sys::cblas_ssyr2k(
604                layout,
605                uplo,
606                trans,
607                n,
608                k,
609                alpha,
610                a as *const _,
611                lda,
612                b as *const _,
613                ldb,
614                beta,
615                c as *mut _,
616                ldc,
617            )
618        }
619    }
620}
621
622impl BlasScalar for f64 {
623    unsafe fn cblas_dot(n: i32, x: *const f64, incx: i32, y: *const f64, incy: i32) -> f64 {
624        unsafe { cblas_sys::cblas_ddot(n, x as *const _, incx, y as *const _, incy) }
625    }
626
627    unsafe fn cblas_nrm2(n: i32, x: *const f64, incx: i32) -> f64 {
628        unsafe { cblas_sys::cblas_dnrm2(n, x as *const _, incx) }
629    }
630
631    unsafe fn cblas_asum(n: i32, x: *const f64, incx: i32) -> f64 {
632        unsafe { cblas_sys::cblas_dasum(n, x as *const _, incx) }
633    }
634
635    unsafe fn cblas_swap(n: i32, x: *mut f64, incx: i32, y: *mut f64, incy: i32) {
636        unsafe { cblas_sys::cblas_dswap(n, x as *mut _, incx, y as *mut _, incy) }
637    }
638
639    unsafe fn cblas_copy(n: i32, x: *const f64, incx: i32, y: *mut f64, incy: i32) {
640        unsafe { cblas_sys::cblas_dcopy(n, x as *const _, incx, y as *mut _, incy) }
641    }
642
643    unsafe fn cblas_axpy(n: i32, alpha: f64, x: *const f64, incx: i32, y: *mut f64, incy: i32) {
644        unsafe { cblas_sys::cblas_daxpy(n, alpha, x as *const _, incx, y as *mut _, incy) }
645    }
646
647    unsafe fn cblas_scal(n: i32, alpha: f64, x: *mut f64, incx: i32) {
648        unsafe { cblas_sys::cblas_dscal(n, alpha, x as *mut _, incx) }
649    }
650
651    unsafe fn cblas_gemv(
652        layout: CBLAS_LAYOUT,
653        transa: CBLAS_TRANSPOSE,
654        m: i32,
655        n: i32,
656        alpha: f64,
657        a: *const f64,
658        lda: i32,
659        x: *const f64,
660        incx: i32,
661        beta: f64,
662        y: *mut f64,
663        incy: i32,
664    ) {
665        unsafe {
666            cblas_sys::cblas_dgemv(
667                layout,
668                transa,
669                m,
670                n,
671                alpha,
672                a as *const _,
673                lda,
674                x as *const _,
675                incx,
676                beta,
677                y as *mut _,
678                incy,
679            )
680        }
681    }
682
683    unsafe fn cblas_trmv(
684        layout: CBLAS_LAYOUT,
685        uplo: CBLAS_UPLO,
686        transa: CBLAS_TRANSPOSE,
687        diag: CBLAS_DIAG,
688        n: i32,
689        a: *const f64,
690        lda: i32,
691        x: *mut f64,
692        incx: i32,
693    ) {
694        unsafe {
695            cblas_sys::cblas_dtrmv(
696                layout,
697                uplo,
698                transa,
699                diag,
700                n,
701                a as *const _,
702                lda,
703                x as *mut _,
704                incx,
705            )
706        }
707    }
708
709    unsafe fn cblas_symv(
710        layout: CBLAS_LAYOUT,
711        uplo: CBLAS_UPLO,
712        n: i32,
713        alpha: f64,
714        a: *const f64,
715        lda: i32,
716        x: *const f64,
717        incx: i32,
718        beta: f64,
719        y: *mut f64,
720        incy: i32,
721    ) {
722        unsafe {
723            cblas_sys::cblas_dsymv(
724                layout,
725                uplo,
726                n,
727                alpha,
728                a as *const _,
729                lda,
730                x as *const _,
731                incx,
732                beta,
733                y as *mut _,
734                incy,
735            )
736        }
737    }
738
739    unsafe fn cblas_ger(
740        layout: CBLAS_LAYOUT,
741        m: i32,
742        n: i32,
743        alpha: f64,
744        x: *const f64,
745        incx: i32,
746        y: *const f64,
747        incy: i32,
748        a: *mut f64,
749        lda: i32,
750    ) {
751        unsafe {
752            cblas_sys::cblas_dger(
753                layout,
754                m,
755                n,
756                alpha,
757                x as *const _,
758                incx,
759                y as *const _,
760                incy,
761                a as *mut _,
762                lda,
763            )
764        }
765    }
766
767    unsafe fn cblas_syr(
768        layout: CBLAS_LAYOUT,
769        uplo: CBLAS_UPLO,
770        n: i32,
771        alpha: f64,
772        x: *const f64,
773        incx: i32,
774        a: *mut f64,
775        lda: i32,
776    ) {
777        unsafe {
778            cblas_sys::cblas_dsyr(
779                layout,
780                uplo,
781                n,
782                alpha,
783                x as *const _,
784                incx,
785                a as *mut _,
786                lda,
787            )
788        }
789    }
790
791    unsafe fn cblas_syr2(
792        layout: CBLAS_LAYOUT,
793        uplo: CBLAS_UPLO,
794        n: i32,
795        alpha: f64,
796        x: *const f64,
797        incx: i32,
798        y: *const f64,
799        incy: i32,
800        a: *mut f64,
801        lda: i32,
802    ) {
803        unsafe {
804            cblas_sys::cblas_dsyr2(
805                layout,
806                uplo,
807                n,
808                alpha,
809                x as *const _,
810                incx,
811                y as *const _,
812                incy,
813                a as *mut _,
814                lda,
815            )
816        }
817    }
818
819    unsafe fn cblas_syrk(
820        layout: CBLAS_LAYOUT,
821        uplo: CBLAS_UPLO,
822        trans: CBLAS_TRANSPOSE,
823        n: i32,
824        k: i32,
825        alpha: f64,
826        a: *const f64,
827        lda: i32,
828        beta: f64,
829        c: *mut f64,
830        ldc: i32,
831    ) {
832        unsafe {
833            cblas_sys::cblas_dsyrk(
834                layout,
835                uplo,
836                trans,
837                n,
838                k,
839                alpha,
840                a as *const _,
841                lda,
842                beta,
843                c as *mut _,
844                ldc,
845            )
846        }
847    }
848
849    unsafe fn cblas_syr2k(
850        layout: CBLAS_LAYOUT,
851        uplo: CBLAS_UPLO,
852        trans: CBLAS_TRANSPOSE,
853        n: i32,
854        k: i32,
855        alpha: f64,
856        a: *const f64,
857        lda: i32,
858        b: *const f64,
859        ldb: i32,
860        beta: f64,
861        c: *mut f64,
862        ldc: i32,
863    ) {
864        unsafe {
865            cblas_sys::cblas_dsyr2k(
866                layout,
867                uplo,
868                trans,
869                n,
870                k,
871                alpha,
872                a as *const _,
873                lda,
874                b as *const _,
875                ldb,
876                beta,
877                c as *mut _,
878                ldc,
879            )
880        }
881    }
882}
883
884impl BlasScalar for Complex<f32> {
885    unsafe fn cblas_dotu_sub(
886        n: i32,
887        x: *const Complex<f32>,
888        incx: i32,
889        y: *const Complex<f32>,
890        incy: i32,
891        dotu: *mut Complex<f32>,
892    ) {
893        unsafe {
894            cblas_sys::cblas_cdotu_sub(n, x as *const _, incx, y as *const _, incy, dotu as *mut _)
895        }
896    }
897
898    unsafe fn cblas_dotc_sub(
899        n: i32,
900        x: *const Complex<f32>,
901        incx: i32,
902        y: *const Complex<f32>,
903        incy: i32,
904        dotc: *mut Complex<f32>,
905    ) {
906        unsafe {
907            cblas_sys::cblas_cdotc_sub(n, x as *const _, incx, y as *const _, incy, dotc as *mut _)
908        }
909    }
910
911    unsafe fn cblas_nrm2(n: i32, x: *const Complex<f32>, incx: i32) -> f32 {
912        unsafe { cblas_sys::cblas_scnrm2(n, x as *const _, incx) }
913    }
914
915    unsafe fn cblas_asum(n: i32, x: *const Complex<f32>, incx: i32) -> f32 {
916        unsafe { cblas_sys::cblas_scasum(n, x as *const _, incx) }
917    }
918
919    unsafe fn cblas_swap(n: i32, x: *mut Complex<f32>, incx: i32, y: *mut Complex<f32>, incy: i32) {
920        unsafe { cblas_sys::cblas_cswap(n, x as *mut _, incx, y as *mut _, incy) }
921    }
922
923    unsafe fn cblas_copy(
924        n: i32,
925        x: *const Complex<f32>,
926        incx: i32,
927        y: *mut Complex<f32>,
928        incy: i32,
929    ) {
930        unsafe { cblas_sys::cblas_ccopy(n, x as *const _, incx, y as *mut _, incy) }
931    }
932
933    unsafe fn cblas_axpy(
934        n: i32,
935        alpha: Complex<f32>,
936        x: *const Complex<f32>,
937        incx: i32,
938        y: *mut Complex<f32>,
939        incy: i32,
940    ) {
941        unsafe {
942            cblas_sys::cblas_caxpy(
943                n,
944                &alpha as *const _ as *const _,
945                x as *const _,
946                incx,
947                y as *mut _,
948                incy,
949            )
950        }
951    }
952
953    unsafe fn cblas_scal(n: i32, alpha: Complex<f32>, x: *mut Complex<f32>, incx: i32) {
954        unsafe { cblas_sys::cblas_cscal(n, &alpha as *const _ as *const _, x as *mut _, incx) }
955    }
956
957    unsafe fn cblas_rscal(n: i32, alpha: f32, x: *mut Complex<f32>, incx: i32) {
958        unsafe { cblas_sys::cblas_csscal(n, alpha, x as *mut _, incx) }
959    }
960
961    unsafe fn cblas_gemv(
962        layout: CBLAS_LAYOUT,
963        transa: CBLAS_TRANSPOSE,
964        m: i32,
965        n: i32,
966        alpha: Complex<f32>,
967        a: *const Complex<f32>,
968        lda: i32,
969        x: *const Complex<f32>,
970        incx: i32,
971        beta: Complex<f32>,
972        y: *mut Complex<f32>,
973        incy: i32,
974    ) {
975        unsafe {
976            cblas_sys::cblas_cgemv(
977                layout,
978                transa,
979                m,
980                n,
981                &alpha as *const _ as *const _,
982                a as *const _,
983                lda,
984                x as *const _,
985                incx,
986                &beta as *const _ as *const _,
987                y as *mut _,
988                incy,
989            )
990        }
991    }
992
993    unsafe fn cblas_trmv(
994        layout: CBLAS_LAYOUT,
995        uplo: CBLAS_UPLO,
996        transa: CBLAS_TRANSPOSE,
997        diag: CBLAS_DIAG,
998        n: i32,
999        a: *const Complex<f32>,
1000        lda: i32,
1001        x: *mut Complex<f32>,
1002        incx: i32,
1003    ) {
1004        unsafe {
1005            cblas_sys::cblas_ctrmv(
1006                layout,
1007                uplo,
1008                transa,
1009                diag,
1010                n,
1011                a as *const _,
1012                lda,
1013                x as *mut _,
1014                incx,
1015            )
1016        }
1017    }
1018
1019    unsafe fn cblas_geru(
1020        layout: CBLAS_LAYOUT,
1021        m: i32,
1022        n: i32,
1023        alpha: Complex<f32>,
1024        x: *const Complex<f32>,
1025        incx: i32,
1026        y: *const Complex<f32>,
1027        incy: i32,
1028        a: *mut Complex<f32>,
1029        lda: i32,
1030    ) {
1031        unsafe {
1032            cblas_sys::cblas_cgeru(
1033                layout,
1034                m,
1035                n,
1036                &alpha as *const _ as *const _,
1037                x as *const _,
1038                incx,
1039                y as *const _,
1040                incy,
1041                a as *mut _,
1042                lda,
1043            )
1044        }
1045    }
1046
1047    unsafe fn cblas_gerc(
1048        layout: CBLAS_LAYOUT,
1049        m: i32,
1050        n: i32,
1051        alpha: Complex<f32>,
1052        x: *const Complex<f32>,
1053        incx: i32,
1054        y: *const Complex<f32>,
1055        incy: i32,
1056        a: *mut Complex<f32>,
1057        lda: i32,
1058    ) {
1059        unsafe {
1060            cblas_sys::cblas_cgerc(
1061                layout,
1062                m,
1063                n,
1064                &alpha as *const _ as *const _,
1065                x as *const _,
1066                incx,
1067                y as *const _,
1068                incy,
1069                a as *mut _,
1070                lda,
1071            )
1072        }
1073    }
1074
1075    unsafe fn cblas_her(
1076        layout: CBLAS_LAYOUT,
1077        uplo: CBLAS_UPLO,
1078        n: i32,
1079        alpha: f32,
1080        x: *const Complex<f32>,
1081        incx: i32,
1082        a: *mut Complex<f32>,
1083        lda: i32,
1084    ) {
1085        unsafe {
1086            cblas_sys::cblas_cher(
1087                layout,
1088                uplo,
1089                n,
1090                alpha,
1091                x as *const _,
1092                incx,
1093                a as *mut _,
1094                lda,
1095            )
1096        }
1097    }
1098
1099    unsafe fn cblas_her2(
1100        layout: CBLAS_LAYOUT,
1101        uplo: CBLAS_UPLO,
1102        n: i32,
1103        alpha: Complex<f32>,
1104        x: *const Complex<f32>,
1105        incx: i32,
1106        y: *const Complex<f32>,
1107        incy: i32,
1108        a: *mut Complex<f32>,
1109        lda: i32,
1110    ) {
1111        unsafe {
1112            cblas_sys::cblas_cher2(
1113                layout,
1114                uplo,
1115                n,
1116                &alpha as *const _ as *const _,
1117                x as *const _,
1118                incx,
1119                y as *const _,
1120                incy,
1121                a as *mut _,
1122                lda,
1123            )
1124        }
1125    }
1126
1127    unsafe fn cblas_syrk(
1128        layout: CBLAS_LAYOUT,
1129        uplo: CBLAS_UPLO,
1130        trans: CBLAS_TRANSPOSE,
1131        n: i32,
1132        k: i32,
1133        alpha: Complex<f32>,
1134        a: *const Complex<f32>,
1135        lda: i32,
1136        beta: Complex<f32>,
1137        c: *mut Complex<f32>,
1138        ldc: i32,
1139    ) {
1140        unsafe {
1141            cblas_sys::cblas_csyrk(
1142                layout,
1143                uplo,
1144                trans,
1145                n,
1146                k,
1147                &alpha as *const _ as *const _,
1148                a as *const _,
1149                lda,
1150                &beta as *const _ as *const _,
1151                c as *mut _,
1152                ldc,
1153            )
1154        }
1155    }
1156
1157    unsafe fn cblas_syr2k(
1158        layout: CBLAS_LAYOUT,
1159        uplo: CBLAS_UPLO,
1160        trans: CBLAS_TRANSPOSE,
1161        n: i32,
1162        k: i32,
1163        alpha: Complex<f32>,
1164        a: *const Complex<f32>,
1165        lda: i32,
1166        b: *const Complex<f32>,
1167        ldb: i32,
1168        beta: Complex<f32>,
1169        c: *mut Complex<f32>,
1170        ldc: i32,
1171    ) {
1172        unsafe {
1173            cblas_sys::cblas_csyr2k(
1174                layout,
1175                uplo,
1176                trans,
1177                n,
1178                k,
1179                &alpha as *const _ as *const _,
1180                a as *const _,
1181                lda,
1182                b as *const _,
1183                ldb,
1184                &beta as *const _ as *const _,
1185                c as *mut _,
1186                ldc,
1187            )
1188        }
1189    }
1190
1191    unsafe fn cblas_herk(
1192        layout: CBLAS_LAYOUT,
1193        uplo: CBLAS_UPLO,
1194        trans: CBLAS_TRANSPOSE,
1195        n: i32,
1196        k: i32,
1197        alpha: f32,
1198        a: *const Complex<f32>,
1199        lda: i32,
1200        beta: f32,
1201        c: *mut Complex<f32>,
1202        ldc: i32,
1203    ) {
1204        unsafe {
1205            cblas_sys::cblas_cherk(
1206                layout,
1207                uplo,
1208                trans,
1209                n,
1210                k,
1211                alpha,
1212                a as *const _,
1213                lda,
1214                beta,
1215                c as *mut _,
1216                ldc,
1217            )
1218        }
1219    }
1220
1221    unsafe fn cblas_her2k(
1222        layout: CBLAS_LAYOUT,
1223        uplo: CBLAS_UPLO,
1224        trans: CBLAS_TRANSPOSE,
1225        n: i32,
1226        k: i32,
1227        alpha: Complex<f32>,
1228        a: *const Complex<f32>,
1229        lda: i32,
1230        b: *const Complex<f32>,
1231        ldb: i32,
1232        beta: f32,
1233        c: *mut Complex<f32>,
1234        ldc: i32,
1235    ) {
1236        unsafe {
1237            cblas_sys::cblas_cher2k(
1238                layout,
1239                uplo,
1240                trans,
1241                n,
1242                k,
1243                &alpha as *const _ as *const _,
1244                a as *const _,
1245                lda,
1246                b as *const _,
1247                ldb,
1248                beta,
1249                c as *mut _,
1250                ldc,
1251            )
1252        }
1253    }
1254}
1255
1256impl BlasScalar for Complex<f64> {
1257    unsafe fn cblas_dotu_sub(
1258        n: i32,
1259        x: *const Complex<f64>,
1260        incx: i32,
1261        y: *const Complex<f64>,
1262        incy: i32,
1263        dotu: *mut Complex<f64>,
1264    ) {
1265        unsafe {
1266            cblas_sys::cblas_zdotu_sub(n, x as *const _, incx, y as *const _, incy, dotu as *mut _)
1267        }
1268    }
1269
1270    unsafe fn cblas_dotc_sub(
1271        n: i32,
1272        x: *const Complex<f64>,
1273        incx: i32,
1274        y: *const Complex<f64>,
1275        incy: i32,
1276        dotc: *mut Complex<f64>,
1277    ) {
1278        unsafe {
1279            cblas_sys::cblas_zdotc_sub(n, x as *const _, incx, y as *const _, incy, dotc as *mut _)
1280        }
1281    }
1282
1283    unsafe fn cblas_nrm2(n: i32, x: *const Complex<f64>, incx: i32) -> f64 {
1284        unsafe { cblas_sys::cblas_dznrm2(n, x as *const _, incx) }
1285    }
1286
1287    unsafe fn cblas_asum(n: i32, x: *const Complex<f64>, incx: i32) -> f64 {
1288        unsafe { cblas_sys::cblas_dzasum(n, x as *const _, incx) }
1289    }
1290
1291    unsafe fn cblas_swap(n: i32, x: *mut Complex<f64>, incx: i32, y: *mut Complex<f64>, incy: i32) {
1292        unsafe { cblas_sys::cblas_zswap(n, x as *mut _, incx, y as *mut _, incy) }
1293    }
1294
1295    unsafe fn cblas_copy(
1296        n: i32,
1297        x: *const Complex<f64>,
1298        incx: i32,
1299        y: *mut Complex<f64>,
1300        incy: i32,
1301    ) {
1302        unsafe { cblas_sys::cblas_zcopy(n, x as *const _, incx, y as *mut _, incy) }
1303    }
1304
1305    unsafe fn cblas_axpy(
1306        n: i32,
1307        alpha: Complex<f64>,
1308        x: *const Complex<f64>,
1309        incx: i32,
1310        y: *mut Complex<f64>,
1311        incy: i32,
1312    ) {
1313        unsafe {
1314            cblas_sys::cblas_zaxpy(
1315                n,
1316                &alpha as *const _ as *const _,
1317                x as *const _,
1318                incx,
1319                y as *mut _,
1320                incy,
1321            )
1322        }
1323    }
1324
1325    unsafe fn cblas_scal(n: i32, alpha: Complex<f64>, x: *mut Complex<f64>, incx: i32) {
1326        unsafe { cblas_sys::cblas_zscal(n, &alpha as *const _ as *const _, x as *mut _, incx) }
1327    }
1328
1329    unsafe fn cblas_rscal(n: i32, alpha: f64, x: *mut Complex<f64>, incx: i32) {
1330        unsafe { cblas_sys::cblas_zdscal(n, alpha, x as *mut _, incx) }
1331    }
1332
1333    unsafe fn cblas_gemv(
1334        layout: CBLAS_LAYOUT,
1335        transa: CBLAS_TRANSPOSE,
1336        m: i32,
1337        n: i32,
1338        alpha: Complex<f64>,
1339        a: *const Complex<f64>,
1340        lda: i32,
1341        x: *const Complex<f64>,
1342        incx: i32,
1343        beta: Complex<f64>,
1344        y: *mut Complex<f64>,
1345        incy: i32,
1346    ) {
1347        unsafe {
1348            cblas_sys::cblas_zgemv(
1349                layout,
1350                transa,
1351                m,
1352                n,
1353                &alpha as *const _ as *const _,
1354                a as *const _,
1355                lda,
1356                x as *const _,
1357                incx,
1358                &beta as *const _ as *const _,
1359                y as *mut _,
1360                incy,
1361            )
1362        }
1363    }
1364
1365    unsafe fn cblas_trmv(
1366        layout: CBLAS_LAYOUT,
1367        uplo: CBLAS_UPLO,
1368        transa: CBLAS_TRANSPOSE,
1369        diag: CBLAS_DIAG,
1370        n: i32,
1371        a: *const Complex<f64>,
1372        lda: i32,
1373        x: *mut Complex<f64>,
1374        incx: i32,
1375    ) {
1376        unsafe {
1377            cblas_sys::cblas_ztrmv(
1378                layout,
1379                uplo,
1380                transa,
1381                diag,
1382                n,
1383                a as *const _,
1384                lda,
1385                x as *mut _,
1386                incx,
1387            )
1388        }
1389    }
1390
1391    unsafe fn cblas_geru(
1392        layout: CBLAS_LAYOUT,
1393        m: i32,
1394        n: i32,
1395        alpha: Complex<f64>,
1396        x: *const Complex<f64>,
1397        incx: i32,
1398        y: *const Complex<f64>,
1399        incy: i32,
1400        a: *mut Complex<f64>,
1401        lda: i32,
1402    ) {
1403        unsafe {
1404            cblas_sys::cblas_zgeru(
1405                layout,
1406                m,
1407                n,
1408                &alpha as *const _ as *const _,
1409                x as *const _,
1410                incx,
1411                y as *const _,
1412                incy,
1413                a as *mut _,
1414                lda,
1415            )
1416        }
1417    }
1418
1419    unsafe fn cblas_gerc(
1420        layout: CBLAS_LAYOUT,
1421        m: i32,
1422        n: i32,
1423        alpha: Complex<f64>,
1424        x: *const Complex<f64>,
1425        incx: i32,
1426        y: *const Complex<f64>,
1427        incy: i32,
1428        a: *mut Complex<f64>,
1429        lda: i32,
1430    ) {
1431        unsafe {
1432            cblas_sys::cblas_zgerc(
1433                layout,
1434                m,
1435                n,
1436                &alpha as *const _ as *const _,
1437                x as *const _,
1438                incx,
1439                y as *const _,
1440                incy,
1441                a as *mut _,
1442                lda,
1443            )
1444        }
1445    }
1446
1447    unsafe fn cblas_her(
1448        layout: CBLAS_LAYOUT,
1449        uplo: CBLAS_UPLO,
1450        n: i32,
1451        alpha: f64,
1452        x: *const Complex<f64>,
1453        incx: i32,
1454        a: *mut Complex<f64>,
1455        lda: i32,
1456    ) {
1457        unsafe {
1458            cblas_sys::cblas_zher(
1459                layout,
1460                uplo,
1461                n,
1462                alpha,
1463                x as *const _,
1464                incx,
1465                a as *mut _,
1466                lda,
1467            )
1468        }
1469    }
1470
1471    unsafe fn cblas_her2(
1472        layout: CBLAS_LAYOUT,
1473        uplo: CBLAS_UPLO,
1474        n: i32,
1475        alpha: Complex<f64>,
1476        x: *const Complex<f64>,
1477        incx: i32,
1478        y: *const Complex<f64>,
1479        incy: i32,
1480        a: *mut Complex<f64>,
1481        lda: i32,
1482    ) {
1483        unsafe {
1484            cblas_sys::cblas_zher2(
1485                layout,
1486                uplo,
1487                n,
1488                &alpha as *const _ as *const _,
1489                x as *const _,
1490                incx,
1491                y as *const _,
1492                incy,
1493                a as *mut _,
1494                lda,
1495            )
1496        }
1497    }
1498
1499    unsafe fn cblas_syrk(
1500        layout: CBLAS_LAYOUT,
1501        uplo: CBLAS_UPLO,
1502        trans: CBLAS_TRANSPOSE,
1503        n: i32,
1504        k: i32,
1505        alpha: Complex<f64>,
1506        a: *const Complex<f64>,
1507        lda: i32,
1508        beta: Complex<f64>,
1509        c: *mut Complex<f64>,
1510        ldc: i32,
1511    ) {
1512        unsafe {
1513            cblas_sys::cblas_zsyrk(
1514                layout,
1515                uplo,
1516                trans,
1517                n,
1518                k,
1519                &alpha as *const _ as *const _,
1520                a as *const _,
1521                lda,
1522                &beta as *const _ as *const _,
1523                c as *mut _,
1524                ldc,
1525            )
1526        }
1527    }
1528
1529    unsafe fn cblas_syr2k(
1530        layout: CBLAS_LAYOUT,
1531        uplo: CBLAS_UPLO,
1532        trans: CBLAS_TRANSPOSE,
1533        n: i32,
1534        k: i32,
1535        alpha: Complex<f64>,
1536        a: *const Complex<f64>,
1537        lda: i32,
1538        b: *const Complex<f64>,
1539        ldb: i32,
1540        beta: Complex<f64>,
1541        c: *mut Complex<f64>,
1542        ldc: i32,
1543    ) {
1544        unsafe {
1545            cblas_sys::cblas_zsyr2k(
1546                layout,
1547                uplo,
1548                trans,
1549                n,
1550                k,
1551                &alpha as *const _ as *const _,
1552                a as *const _,
1553                lda,
1554                b as *const _,
1555                ldb,
1556                &beta as *const _ as *const _,
1557                c as *mut _,
1558                ldc,
1559            )
1560        }
1561    }
1562
1563    unsafe fn cblas_herk(
1564        layout: CBLAS_LAYOUT,
1565        uplo: CBLAS_UPLO,
1566        trans: CBLAS_TRANSPOSE,
1567        n: i32,
1568        k: i32,
1569        alpha: f64,
1570        a: *const Complex<f64>,
1571        lda: i32,
1572        beta: f64,
1573        c: *mut Complex<f64>,
1574        ldc: i32,
1575    ) {
1576        unsafe {
1577            cblas_sys::cblas_zherk(
1578                layout,
1579                uplo,
1580                trans,
1581                n,
1582                k,
1583                alpha,
1584                a as *const _,
1585                lda,
1586                beta,
1587                c as *mut _,
1588                ldc,
1589            )
1590        }
1591    }
1592
1593    unsafe fn cblas_her2k(
1594        layout: CBLAS_LAYOUT,
1595        uplo: CBLAS_UPLO,
1596        trans: CBLAS_TRANSPOSE,
1597        n: i32,
1598        k: i32,
1599        alpha: Complex<f64>,
1600        a: *const Complex<f64>,
1601        lda: i32,
1602        b: *const Complex<f64>,
1603        ldb: i32,
1604        beta: f64,
1605        c: *mut Complex<f64>,
1606        ldc: i32,
1607    ) {
1608        unsafe {
1609            cblas_sys::cblas_zher2k(
1610                layout,
1611                uplo,
1612                trans,
1613                n,
1614                k,
1615                &alpha as *const _ as *const _,
1616                a as *const _,
1617                lda,
1618                b as *const _,
1619                ldb,
1620                beta,
1621                c as *mut _,
1622                ldc,
1623            )
1624        }
1625    }
1626}