summaryrefslogtreecommitdiff
path: root/kaldi_io/src/tools/ATLAS/include/atlas_f77wrap.h
blob: db6099ccf3d3ff8762a3fa0ba2c2c73a8be88561 (plain) (blame)
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
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
/* ---------------------------------------------------------------------
 *
 * -- Automatically Tuned Linear Algebra Software (ATLAS)
 *    (C) Copyright 2000 All Rights Reserved
 *
 * -- ATLAS routine -- Version 3.2 -- December 25, 2000
 *
 * Author         : Antoine P. Petitet
 * Originally developed at the University of Tennessee,
 * Innovative Computing Laboratory, Knoxville TN, 37996-1301, USA.
 *
 * ---------------------------------------------------------------------
 *
 * -- Copyright notice and Licensing terms:
 *
 *  Redistribution  and  use in  source and binary forms, with or without
 *  modification, are  permitted provided  that the following  conditions
 *  are met:
 *
 * 1. Redistributions  of  source  code  must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce  the above copyright
 *    notice,  this list of conditions, and the  following disclaimer in
 *    the documentation and/or other materials provided with the distri-
 *    bution.
 * 3. The name of the University,  the ATLAS group,  or the names of its
 *    contributors  may not be used to endorse or promote products deri-
 *    ved from this software without specific written permission.
 *
 * -- Disclaimer:
 *
 * THIS  SOFTWARE  IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,  INCLUDING,  BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,  INDIRECT, INCIDENTAL, SPE-
 * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 * TO,  PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEO-
 * RY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  (IN-
 * CLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * ---------------------------------------------------------------------
 */
#ifndef ATLAS_F77WRAP_H
#define ATLAS_F77WRAP_H
/*
 * =====================================================================
 * Include Files
 * =====================================================================
 */
#include "atlas_misc.h"
#include "atlas_f77.h"
/*
 * =====================================================================
 * Multi-threaded/reference implementation function names re-definition
 * =====================================================================
 *
 * Uncomment the following definition macros to call the  multi-threaded
 * implementation or define those macros at compile time.
 *
 * #define USE_L1_PTHREADS
 * #define USE_L2_PTHREADS
 * #define USE_L3_PTHREADS
 *
 * Uncomment  the following definition  macros to call the reference im-
 * plementation or define those macros at compile time.
 *
 * #define USE_L1_REFERENCE
 * #define USE_L2_REFERENCE
 * #define USE_L3_REFERENCE
 *
 * =====================================================================
 */

#ifdef ATL_USEPTHREADS
#define USE_L3_PTHREADS
#endif

/*
 * =====================================================================
 * ATLAS Levels 1, 2 and 3 Prototypes
 * =====================================================================
 */
#if   defined( USE_L1_PTHREADS  )
#include "atlas_ptalias1.h"
#include "atlas_ptlevel1.h"
#elif defined( USE_L1_REFERENCE )
#include "atlas_refalias1.h"
#include "atlas_reflevel1.h"
#else
#include "atlas_level1.h"
#endif

#if   defined( USE_L2_PTHREADS  )
#include "atlas_ptalias2.h"
#include "atlas_ptlevel2.h"
#elif defined( USE_L2_REFERENCE )
#include "atlas_refalias2.h"
#include "atlas_reflevel2.h"
#else
#include "atlas_level2.h"
#endif

#if   defined( USE_L3_PTHREADS  )
#include "atlas_ptalias3.h"
#include "atlas_ptlevel3.h"
#elif defined( USE_L3_REFERENCE )
#include "atlas_refalias3.h"
#include "atlas_reflevel3.h"
#else
#include "atlas_level3.h"
#endif
/*
 * =====================================================================
 * #define macro constants
 * =====================================================================
 */
#define  PATLF77WRAP         Mjoin( ATL_F77wrap_, PRE )

#ifdef TREAL
#define  ATLPUF77WRAP        Mjoin( ATL_F77wrap_, PRE )
#define  ATLUPF77WRAP        Mjoin( ATL_F77wrap_, PRE )
#else
#define  ATLPUF77WRAP        Mjoin( Mjoin( ATL_F77wrap_, PRE ), UPR )
#define  ATLUPF77WRAP        Mjoin( Mjoin( ATL_F77wrap_, UPR ), PRE )
#endif

#define  F77_INOTRAN         111
#define  F77_ITRAN           112
#define  F77_ICOTRAN         113

#define  F77_IUPPER          121
#define  F77_ILOWER          122

