File size: 57,135 Bytes
3e5595b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994

// =================================================================================================
// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This
// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max-
// width of 100 characters per line.
//
// Author(s):
//   Cedric Nugteren <www.cedricnugteren.nl>
//
// This file contains the Netlib CBLAS interface to the CLBlast BLAS routines, performing all buffer
// copies automatically and running on the default OpenCL platform and device. For full control over
// performance, it is advised to use the regular clblast.h or clblast_c.h headers instead.
//
// =================================================================================================

#ifndef CLBLAST_CLBLAST_NETLIB_C_H_
#define CLBLAST_CLBLAST_NETLIB_C_H_

// Exports library functions under Windows when building a DLL. See also:
// https://msdn.microsoft.com/en-us/library/a90k134d.aspx
#if defined(_WIN32) && defined(CLBLAST_DLL)
  #if defined(COMPILING_DLL)
    #define PUBLIC_API __declspec(dllexport)
  #else
    #define PUBLIC_API __declspec(dllimport)
  #endif
#else
  #define PUBLIC_API
#endif

// The C interface
#ifdef __cplusplus
extern "C" {
#endif

// =================================================================================================

// Matrix layout and transpose types
typedef enum CLBlastLayout_ { CLBlastLayoutRowMajor = 101,
                              CLBlastLayoutColMajor = 102 } CLBlastLayout;
typedef enum CLBlastTranspose_ { CLBlastTransposeNo = 111, CLBlastTransposeYes = 112,
                                 CLBlastTransposeConjugate = 113 } CLBlastTranspose;
typedef enum CLBlastTriangle_ { CLBlastTriangleUpper = 121,
                                CLBlastTriangleLower = 122 } CLBlastTriangle;
typedef enum CLBlastDiagonal_ { CLBlastDiagonalNonUnit = 131,
                                CLBlastDiagonalUnit = 132 } CLBlastDiagonal;
typedef enum CLBlastSide_ { CLBlastSideLeft = 141, CLBlastSideRight = 142 } CLBlastSide;
typedef enum CLBlastKernelMode_ { CLBlastKernelModeCrossCorrelation = 141, CLBlastKernelModeConvolution = 152 } CLBlastKernelMode;

// For full compatibility with CBLAS
typedef CLBlastLayout CBLAS_ORDER;
typedef CLBlastTranspose CBLAS_TRANSPOSE;
typedef CLBlastTriangle CBLAS_UPLO;
typedef CLBlastDiagonal CBLAS_DIAG;
typedef CLBlastSide CBLAS_SIDE;
#define CblasRowMajor CLBlastLayoutRowMajor
#define CblasColMajor CLBlastLayoutColMajor
#define CblasNoTrans CLBlastTransposeNo
#define CblasTrans CLBlastTransposeYes
#define CblasConjTrans CLBlastTransposeConjugate
#define CblasUpper CLBlastTriangleUpper
#define CblasLower CLBlastTriangleLower
#define CblasNonUnit CLBlastDiagonalNonUnit
#define CblasUnit CLBlastDiagonalUnit
#define CblasLeft CLBlastSideLeft
#define CblasRight CLBlastSideRight

// =================================================================================================
// BLAS level-1 (vector-vector) routines
// =================================================================================================

// Generate givens plane rotation: SROTG/DROTG
void PUBLIC_API cblas_srotg(float* sa,
                            float* sb,
                            float* sc,
                            float* ss);
void PUBLIC_API cblas_drotg(double* sa,
                            double* sb,
                            double* sc,
                            double* ss);

// Generate modified givens plane rotation: SROTMG/DROTMG
void PUBLIC_API cblas_srotmg(float* sd1,
                             float* sd2,
                             float* sx1,
                             const float sy1,
                             float* sparam);
void PUBLIC_API cblas_drotmg(double* sd1,
                             double* sd2,
                             double* sx1,
                             const double sy1,
                             double* sparam);

// Apply givens plane rotation: SROT/DROT
void PUBLIC_API cblas_srot(const int n,
                           float* x, const int x_inc,
                           float* y, const int y_inc,
                           const float cos,
                           const float sin);
void PUBLIC_API cblas_drot(const int n,
                           double* x, const int x_inc,
                           double* y, const int y_inc,
                           const double cos,
                           const double sin);

// Apply modified givens plane rotation: SROTM/DROTM
void PUBLIC_API cblas_srotm(const int n,
                            float* x, const int x_inc,
                            float* y, const int y_inc,
                            float* sparam);
void PUBLIC_API cblas_drotm(const int n,
                            double* x, const int x_inc,
                            double* y, const int y_inc,
                            double* sparam);

// Swap two vectors: SSWAP/DSWAP/CSWAP/ZSWAP/HSWAP
void PUBLIC_API cblas_sswap(const int n,
                            float* x, const int x_inc,
                            float* y, const int y_inc);
void PUBLIC_API cblas_dswap(const int n,
                            double* x, const int x_inc,
                            double* y, const int y_inc);
void PUBLIC_API cblas_cswap(const int n,
                            void* x, const int x_inc,
                            void* y, const int y_inc);
void PUBLIC_API cblas_zswap(const int n,
                            void* x, const int x_inc,
                            void* y, const int y_inc);

// Vector scaling: SSCAL/DSCAL/CSCAL/ZSCAL/HSCAL
void PUBLIC_API cblas_sscal(const int n,
                            const float alpha,
                            float* x, const int x_inc);
void PUBLIC_API cblas_dscal(const int n,
                            const double alpha,
                            double* x, const int x_inc);
void PUBLIC_API cblas_cscal(const int n,
                            const void* alpha,
                            void* x, const int x_inc);
void PUBLIC_API cblas_zscal(const int n,
                            const void* alpha,
                            void* x, const int x_inc);

// Vector copy: SCOPY/DCOPY/CCOPY/ZCOPY/HCOPY
void PUBLIC_API cblas_scopy(const int n,
                            const float* x, const int x_inc,
                            float* y, const int y_inc);
void PUBLIC_API cblas_dcopy(const int n,
                            const double* x, const int x_inc,
                            double* y, const int y_inc);
void PUBLIC_API cblas_ccopy(const int n,
                            const void* x, const int x_inc,
                            void* y, const int y_inc);
void PUBLIC_API cblas_zcopy(const int n,
                            const void* x, const int x_inc,
                            void* y, const int y_inc);

// Vector-times-constant plus vector: SAXPY/DAXPY/CAXPY/ZAXPY/HAXPY
void PUBLIC_API cblas_saxpy(const int n,
                            const float alpha,
                            const float* x, const int x_inc,
                            float* y, const int y_inc);
void PUBLIC_API cblas_daxpy(const int n,
                            const double alpha,
                            const double* x, const int x_inc,
                            double* y, const int y_inc);
void PUBLIC_API cblas_caxpy(const int n,
                            const void* alpha,
                            const void* x, const int x_inc,
                            void* y, const int y_inc);
void PUBLIC_API cblas_zaxpy(const int n,
                            const void* alpha,
                            const void* x, const int x_inc,
                            void* y, const int y_inc);

// Dot product of two vectors: SDOT/DDOT/HDOT
float PUBLIC_API cblas_sdot(const int n,
                            const float* x, const int x_inc,
                            const float* y, const int y_inc);
double PUBLIC_API cblas_ddot(const int n,
                             const double* x, const int x_inc,
                             const double* y, const int y_inc);

// Dot product of two complex vectors: CDOTU/ZDOTU
void PUBLIC_API cblas_cdotu_sub(const int n,
                                const void* x, const int x_inc,
                                const void* y, const int y_inc,
                                void* dot);
void PUBLIC_API cblas_zdotu_sub(const int n,
                                const void* x, const int x_inc,
                                const void* y, const int y_inc,
                                void* dot);

// Dot product of two complex vectors, one conjugated: CDOTC/ZDOTC
void PUBLIC_API cblas_cdotc_sub(const int n,
                                const void* x, const int x_inc,
                                const void* y, const int y_inc,
                                void* dot);
void PUBLIC_API cblas_zdotc_sub(const int n,
                                const void* x, const int x_inc,
                                const void* y, const int y_inc,
                                void* dot);

// Euclidian norm of a vector: SNRM2/DNRM2/ScNRM2/DzNRM2/HNRM2
float PUBLIC_API cblas_snrm2(const int n,
                             const float* x, const int x_inc);
double PUBLIC_API cblas_dnrm2(const int n,
                              const double* x, const int x_inc);
float PUBLIC_API cblas_scnrm2(const int n,
                             const void* x, const int x_inc);
double PUBLIC_API cblas_dznrm2(const int n,
                              const void* x, const int x_inc);

// Absolute sum of values in a vector: SASUM/DASUM/ScASUM/DzASUM/HASUM
float PUBLIC_API cblas_sasum(const int n,
                             const float* x, const int x_inc);
double PUBLIC_API cblas_dasum(const int n,
                              const double* x, const int x_inc);
float PUBLIC_API cblas_scasum(const int n,
                             const void* x, const int x_inc);
double PUBLIC_API cblas_dzasum(const int n,
                              const void* x, const int x_inc);

// Sum of values in a vector (non-BLAS function): SSUM/DSUM/ScSUM/DzSUM/HSUM
float PUBLIC_API cblas_ssum(const int n,
                            const float* x, const int x_inc);
double PUBLIC_API cblas_dsum(const int n,
                             const double* x, const int x_inc);
float PUBLIC_API cblas_scsum(const int n,
                            const void* x, const int x_inc);
double PUBLIC_API cblas_dzsum(const int n,
                             const void* x, const int x_inc);

// Index of absolute maximum value in a vector: iSAMAX/iDAMAX/iCAMAX/iZAMAX/iHAMAX
int PUBLIC_API cblas_isamax(const int n,
                           const float* x, const int x_inc);
int PUBLIC_API cblas_idamax(const int n,
                           const double* x, const int x_inc);
int PUBLIC_API cblas_icamax(const int n,
                           const void* x, const int x_inc);
int PUBLIC_API cblas_izamax(const int n,
                           const void* x, const int x_inc);

// Index of absolute minimum value in a vector (non-BLAS function): iSAMIN/iDAMIN/iCAMIN/iZAMIN/iHAMIN
int PUBLIC_API cblas_isamin(const int n,
                           const float* x, const int x_inc);
int PUBLIC_API cblas_idamin(const int n,
                           const double* x, const int x_inc);
int PUBLIC_API cblas_icamin(const int n,
                           const void* x, const int x_inc);
int PUBLIC_API cblas_izamin(const int n,
                           const void* x, const int x_inc);

// Index of maximum value in a vector (non-BLAS function): iSMAX/iDMAX/iCMAX/iZMAX/iHMAX
int PUBLIC_API cblas_ismax(const int n,
                          const float* x, const int x_inc);
int PUBLIC_API cblas_idmax(const int n,
                          const double* x, const int x_inc);
int PUBLIC_API cblas_icmax(const int n,
                          const void* x, const int x_inc);
int PUBLIC_API cblas_izmax(const int n,
                          const void* x, const int x_inc);

// Index of minimum value in a vector (non-BLAS function): iSMIN/iDMIN/iCMIN/iZMIN/iHMIN
int PUBLIC_API cblas_ismin(const int n,
                          const float* x, const int x_inc);
int PUBLIC_API cblas_idmin(const int n,
                          const double* x, const int x_inc);
int PUBLIC_API cblas_icmin(const int n,
                          const void* x, const int x_inc);
int PUBLIC_API cblas_izmin(const int n,
                          const void* x, const int x_inc);

// =================================================================================================
// BLAS level-2 (matrix-vector) routines
// =================================================================================================

// General matrix-vector multiplication: SGEMV/DGEMV/CGEMV/ZGEMV/HGEMV
void PUBLIC_API cblas_sgemv(const CLBlastLayout layout, const CLBlastTranspose a_transpose,
                            const int m, const int n,
                            const float alpha,
                            const float* a, const int a_ld,
                            const float* x, const int x_inc,
                            const float beta,
                            float* y, const int y_inc);
void PUBLIC_API cblas_dgemv(const CLBlastLayout layout, const CLBlastTranspose a_transpose,
                            const int m, const int n,
                            const double alpha,
                            const double* a, const int a_ld,
                            const double* x, const int x_inc,
                            const double beta,
                            double* y, const int y_inc);
void PUBLIC_API cblas_cgemv(const CLBlastLayout layout, const CLBlastTranspose a_transpose,
                            const int m, const int n,
                            const void* alpha,
                            const void* a, const int a_ld,
                            const void* x, const int x_inc,
                            const void* beta,
                            void* y, const int y_inc);
void PUBLIC_API cblas_zgemv(const CLBlastLayout layout, const CLBlastTranspose a_transpose,
                            const int m, const int n,
                            const void* alpha,
                            const void* a, const int a_ld,
                            const void* x, const int x_inc,
                            const void* beta,
                            void* y, const int y_inc);

// General banded matrix-vector multiplication: SGBMV/DGBMV/CGBMV/ZGBMV/HGBMV
void PUBLIC_API cblas_sgbmv(const CLBlastLayout layout, const CLBlastTranspose a_transpose,
                            const int m, const int n, const int kl, const int ku,
                            const float alpha,
                            const float* a, const int a_ld,
                            const float* x, const int x_inc,
                            const float beta,
                            float* y, const int y_inc);
void PUBLIC_API cblas_dgbmv(const CLBlastLayout layout, const CLBlastTranspose a_transpose,
                            const int m, const int n, const int kl, const int ku,
                            const double alpha,
                            const double* a, const int a_ld,
                            const double* x, const int x_inc,
                            const double beta,
                            double* y, const int y_inc);
void PUBLIC_API cblas_cgbmv(const CLBlastLayout layout, const CLBlastTranspose a_transpose,
                            const int m, const int n, const int kl, const int ku,
                            const void* alpha,
                            const void* a, const int a_ld,
                            const void* x, const int x_inc,
                            const void* beta,
                            void* y, const int y_inc);
void PUBLIC_API cblas_zgbmv(const CLBlastLayout layout, const CLBlastTranspose a_transpose,
                            const int m, const int n, const int kl, const int ku,
                            const void* alpha,
                            const void* a, const int a_ld,
                            const void* x, const int x_inc,
                            const void* beta,
                            void* y, const int y_inc);

// Hermitian matrix-vector multiplication: CHEMV/ZHEMV
void PUBLIC_API cblas_chemv(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n,
                            const void* alpha,
                            const void* a, const int a_ld,
                            const void* x, const int x_inc,
                            const void* beta,
                            void* y, const int y_inc);
void PUBLIC_API cblas_zhemv(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n,
                            const void* alpha,
                            const void* a, const int a_ld,
                            const void* x, const int x_inc,
                            const void* beta,
                            void* y, const int y_inc);

// Hermitian banded matrix-vector multiplication: CHBMV/ZHBMV
void PUBLIC_API cblas_chbmv(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n, const int k,
                            const void* alpha,
                            const void* a, const int a_ld,
                            const void* x, const int x_inc,
                            const void* beta,
                            void* y, const int y_inc);
void PUBLIC_API cblas_zhbmv(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n, const int k,
                            const void* alpha,
                            const void* a, const int a_ld,
                            const void* x, const int x_inc,
                            const void* beta,
                            void* y, const int y_inc);

// Hermitian packed matrix-vector multiplication: CHPMV/ZHPMV
void PUBLIC_API cblas_chpmv(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n,
                            const void* alpha,
                            const void* ap,
                            const void* x, const int x_inc,
                            const void* beta,
                            void* y, const int y_inc);
void PUBLIC_API cblas_zhpmv(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n,
                            const void* alpha,
                            const void* ap,
                            const void* x, const int x_inc,
                            const void* beta,
                            void* y, const int y_inc);

// Symmetric matrix-vector multiplication: SSYMV/DSYMV/HSYMV
void PUBLIC_API cblas_ssymv(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n,
                            const float alpha,
                            const float* a, const int a_ld,
                            const float* x, const int x_inc,
                            const float beta,
                            float* y, const int y_inc);
void PUBLIC_API cblas_dsymv(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n,
                            const double alpha,
                            const double* a, const int a_ld,
                            const double* x, const int x_inc,
                            const double beta,
                            double* y, const int y_inc);

// Symmetric banded matrix-vector multiplication: SSBMV/DSBMV/HSBMV
void PUBLIC_API cblas_ssbmv(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n, const int k,
                            const float alpha,
                            const float* a, const int a_ld,
                            const float* x, const int x_inc,
                            const float beta,
                            float* y, const int y_inc);
void PUBLIC_API cblas_dsbmv(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n, const int k,
                            const double alpha,
                            const double* a, const int a_ld,
                            const double* x, const int x_inc,
                            const double beta,
                            double* y, const int y_inc);

// Symmetric packed matrix-vector multiplication: SSPMV/DSPMV/HSPMV
void PUBLIC_API cblas_sspmv(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n,
                            const float alpha,
                            const float* ap,
                            const float* x, const int x_inc,
                            const float beta,
                            float* y, const int y_inc);
void PUBLIC_API cblas_dspmv(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n,
                            const double alpha,
                            const double* ap,
                            const double* x, const int x_inc,
                            const double beta,
                            double* y, const int y_inc);

// Triangular matrix-vector multiplication: STRMV/DTRMV/CTRMV/ZTRMV/HTRMV
void PUBLIC_API cblas_strmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n,
                            const float* a, const int a_ld,
                            float* x, const int x_inc);
