1use singe_cuda::{
2 memory::DeviceMemory,
3 types::{Complex32, Complex64},
4};
5
6use crate::{
7 context::Context,
8 dense::legacy::{bidiagonal::*, cholesky::*, qr::*, sytrf::*, tridiagonal::*},
9 error::Result,
10 layout::{BatchedMatrixRef, BatchedVectorRef, MatrixMut, MatrixRef, VectorMut, VectorRef},
11 types::{FillMode, Operation, SideMode},
12};
13
14mod potrf_batched_scalar {
15 use super::*;
16
17 pub trait Sealed {
18 fn potrf_batched(
19 ctx: &Context,
20 fill_mode: FillMode,
21 n: usize,
22 a: BatchedMatrixRef<'_, Self>,
23 info: &mut DeviceMemory<i32>,
24 ) -> Result<()>
25 where
26 Self: Sized;
27 }
28
29 impl Sealed for f32 {
30 fn potrf_batched(
31 ctx: &Context,
32 fill_mode: FillMode,
33 n: usize,
34 a: BatchedMatrixRef<'_, Self>,
35 info: &mut DeviceMemory<i32>,
36 ) -> Result<()> {
37 spotrf_batched(ctx, fill_mode, n, a, info)
38 }
39 }
40
41 impl Sealed for f64 {
42 fn potrf_batched(
43 ctx: &Context,
44 fill_mode: FillMode,
45 n: usize,
46 a: BatchedMatrixRef<'_, Self>,
47 info: &mut DeviceMemory<i32>,
48 ) -> Result<()> {
49 dpotrf_batched(ctx, fill_mode, n, a, info)
50 }
51 }
52
53 impl Sealed for Complex32 {
54 fn potrf_batched(
55 ctx: &Context,
56 fill_mode: FillMode,
57 n: usize,
58 a: BatchedMatrixRef<'_, Self>,
59 info: &mut DeviceMemory<i32>,
60 ) -> Result<()> {
61 cpotrf_batched(ctx, fill_mode, n, a, info)
62 }
63 }
64
65 impl Sealed for Complex64 {
66 fn potrf_batched(
67 ctx: &Context,
68 fill_mode: FillMode,
69 n: usize,
70 a: BatchedMatrixRef<'_, Self>,
71 info: &mut DeviceMemory<i32>,
72 ) -> Result<()> {
73 zpotrf_batched(ctx, fill_mode, n, a, info)
74 }
75 }
76}
77
78pub trait PotrfBatchedScalar: potrf_batched_scalar::Sealed {}
79
80impl PotrfBatchedScalar for f32 {}
81impl PotrfBatchedScalar for f64 {}
82impl PotrfBatchedScalar for Complex32 {}
83impl PotrfBatchedScalar for Complex64 {}
84
85mod potrs_batched_scalar {
86 use super::*;
87
88 pub trait Sealed {
89 fn potrs_batched(
90 ctx: &Context,
91 fill_mode: FillMode,
92 n: usize,
93 a: BatchedMatrixRef<'_, Self>,
94 b: BatchedVectorRef<'_, Self>,
95 info: &mut DeviceMemory<i32>,
96 ) -> Result<()>
97 where
98 Self: Sized;
99 }
100
101 impl Sealed for f32 {
102 fn potrs_batched(
103 ctx: &Context,
104 fill_mode: FillMode,
105 n: usize,
106 a: BatchedMatrixRef<'_, Self>,
107 b: BatchedVectorRef<'_, Self>,
108 info: &mut DeviceMemory<i32>,
109 ) -> Result<()> {
110 spotrs_batched(ctx, fill_mode, n, a, b, info)
111 }
112 }
113
114 impl Sealed for f64 {
115 fn potrs_batched(
116 ctx: &Context,
117 fill_mode: FillMode,
118 n: usize,
119 a: BatchedMatrixRef<'_, Self>,
120 b: BatchedVectorRef<'_, Self>,
121 info: &mut DeviceMemory<i32>,
122 ) -> Result<()> {
123 dpotrs_batched(ctx, fill_mode, n, a, b, info)
124 }
125 }
126
127 impl Sealed for Complex64 {
128 fn potrs_batched(
129 ctx: &Context,
130 fill_mode: FillMode,
131 n: usize,
132 a: BatchedMatrixRef<'_, Self>,
133 b: BatchedVectorRef<'_, Self>,
134 info: &mut DeviceMemory<i32>,
135 ) -> Result<()> {
136 zpotrs_batched(ctx, fill_mode, n, a, b, info)
137 }
138 }
139}
140
141pub trait PotrsBatchedScalar: potrs_batched_scalar::Sealed {}
142
143impl PotrsBatchedScalar for f32 {}
144impl PotrsBatchedScalar for f64 {}
145impl PotrsBatchedScalar for Complex64 {}
146
147mod potri_scalar {
148 use super::*;
149
150 pub trait Sealed {
151 fn potri_buffer_size(
152 ctx: &Context,
153 fill_mode: FillMode,
154 n: usize,
155 factor: MatrixMut<'_, Self>,
156 ) -> Result<usize>
157 where
158 Self: Sized;
159
160 fn potri(
161 ctx: &Context,
162 fill_mode: FillMode,
163 n: usize,
164 factor: MatrixMut<'_, Self>,
165 workspace: &mut DeviceMemory<Self>,
166 dev_info: &mut DeviceMemory<i32>,
167 ) -> Result<()>
168 where
169 Self: Sized;
170 }
171
172 impl Sealed for f32 {
173 fn potri_buffer_size(
174 ctx: &Context,
175 fill_mode: FillMode,
176 n: usize,
177 factor: MatrixMut<'_, Self>,
178 ) -> Result<usize> {
179 spotri_buffer_size(ctx, fill_mode, n, factor.data, factor.leading_dimension)
180 }
181
182 fn potri(
183 ctx: &Context,
184 fill_mode: FillMode,
185 n: usize,
186 factor: MatrixMut<'_, Self>,
187 workspace: &mut DeviceMemory<Self>,
188 dev_info: &mut DeviceMemory<i32>,
189 ) -> Result<()> {
190 spotri(
191 ctx,
192 fill_mode,
193 n,
194 factor.data,
195 factor.leading_dimension,
196 workspace,
197 dev_info,
198 )
199 }
200 }
201
202 impl Sealed for f64 {
203 fn potri_buffer_size(
204 ctx: &Context,
205 fill_mode: FillMode,
206 n: usize,
207 factor: MatrixMut<'_, Self>,
208 ) -> Result<usize> {
209 dpotri_buffer_size(ctx, fill_mode, n, factor.data, factor.leading_dimension)
210 }
211
212 fn potri(
213 ctx: &Context,
214 fill_mode: FillMode,
215 n: usize,
216 factor: MatrixMut<'_, Self>,
217 workspace: &mut DeviceMemory<Self>,
218 dev_info: &mut DeviceMemory<i32>,
219 ) -> Result<()> {
220 dpotri(
221 ctx,
222 fill_mode,
223 n,
224 factor.data,
225 factor.leading_dimension,
226 workspace,
227 dev_info,
228 )
229 }
230 }
231
232 impl Sealed for Complex32 {
233 fn potri_buffer_size(
234 ctx: &Context,
235 fill_mode: FillMode,
236 n: usize,
237 factor: MatrixMut<'_, Self>,
238 ) -> Result<usize> {
239 cpotri_buffer_size(ctx, fill_mode, n, factor.data, factor.leading_dimension)
240 }
241
242 fn potri(
243 ctx: &Context,
244 fill_mode: FillMode,
245 n: usize,
246 factor: MatrixMut<'_, Self>,
247 workspace: &mut DeviceMemory<Self>,
248 dev_info: &mut DeviceMemory<i32>,
249 ) -> Result<()> {
250 cpotri(
251 ctx,
252 fill_mode,
253 n,
254 factor.data,
255 factor.leading_dimension,
256 workspace,
257 dev_info,
258 )
259 }
260 }
261
262 impl Sealed for Complex64 {
263 fn potri_buffer_size(
264 ctx: &Context,
265 fill_mode: FillMode,
266 n: usize,
267 factor: MatrixMut<'_, Self>,
268 ) -> Result<usize> {
269 zpotri_buffer_size(ctx, fill_mode, n, factor.data, factor.leading_dimension)
270 }
271
272 fn potri(
273 ctx: &Context,
274 fill_mode: FillMode,
275 n: usize,
276 factor: MatrixMut<'_, Self>,
277 workspace: &mut DeviceMemory<Self>,
278 dev_info: &mut DeviceMemory<i32>,
279 ) -> Result<()> {
280 zpotri(
281 ctx,
282 fill_mode,
283 n,
284 factor.data,
285 factor.leading_dimension,
286 workspace,
287 dev_info,
288 )
289 }
290 }
291}
292
293pub trait PotriScalar: potri_scalar::Sealed {}
294
295impl PotriScalar for f32 {}
296impl PotriScalar for f64 {}
297impl PotriScalar for Complex32 {}
298impl PotriScalar for Complex64 {}
299
300mod ormqr_scalar {
301 use super::*;
302
303 pub trait Sealed {
304 fn ormqr_buffer_size(
305 ctx: &Context,
306 side: SideMode,
307 operation: Operation,
308 m: usize,
309 n: usize,
310 k: usize,
311 reflectors: MatrixRef<'_, Self>,
312 tau: VectorRef<'_, Self>,
313 matrix: MatrixRef<'_, Self>,
314 ) -> Result<usize>
315 where
316 Self: Sized;
317
318 fn ormqr(
319 ctx: &Context,
320 side: SideMode,
321 operation: Operation,
322 m: usize,
323 n: usize,
324 k: usize,
325 reflectors: MatrixRef<'_, Self>,
326 tau: VectorRef<'_, Self>,
327 matrix: MatrixMut<'_, Self>,
328 workspace: &mut DeviceMemory<Self>,
329 dev_info: &mut DeviceMemory<i32>,
330 ) -> Result<()>
331 where
332 Self: Sized;
333 }
334
335 impl Sealed for f32 {
336 fn ormqr_buffer_size(
337 ctx: &Context,
338 side: SideMode,
339 operation: Operation,
340 m: usize,
341 n: usize,
342 k: usize,
343 reflectors: MatrixRef<'_, Self>,
344 tau: VectorRef<'_, Self>,
345 matrix: MatrixRef<'_, Self>,
346 ) -> Result<usize> {
347 sormqr_buffer_size(
348 ctx,
349 side,
350 operation,
351 m,
352 n,
353 k,
354 reflectors.data,
355 reflectors.leading_dimension,
356 tau.data,
357 matrix.data,
358 matrix.leading_dimension,
359 )
360 }
361
362 fn ormqr(
363 ctx: &Context,
364 side: SideMode,
365 operation: Operation,
366 m: usize,
367 n: usize,
368 k: usize,
369 reflectors: MatrixRef<'_, Self>,
370 tau: VectorRef<'_, Self>,
371 matrix: MatrixMut<'_, Self>,
372 workspace: &mut DeviceMemory<Self>,
373 dev_info: &mut DeviceMemory<i32>,
374 ) -> Result<()> {
375 sormqr(
376 ctx,
377 side,
378 operation,
379 m,
380 n,
381 k,
382 reflectors.data,
383 reflectors.leading_dimension,
384 tau.data,
385 matrix.data,
386 matrix.leading_dimension,
387 workspace,
388 dev_info,
389 )
390 }
391 }
392
393 impl Sealed for f64 {
394 fn ormqr_buffer_size(
395 ctx: &Context,
396 side: SideMode,
397 operation: Operation,
398 m: usize,
399 n: usize,
400 k: usize,
401 reflectors: MatrixRef<'_, Self>,
402 tau: VectorRef<'_, Self>,
403 matrix: MatrixRef<'_, Self>,
404 ) -> Result<usize> {
405 dormqr_buffer_size(
406 ctx,
407 side,
408 operation,
409 m,
410 n,
411 k,
412 reflectors.data,
413 reflectors.leading_dimension,
414 tau.data,
415 matrix.data,
416 matrix.leading_dimension,
417 )
418 }
419
420 fn ormqr(
421 ctx: &Context,
422 side: SideMode,
423 operation: Operation,
424 m: usize,
425 n: usize,
426 k: usize,
427 reflectors: MatrixRef<'_, Self>,
428 tau: VectorRef<'_, Self>,
429 matrix: MatrixMut<'_, Self>,
430 workspace: &mut DeviceMemory<Self>,
431 dev_info: &mut DeviceMemory<i32>,
432 ) -> Result<()> {
433 dormqr(
434 ctx,
435 side,
436 operation,
437 m,
438 n,
439 k,
440 reflectors.data,
441 reflectors.leading_dimension,
442 tau.data,
443 matrix.data,
444 matrix.leading_dimension,
445 workspace,
446 dev_info,
447 )
448 }
449 }
450
451 impl Sealed for Complex32 {
452 fn ormqr_buffer_size(
453 ctx: &Context,
454 side: SideMode,
455 operation: Operation,
456 m: usize,
457 n: usize,
458 k: usize,
459 reflectors: MatrixRef<'_, Self>,
460 tau: VectorRef<'_, Self>,
461 matrix: MatrixRef<'_, Self>,
462 ) -> Result<usize> {
463 cunmqr_buffer_size(
464 ctx,
465 side,
466 operation,
467 m,
468 n,
469 k,
470 reflectors.data,
471 reflectors.leading_dimension,
472 tau.data,
473 matrix.data,
474 matrix.leading_dimension,
475 )
476 }
477
478 fn ormqr(
479 ctx: &Context,
480 side: SideMode,
481 operation: Operation,
482 m: usize,
483 n: usize,
484 k: usize,
485 reflectors: MatrixRef<'_, Self>,
486 tau: VectorRef<'_, Self>,
487 matrix: MatrixMut<'_, Self>,
488 workspace: &mut DeviceMemory<Self>,
489 dev_info: &mut DeviceMemory<i32>,
490 ) -> Result<()> {
491 cunmqr(
492 ctx,
493 side,
494 operation,
495 m,
496 n,
497 k,
498 reflectors.data,
499 reflectors.leading_dimension,
500 tau.data,
501 matrix.data,
502 matrix.leading_dimension,
503 workspace,
504 dev_info,
505 )
506 }
507 }
508
509 impl Sealed for Complex64 {
510 fn ormqr_buffer_size(
511 ctx: &Context,
512 side: SideMode,
513 operation: Operation,
514 m: usize,
515 n: usize,
516 k: usize,
517 reflectors: MatrixRef<'_, Self>,
518 tau: VectorRef<'_, Self>,
519 matrix: MatrixRef<'_, Self>,
520 ) -> Result<usize> {
521 zunmqr_buffer_size(
522 ctx,
523 side,
524 operation,
525 m,
526 n,
527 k,
528 reflectors.data,
529 reflectors.leading_dimension,
530 tau.data,
531 matrix.data,
532 matrix.leading_dimension,
533 )
534 }
535
536 fn ormqr(
537 ctx: &Context,
538 side: SideMode,
539 operation: Operation,
540 m: usize,
541 n: usize,
542 k: usize,
543 reflectors: MatrixRef<'_, Self>,
544 tau: VectorRef<'_, Self>,
545 matrix: MatrixMut<'_, Self>,
546 workspace: &mut DeviceMemory<Self>,
547 dev_info: &mut DeviceMemory<i32>,
548 ) -> Result<()> {
549 zunmqr(
550 ctx,
551 side,
552 operation,
553 m,
554 n,
555 k,
556 reflectors.data,
557 reflectors.leading_dimension,
558 tau.data,
559 matrix.data,
560 matrix.leading_dimension,
561 workspace,
562 dev_info,
563 )
564 }
565 }
566}
567
568pub trait OrmqrScalar: ormqr_scalar::Sealed {}
569
570impl OrmqrScalar for f32 {}
571impl OrmqrScalar for f64 {}
572impl OrmqrScalar for Complex32 {}
573impl OrmqrScalar for Complex64 {}
574
575mod orgqr_scalar {
576 use super::*;
577
578 pub trait Sealed {
579 fn orgqr_buffer_size(
580 ctx: &Context,
581 m: usize,
582 n: usize,
583 k: usize,
584 a: MatrixRef<'_, Self>,
585 tau: VectorRef<'_, Self>,
586 ) -> Result<usize>
587 where
588 Self: Sized;
589
590 fn orgqr(
591 ctx: &Context,
592 m: usize,
593 n: usize,
594 k: usize,
595 a: MatrixMut<'_, Self>,
596 tau: VectorRef<'_, Self>,
597 workspace: &mut DeviceMemory<Self>,
598 dev_info: &mut DeviceMemory<i32>,
599 ) -> Result<()>
600 where
601 Self: Sized;
602 }
603
604 impl Sealed for f32 {
605 fn orgqr_buffer_size(
606 ctx: &Context,
607 m: usize,
608 n: usize,
609 k: usize,
610 a: MatrixRef<'_, Self>,
611 tau: VectorRef<'_, Self>,
612 ) -> Result<usize> {
613 sorgqr_buffer_size(ctx, m, n, k, a.data, a.leading_dimension, tau.data)
614 }
615
616 fn orgqr(
617 ctx: &Context,
618 m: usize,
619 n: usize,
620 k: usize,
621 a: MatrixMut<'_, Self>,
622 tau: VectorRef<'_, Self>,
623 workspace: &mut DeviceMemory<Self>,
624 dev_info: &mut DeviceMemory<i32>,
625 ) -> Result<()> {
626 sorgqr(
627 ctx,
628 m,
629 n,
630 k,
631 a.data,
632 a.leading_dimension,
633 tau.data,
634 workspace,
635 dev_info,
636 )
637 }
638 }
639
640 impl Sealed for f64 {
641 fn orgqr_buffer_size(
642 ctx: &Context,
643 m: usize,
644 n: usize,
645 k: usize,
646 a: MatrixRef<'_, Self>,
647 tau: VectorRef<'_, Self>,
648 ) -> Result<usize> {
649 dorgqr_buffer_size(ctx, m, n, k, a.data, a.leading_dimension, tau.data)
650 }
651
652 fn orgqr(
653 ctx: &Context,
654 m: usize,
655 n: usize,
656 k: usize,
657 a: MatrixMut<'_, Self>,
658 tau: VectorRef<'_, Self>,
659 workspace: &mut DeviceMemory<Self>,
660 dev_info: &mut DeviceMemory<i32>,
661 ) -> Result<()> {
662 dorgqr(
663 ctx,
664 m,
665 n,
666 k,
667 a.data,
668 a.leading_dimension,
669 tau.data,
670 workspace,
671 dev_info,
672 )
673 }
674 }
675
676 impl Sealed for Complex32 {
677 fn orgqr_buffer_size(
678 ctx: &Context,
679 m: usize,
680 n: usize,
681 k: usize,
682 a: MatrixRef<'_, Self>,
683 tau: VectorRef<'_, Self>,
684 ) -> Result<usize> {
685 cungqr_buffer_size(ctx, m, n, k, a.data, a.leading_dimension, tau.data)
686 }
687
688 fn orgqr(
689 ctx: &Context,
690 m: usize,
691 n: usize,
692 k: usize,
693 a: MatrixMut<'_, Self>,
694 tau: VectorRef<'_, Self>,
695 workspace: &mut DeviceMemory<Self>,
696 dev_info: &mut DeviceMemory<i32>,
697 ) -> Result<()> {
698 cungqr(
699 ctx,
700 m,
701 n,
702 k,
703 a.data,
704 a.leading_dimension,
705 tau.data,
706 workspace,
707 dev_info,
708 )
709 }
710 }
711
712 impl Sealed for Complex64 {
713 fn orgqr_buffer_size(
714 ctx: &Context,
715 m: usize,
716 n: usize,
717 k: usize,
718 a: MatrixRef<'_, Self>,
719 tau: VectorRef<'_, Self>,
720 ) -> Result<usize> {
721 zungqr_buffer_size(ctx, m, n, k, a.data, a.leading_dimension, tau.data)
722 }
723
724 fn orgqr(
725 ctx: &Context,
726 m: usize,
727 n: usize,
728 k: usize,
729 a: MatrixMut<'_, Self>,
730 tau: VectorRef<'_, Self>,
731 workspace: &mut DeviceMemory<Self>,
732 dev_info: &mut DeviceMemory<i32>,
733 ) -> Result<()> {
734 zungqr(
735 ctx,
736 m,
737 n,
738 k,
739 a.data,
740 a.leading_dimension,
741 tau.data,
742 workspace,
743 dev_info,
744 )
745 }
746 }
747}
748
749pub trait OrgqrScalar: orgqr_scalar::Sealed {}
750
751impl OrgqrScalar for f32 {}
752impl OrgqrScalar for f64 {}
753impl OrgqrScalar for Complex32 {}
754impl OrgqrScalar for Complex64 {}
755
756mod sytrf_scalar {
757 use super::*;
758
759 pub trait Sealed {
760 fn sytrf_buffer_size(ctx: &Context, n: usize, a: MatrixMut<'_, Self>) -> Result<usize>
761 where
762 Self: Sized;
763
764 fn sytrf(
765 ctx: &Context,
766 fill_mode: FillMode,
767 n: usize,
768 a: MatrixMut<'_, Self>,
769 pivots: Option<&mut DeviceMemory<i32>>,
770 workspace: &mut DeviceMemory<Self>,
771 dev_info: &mut DeviceMemory<i32>,
772 ) -> Result<()>
773 where
774 Self: Sized;
775 }
776
777 impl Sealed for f32 {
778 fn sytrf_buffer_size(ctx: &Context, n: usize, a: MatrixMut<'_, Self>) -> Result<usize> {
779 ssytrf_buffer_size(ctx, n, a.data, a.leading_dimension)
780 }
781
782 fn sytrf(
783 ctx: &Context,
784 fill_mode: FillMode,
785 n: usize,
786 a: MatrixMut<'_, Self>,
787 pivots: Option<&mut DeviceMemory<i32>>,
788 workspace: &mut DeviceMemory<Self>,
789 dev_info: &mut DeviceMemory<i32>,
790 ) -> Result<()> {
791 ssytrf(
792 ctx,
793 fill_mode,
794 n,
795 a.data,
796 a.leading_dimension,
797 pivots,
798 workspace,
799 dev_info,
800 )
801 }
802 }
803
804 impl Sealed for f64 {
805 fn sytrf_buffer_size(ctx: &Context, n: usize, a: MatrixMut<'_, Self>) -> Result<usize> {
806 dsytrf_buffer_size(ctx, n, a.data, a.leading_dimension)
807 }
808
809 fn sytrf(
810 ctx: &Context,
811 fill_mode: FillMode,
812 n: usize,
813 a: MatrixMut<'_, Self>,
814 pivots: Option<&mut DeviceMemory<i32>>,
815 workspace: &mut DeviceMemory<Self>,
816 dev_info: &mut DeviceMemory<i32>,
817 ) -> Result<()> {
818 dsytrf(
819 ctx,
820 fill_mode,
821 n,
822 a.data,
823 a.leading_dimension,
824 pivots,
825 workspace,
826 dev_info,
827 )
828 }
829 }
830
831 impl Sealed for Complex32 {
832 fn sytrf_buffer_size(ctx: &Context, n: usize, a: MatrixMut<'_, Self>) -> Result<usize> {
833 csytrf_buffer_size(ctx, n, a.data, a.leading_dimension)
834 }
835
836 fn sytrf(
837 ctx: &Context,
838 fill_mode: FillMode,
839 n: usize,
840 a: MatrixMut<'_, Self>,
841 pivots: Option<&mut DeviceMemory<i32>>,
842 workspace: &mut DeviceMemory<Self>,
843 dev_info: &mut DeviceMemory<i32>,
844 ) -> Result<()> {
845 csytrf(
846 ctx,
847 fill_mode,
848 n,
849 a.data,
850 a.leading_dimension,
851 pivots,
852 workspace,
853 dev_info,
854 )
855 }
856 }
857
858 impl Sealed for Complex64 {
859 fn sytrf_buffer_size(ctx: &Context, n: usize, a: MatrixMut<'_, Self>) -> Result<usize> {
860 zsytrf_buffer_size(ctx, n, a.data, a.leading_dimension)
861 }
862
863 fn sytrf(
864 ctx: &Context,
865 fill_mode: FillMode,
866 n: usize,
867 a: MatrixMut<'_, Self>,
868 pivots: Option<&mut DeviceMemory<i32>>,
869 workspace: &mut DeviceMemory<Self>,
870 dev_info: &mut DeviceMemory<i32>,
871 ) -> Result<()> {
872 zsytrf(
873 ctx,
874 fill_mode,
875 n,
876 a.data,
877 a.leading_dimension,
878 pivots,
879 workspace,
880 dev_info,
881 )
882 }
883 }
884}
885
886pub trait SytrfScalar: sytrf_scalar::Sealed {}
887
888impl SytrfScalar for f32 {}
889impl SytrfScalar for f64 {}
890impl SytrfScalar for Complex32 {}
891impl SytrfScalar for Complex64 {}
892
893mod sytrd_scalar {
894 use super::*;
895
896 pub trait Sealed {
897 type Real;
898
899 fn sytrd_buffer_size(
900 ctx: &Context,
901 fill_mode: FillMode,
902 n: usize,
903 a: MatrixRef<'_, Self>,
904 d: VectorRef<'_, Self::Real>,
905 e: VectorRef<'_, Self::Real>,
906 tau: VectorRef<'_, Self>,
907 ) -> Result<usize>
908 where
909 Self: Sized;
910
911 fn sytrd(
912 ctx: &Context,
913 fill_mode: FillMode,
914 n: usize,
915 a: MatrixMut<'_, Self>,
916 d: VectorMut<'_, Self::Real>,
917 e: VectorMut<'_, Self::Real>,
918 tau: VectorMut<'_, Self>,
919 workspace: &mut DeviceMemory<Self>,
920 dev_info: &mut DeviceMemory<i32>,
921 ) -> Result<()>
922 where
923 Self: Sized;
924 }
925
926 impl Sealed for f32 {
927 type Real = f32;
928
929 fn sytrd_buffer_size(
930 ctx: &Context,
931 fill_mode: FillMode,
932 n: usize,
933 a: MatrixRef<'_, Self>,
934 d: VectorRef<'_, Self::Real>,
935 e: VectorRef<'_, Self::Real>,
936 tau: VectorRef<'_, Self>,
937 ) -> Result<usize> {
938 ssytrd_buffer_size(
939 ctx,
940 fill_mode,
941 n,
942 a.data,
943 a.leading_dimension,
944 d.data,
945 e.data,
946 tau.data,
947 )
948 }
949
950 fn sytrd(
951 ctx: &Context,
952 fill_mode: FillMode,
953 n: usize,
954 a: MatrixMut<'_, Self>,
955 d: VectorMut<'_, Self::Real>,
956 e: VectorMut<'_, Self::Real>,
957 tau: VectorMut<'_, Self>,
958 workspace: &mut DeviceMemory<Self>,
959 dev_info: &mut DeviceMemory<i32>,
960 ) -> Result<()> {
961 ssytrd(
962 ctx,
963 fill_mode,
964 n,
965 a.data,
966 a.leading_dimension,
967 d.data,
968 e.data,
969 tau.data,
970 workspace,
971 dev_info,
972 )
973 }
974 }
975
976 impl Sealed for f64 {
977 type Real = f64;
978
979 fn sytrd_buffer_size(
980 ctx: &Context,
981 fill_mode: FillMode,
982 n: usize,
983 a: MatrixRef<'_, Self>,
984 d: VectorRef<'_, Self::Real>,
985 e: VectorRef<'_, Self::Real>,
986 tau: VectorRef<'_, Self>,
987 ) -> Result<usize> {
988 dsytrd_buffer_size(
989 ctx,
990 fill_mode,
991 n,
992 a.data,
993 a.leading_dimension,
994 d.data,
995 e.data,
996 tau.data,
997 )
998 }
999
1000 fn sytrd(
1001 ctx: &Context,
1002 fill_mode: FillMode,
1003 n: usize,
1004 a: MatrixMut<'_, Self>,
1005 d: VectorMut<'_, Self::Real>,
1006 e: VectorMut<'_, Self::Real>,
1007 tau: VectorMut<'_, Self>,
1008 workspace: &mut DeviceMemory<Self>,
1009 dev_info: &mut DeviceMemory<i32>,
1010 ) -> Result<()> {
1011 dsytrd(
1012 ctx,
1013 fill_mode,
1014 n,
1015 a.data,
1016 a.leading_dimension,
1017 d.data,
1018 e.data,
1019 tau.data,
1020 workspace,
1021 dev_info,
1022 )
1023 }
1024 }
1025
1026 impl Sealed for Complex32 {
1027 type Real = f32;
1028
1029 fn sytrd_buffer_size(
1030 ctx: &Context,
1031 fill_mode: FillMode,
1032 n: usize,
1033 a: MatrixRef<'_, Self>,
1034 d: VectorRef<'_, Self::Real>,
1035 e: VectorRef<'_, Self::Real>,
1036 tau: VectorRef<'_, Self>,
1037 ) -> Result<usize> {
1038 chetrd_buffer_size(
1039 ctx,
1040 fill_mode,
1041 n,
1042 a.data,
1043 a.leading_dimension,
1044 d.data,
1045 e.data,
1046 tau.data,
1047 )
1048 }
1049
1050 fn sytrd(
1051 ctx: &Context,
1052 fill_mode: FillMode,
1053 n: usize,
1054 a: MatrixMut<'_, Self>,
1055 d: VectorMut<'_, Self::Real>,
1056 e: VectorMut<'_, Self::Real>,
1057 tau: VectorMut<'_, Self>,
1058 workspace: &mut DeviceMemory<Self>,
1059 dev_info: &mut DeviceMemory<i32>,
1060 ) -> Result<()> {
1061 chetrd(
1062 ctx,
1063 fill_mode,
1064 n,
1065 a.data,
1066 a.leading_dimension,
1067 d.data,
1068 e.data,
1069 tau.data,
1070 workspace,
1071 dev_info,
1072 )
1073 }
1074 }
1075
1076 impl Sealed for Complex64 {
1077 type Real = f64;
1078
1079 fn sytrd_buffer_size(
1080 ctx: &Context,
1081 fill_mode: FillMode,
1082 n: usize,
1083 a: MatrixRef<'_, Self>,
1084 d: VectorRef<'_, Self::Real>,
1085 e: VectorRef<'_, Self::Real>,
1086 tau: VectorRef<'_, Self>,
1087 ) -> Result<usize> {
1088 zhetrd_buffer_size(
1089 ctx,
1090 fill_mode,
1091 n,
1092 a.data,
1093 a.leading_dimension,
1094 d.data,
1095 e.data,
1096 tau.data,
1097 )
1098 }
1099
1100 fn sytrd(
1101 ctx: &Context,
1102 fill_mode: FillMode,
1103 n: usize,
1104 a: MatrixMut<'_, Self>,
1105 d: VectorMut<'_, Self::Real>,
1106 e: VectorMut<'_, Self::Real>,
1107 tau: VectorMut<'_, Self>,
1108 workspace: &mut DeviceMemory<Self>,
1109 dev_info: &mut DeviceMemory<i32>,
1110 ) -> Result<()> {
1111 zhetrd(
1112 ctx,
1113 fill_mode,
1114 n,
1115 a.data,
1116 a.leading_dimension,
1117 d.data,
1118 e.data,
1119 tau.data,
1120 workspace,
1121 dev_info,
1122 )
1123 }
1124 }
1125}
1126
1127pub trait SytrdScalar: sytrd_scalar::Sealed {}
1128
1129impl SytrdScalar for f32 {}
1130impl SytrdScalar for f64 {}
1131impl SytrdScalar for Complex32 {}
1132impl SytrdScalar for Complex64 {}
1133
1134mod orgtr_scalar {
1135 use super::*;
1136
1137 pub trait Sealed {
1138 fn orgtr_buffer_size(
1139 ctx: &Context,
1140 fill_mode: FillMode,
1141 n: usize,
1142 a: MatrixRef<'_, Self>,
1143 tau: VectorRef<'_, Self>,
1144 ) -> Result<usize>
1145 where
1146 Self: Sized;
1147
1148 fn orgtr(
1149 ctx: &Context,
1150 fill_mode: FillMode,
1151 n: usize,
1152 a: MatrixMut<'_, Self>,
1153 tau: VectorRef<'_, Self>,
1154 workspace: &mut DeviceMemory<Self>,
1155 dev_info: &mut DeviceMemory<i32>,
1156 ) -> Result<()>
1157 where
1158 Self: Sized;
1159 }
1160
1161 impl Sealed for f32 {
1162 fn orgtr_buffer_size(
1163 ctx: &Context,
1164 fill_mode: FillMode,
1165 n: usize,
1166 a: MatrixRef<'_, Self>,
1167 tau: VectorRef<'_, Self>,
1168 ) -> Result<usize> {
1169 sorgtr_buffer_size(ctx, fill_mode, n, a.data, a.leading_dimension, tau.data)
1170 }
1171
1172 fn orgtr(
1173 ctx: &Context,
1174 fill_mode: FillMode,
1175 n: usize,
1176 a: MatrixMut<'_, Self>,
1177 tau: VectorRef<'_, Self>,
1178 workspace: &mut DeviceMemory<Self>,
1179 dev_info: &mut DeviceMemory<i32>,
1180 ) -> Result<()> {
1181 sorgtr(
1182 ctx,
1183 fill_mode,
1184 n,
1185 a.data,
1186 a.leading_dimension,
1187 tau.data,
1188 workspace,
1189 dev_info,
1190 )
1191 }
1192 }
1193
1194 impl Sealed for f64 {
1195 fn orgtr_buffer_size(
1196 ctx: &Context,
1197 fill_mode: FillMode,
1198 n: usize,
1199 a: MatrixRef<'_, Self>,
1200 tau: VectorRef<'_, Self>,
1201 ) -> Result<usize> {
1202 dorgtr_buffer_size(ctx, fill_mode, n, a.data, a.leading_dimension, tau.data)
1203 }
1204
1205 fn orgtr(
1206 ctx: &Context,
1207 fill_mode: FillMode,
1208 n: usize,
1209 a: MatrixMut<'_, Self>,
1210 tau: VectorRef<'_, Self>,
1211 workspace: &mut DeviceMemory<Self>,
1212 dev_info: &mut DeviceMemory<i32>,
1213 ) -> Result<()> {
1214 dorgtr(
1215 ctx,
1216 fill_mode,
1217 n,
1218 a.data,
1219 a.leading_dimension,
1220 tau.data,
1221 workspace,
1222 dev_info,
1223 )
1224 }
1225 }
1226
1227 impl Sealed for Complex32 {
1228 fn orgtr_buffer_size(
1229 ctx: &Context,
1230 fill_mode: FillMode,
1231 n: usize,
1232 a: MatrixRef<'_, Self>,
1233 tau: VectorRef<'_, Self>,
1234 ) -> Result<usize> {
1235 cungtr_buffer_size(ctx, fill_mode, n, a.data, a.leading_dimension, tau.data)
1236 }
1237
1238 fn orgtr(
1239 ctx: &Context,
1240 fill_mode: FillMode,
1241 n: usize,
1242 a: MatrixMut<'_, Self>,
1243 tau: VectorRef<'_, Self>,
1244 workspace: &mut DeviceMemory<Self>,
1245 dev_info: &mut DeviceMemory<i32>,
1246 ) -> Result<()> {
1247 cungtr(
1248 ctx,
1249 fill_mode,
1250 n,
1251 a.data,
1252 a.leading_dimension,
1253 tau.data,
1254 workspace,
1255 dev_info,
1256 )
1257 }
1258 }
1259
1260 impl Sealed for Complex64 {
1261 fn orgtr_buffer_size(
1262 ctx: &Context,
1263 fill_mode: FillMode,
1264 n: usize,
1265 a: MatrixRef<'_, Self>,
1266 tau: VectorRef<'_, Self>,
1267 ) -> Result<usize> {
1268 zungtr_buffer_size(ctx, fill_mode, n, a.data, a.leading_dimension, tau.data)
1269 }
1270
1271 fn orgtr(
1272 ctx: &Context,
1273 fill_mode: FillMode,
1274 n: usize,
1275 a: MatrixMut<'_, Self>,
1276 tau: VectorRef<'_, Self>,
1277 workspace: &mut DeviceMemory<Self>,
1278 dev_info: &mut DeviceMemory<i32>,
1279 ) -> Result<()> {
1280 zungtr(
1281 ctx,
1282 fill_mode,
1283 n,
1284 a.data,
1285 a.leading_dimension,
1286 tau.data,
1287 workspace,
1288 dev_info,
1289 )
1290 }
1291 }
1292}
1293
1294pub trait OrgtrScalar: orgtr_scalar::Sealed {}
1295
1296impl OrgtrScalar for f32 {}
1297impl OrgtrScalar for f64 {}
1298impl OrgtrScalar for Complex32 {}
1299impl OrgtrScalar for Complex64 {}
1300
1301mod ormtr_scalar {
1302 use super::*;
1303
1304 pub trait Sealed {
1305 fn ormtr_buffer_size(
1306 ctx: &Context,
1307 side: SideMode,
1308 fill_mode: FillMode,
1309 operation: Operation,
1310 m: usize,
1311 n: usize,
1312 reflectors: MatrixRef<'_, Self>,
1313 tau: VectorRef<'_, Self>,
1314 matrix: MatrixRef<'_, Self>,
1315 ) -> Result<usize>
1316 where
1317 Self: Sized;
1318
1319 fn ormtr(
1320 ctx: &Context,
1321 side: SideMode,
1322 fill_mode: FillMode,
1323 operation: Operation,
1324 m: usize,
1325 n: usize,
1326 reflectors: MatrixMut<'_, Self>,
1327 tau: VectorMut<'_, Self>,
1328 matrix: MatrixMut<'_, Self>,
1329 workspace: &mut DeviceMemory<Self>,
1330 dev_info: &mut DeviceMemory<i32>,
1331 ) -> Result<()>
1332 where
1333 Self: Sized;
1334 }
1335
1336 impl Sealed for f32 {
1337 fn ormtr_buffer_size(
1338 ctx: &Context,
1339 side: SideMode,
1340 fill_mode: FillMode,
1341 operation: Operation,
1342 m: usize,
1343 n: usize,
1344 reflectors: MatrixRef<'_, Self>,
1345 tau: VectorRef<'_, Self>,
1346 matrix: MatrixRef<'_, Self>,
1347 ) -> Result<usize> {
1348 sormtr_buffer_size(
1349 ctx,
1350 side,
1351 fill_mode,
1352 operation,
1353 m,
1354 n,
1355 reflectors.data,
1356 reflectors.leading_dimension,
1357 tau.data,
1358 matrix.data,
1359 matrix.leading_dimension,
1360 )
1361 }
1362
1363 fn ormtr(
1364 ctx: &Context,
1365 side: SideMode,
1366 fill_mode: FillMode,
1367 operation: Operation,
1368 m: usize,
1369 n: usize,
1370 reflectors: MatrixMut<'_, Self>,
1371 tau: VectorMut<'_, Self>,
1372 matrix: MatrixMut<'_, Self>,
1373 workspace: &mut DeviceMemory<Self>,
1374 dev_info: &mut DeviceMemory<i32>,
1375 ) -> Result<()> {
1376 sormtr(
1377 ctx,
1378 side,
1379 fill_mode,
1380 operation,
1381 m,
1382 n,
1383 reflectors.data,
1384 reflectors.leading_dimension,
1385 tau.data,
1386 matrix.data,
1387 matrix.leading_dimension,
1388 workspace,
1389 dev_info,
1390 )
1391 }
1392 }
1393
1394 impl Sealed for f64 {
1395 fn ormtr_buffer_size(
1396 ctx: &Context,
1397 side: SideMode,
1398 fill_mode: FillMode,
1399 operation: Operation,
1400 m: usize,
1401 n: usize,
1402 reflectors: MatrixRef<'_, Self>,
1403 tau: VectorRef<'_, Self>,
1404 matrix: MatrixRef<'_, Self>,
1405 ) -> Result<usize> {
1406 dormtr_buffer_size(
1407 ctx,
1408 side,
1409 fill_mode,
1410 operation,
1411 m,
1412 n,
1413 reflectors.data,
1414 reflectors.leading_dimension,
1415 tau.data,
1416 matrix.data,
1417 matrix.leading_dimension,
1418 )
1419 }
1420
1421 fn ormtr(
1422 ctx: &Context,
1423 side: SideMode,
1424 fill_mode: FillMode,
1425 operation: Operation,
1426 m: usize,
1427 n: usize,
1428 reflectors: MatrixMut<'_, Self>,
1429 tau: VectorMut<'_, Self>,
1430 matrix: MatrixMut<'_, Self>,
1431 workspace: &mut DeviceMemory<Self>,
1432 dev_info: &mut DeviceMemory<i32>,
1433 ) -> Result<()> {
1434 dormtr(
1435 ctx,
1436 side,
1437 fill_mode,
1438 operation,
1439 m,
1440 n,
1441 reflectors.data,
1442 reflectors.leading_dimension,
1443 tau.data,
1444 matrix.data,
1445 matrix.leading_dimension,
1446 workspace,
1447 dev_info,
1448 )
1449 }
1450 }
1451
1452 impl Sealed for Complex32 {
1453 fn ormtr_buffer_size(
1454 ctx: &Context,
1455 side: SideMode,
1456 fill_mode: FillMode,
1457 operation: Operation,
1458 m: usize,
1459 n: usize,
1460 reflectors: MatrixRef<'_, Self>,
1461 tau: VectorRef<'_, Self>,
1462 matrix: MatrixRef<'_, Self>,
1463 ) -> Result<usize> {
1464 cunmtr_buffer_size(
1465 ctx,
1466 side,
1467 fill_mode,
1468 operation,
1469 m,
1470 n,
1471 reflectors.data,
1472 reflectors.leading_dimension,
1473 tau.data,
1474 matrix.data,
1475 matrix.leading_dimension,
1476 )
1477 }
1478
1479 fn ormtr(
1480 ctx: &Context,
1481 side: SideMode,
1482 fill_mode: FillMode,
1483 operation: Operation,
1484 m: usize,
1485 n: usize,
1486 reflectors: MatrixMut<'_, Self>,
1487 tau: VectorMut<'_, Self>,
1488 matrix: MatrixMut<'_, Self>,
1489 workspace: &mut DeviceMemory<Self>,
1490 dev_info: &mut DeviceMemory<i32>,
1491 ) -> Result<()> {
1492 cunmtr(
1493 ctx,
1494 side,
1495 fill_mode,
1496 operation,
1497 m,
1498 n,
1499 reflectors.data,
1500 reflectors.leading_dimension,
1501 tau.data,
1502 matrix.data,
1503 matrix.leading_dimension,
1504 workspace,
1505 dev_info,
1506 )
1507 }
1508 }
1509
1510 impl Sealed for Complex64 {
1511 fn ormtr_buffer_size(
1512 ctx: &Context,
1513 side: SideMode,
1514 fill_mode: FillMode,
1515 operation: Operation,
1516 m: usize,
1517 n: usize,
1518 reflectors: MatrixRef<'_, Self>,
1519 tau: VectorRef<'_, Self>,
1520 matrix: MatrixRef<'_, Self>,
1521 ) -> Result<usize> {
1522 zunmtr_buffer_size(
1523 ctx,
1524 side,
1525 fill_mode,
1526 operation,
1527 m,
1528 n,
1529 reflectors.data,
1530 reflectors.leading_dimension,
1531 tau.data,
1532 matrix.data,
1533 matrix.leading_dimension,
1534 )
1535 }
1536
1537 fn ormtr(
1538 ctx: &Context,
1539 side: SideMode,
1540 fill_mode: FillMode,
1541 operation: Operation,
1542 m: usize,
1543 n: usize,
1544 reflectors: MatrixMut<'_, Self>,
1545 tau: VectorMut<'_, Self>,
1546 matrix: MatrixMut<'_, Self>,
1547 workspace: &mut DeviceMemory<Self>,
1548 dev_info: &mut DeviceMemory<i32>,
1549 ) -> Result<()> {
1550 zunmtr(
1551 ctx,
1552 side,
1553 fill_mode,
1554 operation,
1555 m,
1556 n,
1557 reflectors.data,
1558 reflectors.leading_dimension,
1559 tau.data,
1560 matrix.data,
1561 matrix.leading_dimension,
1562 workspace,
1563 dev_info,
1564 )
1565 }
1566 }
1567}
1568
1569pub trait OrmtrScalar: ormtr_scalar::Sealed {}
1570
1571impl OrmtrScalar for f32 {}
1572impl OrmtrScalar for f64 {}
1573impl OrmtrScalar for Complex32 {}
1574impl OrmtrScalar for Complex64 {}
1575
1576mod gebrd_scalar {
1577 use super::*;
1578
1579 pub trait Sealed {
1580 type Real;
1581
1582 fn gebrd_buffer_size(ctx: &Context, m: usize, n: usize) -> Result<usize>;
1583
1584 fn gebrd(
1585 ctx: &Context,
1586 m: usize,
1587 n: usize,
1588 a: MatrixMut<'_, Self>,
1589 d: VectorMut<'_, Self::Real>,
1590 e: VectorMut<'_, Self::Real>,
1591 tauq: VectorMut<'_, Self>,
1592 taup: VectorMut<'_, Self>,
1593 workspace: &mut DeviceMemory<Self>,
1594 dev_info: &mut DeviceMemory<i32>,
1595 ) -> Result<()>
1596 where
1597 Self: Sized;
1598 }
1599
1600 impl Sealed for f32 {
1601 type Real = f32;
1602
1603 fn gebrd_buffer_size(ctx: &Context, m: usize, n: usize) -> Result<usize> {
1604 sgebrd_buffer_size(ctx, m, n)
1605 }
1606
1607 fn gebrd(
1608 ctx: &Context,
1609 m: usize,
1610 n: usize,
1611 a: MatrixMut<'_, Self>,
1612 d: VectorMut<'_, Self::Real>,
1613 e: VectorMut<'_, Self::Real>,
1614 tauq: VectorMut<'_, Self>,
1615 taup: VectorMut<'_, Self>,
1616 workspace: &mut DeviceMemory<Self>,
1617 dev_info: &mut DeviceMemory<i32>,
1618 ) -> Result<()> {
1619 sgebrd(
1620 ctx,
1621 m,
1622 n,
1623 a.data,
1624 a.leading_dimension,
1625 d.data,
1626 e.data,
1627 tauq.data,
1628 taup.data,
1629 workspace,
1630 dev_info,
1631 )
1632 }
1633 }
1634
1635 impl Sealed for f64 {
1636 type Real = f64;
1637
1638 fn gebrd_buffer_size(ctx: &Context, m: usize, n: usize) -> Result<usize> {
1639 dgebrd_buffer_size(ctx, m, n)
1640 }
1641
1642 fn gebrd(
1643 ctx: &Context,
1644 m: usize,
1645 n: usize,
1646 a: MatrixMut<'_, Self>,
1647 d: VectorMut<'_, Self::Real>,
1648 e: VectorMut<'_, Self::Real>,
1649 tauq: VectorMut<'_, Self>,
1650 taup: VectorMut<'_, Self>,
1651 workspace: &mut DeviceMemory<Self>,
1652 dev_info: &mut DeviceMemory<i32>,
1653 ) -> Result<()> {
1654 dgebrd(
1655 ctx,
1656 m,
1657 n,
1658 a.data,
1659 a.leading_dimension,
1660 d.data,
1661 e.data,
1662 tauq.data,
1663 taup.data,
1664 workspace,
1665 dev_info,
1666 )
1667 }
1668 }
1669
1670 impl Sealed for Complex32 {
1671 type Real = f32;
1672
1673 fn gebrd_buffer_size(ctx: &Context, m: usize, n: usize) -> Result<usize> {
1674 cgebrd_buffer_size(ctx, m, n)
1675 }
1676
1677 fn gebrd(
1678 ctx: &Context,
1679 m: usize,
1680 n: usize,
1681 a: MatrixMut<'_, Self>,
1682 d: VectorMut<'_, Self::Real>,
1683 e: VectorMut<'_, Self::Real>,
1684 tauq: VectorMut<'_, Self>,
1685 taup: VectorMut<'_, Self>,
1686 workspace: &mut DeviceMemory<Self>,
1687 dev_info: &mut DeviceMemory<i32>,
1688 ) -> Result<()> {
1689 cgebrd(
1690 ctx,
1691 m,
1692 n,
1693 a.data,
1694 a.leading_dimension,
1695 d.data,
1696 e.data,
1697 tauq.data,
1698 taup.data,
1699 workspace,
1700 dev_info,
1701 )
1702 }
1703 }
1704
1705 impl Sealed for Complex64 {
1706 type Real = f64;
1707
1708 fn gebrd_buffer_size(ctx: &Context, m: usize, n: usize) -> Result<usize> {
1709 zgebrd_buffer_size(ctx, m, n)
1710 }
1711
1712 fn gebrd(
1713 ctx: &Context,
1714 m: usize,
1715 n: usize,
1716 a: MatrixMut<'_, Self>,
1717 d: VectorMut<'_, Self::Real>,
1718 e: VectorMut<'_, Self::Real>,
1719 tauq: VectorMut<'_, Self>,
1720 taup: VectorMut<'_, Self>,
1721 workspace: &mut DeviceMemory<Self>,
1722 dev_info: &mut DeviceMemory<i32>,
1723 ) -> Result<()> {
1724 zgebrd(
1725 ctx,
1726 m,
1727 n,
1728 a.data,
1729 a.leading_dimension,
1730 d.data,
1731 e.data,
1732 tauq.data,
1733 taup.data,
1734 workspace,
1735 dev_info,
1736 )
1737 }
1738 }
1739}
1740
1741pub trait GebrdScalar: gebrd_scalar::Sealed {}
1742
1743impl GebrdScalar for f32 {}
1744impl GebrdScalar for f64 {}
1745impl GebrdScalar for Complex32 {}
1746impl GebrdScalar for Complex64 {}
1747
1748mod orgbr_scalar {
1749 use super::*;
1750
1751 pub trait Sealed {
1752 fn orgbr_buffer_size(
1753 ctx: &Context,
1754 side: SideMode,
1755 m: usize,
1756 n: usize,
1757 k: usize,
1758 a: MatrixRef<'_, Self>,
1759 tau: VectorRef<'_, Self>,
1760 ) -> Result<usize>
1761 where
1762 Self: Sized;
1763
1764 fn orgbr(
1765 ctx: &Context,
1766 side: SideMode,
1767 m: usize,
1768 n: usize,
1769 k: usize,
1770 a: MatrixMut<'_, Self>,
1771 tau: VectorRef<'_, Self>,
1772 workspace: &mut DeviceMemory<Self>,
1773 dev_info: &mut DeviceMemory<i32>,
1774 ) -> Result<()>
1775 where
1776 Self: Sized;
1777 }
1778
1779 impl Sealed for f32 {
1780 fn orgbr_buffer_size(
1781 ctx: &Context,
1782 side: SideMode,
1783 m: usize,
1784 n: usize,
1785 k: usize,
1786 a: MatrixRef<'_, Self>,
1787 tau: VectorRef<'_, Self>,
1788 ) -> Result<usize> {
1789 sorgbr_buffer_size(ctx, side, m, n, k, a.data, a.leading_dimension, tau.data)
1790 }
1791
1792 fn orgbr(
1793 ctx: &Context,
1794 side: SideMode,
1795 m: usize,
1796 n: usize,
1797 k: usize,
1798 a: MatrixMut<'_, Self>,
1799 tau: VectorRef<'_, Self>,
1800 workspace: &mut DeviceMemory<Self>,
1801 dev_info: &mut DeviceMemory<i32>,
1802 ) -> Result<()> {
1803 sorgbr(
1804 ctx,
1805 side,
1806 m,
1807 n,
1808 k,
1809 a.data,
1810 a.leading_dimension,
1811 tau.data,
1812 workspace,
1813 dev_info,
1814 )
1815 }
1816 }
1817
1818 impl Sealed for f64 {
1819 fn orgbr_buffer_size(
1820 ctx: &Context,
1821 side: SideMode,
1822 m: usize,
1823 n: usize,
1824 k: usize,
1825 a: MatrixRef<'_, Self>,
1826 tau: VectorRef<'_, Self>,
1827 ) -> Result<usize> {
1828 dorgbr_buffer_size(ctx, side, m, n, k, a.data, a.leading_dimension, tau.data)
1829 }
1830
1831 fn orgbr(
1832 ctx: &Context,
1833 side: SideMode,
1834 m: usize,
1835 n: usize,
1836 k: usize,
1837 a: MatrixMut<'_, Self>,
1838 tau: VectorRef<'_, Self>,
1839 workspace: &mut DeviceMemory<Self>,
1840 dev_info: &mut DeviceMemory<i32>,
1841 ) -> Result<()> {
1842 dorgbr(
1843 ctx,
1844 side,
1845 m,
1846 n,
1847 k,
1848 a.data,
1849 a.leading_dimension,
1850 tau.data,
1851 workspace,
1852 dev_info,
1853 )
1854 }
1855 }
1856
1857 impl Sealed for Complex32 {
1858 fn orgbr_buffer_size(
1859 ctx: &Context,
1860 side: SideMode,
1861 m: usize,
1862 n: usize,
1863 k: usize,
1864 a: MatrixRef<'_, Self>,
1865 tau: VectorRef<'_, Self>,
1866 ) -> Result<usize> {
1867 cungbr_buffer_size(ctx, side, m, n, k, a.data, a.leading_dimension, tau.data)
1868 }
1869
1870 fn orgbr(
1871 ctx: &Context,
1872 side: SideMode,
1873 m: usize,
1874 n: usize,
1875 k: usize,
1876 a: MatrixMut<'_, Self>,
1877 tau: VectorRef<'_, Self>,
1878 workspace: &mut DeviceMemory<Self>,
1879 dev_info: &mut DeviceMemory<i32>,
1880 ) -> Result<()> {
1881 cungbr(
1882 ctx,
1883 side,
1884 m,
1885 n,
1886 k,
1887 a.data,
1888 a.leading_dimension,
1889 tau.data,
1890 workspace,
1891 dev_info,
1892 )
1893 }
1894 }
1895
1896 impl Sealed for Complex64 {
1897 fn orgbr_buffer_size(
1898 ctx: &Context,
1899 side: SideMode,
1900 m: usize,
1901 n: usize,
1902 k: usize,
1903 a: MatrixRef<'_, Self>,
1904 tau: VectorRef<'_, Self>,
1905 ) -> Result<usize> {
1906 zungbr_buffer_size(ctx, side, m, n, k, a.data, a.leading_dimension, tau.data)
1907 }
1908
1909 fn orgbr(
1910 ctx: &Context,
1911 side: SideMode,
1912 m: usize,
1913 n: usize,
1914 k: usize,
1915 a: MatrixMut<'_, Self>,
1916 tau: VectorRef<'_, Self>,
1917 workspace: &mut DeviceMemory<Self>,
1918 dev_info: &mut DeviceMemory<i32>,
1919 ) -> Result<()> {
1920 zungbr(
1921 ctx,
1922 side,
1923 m,
1924 n,
1925 k,
1926 a.data,
1927 a.leading_dimension,
1928 tau.data,
1929 workspace,
1930 dev_info,
1931 )
1932 }
1933 }
1934}
1935
1936pub trait OrgbrScalar: orgbr_scalar::Sealed {}
1937
1938impl OrgbrScalar for f32 {}
1939impl OrgbrScalar for f64 {}
1940impl OrgbrScalar for Complex32 {}
1941impl OrgbrScalar for Complex64 {}