#define  F77_INONUNIT        131
#define  F77_IUNIT           132

#define  F77_ILEFT           141
#define  F77_IRIGHT          142
/*
 * =====================================================================
 * #define macro functions
 * =====================================================================
 */
#ifdef TREAL
#define    V1N( n_, x_, incx_ )   \
                          ( (*n_) > 0 ? (x_)+(1-(*n_))*(*incx_) : (x_) )
#define    VN1( n_, x_, incx_ )   \
                          ( (*n_) > 0 ? (x_)+((*n_)-1)*(*incx_) : (x_) )
#define    W1N( n_, x_, incx_ )   \
                          ( (*incx_) < 0 ? V1N( n_, x_, incx_ ) : (x_) )
#else
#define    V1N( n_, x_, incx_ )   \
             ( (*n_) > 0 ? (x_)+( ( (1-(*n_))*(*incx_) ) << 1 ) : (x_) )
#define    VN1( n_, x_, incx_ )   \
             ( (*n_) > 0 ? (x_)+( ( ((*n_)-1)*(*incx_) ) << 1 ) : (x_) )
#define    W1N( n_, x_, incx_ )   \
                          ( (*incx_) < 0 ? V1N( n_, x_, incx_ ) : (x_) )
#endif
/*
 * =====================================================================
 * FORTRAN <-> C interface
 * =====================================================================
 *
 * These macros identifies how these wrappers will be called as follows:
 *
 * Add_:      the FORTRAN compiler expects the name of C functions to be
 * in all lower case and to have an underscore postfixed it (Suns, Intel
 * compilers expect this).
 *
 * NoChange:  the FORTRAN compiler expects the name of C functions to be
 * in all lower case (IBM RS6K compilers do this).
 *
 * UpCase:    the FORTRAN compiler expects the name of C functions to be
 * in all upcase. (Cray compilers expect this).
 *
 * Add__:     the FORTRAN compiler in use is f2c, a FORTRAN to C conver-
 * ter.
 */
#if defined( Add_ )
/*
 * These defines  set  up  the  naming scheme required to have a FORTRAN
 * routine calling a C routine.
 *
 *    FORTRAN CALL                          C declaration
 *    CALL ATL_F77WRAP_SGEMM(...)           void atl_f77wrap_sgemm_(...)
 *
 * This is the default.
 */
#if   defined( SREAL )

#define    ATL_F77wrap_srotg   atl_f77wrap_srotg_
#define    ATL_F77wrap_srotmg  atl_f77wrap_srotmg_
#define    ATL_F77wrap_snrm2   atl_f77wrap_snrm2_
#define    ATL_F77wrap_sasum   atl_f77wrap_sasum_
#define    ATL_F77wrap_sscal   atl_f77wrap_sscal_
#define    ATL_F77wrap_isamax  atl_f77wrap_isamax_
#define    ATL_F77wrap_saxpy   atl_f77wrap_saxpy_
#define    ATL_F77wrap_scopy   atl_f77wrap_scopy_
#define    ATL_F77wrap_sswap   atl_f77wrap_sswap_
#define    ATL_F77wrap_srot    atl_f77wrap_srot_
#define    ATL_F77wrap_srotm   atl_f77wrap_srotm_
#define    ATL_F77wrap_sdot    atl_f77wrap_sdot_
#define    ATL_F77wrap_dsdot   atl_f77wrap_dsdot_
#define    ATL_F77wrap_sdsdot  atl_f77wrap_sdsdot_

#define    ATL_F77wrap_sgbmv   atl_f77wrap_sgbmv_
#define    ATL_F77wrap_sgemv   atl_f77wrap_sgemv_
#define    ATL_F77wrap_sger    atl_f77wrap_sger_
#define    ATL_F77wrap_ssbmv   atl_f77wrap_ssbmv_
#define    ATL_F77wrap_sspmv   atl_f77wrap_sspmv_
#define    ATL_F77wrap_ssymv   atl_f77wrap_ssymv_
#define    ATL_F77wrap_sspr    atl_f77wrap_sspr_
#define    ATL_F77wrap_ssyr    atl_f77wrap_ssyr_
#define    ATL_F77wrap_sspr2   atl_f77wrap_sspr2_
#define    ATL_F77wrap_ssyr2   atl_f77wrap_ssyr2_
#define    ATL_F77wrap_stbmv   atl_f77wrap_stbmv_
#define    ATL_F77wrap_stpmv   atl_f77wrap_stpmv_
#define    ATL_F77wrap_strmv   atl_f77wrap_strmv_
#define    ATL_F77wrap_stbsv   atl_f77wrap_stbsv_
#define    ATL_F77wrap_stpsv   atl_f77wrap_stpsv_
#define    ATL_F77wrap_strsv   atl_f77wrap_strsv_