void PUBLIC_API cblas_dtrmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n,
                            const double* a, const int a_ld,
                            double* x, const int x_inc);
void PUBLIC_API cblas_ctrmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n,
                            const void* a, const int a_ld,
                            void* x, const int x_inc);
void PUBLIC_API cblas_ztrmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n,
                            const void* a, const int a_ld,
                            void* x, const int x_inc);

// Triangular banded matrix-vector multiplication: STBMV/DTBMV/CTBMV/ZTBMV/HTBMV
void PUBLIC_API cblas_stbmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n, const int k,
                            const float* a, const int a_ld,
                            float* x, const int x_inc);
void PUBLIC_API cblas_dtbmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n, const int k,
                            const double* a, const int a_ld,
                            double* x, const int x_inc);
void PUBLIC_API cblas_ctbmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n, const int k,
                            const void* a, const int a_ld,
                            void* x, const int x_inc);
void PUBLIC_API cblas_ztbmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n, const int k,
                            const void* a, const int a_ld,
                            void* x, const int x_inc);

// Triangular packed matrix-vector multiplication: STPMV/DTPMV/CTPMV/ZTPMV/HTPMV
void PUBLIC_API cblas_stpmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n,
                            const float* ap,
                            float* x, const int x_inc);
void PUBLIC_API cblas_dtpmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n,
                            const double* ap,
                            double* x, const int x_inc);
