accelerate-general 0.1.0

A general matrix and vector operations library using Apple's Accelerate framework.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
use crate::constants::{IsDiagUnit, MultiplyOrder, RowColMajor, TransposeMode, UpOrLowTriangle};
use num_complex::Complex;
use std::ffi::{c_double, c_int};

#[link(name = "Accelerate", kind = "framework")]
extern "C" {
    /// Scales a general band matrix, then multiplies it by a vector, and adds another vector (single-precision complex).
    ///
    /// # Precision
    /// This function operates on `f64` complex numbers (`Complex<f64>`).
    ///
    /// Computes the operation `alpha * A * x + beta * y` or `alpha * A^T * x + beta * y`, where `A` is a band matrix.
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `trans_a`: Specifies whether to use matrix `A`, its transpose, or conjugate transpose.
    /// - `m`: The number of rows in matrix `A`.
    /// - `n`: The number of columns in matrix `A`.
    /// - `kl`: The number of sub-diagonals in matrix `A`.
    /// - `ku`: The number of super-diagonals in matrix `A`.
    /// - `alpha`: Scaling factor applied to matrix `A`.
    /// - `a`: A pointer to the band matrix `A` (complex values).
    /// - `lda`: The leading dimension of matrix `A`, must be at least `kl + ku + 1`.
    /// - `x`: A pointer to the input vector `X` (complex values).
    /// - `inc_x`: The stride within vector `X`.
    /// - `beta`: Scaling factor applied to vector `Y`.
    /// - `y`: A pointer to the output vector `Y` (complex values).
    /// - `inc_y`: The stride within vector `Y`.
    ///
    /// # Safety
    /// This is an `unsafe` function. The caller must ensure that the memory regions pointed to by `a`, `x`, and `y` are valid and
    /// that accessing the data up to `m * n`, `n * inc_x`, and `m * inc_y` elements is safe.
    #[link_name = "cblas_zgbmv"]
    pub fn band_mat_vec_mul(
        major: RowColMajor,              // Row-major or column-major
        trans_a: TransposeMode,          // Transpose mode for matrix A
        m: c_int,                        // Number of rows in matrix A
        n: c_int,                        // Number of columns in matrix A
        kl: c_int,                       // Number of  sub-diagonals in matrix A
        ku: c_int,                       // Number of super-diagonals in matrix A
        alpha: *const Complex<c_double>, // Scaling factor alpha
        a: *const Complex<c_double>,     // Pointer to band matrix A
        lda: c_int,                      // Leading dimension of matrix A
        x: *const Complex<c_double>,     // Pointer to input vector X
        inc_x: c_int,                    // Stride within vector X
        beta: *const Complex<c_double>,  // Scaling factor beta
        y: *mut Complex<c_double>,       // Pointer to output vector Y
        inc_y: c_int,                    // Stride within vector Y
    );

    /// Multiplies two matrices (single-precision complex) and optionally adds a scaled matrix.
    ///
    /// # Precision
    /// This function operates on `f64` complex numbers (`Complex<f64>`).
    ///
    /// Computes the matrix-matrix product and adds the result to a scaled matrix `C`:
    /// `C = alpha * A * B + beta * C` or `C = alpha * B * A + beta * C`.
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `trans_a`: Specifies whether to transpose matrix `A`.
    /// - `trans_b`: Specifies whether to transpose matrix `B`.
    /// - `m`: The number of rows in matrices `A` and `C`.
    /// - `n`: The number of columns in matrices `B` and `C`.
    /// - `k`: The number of columns in matrix `A` and the number of rows in matrix `B`.
    /// - `alpha`: The scaling factor applied to the product of `A` and `B`.
    /// - `a`: A pointer to matrix `A` (complex values).
    /// - `lda`: The leading dimension of matrix `A` (usually the number of rows if column-major, or columns if row-major).
    /// - `b`: A pointer to matrix `B` (complex values).
    /// - `ldb`: The leading dimension of matrix `B` (same as `lda`, typically).
    /// - `beta`: The scaling factor applied to matrix `C`.
    /// - `c`: A pointer to matrix `C` (complex values), where the result will be stored.
    /// - `ldc`: The leading dimension of matrix `C` (same as `lda`, typically).
    ///
    /// # Safety
    /// This is an `unsafe` function. The caller must ensure that the memory regions for `a`, `b`, and `c` are valid and that the dimensions and strides provided match the matrix layout.
    #[link_name = "cblas_zgemm"]
    pub fn mat_mul_add(
        major: RowColMajor,              // Row-major or column-major
        trans_a: TransposeMode,          // Transpose mode for matrix A
        trans_b: TransposeMode,          // Transpose mode for matrix B
        m: c_int,                        // Number of rows in matrices A and C
        n: c_int,                        // Number of columns in matrices B and C
        k: c_int,                        // Number of columns in A and rows in B
        alpha: *const Complex<c_double>, // Scaling factor for the product of A and B
        a: *const Complex<c_double>,     // Pointer to matrix A
        lda: c_int,                      // Leading dimension of matrix A
        b: *const Complex<c_double>,     // Pointer to matrix B
        ldb: c_int,                      // Leading dimension of matrix B
        beta: *const Complex<c_double>,  // Scaling factor for matrix C
        c: *mut Complex<c_double>,       // Pointer to matrix C (output)
        ldc: c_int,                      // Leading dimension of matrix C
    );

    /// General matrix-vector multiplication (single-precision complex).
    ///
    /// # Precision
    /// This function operates on `f64` complex numbers (`Complex<f64>`).
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `trans`: Specifies whether to transpose matrix `A`.
    /// - `m`: Number of rows in matrix `A`.
    /// - `n`: Number of columns in matrix `A`.
    /// - `alpha`: The scalar factor applied to matrix `A`.
    /// - `a`: A pointer to matrix `A`.
    /// - `lda`: The leading dimension of matrix `A`.
    /// - `x`: A pointer to vector `x`.
    /// - `inc_x`: The increment between elements in vector `x`.
    /// - `beta`: The scalar factor applied to vector `y`.
    /// - `y`: A pointer to vector `y`, which stores the result in-place.
    /// - `inc_y`: The increment between elements in vector `y`.
    ///
    /// # Safety
    /// This is an `unsafe` function. The caller must ensure that the memory regions accessed by `a`, `x`, and `y` are valid.
    #[link_name = "cblas_zgemv"]
    pub fn mat_vec_mul(
        major: RowColMajor,
        trans: TransposeMode,
        m: c_int,
        n: c_int,
        alpha: *const Complex<c_double>,
        a: *const Complex<c_double>,
        lda: c_int,
        x: *const Complex<c_double>,
        inc_x: c_int,
        beta: *const Complex<c_double>,
        y: *mut Complex<c_double>,
        inc_y: c_int,
    );

    /// Performs a rank-1 update of a matrix using the conjugate transpose of vector `Y`:
    /// `A = alpha * x * conjg(y') + A` (single-precision complex).
    ///
    /// # Precision
    /// This function operates on `f64` complex numbers (`Complex<f64>`).
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `m`: The number of rows in matrix `A`.
    /// - `n`: The number of columns in matrix `A`.
    /// - `alpha`: The scalar factor applied to vector `X`.
    /// - `x`: A pointer to the input vector `X`.
    /// - `inc_x`: The increment between elements in vector `X`. For example, if `inc_x = 7`, every 7th element is used.
    /// - `y`: A pointer to the input vector `Y`.
    /// - `inc_y`: The increment between elements in vector `Y`. For example, if `inc_y = 7`, every 7th element is used.
    /// - `a`: A pointer to the matrix `A`, which is updated in-place.
    /// - `lda`: The leading dimension of matrix `A`.
    ///
    /// # Safety
    /// This is an `unsafe` function. The caller must ensure that the memory regions accessed by `x`, `y`, and `A` are valid.
    #[link_name = "cblas_zgerc"]
    pub fn mat_rank1_conj_update(
        major: RowColMajor,
        m: c_int,
        n: c_int,
        alpha: *const Complex<c_double>,
        x: *const Complex<c_double>,
        inc_x: c_int,
        y: *const Complex<c_double>,
        inc_y: c_int,
        a: *mut Complex<c_double>,
        lda: c_int,
    );

    /// Performs a rank-1 update: `A = alpha * x * y^T + A`
    ///
    /// # Precision
    /// This function operates on single-precision `f64` complex numbers.
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `m`: The number of rows in matrix `A`.
    /// - `n`: The number of columns in matrix `A`.
    /// - `alpha`: The scaling factor for vector `x`.
    /// - `x`: A pointer to the input vector `x` (single-precision complex).
    /// - `inc_x`: The increment (stride) between elements in vector `x`.
    /// - `y`: A pointer to the input vector `y` (single-precision complex).
    /// - `inc_y`: The increment (stride) between elements in vector `y`.
    /// - `a`: A pointer to the matrix `A` (single-precision complex) which will be updated in place.
    /// - `lda`: The leading dimension of matrix `A`.
    ///
    /// # Safety
    /// This function is `unsafe` as it involves raw pointers and does not perform bounds checking.
    #[link_name = "cblas_zgeru"]
    pub fn rank1_update_unconj(
        major: RowColMajor,              // Row or Column Major
        m: c_int,                        // Number of rows in matrix A
        n: c_int,                        // Number of columns in matrix A
        alpha: *const Complex<c_double>, // Scaling factor for vector x (complex)
        x: *const Complex<c_double>,     // Pointer to vector x (complex)
        inc_x: c_int,                    // Increment for vector x
        y: *const Complex<c_double>,     // Pointer to vector y (complex)
        inc_y: c_int,                    // Increment for vector y
        a: *mut Complex<c_double>,       // Pointer to matrix A (complex, output)
        lda: c_int,                      // Leading dimension of matrix A
    );

    /// Scales a Hermitian band matrix, then multiplies by a vector, then adds a vector.
    ///
    /// # Precision
    /// This function operates on single-precision `f64` complex numbers.
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `tri`: Specifies whether to use the upper or lower triangle of the matrix. Valid values are 'U' (Upper) or 'L' (Lower).
    /// - `n`: The order of the Hermitian matrix `A` (i.e., the number of rows/columns).
    /// - `k`: Half-bandwidth of the Hermitian band matrix `A`.
    /// - `alpha`: The scaling factor to multiply the Hermitian band matrix `A` by.
    /// - `a`: A pointer to the Hermitian band matrix `A` (complex).
    /// - `lda`: The leading dimension of the matrix `A`.
    /// - `x`: A pointer to the input vector `X` (complex).
    /// - `inc_x`: The increment (stride) between elements in vector `X`.
    /// - `beta`: The scaling factor to multiply the vector `Y` by.
    /// - `y`: A pointer to the output vector `Y` (complex), which will be replaced with the result.
    /// - `inc_y`: The increment (stride) between elements in vector `Y`.
    ///
    /// # Safety
    /// This function is `unsafe` as it involves raw pointers and does not perform bounds checking.
    #[link_name = "cblas_zhbmv"]
    pub fn herm_band_mat_vec_mul(
        major: RowColMajor,              // Row or Column Major
        tri: UpOrLowTriangle,            // Upper or Lower triangle
        n: c_int,                        // Order of the matrix A
        k: c_int,                        // Half-bandwidth of the Hermitian band matrix A
        alpha: *const Complex<c_double>, // Scaling factor alpha (complex)
        a: *const Complex<c_double>,     // Pointer to the Hermitian band matrix A (complex)
        lda: c_int,                      // Leading dimension of matrix A
        x: *const Complex<c_double>,     // Pointer to vector X (complex)
        inc_x: c_int,                    // Stride within vector X
        beta: *const Complex<c_double>,  // Scaling factor beta (complex)
        y: *mut Complex<c_double>,       // Pointer to vector Y (complex, output)
        inc_y: c_int,                    // Stride within vector Y
    );

    /// Multiplies two Hermitian matrices, then adds a third matrix with scaling.
    ///
    /// # Precision
    /// This function operates on single-precision `f64` complex numbers.
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `side`: Determines the order in which the matrices should be multiplied.
    /// - `tri`: Specifies whether to use the upper or lower triangle of the Hermitian matrix. Valid values are 'U' (Upper) or 'L' (Lower).
    /// - `m`: The number of rows in matrices `A` and `C`.
    /// - `n`: The number of columns in matrices `B` and `C`.
    /// - `alpha`: The scaling factor applied to the product of matrices `A` and `B` (complex).
    /// - `a`: A pointer to the Hermitian matrix `A` (complex).
    /// - `lda`: The leading dimension of matrix `A` (typically the number of rows).
    /// - `b`: A pointer to matrix `B` (complex).
    /// - `ldb`: The leading dimension of matrix `B` (typically the number of rows).
    /// - `beta`: The scaling factor applied to matrix `C` (complex).
    /// - `c`: A pointer to matrix `C`, where the result is stored (complex).
    /// - `ldc`: The leading dimension of matrix `C` (typically the number of rows).
    ///
    /// # Safety
    /// This function is `unsafe` as it involves raw pointers and does not perform bounds checking.
    #[link_name = "cblas_zhemm"]
    pub fn herm_mat_mul_add(
        major: RowColMajor,              // Row or Column Major
        side: MultiplyOrder,             // Left or Right multiplication
        tri: UpOrLowTriangle,            // Upper or Lower triangle
        m: c_int,                        // Number of rows in A and C
        n: c_int,                        // Number of columns in B and C
        alpha: *const Complex<c_double>, // Scaling factor alpha (complex)
        a: *const Complex<c_double>,     // Pointer to Hermitian matrix A (complex)
        lda: c_int,                      // Leading dimension of matrix A
        b: *const Complex<c_double>,     // Pointer to matrix B (complex)
        ldb: c_int,                      // Leading dimension of matrix B
        beta: *const Complex<c_double>,  // Scaling factor beta (complex)
        c: *mut Complex<c_double>,       // Pointer to matrix C (complex, output)
        ldc: c_int,                      // Leading dimension of matrix C
    );

    /// Scales and multiplies a Hermitian matrix by a vector, then adds a second (scaled) vector.
    ///
    /// # Precision
    /// This function operates on single-precision `f64` complex numbers.
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `tri`: Specifies whether to use the upper or lower triangle from the matrix. Valid values are 'U' (Upper) or 'L' (Lower).
    /// - `n`: The order (number of rows and columns) of the Hermitian matrix `A`.
    /// - `alpha`: The scaling factor applied to the matrix `A` (complex).
    /// - `a`: A pointer to the Hermitian matrix `A` (complex).
    /// - `lda`: The leading dimension of matrix `A` (typically the number of rows).
    /// - `x`: A pointer to vector `X` (complex).
    /// - `inc_x`: The increment between elements in `X`. For example, if `inc_x = 7`, every 7th element of `X` is used.
    /// - `beta`: The scaling factor applied to the vector `Y` (complex).
    /// - `y`: A pointer to vector `Y` (complex), which will store the result in-place.
    /// - `inc_y`: The increment between elements in `Y`. For example, if `inc_y = 7`, every 7th element of `Y` is used.
    ///
    /// # Safety
    /// This function is `unsafe` as it involves raw pointers and does not perform bounds checking.
    #[link_name = "cblas_zhemv"]
    pub fn herm_mat_vec_mul_add(
        major: RowColMajor,              // Row or Column Major
        tri: UpOrLowTriangle,            // Upper or Lower triangle of Hermitian matrix
        n: c_int,                        // Order of the matrix A
        alpha: *const Complex<c_double>, // Scaling factor alpha (complex)
        a: *const Complex<c_double>,     // Pointer to Hermitian matrix A (complex)
        lda: c_int,                      // Leading dimension of matrix A
        x: *const Complex<c_double>,     // Pointer to vector X (complex)
        inc_x: c_int,                    // Increment between elements in X
        beta: *const Complex<c_double>,  // Scaling factor beta (complex)
        y: *mut Complex<c_double>,       // Pointer to vector Y (complex, output)
        inc_y: c_int,                    // Increment between elements in Y
    );

    /// Hermitian rank 1 update: adds the product of a scaling factor, vector X, and the conjugate transpose of X to matrix A.
    ///
    /// # Precision
    /// This function operates on single-precision `f64` complex numbers.
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `tri`: Specifies whether to use the upper ('U') or lower ('L') triangle from the matrix.
    /// - `n`: The order of matrix `A` (the number of rows and columns).
    /// - `alpha`: The scaling factor for vector `X` (real scalar).
    /// - `x`: A pointer to vector `X` (complex).
    /// - `inc_x`: The increment between elements in `X`. For example, if `inc_x = 7`, every 7th element of `X` is used.
    /// - `a`: A pointer to Hermitian matrix `A` (complex), which will be updated in-place.
    /// - `lda`: The leading dimension of matrix `A` (typically the number of rows).
    ///
    /// # Safety
    /// This function is `unsafe` as it involves raw pointers and does not perform bounds checking.
    #[link_name = "cblas_zher"]
    pub fn herm_rank1_update(
        major: RowColMajor,          // Row or Column Major
        tri: UpOrLowTriangle,        // Upper or Lower triangle of Hermitian matrix
        n: c_int,                    // Order of matrix A
        alpha: c_double,             // Scaling factor (real scalar)
        x: *const Complex<c_double>, // Pointer to vector X (complex)
        inc_x: c_int,                // Increment between elements in X
        a: *mut Complex<c_double>,   // Pointer to Hermitian matrix A (complex)
        lda: c_int,                  // Leading dimension of matrix A
    );

    /// Hermitian rank 2 update: adds the product of a scaling factor, vector X, and the conjugate transpose of vector Y
    /// to the product of the conjugate of the scaling factor, vector Y, and the conjugate transpose of vector X, and adds the result to matrix A.
    ///
    /// # Precision
    /// This function operates on single-precision `f64` complex numbers.
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `tri`: Specifies whether to use the upper ('U') or lower ('L') triangle of the Hermitian matrix.
    /// - `n`: The order of the matrix `A` (the number of rows and columns).
    /// - `alpha`: The scaling factor `α` (complex scalar).
    /// - `x`: A pointer to vector `X` (complex).
    /// - `inc_x`: The increment between elements in `X`. For example, if `inc_x = 7`, every 7th element of `X` is used.
    /// - `y`: A pointer to vector `Y` (complex).
    /// - `inc_y`: The increment between elements in `Y`. For example, if `inc_y = 7`, every 7th element of `Y` is used.
    /// - `a`: A pointer to Hermitian matrix `A` (complex), which will be updated in-place.
    /// - `lda`: The leading dimension of the matrix `A` (typically the number of rows).
    ///
    /// # Safety
    /// This function is `unsafe` as it involves raw pointers and does not perform bounds checking.
    #[link_name = "cblas_zher2"]
    pub fn herm_rank2_update(
        major: RowColMajor,              // Row or Column Major
        tri: UpOrLowTriangle,            // Upper or Lower triangle of Hermitian matrix
        n: c_int,                        // Order of matrix A
        alpha: *const Complex<c_double>, // Scaling factor (complex scalar)
        x: *const Complex<c_double>,     // Pointer to vector X (complex)
        inc_x: c_int,                    // Increment between elements in X
        y: *const Complex<c_double>,     // Pointer to vector Y (complex)
        inc_y: c_int,                    // Increment between elements in Y
        a: *mut Complex<c_double>,       // Pointer to Hermitian matrix A (complex)
        lda: c_int,                      // Leading dimension of matrix A
    );

    /// Rank-k update: multiplies a Hermitian matrix by its transpose and adds a second matrix.
    ///
    /// # Precision
    /// This function operates on single-precision `f64` complex numbers.
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `tri`: Specifies whether to use the upper ('U') or lower ('L') triangle of the Hermitian matrix.
    /// - `trans`: Specifies whether to use matrix `A` ('N') or the conjugate transpose of `A` ('C').
    /// - `n`: The order of matrix `C` (the number of rows and columns).
    /// - `k`: The number of columns in matrix `A` (or number of rows if matrix `A` is transposed).
    /// - `alpha`: The scaling factor for matrix `A`.
    /// - `a`: A pointer to matrix `A` (complex).
    /// - `lda`: The leading dimension of matrix `A`.
    /// - `beta`: The scaling factor for matrix `C`.
    /// - `c`: A pointer to matrix `C` (complex), which will be updated in-place.
    /// - `ldc`: The leading dimension of matrix `C`.
    ///
    /// # Safety
    /// This is an `unsafe` function as it involves raw pointers and does not perform bounds checking.
    #[link_name = "cblas_zherk"]
    pub fn herm_rank_k_update(
        major: RowColMajor,          // Row or Column Major
        tri: UpOrLowTriangle,        // Upper or Lower triangle of Hermitian matrix
        trans: TransposeMode,        // Transpose mode (None, Conjugate Transpose)
        n: c_int,                    // Order of matrix C
        k: c_int,                    // Number of columns of A (or rows if transposed)
        alpha: c_double,             // Scaling factor for A
        a: *const Complex<c_double>, // Pointer to matrix A (complex)
        lda: c_int,                  // Leading dimension of matrix A
        beta: c_double,              // Scaling factor for matrix C
        c: *mut Complex<c_double>,   // Pointer to matrix C (complex)
        ldc: c_int,                  // Leading dimension of matrix C
    );

    /// Performs a rank-2k update of a complex Hermitian matrix.
    ///
    /// # Precision
    /// This function operates on single-precision `f64` complex numbers.
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `tri`: Specifies whether to use the upper ('U') or lower ('L') triangle of the Hermitian matrix.
    /// - `trans`: Specifies whether to use matrix `A` ('N'), the transpose of `A` ('T'), or the conjugate transpose of `A` ('C').
    /// - `n`: The order of matrix `C` (the number of rows and columns).
    /// - `k`: The number of columns in matrices `A` and `B` (or rows if transposed).
    /// - `alpha`: The scaling factor for matrices `A` and `B`.
    /// - `a`: A pointer to matrix `A` (complex).
    /// - `lda`: The leading dimension of matrix `A`.
    /// - `b`: A pointer to matrix `B` (complex).
    /// - `ldb`: The leading dimension of matrix `B`.
    /// - `beta`: The scaling factor for matrix `C`.
    /// - `c`: A pointer to matrix `C` (complex), which will be updated in-place.
    /// - `ldc`: The leading dimension of matrix `C`.
    ///
    /// # Safety
    /// This is an `unsafe` function as it involves raw pointers and does not perform bounds checking.
    #[link_name = "cblas_zher2k"]
    pub fn herm_rank_2k_update(
        major: RowColMajor,              // Row or Column Major
        tri: UpOrLowTriangle,            // Upper or Lower triangle of Hermitian matrix
        trans: TransposeMode,            // Transpose mode (None, Transpose, Conjugate Transpose)
        n: c_int,                        // Order of matrix C
        k: c_int,                        // Number of columns of A and B (or rows if transposed)
        alpha: *const Complex<c_double>, // Pointer to the scaling factor for A and B
        a: *const Complex<c_double>,     // Pointer to matrix A (complex)
        lda: c_int,                      // Leading dimension of matrix A
        b: *const Complex<c_double>,     // Pointer to matrix B (complex)
        ldb: c_int,                      // Leading dimension of matrix B
        beta: c_double,                  // Scaling factor for matrix C
        c: *mut Complex<c_double>,       // Pointer to matrix C (complex)
        ldc: c_int,                      // Leading dimension of matrix C
    );

    /// Performs the operation y = alpha * A * x + beta * y, where A is a Hermitian matrix stored in packed format.
    ///
    /// # Precision
    /// This function operates on single-precision `f64` complex numbers.
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `tri`: Specifies whether to use the upper ('U') or lower ('L') triangle of the Hermitian matrix.
    /// - `n`: The order of matrix `A` and the number of elements in vectors `x` and `y`.
    /// - `alpha`: Scaling factor applied to the matrix `A`.
    /// - `ap`: A pointer to the Hermitian matrix `A` stored in packed format (complex).
    /// - `x`: A pointer to the vector `X` (complex).
    /// - `inc_x`: The increment between elements in `X`.
    /// - `beta`: Scaling factor applied to the vector `Y`.
    /// - `y`: A pointer to the vector `Y` (complex), which stores the result in-place.
    /// - `inc_y`: The increment between elements in `Y`.
    ///
    /// # Safety
    /// This is an `unsafe` function. The caller must ensure that the pointers passed to `ap`, `x`, and `y` are valid and within bounds.
    #[link_name = "cblas_zhpmv"]
    pub fn pack_herm_mat_vec_mul(
        major: RowColMajor,              // RowColMajor: Row or Column major data ordering
        tri: UpOrLowTriangle, // UpOrLowTriangle: Upper or Lower triangle of Hermitian matrix
        n: c_int,             // Number of rows/columns in matrix A
        alpha: *const Complex<c_double>, // Pointer to scaling factor for A (complex)
        ap: *const Complex<c_double>, // Pointer to packed Hermitian matrix A (complex)
        x: *const Complex<c_double>, // Pointer to vector X (complex)
        inc_x: c_int,         // Stride between elements in X
        beta: *const Complex<c_double>, // Pointer to scaling factor for Y (complex)
        y: *mut Complex<c_double>, // Pointer to vector Y (complex), result is stored in-place
        inc_y: c_int,         // Stride between elements in Y
    );

    /// Scales and multiplies a vector times its conjugate transpose, then adds a packed Hermitian matrix.
    ///
    /// # Precision
    /// This function operates on `Complex<f64>` numbers (single-precision complex).
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `tri`: Specifies whether to use the upper or lower triangle from the matrix. Valid values are `'U'` or `'L'`.
    /// - `n`: Order of matrix `A` and the number of elements in vector `X`.
    /// - `alpha`: Scaling factor that vector `X` is multiplied by.
    /// - `x`: Pointer to the vector `X`.
    /// - `inc_x`: Stride within `X`. For example, if `inc_x` is 7, every 7th element is used.
    /// - `ap`: Pointer to packed Hermitian matrix `A`, which is overwritten by the results on return.
    ///
    /// # Safety
    /// This function is unsafe as it deals with raw pointers and FFI.
    #[link_name = "cblas_zhpr"]
    pub fn pack_hermitian_rank1_update(
        major: RowColMajor,
        tri: UpOrLowTriangle,
        n: c_int,
        alpha: c_double,
        x: *const Complex<c_double>,
        inc_x: c_int,
        ap: *mut Complex<c_double>,
    );

    /// Multiplies a vector times the conjugate transpose of a second vector and vice-versa, sums the results, and adds a packed Hermitian matrix.
    ///
    /// # Precision
    /// This function operates on `Complex<f64>` numbers (single-precision complex).
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `tri`: Specifies whether to use the upper or lower triangle from the matrix. Valid values are `'U'` or `'L'`.
    /// - `n`: Order of matrix `A` and the number of elements in vectors `X` and `Y`.
    /// - `alpha`: Scaling factor that vector `X` is multiplied by.
    /// - `x`: Pointer to the vector `X`.
    /// - `inc_x`: Stride within `X`. For example, if `inc_x` is 7, every 7th element is used.
    /// - `y`: Pointer to the vector `Y`.
    /// - `inc_y`: Stride within `Y`. For example, if `inc_y` is 7, every 7th element is used.
    /// - `ap`: Pointer to packed Hermitian matrix `A`, which is overwritten by the results on return.
    ///
    /// # Safety
    /// This function is unsafe as it deals with raw pointers and FFI.
    #[link_name = "cblas_zhpr2"]
    pub fn pack_hermitian_rank2_update(
        major: RowColMajor,
        tri: UpOrLowTriangle,
        n: c_int,
        alpha: *const Complex<c_double>,
        x: *const Complex<c_double>,
        inc_x: c_int,
        y: *const Complex<c_double>,
        inc_y: c_int,
        ap: *mut Complex<c_double>,
    );

    /// Multiplies a matrix by a symmetric matrix (single-precision complex).
    ///
    /// # Precision
    /// This function operates on `Complex<f64>` (single-precision complex) numbers.
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `side`: Determines whether matrix `A` is on the left or right side of the multiplication (left or right of matrix `B`).
    /// - `tri`: Specifies whether to use the upper or lower triangle from the symmetric matrix `A`.
    /// - `m`: The number of rows in matrices `A` and `C`.
    /// - `n`: The number of columns in matrices `B` and `C`.
    /// - `alpha`: The scaling factor applied to the product of matrices `A` and `B`.
    /// - `a`: A pointer to the symmetric matrix `A`.
    /// - `lda`: The leading dimension of matrix `A`. It should be at least `m` (for column-major) or `n` (for row-major).
    /// - `b`: A pointer to matrix `B`.
    /// - `ldb`: The leading dimension of matrix `B`. It should be at least `m` (for column-major) or `n` (for row-major).
    /// - `beta`: The scaling factor applied to matrix `C`.
    /// - `c`: A pointer to the result matrix `C`.
    /// - `ldc`: The leading dimension of matrix `C`. It should be at least `m` (for column-major) or `n` (for row-major).
    ///
    /// # Safety
    /// This is an `unsafe` C function. The caller must ensure that the memory regions accessed by `A`, `B`, and `C` are valid and within bounds.
    ///
    /// # Discussion
    /// This function computes one of the following, depending on the value of `side`:
    /// - `C ← α * A * B + β * C` (if `side` is left),
    /// - `C ← α * B * A + β * C` (if `side` is right).
    #[link_name = "cblas_zsymm"]
    pub fn sym_mat_mul(
        major: RowColMajor,              // RowColMajor
        side: MultiplyOrder,             // MultiplyOrder
        tri: UpOrLowTriangle,            // UpOrLowTriangle
        m: c_int,                        // Number of rows in matrices A and C
        n: c_int,                        // Number of columns in matrices B and C
        alpha: *const Complex<c_double>, // Scaling factor for matrix A
        a: *const Complex<c_double>,     // Pointer to symmetric matrix A
        lda: c_int,                      // Leading dimension of matrix A
        b: *const Complex<c_double>,     // Pointer to matrix B
        ldb: c_int,                      // Leading dimension of matrix B
        beta: *const Complex<c_double>,  // Scaling factor for matrix C
        c: *mut Complex<c_double>,       // Pointer to matrix C (output)
        ldc: c_int,                      // Leading dimension of matrix C
    );

    /// Performs a rank-2k update of a symmetric matrix (single-precision complex).
    ///
    /// # Precision
    /// This function operates on `Complex<f64>` numbers (single-precision complex).
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `tri`: Specifies whether to use the upper or lower triangle from the matrix. Valid values are 'U' (upper) or 'L' (lower).
    /// - `trans`: Specifies whether to use matrix `A` ('N'), the transpose of `A` ('T'), or the conjugate transpose of `A` ('C').
    /// - `n`: The order of matrix `C` (number of rows and columns).
    /// - `k`: The number of columns in matrices `A` and `B` if `trans = 'N'`, or the number of rows if `trans = 'T'` or `trans = 'C'`.
    /// - `alpha`: The scaling factor applied to the product of matrices `A` and `B`.
    /// - `a`: A pointer to matrix `A`.
    /// - `lda`: The leading dimension of matrix `A`.
    /// - `b`: A pointer to matrix `B`.
    /// - `ldb`: The leading dimension of matrix `B`.
    /// - `beta`: The scaling factor applied to matrix `C`.
    /// - `c`: A pointer to the result matrix `C`, where the result is stored in place.
    /// - `ldc`: The leading dimension of matrix `C`.
    ///
    /// # Safety
    /// This is an `unsafe` C function. The caller must ensure that the memory regions accessed by `A`, `B`, and `C` are valid and within bounds.
    ///
    /// # Discussion
    /// This function computes:
    /// `C ← α * A * B^T + α * B * A^T + β * C`,
    /// where `A` and `B` are matrices, and `C` is a symmetric matrix.
    #[link_name = "cblas_zsyr2k"]
    pub fn sym_rank_2k_update(
        major: RowColMajor,              // RowColMajor
        tri: UpOrLowTriangle,            // UpOrLowTriangle
        trans: TransposeMode,            // TransposeMode
        n: c_int,                        // Order of matrix C
        k: c_int,                        // Number of columns (or rows) in matrices A and B
        alpha: *const Complex<c_double>, // Scaling factor for A and B
        a: *const Complex<c_double>,     // Pointer to matrix A
        lda: c_int,                      // Leading dimension of matrix A
        b: *const Complex<c_double>,     // Pointer to matrix B
        ldb: c_int,                      // Leading dimension of matrix B
        beta: *const Complex<c_double>,  // Scaling factor for matrix C
        c: *mut Complex<c_double>,       // Pointer to matrix C (output)
        ldc: c_int,                      // Leading dimension of matrix C
    );

    /// Performs a rank-k update of a symmetric matrix (single-precision complex).
    ///
    /// # Precision
    /// This function operates on `Complex<f64>` numbers (single-precision complex).
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `tri`: Specifies whether to use the upper or lower triangle from the matrix. Valid values are 'U' (upper) or 'L' (lower).
    /// - `trans`: Specifies whether to use matrix `A` ('N') or the transpose of `A` ('T').
    /// - `n`: The order of matrix `C` (number of rows and columns).
    /// - `k`: The number of columns in matrix `A` if `trans = 'N'`, or the number of rows if `trans = 'T'`.
    /// - `alpha`: The scaling factor applied to matrix `A`.
    /// - `a`: A pointer to matrix `A`.
    /// - `lda`: The leading dimension of matrix `A`.
    /// - `beta`: The scaling factor applied to matrix `C`.
    /// - `c`: A pointer to the result matrix `C`, where the result is stored in place.
    /// - `ldc`: The leading dimension of matrix `C`.
    ///
    /// # Safety
    /// This is an `unsafe` C function. The caller must ensure that the memory regions accessed by `A` and `C` are valid and within bounds.
    ///
    /// # Discussion
    /// This function computes:
    /// `C ← α * A * A^T + β * C` when `trans = 'N'`,
    /// or
    /// `C ← α * A^T * A + β * C` when `trans = 'T'`.
    #[link_name = "cblas_zsyrk"]
    pub fn sym_rank_k_update(
        major: RowColMajor,              // RowColMajor
        tri: UpOrLowTriangle,            // UpOrLowTriangle
        trans: TransposeMode,            // TransposeMode
        n: c_int,                        // Order of matrix C
        k: c_int,                        // Number of columns (or rows) in matrix A
        alpha: *const Complex<c_double>, // Scaling factor for matrix A
        a: *const Complex<c_double>,     // Pointer to matrix A
        lda: c_int,                      // Leading dimension of matrix A
        beta: *const Complex<c_double>,  // Scaling factor for matrix C
        c: *mut Complex<c_double>,       // Pointer to matrix C (output)
        ldc: c_int,                      // Leading dimension of matrix C
    );

    /// Scales a triangular band matrix, then multiplies it by a vector (single-precision complex).
    ///
    /// # Precision
    /// This function operates on `f64` complex numbers (single-precision).
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `tri`: Specifies whether to use the upper or lower triangle of the matrix. Valid values are 'U' (upper) or 'L' (lower).
    /// - `trans_a`: Specifies whether to use matrix `A` ('N') or the transpose of `A` ('T', 'C').
    /// - `diag`: Specifies whether the matrix is unit triangular ('U') or not ('N').
    /// - `n`: The order of matrix `A`.
    /// - `k`: The half-bandwidth of matrix `A`.
    /// - `a`: A pointer to the triangular band matrix `A` (stored as single-precision complex numbers).
    /// - `lda`: The leading dimension of the array containing matrix `A`. It must be at least `k + 1`.
    /// - `x`: A pointer to the vector `x`, which is modified on return.
    /// - `inc_x`: The increment (stride) between elements in `x`. For example, if `inc_x = 7`, every 7th element is used.
    ///
    /// # Safety
    /// This is an `unsafe` C function. The caller must ensure that the memory regions accessed by `A` and `x` are valid and within bounds.
    ///
    /// # Discussion
    /// This function computes the matrix-vector multiplication `A * x` for a triangular band matrix `A` and stores the result in vector `x`.
    #[link_name = "cblas_ztbmv"]
    pub fn tri_band_mat_vec_mul(
        major: RowColMajor,          // RowColMajor
        tri: UpOrLowTriangle,        // UpOrLowTriangle
        trans_a: TransposeMode,      // TransposeMode
        diag: IsDiagUnit,            // IsDiagUnit
        n: c_int,                    // Order of matrix A
        k: c_int,                    // Half-bandwidth of matrix A
        a: *const Complex<c_double>, // Pointer to complex matrix A
        lda: c_int,                  // Leading dimension of matrix A
        x: *mut Complex<c_double>,   // Pointer to vector x (input/output)
        inc_x: c_int,                // Stride within vector x
    );

    /// Solves a triangular banded system of equations, either `A * X = B` or `A^T * X = B`
    /// (or `A^H * X = B` for conjugate transpose), depending on the value of `trans_a`.
    ///
    /// # Precision
    /// This function operates on `f64` complex numbers (single-precision).
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `tri`: Specifies whether to use the upper or lower triangle of the matrix. Valid values are 'U' (upper) or 'L' (lower).
    /// - `trans_a`: Specifies whether to use matrix `A` as is ('N'), its transpose ('T'), or its conjugate transpose ('C').
    /// - `diag`: Specifies whether the matrix is unit triangular ('U') or not ('N').
    /// - `n`: The order of matrix `A` (i.e., the number of rows and columns).
    /// - `k`: The number of super-diagonals or  sub-diagonals of matrix `A`, depending on whether the upper ('U') or lower ('L') triangle is used.
    /// - `a`: A pointer to the triangular band matrix `A` (stored as single-precision complex numbers).
    /// - `lda`: The leading dimension of matrix `A`, must be at least `k + 1`.
    /// - `x`: On entry, contains the vector `B`. On return, this vector is overwritten with the solution vector `X`.
    /// - `inc_x`: The increment (stride) between elements in `x`. For example, if `inc_x = 7`, every 7th element is used.
    ///
    /// # Safety
    /// This is an `unsafe` C function. The caller must ensure that the memory regions accessed by `a` and `x` are valid and within bounds.
    ///
    /// # Discussion
    /// Solves the system of linear equations `A * X = B` or `A^T * X = B`, depending on the value of `trans_a`.
    #[link_name = "cblas_ztbsv"]
    pub fn tri_band_solve(
        major: RowColMajor,          // RowColMajor
        tri: UpOrLowTriangle,        // UpOrLowTriangle
        trans_a: TransposeMode,      // TransposeMode
        diag: IsDiagUnit,            // IsDiagUnit
        n: c_int,                    // Order of matrix A
        k: c_int,                    // Number of super-diagonals/ sub-diagonals in A
        a: *const Complex<c_double>, // Pointer to matrix A
        lda: c_int,                  // Leading dimension of matrix A
        x: *mut Complex<c_double>,   // Pointer to vector X (solution vector, modified in-place)
        inc_x: c_int,                // Stride within vector X
    );

    /// Multiplies a packed triangular matrix by a vector (single-precision complex).
    ///
    /// # Precision
    /// This function operates on single-precision complex numbers (`Complex<f64>`).
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `tri`: Specifies whether to use the upper or lower triangle of the matrix. Valid values are `'U'` (upper) or `'L'` (lower).
    /// - `trans_a`: Specifies whether to use matrix `A` as is (`'N'`), its transpose (`'T'`), or its conjugate transpose (`'C'`).
    /// - `diag`: Specifies whether the matrix is unit triangular (`'U'`) or not (`'N'`).
    /// - `n`: The order of matrix `A` and the number of elements in vectors `x`.
    /// - `ap`: Pointer to the packed triangular matrix `A` (stored in single-precision complex numbers).
    /// - `x`: Pointer to the input/output vector `X`. On return, this vector contains the result.
    /// - `inc_x`: The increment (stride) between elements in `x`. For example, if `inc_x = 7`, every 7th element is used.
    ///
    /// # Safety
    /// This is an `unsafe` C function. The caller must ensure that the memory regions accessed by `ap` and `x` are valid and within bounds.
    ///
    /// # Discussion
    /// Computes `A * x`, `A^T * x`, or `conjg(A^T) * x`, depending on the value of `trans_a`, and stores the result in `x`.
    #[link_name = "cblas_ztpmv"]
    pub fn pack_tri_mat_vec_mul(
        major: RowColMajor,           // RowColMajor
        tri: UpOrLowTriangle,         // UpOrLowTriangle
        trans_a: TransposeMode,       // TransposeMode
        diag: IsDiagUnit,             // IsDiagUnit
        n: c_int,                     // Order of matrix A and number of elements in x
        ap: *const Complex<c_double>, // Pointer to packed triangular matrix A
        x: *mut Complex<c_double>,    // Pointer to vector x (output)
        inc_x: c_int,                 // Stride within vector x
    );

    /// Solves a packed triangular system of equations (single-precision complex).
    ///
    /// # Precision
    /// This function operates on single-precision complex numbers (`Complex<f64>`).
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `tri`: Specifies whether to use the upper or lower triangle of the matrix. Valid values are `'U'` (upper) or `'L'` (lower).
    /// - `trans_a`: Specifies whether to use matrix `A` as is (`'N'`), its transpose (`'T'`), or its conjugate transpose (`'C'`).
    /// - `diag`: Specifies whether the matrix is unit triangular (`'U'`) or not (`'N'`).
    /// - `n`: The order of matrix `A` and the number of elements in vectors `x`.
    /// - `ap`: Pointer to the packed triangular matrix `A` (stored as single-precision complex numbers).
    /// - `x`: On entry, contains vector `B`. On return, this vector contains the solution vector `X`.
    /// - `inc_x`: The increment (stride) between elements in `x`. For example, if `inc_x = 7`, every 7th element is used.
    ///
    /// # Safety
    /// This is an `unsafe` C function. The caller must ensure that the memory regions accessed by `ap` and `x` are valid and within bounds.
    ///
    /// # Discussion
    /// Solves the system of equations `A * X = B` or `A' * X = B`, depending on the value of `trans_a`.
    /// The packed storage format is used for matrix `A`.
    #[link_name = "cblas_ztpsv"]
    pub fn pack_tri_solve(
        major: RowColMajor,           // RowColMajor
        tri: UpOrLowTriangle,         // UpOrLowTriangle
        trans_a: TransposeMode,       // TransposeMode
        diag: IsDiagUnit,             // IsDiagUnit
        n: c_int,                     // Order of matrix A and number of elements in x
        ap: *const Complex<c_double>, // Pointer to packed triangular matrix A
        x: *mut Complex<c_double>,    // Pointer to vector x (input/output)
        inc_x: c_int,                 // Stride within vector x
    );

    /// Scales a triangular matrix and multiplies it by a matrix (single-precision complex).
    ///
    /// # Precision
    /// This function operates on single-precision complex numbers (`Complex<f64>`).
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `side`: Specifies whether matrix `A` appears on the left or right in the multiplication.
    /// - `tri`: Specifies whether to use the upper or lower triangle of matrix `A`. Valid values are `'U'` (upper) or `'L'` (lower).
    /// - `trans_a`: Specifies whether to use matrix `A` as is (`'N'`), its transpose (`'T'`), or its conjugate transpose (`'C'`).
    /// - `diag`: Specifies whether matrix `A` is unit triangular (`'U'`) or not (`'N'`).
    /// - `m`: The number of rows in matrix `B`.
    /// - `n`: The number of columns in matrix `B`.
    /// - `alpha`: The scaling factor applied to matrix `A`.
    /// - `a`: Pointer to the triangular matrix `A` (stored as single-precision complex numbers).
    /// - `lda`: The leading dimension of array containing matrix `A`.
    /// - `b`: Pointer to the matrix `B`. On return, contains the result of the matrix multiplication.
    /// - `ldb`: The leading dimension of array containing matrix `B`.
    ///
    /// # Safety
    /// This is an `unsafe` C function. The caller must ensure that the memory regions accessed by `a` and `b` are valid and within bounds.
    ///
    /// # Discussion
    /// If `side` is `'L'`, the function computes `alpha * A * B` or `alpha * A' * B`, depending on `trans_a`.
    /// If `side` is `'R'`, it computes `alpha * B * A` or `alpha * B * A'`, depending on `trans_a`.
    /// In either case, the result is stored in matrix `B`.
    #[link_name = "cblas_ztrmm"]
    pub fn tri_mat_mul(
        major: RowColMajor,              // RowColMajor
        side: MultiplyOrder,             // MultiplyOrder
        tri: UpOrLowTriangle,            // UpOrLowTriangle
        trans_a: TransposeMode,          // TransposeMode
        diag: IsDiagUnit,                // IsDiagUnit
        m: c_int,                        // Number of rows in matrix B
        n: c_int,                        // Number of columns in matrix B
        alpha: *const Complex<c_double>, // Scaling factor for matrix A
        a: *const Complex<c_double>,     // Pointer to triangular matrix A
        lda: c_int,                      // Leading dimension of matrix A
        b: *mut Complex<c_double>,       // Pointer to matrix B (output)
        ldb: c_int,                      // Leading dimension of matrix B
    );

    /// Multiplies a triangular matrix by a vector (single-precision complex).
    ///
    /// # Precision
    /// This function operates on single-precision complex numbers (`Complex<f64>`).
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `tri`: Specifies whether to use the upper or lower triangle of matrix `A`. Valid values are `'U'` (upper) or `'L'` (lower).
    /// - `trans_a`: Specifies whether to use matrix `A` as is (`'N'`), its transpose (`'T'`), or its conjugate transpose (`'C'`).
    /// - `diag`: Specifies whether matrix `A` is unit triangular (`'U'`) or not (`'N'`).
    /// - `n`: The order of matrix `A`.
    /// - `a`: Pointer to the triangular matrix `A` (stored as single-precision complex numbers).
    /// - `lda`: The leading dimension of array containing matrix `A`.
    /// - `x`: Pointer to the vector `X`, modified in place on return.
    /// - `inc_x`: The increment (stride) between elements in `X`. For example, if `inc_x = 7`, every 7th element is used.
    ///
    /// # Safety
    /// This is an `unsafe` C function. The caller must ensure that the memory regions accessed by `a` and `x` are valid and within bounds.
    ///
    /// # Discussion
    /// Computes `A * X` or `A' * X`, depending on the value of `trans_a`. The result is stored in the input vector `X`.
    #[link_name = "cblas_ztrmv"]
    pub fn tri_mat_vec_mul(
        major: RowColMajor,          // RowColMajor
        tri: UpOrLowTriangle,        // UpOrLowTriangle
        trans_a: TransposeMode,      // TransposeMode
        diag: IsDiagUnit,            // IsDiagUnit
        n: c_int,                    // Order of matrix A
        a: *const Complex<c_double>, // Pointer to triangular matrix A
        lda: c_int,                  // Leading dimension of matrix A
        x: *mut Complex<c_double>,   // Pointer to vector X (input/output)
        inc_x: c_int,                // Increment between elements in X
    );

    /// Solves a triangular system of equations with multiple right-hand side vectors (single-precision complex).
    ///
    /// # Precision
    /// This function operates on single-precision complex numbers (`Complex<f64>`).
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `side`: Determines whether matrix `A` is on the left or right side in the system of equations. Use `MultiplyOrder`.
    /// - `tri`: Specifies whether to use the upper or lower triangle of matrix `A`. Valid values are `'U'` (upper) or `'L'` (lower).
    /// - `trans_a`: Specifies whether to use matrix `A` as is (`'N'`), its transpose (`'T'`), or its conjugate transpose (`'C'`).
    /// - `diag`: Specifies whether matrix `A` is unit triangular (`'U'`) or not (`'N'`).
    /// - `m`: The number of rows in matrix `B`.
    /// - `n`: The number of columns in matrix `B`.
    /// - `alpha`: Scaling factor for matrix `A`.
    /// - `a`: Pointer to the triangular matrix `A` (stored as single-precision complex numbers).
    /// - `lda`: The leading dimension of array containing matrix `A`.
    /// - `b`: Pointer to matrix `B` (input/output). On entry, contains matrix `B`, and on return, contains the solution matrix `X`.
    /// - `ldb`: The leading dimension of matrix `B`.
    ///
    /// # Safety
    /// This is an `unsafe` C function. The caller must ensure that the memory regions accessed by `a` and `b` are valid and within bounds.
    ///
    /// # Discussion
    /// Solves the system of equations `A * X = alpha * B` (if `side` is 'L') or `X * A = alpha * B` (if `side` is 'R'), depending on the value of `trans_a`. The result is stored in matrix `B`.
    #[link_name = "cblas_ztrsm"]
    pub fn tri_solve_multiple(
        major: RowColMajor,              // RowColMajor
        side: MultiplyOrder,             // MultiplyOrder (Left or Right)
        tri: UpOrLowTriangle,            // UpOrLowTriangle
        trans_a: TransposeMode,          // TransposeMode
        diag: IsDiagUnit,                // IsDiagUnit
        m: c_int,                        // Number of rows in matrix B
        n: c_int,                        // Number of columns in matrix B
        alpha: *const Complex<c_double>, // Scaling factor for matrix A
        a: *const Complex<c_double>,     // Pointer to triangular matrix A
        lda: c_int,                      // Leading dimension of matrix A
        b: *mut Complex<c_double>,       // Pointer to matrix B (input/output, stores the solution)
        ldb: c_int,                      // Leading dimension of matrix B
    );

    /// Solves a triangular system of equations with a single right-hand side vector (single-precision complex).
    ///
    /// # Precision
    /// This function operates on single-precision complex numbers (`Complex<f64>`).
    ///
    /// # Parameters
    /// - `major`: Specifies row-major (C) or column-major (Fortran) data ordering.
    /// - `tri`: Specifies whether to use the upper or lower triangle of matrix `A`. Use `'U'` for upper, `'L'` for lower.
    /// - `trans_a`: Specifies whether to use matrix `A` as is (`'N'`), its transpose (`'T'`), or its conjugate transpose (`'C'`).
    /// - `diag`: Specifies whether matrix `A` is unit triangular (`'U'` for unit triangular, `'N'` for non-unit).
    /// - `n`: The order of matrix `A`.
    /// - `a`: Pointer to the triangular matrix `A` (stored as single-precision complex numbers).
    /// - `lda`: The leading dimension of matrix `A`.
    /// - `x`: Pointer to the vector `X` (input/output). On entry, contains vector `B`, and on return, contains the solution vector `X`.
    /// - `inc_x`: The stride between elements in `X`. For example, if `inc_x = 7`, every 7th element is used.
    ///
    /// # Safety
    /// This is an `unsafe` C function. The caller must ensure that the memory regions accessed by `a` and `x` are valid.
    ///
    /// # Discussion
    /// Solves the system of equations `A * x = b` or `A' * x = b`, where `A` is a triangular matrix and `b` is a vector. The result is stored in vector `X`.
    #[link_name = "cblas_ztrsv"]
    pub fn tri_solve(
        major: RowColMajor,          // RowColMajor
        tri: UpOrLowTriangle,        // UpOrLowTriangle
        trans_a: TransposeMode,      // TransposeMode
        diag: IsDiagUnit,            // IsDiagUnit
        n: c_int,                    // Order of matrix A
        a: *const Complex<c_double>, // Pointer to triangular matrix A
        lda: c_int,                  // Leading dimension of matrix A
        x: *mut Complex<c_double>,   // Pointer to vector X (input/output)
        inc_x: c_int,                // Stride within vector X
    );
}