#define    ATL_F77wrap_sgemm   atl_f77wrap_sgemm_
#define    ATL_F77wrap_ssymm   atl_f77wrap_ssymm_
#define    ATL_F77wrap_ssyrk   atl_f77wrap_ssyrk_
#define    ATL_F77wrap_ssyr2k  atl_f77wrap_ssyr2k_
#define    ATL_F77wrap_strmm   atl_f77wrap_strmm_
#define    ATL_F77wrap_strsm   atl_f77wrap_strsm_

#elif defined( DREAL )

#define    ATL_F77wrap_drotg   atl_f77wrap_drotg_
#define    ATL_F77wrap_drotmg  atl_f77wrap_drotmg_
#define    ATL_F77wrap_dnrm2   atl_f77wrap_dnrm2_
#define    ATL_F77wrap_dasum   atl_f77wrap_dasum_
#define    ATL_F77wrap_dscal   atl_f77wrap_dscal_
#define    ATL_F77wrap_idamax  atl_f77wrap_idamax_
#define    ATL_F77wrap_daxpy   atl_f77wrap_daxpy_
#define    ATL_F77wrap_dcopy   atl_f77wrap_dcopy_
#define    ATL_F77wrap_dswap   atl_f77wrap_dswap_
#define    ATL_F77wrap_drot    atl_f77wrap_drot_
#define    ATL_F77wrap_drotm   atl_f77wrap_drotm_
#define    ATL_F77wrap_ddot    atl_f77wrap_ddot_

#define    ATL_F77wrap_dgbmv   atl_f77wrap_dgbmv_
#define    ATL_F77wrap_dgemv   atl_f77wrap_dgemv_
#define    ATL_F77wrap_dger    atl_f77wrap_dger_
#define    ATL_F77wrap_dsbmv   atl_f77wrap_dsbmv_
#define    ATL_F77wrap_dspmv   atl_f77wrap_dspmv_
#define    ATL_F77wrap_dsymv   atl_f77wrap_dsymv_
#define    ATL_F77wrap_dspr    atl_f77wrap_dspr_
#define    ATL_F77wrap_dsyr    atl_f77wrap_dsyr_
#define    ATL_F77wrap_dspr2   atl_f77wrap_dspr2_
#define    ATL_F77wrap_dsyr2   atl_f77wrap_dsyr2_
#define    ATL_F77wrap_dtbmv   atl_f77wrap_dtbmv_
#define    ATL_F77wrap_dtpmv   atl_f77wrap_dtpmv_
#define    ATL_F77wrap_dtrmv   atl_f77wrap_dtrmv_
#define    ATL_F77wrap_dtbsv   atl_f77wrap_dtbsv_
#define    ATL_F77wrap_dtpsv   atl_f77wrap_dtpsv_
#define    ATL_F77wrap_dtrsv   atl_f77wrap_dtrsv_

#define    ATL_F77wrap_dgemm   atl_f77wrap_dgemm_
#define    ATL_F77wrap_dsymm   atl_f77wrap_dsymm_
#define    ATL_F77wrap_dsyrk   atl_f77wrap_dsyrk_
#define    ATL_F77wrap_dsyr2k  atl_f77wrap_dsyr2k_
#define    ATL_F77wrap_dtrmm   atl_f77wrap_dtrmm_
#define    ATL_F77wrap_dtrsm   atl_f77wrap_dtrsm_

#elif defined( SCPLX )

#define    ATL_F77wrap_crotg   atl_f77wrap_crotg_
#define    ATL_F77wrap_scnrm2  atl_f77wrap_scnrm2_
#define    ATL_F77wrap_scasum  atl_f77wrap_scasum_
#define    ATL_F77wrap_cscal   atl_f77wrap_cscal_
#define    ATL_F77wrap_csscal  atl_f77wrap_csscal_
#define    ATL_F77wrap_icamax  atl_f77wrap_icamax_
#define    ATL_F77wrap_caxpy   atl_f77wrap_caxpy_
#define    ATL_F77wrap_ccopy   atl_f77wrap_ccopy_
#define    ATL_F77wrap_cswap   atl_f77wrap_cswap_
#define    ATL_F77wrap_csrot   atl_f77wrap_csrot_
#define    ATL_F77wrap_cdotc   atl_f77wrap_cdotc_
#define    ATL_F77wrap_cdotu   atl_f77wrap_cdotu_