void PUBLIC_API cblas_ctpmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n,
                            const void* ap,
                            void* x, const int x_inc);
void PUBLIC_API cblas_ztpmv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n,
                            const void* ap,
                            void* x, const int x_inc);

// Solves a triangular system of equations: STRSV/DTRSV/CTRSV/ZTRSV
void PUBLIC_API cblas_strsv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n,
                            const float* a, const int a_ld,
                            float* x, const int x_inc);
void PUBLIC_API cblas_dtrsv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n,
                            const double* a, const int a_ld,
                            double* x, const int x_inc);
void PUBLIC_API cblas_ctrsv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n,
                            const void* a, const int a_ld,
                            void* x, const int x_inc);
void PUBLIC_API cblas_ztrsv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n,
                            const void* a, const int a_ld,
                            void* x, const int x_inc);

// Solves a banded triangular system of equations: STBSV/DTBSV/CTBSV/ZTBSV
void PUBLIC_API cblas_stbsv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n, const int k,
                            const float* a, const int a_ld,
                            float* x, const int x_inc);
void PUBLIC_API cblas_dtbsv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n, const int k,
                            const double* a, const int a_ld,
                            double* x, const int x_inc);
void PUBLIC_API cblas_ctbsv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n, const int k,
                            const void* a, const int a_ld,
                            void* x, const int x_inc);
void PUBLIC_API cblas_ztbsv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n, const int k,
                            const void* a, const int a_ld,
                            void* x, const int x_inc);

// Solves a packed triangular system of equations: STPSV/DTPSV/CTPSV/ZTPSV
void PUBLIC_API cblas_stpsv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n,
                            const float* ap,
                            float* x, const int x_inc);
void PUBLIC_API cblas_dtpsv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n,
                            const double* ap,
                            double* x, const int x_inc);
void PUBLIC_API cblas_ctpsv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n,
                            const void* ap,
                            void* x, const int x_inc);
void PUBLIC_API cblas_ztpsv(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int n,
                            const void* ap,
                            void* x, const int x_inc);

// General rank-1 matrix update: SGER/DGER/HGER
void PUBLIC_API cblas_sger(const CLBlastLayout layout,
                           const int m, const int n,
                           const float alpha,
                           const float* x, const int x_inc,
                           const float* y, const int y_inc,
                           float* a, const int a_ld);
void PUBLIC_API cblas_dger(const CLBlastLayout layout,
                           const int m, const int n,
                           const double alpha,
                           const double* x, const int x_inc,
                           const double* y, const int y_inc,
                           double* a, const int a_ld);

// General rank-1 complex matrix update: CGERU/ZGERU
void PUBLIC_API cblas_cgeru(const CLBlastLayout layout,
                            const int m, const int n,
                            const void* alpha,
                            const void* x, const int x_inc,
                            const void* y, const int y_inc,
                            void* a, const int a_ld);