#define    ATL_F77wrap_cgbmv   atl_f77wrap_cgbmv_
#define    ATL_F77wrap_cgemv   atl_f77wrap_cgemv_
#define    ATL_F77wrap_cgerc   atl_f77wrap_cgerc_
#define    ATL_F77wrap_cgeru   atl_f77wrap_cgeru_
#define    ATL_F77wrap_chbmv   atl_f77wrap_chbmv_
#define    ATL_F77wrap_chpmv   atl_f77wrap_chpmv_
#define    ATL_F77wrap_chemv   atl_f77wrap_chemv_
#define    ATL_F77wrap_chpr    atl_f77wrap_chpr_
#define    ATL_F77wrap_cher    atl_f77wrap_cher_
#define    ATL_F77wrap_chpr2   atl_f77wrap_chpr2_
#define    ATL_F77wrap_cher2   atl_f77wrap_cher2_
#define    ATL_F77wrap_ctbmv   atl_f77wrap_ctbmv_
#define    ATL_F77wrap_ctpmv   atl_f77wrap_ctpmv_
#define    ATL_F77wrap_ctrmv   atl_f77wrap_ctrmv_
#define    ATL_F77wrap_ctbsv   atl_f77wrap_ctbsv_
#define    ATL_F77wrap_ctpsv   atl_f77wrap_ctpsv_
#define    ATL_F77wrap_ctrsv   atl_f77wrap_ctrsv_

#define    ATL_F77wrap_cgemm   atl_f77wrap_cgemm_
#define    ATL_F77wrap_chemm   atl_f77wrap_chemm_
#define    ATL_F77wrap_cherk   atl_f77wrap_cherk_
#define    ATL_F77wrap_cher2k  atl_f77wrap_cher2k_
#define    ATL_F77wrap_csymm   atl_f77wrap_csymm_
#define    ATL_F77wrap_csyrk   atl_f77wrap_csyrk_
#define    ATL_F77wrap_csyr2k  atl_f77wrap_csyr2k_
#define    ATL_F77wrap_ctrmm   atl_f77wrap_ctrmm_
#define    ATL_F77wrap_ctrsm   atl_f77wrap_ctrsm_

#elif defined( DCPLX )

#define    ATL_F77wrap_zrotg   atl_f77wrap_zrotg_
#define    ATL_F77wrap_dznrm2  atl_f77wrap_dznrm2_
#define    ATL_F77wrap_dzasum  atl_f77wrap_dzasum_
#define    ATL_F77wrap_zscal   atl_f77wrap_zscal_
#define    ATL_F77wrap_zdscal  atl_f77wrap_zdscal_
#define    ATL_F77wrap_izamax  atl_f77wrap_izamax_
#define    ATL_F77wrap_zaxpy   atl_f77wrap_zaxpy_
#define    ATL_F77wrap_zcopy   atl_f77wrap_zcopy_
#define    ATL_F77wrap_zswap   atl_f77wrap_zswap_
#define    ATL_F77wrap_zdrot   atl_f77wrap_zdrot_
#define    ATL_F77wrap_zdotc   atl_f77wrap_zdotc_
#define    ATL_F77wrap_zdotu   atl_f77wrap_zdotu_

#define    ATL_F77wrap_zgbmv   atl_f77wrap_zgbmv_
#define    ATL_F77wrap_zgemv   atl_f77wrap_zgemv_
#define    ATL_F77wrap_zgerc   atl_f77wrap_zgerc_
#define    ATL_F77wrap_zgeru   atl_f77wrap_zgeru_
#define    ATL_F77wrap_zhbmv   atl_f77wrap_zhbmv_
#define    ATL_F77wrap_zhpmv   atl_f77wrap_zhpmv_
#define    ATL_F77wrap_zhemv   atl_f77wrap_zhemv_
#define    ATL_F77wrap_zhpr    atl_f77wrap_zhpr_
#define    ATL_F77wrap_zher    atl_f77wrap_zher_
#define    ATL_F77wrap_zhpr2   atl_f77wrap_zhpr2_
#define    ATL_F77wrap_zher2   atl_f77wrap_zher2_
#define    ATL_F7