void PUBLIC_API cblas_zgeru(const CLBlastLayout layout,
                            const int m, const int n,
                            const void* alpha,
                            const void* x, const int x_inc,
                            const void* y, const int y_inc,
                            void* a, const int a_ld);

// General rank-1 complex conjugated matrix update: CGERC/ZGERC
void PUBLIC_API cblas_cgerc(const CLBlastLayout layout,
                            const int m, const int n,
                            const void* alpha,
                            const void* x, const int x_inc,
                            const void* y, const int y_inc,
                            void* a, const int a_ld);
void PUBLIC_API cblas_zgerc(const CLBlastLayout layout,
                            const int m, const int n,
                            const void* alpha,
                            const void* x, const int x_inc,
                            const void* y, const int y_inc,
                            void* a, const int a_ld);

// Hermitian rank-1 matrix update: CHER/ZHER
void PUBLIC_API cblas_cher(const CLBlastLayout layout, const CLBlastTriangle triangle,
                           const int n,
                           const float alpha,
                           const void* x, const int x_inc,
                           void* a, const int a_ld);
void PUBLIC_API cblas_zher(const CLBlastLayout layout, const CLBlastTriangle triangle,
                           const int n,
                           const double alpha,
                           const void* x, const int x_inc,
                           void* a, const int a_ld);

// Hermitian packed rank-1 matrix update: CHPR/ZHPR
void PUBLIC_API cblas_chpr(const CLBlastLayout layout, const CLBlastTriangle triangle,
                           const int n,
                           const float alpha,
                           const void* x, const int x_inc,
                           void* ap);
void PUBLIC_API cblas_zhpr(const CLBlastLayout layout, const CLBlastTriangle triangle,
                           const int n,
                           const double alpha,
                           const void* x, const int x_inc,
                           void* ap);

// Hermitian rank-2 matrix update: CHER2/ZHER2
void PUBLIC_API cblas_cher2(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n,
                            const void* alpha,
                            const void* x, const int x_inc,
                            const void* y, const int y_inc,
                            void* a, const int a_ld);
void PUBLIC_API cblas_zher2(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n,
                            const void* alpha,
                            const void* x, const int x_inc,
                            const void* y, const int y_inc,
                            void* a, const int a_ld);

// Hermitian packed rank-2 matrix update: CHPR2/ZHPR2
void PUBLIC_API cblas_chpr2(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n,
                            const void* alpha,
                            const void* x, const int x_inc,
                            const void* y, const int y_inc,
                            void* ap);
void PUBLIC_API cblas_zhpr2(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n,
                            const void* alpha,
                            const void* x, const int x_inc,
                            const void* y, const int y_inc,
                            void* ap);

// Symmetric rank-1 matrix update: SSYR/DSYR/HSYR
void PUBLIC_API cblas_ssyr(const CLBlastLayout layout, const CLBlastTriangle triangle,
                           const int n,
                           const float alpha,
                           const float* x, const int x_inc,
                           float* a, const int a_ld);
void PUBLIC_API cblas_dsyr(const CLBlastLayout layout, const CLBlastTriangle triangle,
                           const int n,
                           const double alpha,
                           const double* x, const int x_inc,
                           double* a, const int a_ld);

// Symmetric packed rank-1 matrix update: SSPR/DSPR/HSPR
void PUBLIC_API cblas_sspr(const CLBlastLayout layout, const CLBlastTriangle triangle,
                           const int n,
                           const float alpha,
                           const float* x, const int x_inc,
                           float* ap);
void PUBLIC_API cblas_dspr(const CLBlastLayout layout, const CLBlastTriangle triangle,
                           const int n,
                           const double alpha,
                           const double* x, const int x_inc,
                           double* ap);

// Symmetric rank-2 matrix update: SSYR2/DSYR2/HSYR2
void PUBLIC_API cblas_ssyr2(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n,
                            const float alpha,
                            const float* x, const int x_inc,
                            const float* y, const int y_inc,
                            float* a, const int a_ld);
void PUBLIC_API cblas_dsyr2(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n,
                            const double alpha,
                            const double* x, const int x_inc,
                            const double* y, const int y_inc,
                            double* a, const int a_ld);

// Symmetric packed rank-2 matrix update: SSPR2/DSPR2/HSPR2
void PUBLIC_API cblas_sspr2(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n,
                            const float alpha,
                            const float* x, const int x_inc,
                            const float* y, const int y_inc,
                            float* ap);
void PUBLIC_API cblas_dspr2(const CLBlastLayout layout, const CLBlastTriangle triangle,
                            const int n,
                            const double alpha,
                            const double* x, const int x_inc,
                            const double* y, const int y_inc,
                            double* ap);

// =================================================================================================
// BLAS level-3 (matrix-matrix) routines
// =================================================================================================

// General matrix-matrix multiplication: SGEMM/DGEMM/CGEMM/ZGEMM/HGEMM
void PUBLIC_API cblas_sgemm(const CLBlastLayout layout, const CLBlastTranspose a_transpose, const CLBlastTranspose b_transpose,
                            const int m, const int n, const int k,
                            const float alpha,
                            const float* a, const int a_ld,
                            const float* b, const int b_ld,
                            const float beta,
                            float* c, const int c_ld);
void PUBLIC_API cblas_dgemm(const CLBlastLayout layout, const CLBlastTranspose a_transpose, const CLBlastTranspose b_transpose,
                            const int m, const int n, const int k,
                            const double alpha,
                            const double* a, const int a_ld,
                            const double* b, const int b_ld,
                            const double beta,
                            double* c, const int c_ld);
void PUBLIC_API cblas_cgemm(const CLBlastLayout layout, const CLBlastTranspose a_transpose, const CLBlastTranspose b_transpose,
                            const int m, const int n, const int k,
                            const void* alpha,
                            const void* a, const int a_ld,
                            const void* b, const int b_ld,
                            const void* beta,
                            void* c, const int c_ld);
void PUBLIC_API cblas_zgemm(const CLBlastLayout layout, const CLBlastTranspose a_transpose, const CLBlastTranspose b_transpose,
                            const int m, const int n, const int k,
                            const void* alpha,
                            const void* a, const int a_ld,
                            const void* b, const int b_ld,
                            const void* beta,
                            void* c, const int c_ld);

// Symmetric matrix-matrix multiplication: SSYMM/DSYMM/CSYMM/ZSYMM/HSYMM
void PUBLIC_API cblas_ssymm(const CLBlastLayout layout, const CLBlastSide side, const CLBlastTriangle triangle,
                            const int m, const int n,
                            const float alpha,
                            const float* a, const int a_ld,
                            const float* b, const int b_ld,
                            const float beta,
                            float* c, const int c_ld);
void PUBLIC_API cblas_dsymm(const CLBlastLayout layout, const CLBlastSide side, const CLBlastTriangle triangle,
                            const int m, const int n,
                            const double alpha,
                            const double* a, const int a_ld,
                            const double* b, const int b_ld,
                            const double beta,
                            double* c, const int c_ld);
void PUBLIC_API cblas_csymm(const CLBlastLayout layout, const CLBlastSide side, const CLBlastTriangle triangle,
                            const int m, const int n,
                            const void* alpha,
                            const void* a, const int a_ld,
                            const void* b, const int b_ld,
                            const void* beta,
                            void* c, const int c_ld);
void PUBLIC_API cblas_zsymm(const CLBlastLayout layout, const CLBlastSide side, const CLBlastTriangle triangle,
                            const int m, const int n,
                            const void* alpha,
                            const void* a, const int a_ld,
                            const void* b, const int b_ld,
                            const void* beta,
                            void* c, const int c_ld);

// Hermitian matrix-matrix multiplication: CHEMM/ZHEMM
void PUBLIC_API cblas_chemm(const CLBlastLayout layout, const CLBlastSide side, const CLBlastTriangle triangle,
                            const int m, const int n,
                            const void* alpha,
                            const void* a, const int a_ld,
                            const void* b, const int b_ld,
                            const void* beta,
                            void* c, const int c_ld);
void PUBLIC_API cblas_zhemm(const CLBlastLayout layout, const CLBlastSide side, const CLBlastTriangle triangle,
                            const int m, const int n,
                            const void* alpha,
                            const void* a, const int a_ld,
                            const void* b, const int b_ld,
                            const void* beta,
                            void* c, const int c_ld);

// Rank-K update of a symmetric matrix: SSYRK/DSYRK/CSYRK/ZSYRK/HSYRK
void PUBLIC_API cblas_ssyrk(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose,
                            const int n, const int k,
                            const float alpha,
                            const float* a, const int a_ld,
                            const float beta,
                            float* c, const int c_ld);
void PUBLIC_API cblas_dsyrk(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose,
                            const int n, const int k,
                            const double alpha,
                            const double* a, const int a_ld,
                            const double beta,
                            double* c, const int c_ld);
void PUBLIC_API cblas_csyrk(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose,
                            const int n, const int k,
                            const void* alpha,
                            const void* a, const int a_ld,
                            const void* beta,
                            void* c, const int c_ld);
void PUBLIC_API cblas_zsyrk(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose,
                            const int n, const int k,
                            const void* alpha,
                            const void* a, const int a_ld,
                            const void* beta,
                            void* c, const int c_ld);

// Rank-K update of a hermitian matrix: CHERK/ZHERK
void PUBLIC_API cblas_cherk(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose,
                            const int n, const int k,
                            const float alpha,
                            const void* a, const int a_ld,
                            const float beta,
                            void* c, const int c_ld);
void PUBLIC_API cblas_zherk(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose,
                            const int n, const int k,
                            const double alpha,
                            const void* a, const int a_ld,
                            const double beta,
                            void* c, const int c_ld);

// Rank-2K update of a symmetric matrix: SSYR2K/DSYR2K/CSYR2K/ZSYR2K/HSYR2K
void PUBLIC_API cblas_ssyr2k(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose ab_transpose,
                             const int n, const int k,
                             const float alpha,
                             const float* a, const int a_ld,
                             const float* b, const int b_ld,
                             const float beta,
                             float* c, const int c_ld);
void PUBLIC_API cblas_dsyr2k(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose ab_transpose,
                             const int n, const int k,
                             const double alpha,
                             const double* a, const int a_ld,
                             const double* b, const int b_ld,
                             const double beta,
                             double* c, const int c_ld);
void PUBLIC_API cblas_csyr2k(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose ab_transpose,
                             const int n, const int k,
                             const void* alpha,
                             const void* a, const int a_ld,
                             const void* b, const int b_ld,
                             const void* beta,
                             void* c, const int c_ld);
void PUBLIC_API cblas_zsyr2k(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose ab_transpose,
                             const int n, const int k,
                             const void* alpha,
                             const void* a, const int a_ld,
                             const void* b, const int b_ld,
                             const void* beta,
                             void* c, const int c_ld);

// Rank-2K update of a hermitian matrix: CHER2K/ZHER2K
void PUBLIC_API cblas_cher2k(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose ab_transpose,
                             const int n, const int k,
                             const void* alpha,
                             const void* a, const int a_ld,
                             const void* b, const int b_ld,
                             const float beta,
                             void* c, const int c_ld);
void PUBLIC_API cblas_zher2k(const CLBlastLayout layout, const CLBlastTriangle triangle, const CLBlastTranspose ab_transpose,
                             const int n, const int k,
                             const void* alpha,
                             const void* a, const int a_ld,
                             const void* b, const int b_ld,
                             const double beta,
                             void* c, const int c_ld);

// Triangular matrix-matrix multiplication: STRMM/DTRMM/CTRMM/ZTRMM/HTRMM
void PUBLIC_API cblas_strmm(const CLBlastLayout layout, const CLBlastSide side, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int m, const int n,
                            const float alpha,
                            const float* a, const int a_ld,
                            float* b, const int b_ld);
void PUBLIC_API cblas_dtrmm(const CLBlastLayout layout, const CLBlastSide side, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int m, const int n,
                            const double alpha,
                            const double* a, const int a_ld,
                            double* b, const int b_ld);
void PUBLIC_API cblas_ctrmm(const CLBlastLayout layout, const CLBlastSide side, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int m, const int n,
                            const void* alpha,
                            const void* a, const int a_ld,
                            void* b, const int b_ld);
void PUBLIC_API cblas_ztrmm(const CLBlastLayout layout, const CLBlastSide side, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int m, const int n,
                            const void* alpha,
                            const void* a, const int a_ld,
                            void* b, const int b_ld);

// Solves a triangular system of equations: STRSM/DTRSM/CTRSM/ZTRSM
void PUBLIC_API cblas_strsm(const CLBlastLayout layout, const CLBlastSide side, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int m, const int n,
                            const float alpha,
                            const float* a, const int a_ld,
                            float* b, const int b_ld);
void PUBLIC_API cblas_dtrsm(const CLBlastLayout layout, const CLBlastSide side, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int m, const int n,
                            const double alpha,
                            const double* a, const int a_ld,
                            double* b, const int b_ld);
void PUBLIC_API cblas_ctrsm(const CLBlastLayout layout, const CLBlastSide side, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int m, const int n,
                            const void* alpha,
                            const void* a, const int a_ld,
                            void* b, const int b_ld);
void PUBLIC_API cblas_ztrsm(const CLBlastLayout layout, const CLBlastSide side, const CLBlastTriangle triangle, const CLBlastTranspose a_transpose, const CLBlastDiagonal diagonal,
                            const int m, const int n,
                            const void* alpha,
                            const void* a, const int a_ld,
                            void* b, const int b_ld);

// =================================================================================================
// Extra non-BLAS routines (level-X)
// =================================================================================================

// Element-wise vector product (Hadamard): SHAD/DHAD/CHAD/ZHAD/HHAD
void PUBLIC_API cblas_shad(const int n,
                           const float alpha,
                           const float* x, const int x_inc,
                           const float* y, const int y_inc,
                           const float beta,
                           float* z, const int z_inc);
void PUBLIC_API cblas_dhad(const int n,
                           const double alpha,
                           const double* x, const int x_inc,
                           const double* y, const int y_inc,
                           const double beta,
                           double* z, const int z_inc);
void PUBLIC_API cblas_chad(const int n,
                           const void* alpha,
                           const void* x, const int x_inc,
                           const void* y, const int y_inc,
                           const void* beta,
                           void* z, const int z_inc);
void PUBLIC_API cblas_zhad(const int n,
                           const void* alpha,
                           const void* x, const int x_inc,
                           const void* y, const int y_inc,
                           const void* beta,
                           void* z, const int z_inc);

// Scaling and out-place transpose/copy (non-BLAS function): SOMATCOPY/DOMATCOPY/COMATCOPY/ZOMATCOPY/HOMATCOPY
void PUBLIC_API cblas_somatcopy(const CLBlastLayout layout, const CLBlastTranspose a_transpose,
                                const int m, const int n,
                                const float alpha,
                                const float* a, const int a_ld,
                                float* b, const int b_ld);
void PUBLIC_API cblas_domatcopy(const CLBlastLayout layout, const CLBlastTranspose a_transpose,
                                const int m, const int n,
                                const double alpha,
                                const double* a, const int a_ld,
                                double* b, const int b_ld);
void PUBLIC_API cblas_comatcopy(const CLBlastLayout layout, const CLBlastTranspose a_transpose,
                                const int m, const int n,
                                const void* alpha,
                                const void* a, const int a_ld,
                                void* b, const int b_ld);
void PUBLIC_API cblas_zomatcopy(const CLBlastLayout layout, const CLBlastTranspose a_transpose,
                                const int m, const int n,
                                const void* alpha,
                                const void* a, const int a_ld,
                                void* b, const int b_ld);

// Im2col function (non-BLAS function): SIM2COL/DIM2COL/CIM2COL/ZIM2COL/HIM2COL
void PUBLIC_API cblas_sim2col(const CLBlastKernelMode kernel_mode,
                              const int channels, const int height, const int width, const int kernel_h, const int kernel_w, const int pad_h, const int pad_w, const int stride_h, const int stride_w, const int dilation_h, const int dilation_w,
                              const float* im,
                              float* col);
void PUBLIC_API cblas_dim2col(const CLBlastKernelMode kernel_mode,
                              const int channels, const int height, const int width, const int kernel_h, const int kernel_w, const int pad_h, const int pad_w, const int stride_h, const int stride_w, const int dilation_h, const int dilation_w,
                              const double* im,
                              double* col);
void PUBLIC_API cblas_cim2col(const CLBlastKernelMode kernel_mode,
                              const int channels, const int height, const int width, const int kernel_h, const int kernel_w, const int pad_h, const int pad_w, const int stride_h, const int stride_w, const int dilation_h, const int dilation_w,
                              const void* im,
                              void* col);
void PUBLIC_API cblas_zim2col(const CLBlastKernelMode kernel_mode,
                              const int channels, const int height, const int width, const int kernel_h, const int kernel_w, const int pad_h, const int pad_w, const int stride_h, const int stride_w, const int dilation_h, const int dilation_w,
                              const void* im,
                              void* col);

// Col2im function (non-BLAS function): SCOL2IM/DCOL2IM/CCOL2IM/ZCOL2IM/HCOL2IM
void PUBLIC_API cblas_scol2im(const CLBlastKernelMode kernel_mode,
                              const int channels, const int height, const int width, const int kernel_h, const int kernel_w, const int pad_h, const int pad_w, const int stride_h, const int stride_w, const int dilation_h, const int dilation_w,
                              const float* col,
                              float* im);
void PUBLIC_API cblas_dcol2im(const CLBlastKernelMode kernel_mode,
                              const int channels, const int height, const int width, const int kernel_h, const int kernel_w, const int pad_h, const int pad_w, const int stride_h, const int stride_w, const int dilation_h, const int dilation_w,
                              const double* col,
                              double* im);
void PUBLIC_API cblas_ccol2im(const CLBlastKernelMode kernel_mode,
                              const int channels, const int height, const int width, const int kernel_h, const int kernel_w, const int pad_h, const int pad_w, const int stride_h, const int stride_w, const int dilation_h, const int dilation_w,
                              const void* col,
                              void* im);
void PUBLIC_API cblas_zcol2im(const CLBlastKernelMode kernel_mode,
                              const int channels, const int height, const int width, const int kernel_h, const int kernel_w, const int pad_h, const int pad_w, const int stride_h, const int stride_w, const int dilation_h, const int dilation_w,
                              const void* col,
                              void* im);

// =================================================================================================

#ifdef __cplusplus
} // extern "C"
#endif

// CLBLAST_CLBLAST_NETLIB_C_H_
#endif