-
Notifications
You must be signed in to change notification settings - Fork 0
/
guide
2768 lines (2336 loc) · 111 KB
/
guide
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
*********************************************************
* *
* Guide to the SLATEC Common Mathematical Library *
* *
*********************************************************
Kirby W. Fong
National Magnetic Fusion Energy Computer Center
Lawrence Livermore National Laboratory
Thomas H. Jefferson
Operating Systems Division
Sandia National Laboratories Livermore
Tokihiko Suyehiro
Computing and Mathematics Research Division
Lawrence Livermore National Laboratory
Lee Walton
Network Analysis Division
Sandia National Laboratories Albuquerque
July 1993
*******************************************************************************
Table of Contents
SECTION 1. ABSTRACT
SECTION 2. BACKGROUND
SECTION 3. MEMBERS OF THE SLATEC COMMON MATHEMATICAL LIBRARY SUBCOMMITTEE
SECTION 4. OBTAINING THE LIBRARY
SECTION 5. CODE SUBMISSION PROCEDURES
SECTION 6. CODING GUIDELINES--GENERAL REQUIREMENTS FOR SLATEC
SECTION 7. SOURCE CODE FORMAT
SECTION 8. PROLOGUE FORMAT FOR SUBPROGRAMS
SECTION 9. EXAMPLES OF PROLOGUES
SECTION 10. SLATEC QUICK CHECK PHILOSOPHY
SECTION 11. SPECIFIC PROGRAMMING STANDARDS FOR SLATEC QUICK CHECKS
SECTION 12. QUICK CHECK DRIVERS (MAIN PROGRAMS)
SECTION 13. QUICK CHECK SUBROUTINE EXAMPLE
SECTION 14. QUICK CHECK MAIN PROGRAM EXAMPLE
APPENDIX A. GAMS (AND SLATEC) CLASSIFICATION SCHEME
APPENDIX B. MACHINE CONSTANTS
APPENDIX C. ERROR HANDLING
APPENDIX D. DISTRIBUTION FILE STRUCTURE
APPENDIX E. SUGGESTED FORMAT FOR A SLATEC SUBPROGRAM
ACKNOWLEDGEMENT
REFERENCES
*******************************************************************************
SECTION 1. ABSTRACT
This document is a guide to the SLATEC Common Mathematical Library (CML) [1].
The SLATEC CML is written in FORTRAN 77 (ANSI standard FORTRAN as defined by
ANSI X3.9-1978, reference [6]) and contains general purpose mathematical and
statistical routines. Included in this document are a Library description,
code submission procedures, and a detailed description of the source file
format. This report serves as a guide for programmers who are preparing codes
for inclusion in the library. It also provides the information needed to
process the source file automatically for purposes such as extracting
documentation or inserting usage monitoring calls. This guide will be updated
periodically, so be sure to contact a SLATEC CML subcommittee member to ensure
you have the latest version.
*******************************************************************************
SECTION 2. BACKGROUND
SLATEC is the acronym for the Sandia, Los Alamos, Air Force Weapons Laboratory
Technical Exchange Committee. This organization was formed in 1974 by the
computer centers of Sandia National Laboratories Albuquerque, Los Alamos
National Laboratory, and Air Force Weapons Laboratory to foster the exchange of
technical information. The parent committee established several subcommittees
to deal with various computing specialties. The SLATEC Common Mathematical
Library (CML) Subcommittee decided in 1977 to construct a mathematical FORTRAN
subprogram library that could be used on a variety of computers at the three
sites. A primary impetus for the library development was to provide portable,
non-proprietary, mathematical software for member sites' supercomputers.
In l980 the computer centers of Sandia National Laboratories Livermore and the
Lawrence Livermore National Laboratory were admitted as members of the parent
committee and subcommittees. Lawrence Livermore National Laboratory, unlike the
others, has two separate computer centers: the National Magnetic Fusion Energy
Computer Center (NMFECC) and the Livermore Computer Center (LCC). In 1981 the
National Bureau of Standards (now the National Institute of Standards and
Technology) and the Oak Ridge National Laboratory were invited to participate
in the math library subcommittee because of their great interest in the
project.
Version 1.0 of the CML was released in April 1982 with 114,328 records and 491
user-callable routines. In May 1984 Version 2.0, with 151,864 records and 646
user-callable routines was released. This was followed in April 1986 by
Version 3.0 with 196,013 records and 704 user-callable routines. Version 3.1
followed in August 1987 with 197,931 records and 707 user-callable routines
and Version 3.2 in August 1989 with 203,587 records and 709 user-callable
routines. The committee released Version 4.0 in December 1992 with 298,954
records and 901 user-callable routines. Finally, on July 1, 1993, Version 4.1
was released with 290,907 records and 902 user-callable routines.
The sole documentation provided by SLATEC for the routines of the SLATEC
Library is via comment lines in the source code. Although the library comes
with portable documentation programs to help users access the documentation in
the source code, various installations may wish to use their own documentation
programs. To facilitate automatic extraction of documentation or further
processing by other computer programs, the source file for each routine must
be arranged in a precise format. This document describes that format for the
benefit of potential library contributors and for those interested in
extracting library documentation from the source code.
*******************************************************************************
SECTION 3. MEMBERS OF THE SLATEC COMMON MATHEMATICAL LIBRARY SUBCOMMITTEE
Current member sites and voting members of the subcommittee are the
following.
Air Force Phillips Laboratory, Kirtland (PLK) Reginald Clemens
Lawrence Livermore National Laboratory (LCC) Fred N. Fritsch
Lawrence Livermore National Laboratory (NERSC) Steve Buonincontri
Los Alamos National Laboratory (LANL) W. Robert Boland
(Chairman)
National Institute of Standards and Technology (NIST) Daniel W. Lozier
Oak Ridge National Laboratory (ORNL) Thomas H. Rowan
Sandia National Laboratories/California (SNL/CA) Thomas H. Jefferson
Sandia National Laboratories/New Mexico (SNL/NM) Sue Goudy
*******************************************************************************
SECTION 4. OBTAINING THE LIBRARY
The Library is in the public domain and distributed by the Energy Science
and Technology Software Center.
Energy Science and Technology Software Center
P.O. Box 1020
Oak Ridge, TN 37831
Telephone 615-576-2606
E-mail estsc%[email protected]
*******************************************************************************
SECTION 5. CODE SUBMISSION PROCEDURES
The SLATEC Library is continuously searching for portable high-quality routines
written in FORTRAN 77 that would be of interest to the member sites. The
subcommittee meets several times annually with the member sites rotating as
meeting hosts. At these meetings new routines are introduced, discussed, and
eventually voted on for inclusion in the library. Some of the factors that are
considered in deciding whether to accept a routine into the Library are the
following:
1. Usefulness. Does the routine fill a void in the Library? Will the routine
have widespread appeal? Will it add a new capability?
2. Robustness. Does the routine give accurate results over a wide range of
problems? Does it diagnose errors? Is the routine well tested?
3. Maintainability. Is the author willing to respond to bugs in the routine?
Does the source code follow good programming practices?
4. Adherence to SLATEC standards and coding guidelines. These standards
are described further in this guide and include such things as the order
of subprogram arguments, the presence of a correctly formatted prologue at
the start of each routine, and the naming of routines.
5. Good documentation. Is clear, concise computer readable documentation
built into the source code?
6. Freely distributable. Is the program in the public domain?
A typical submission procedure begins with contact between an author and a
Library committee member. Preliminary discussions with the member are
encouraged for initial screening of any code and to gain insight into the
workings of SLATEC. This member champions the routine to be considered. The
code is introduced at a meeting where the author or committee member describes
the code and explains why it would be suitable for SLATEC. Copies of the code
are distributed to all committee members. Hopefully, the code already adheres
to SLATEC standards. However, most codes do not. At this first formal
discussion, the committee members are able to provide some useful suggestions
for improving the code and revising it for SLATEC.
Between meetings, changes are made to the code and the modified code is
distributed in machine readable format for testing. The code is then
considered at a subsequent meeting, to be voted on and accepted. However,
because committee members and authors do not always see eye to eye, and because
time constraints affect all, the code is usually discussed at several meetings.
If codes adhered to the programming practices and formatting described in this
guide, the time for acceptance could be greatly reduced.
*******************************************************************************
SECTION 6. CODING GUIDELINES--GENERAL REQUIREMENTS FOR SLATEC
A software collection of the size of the SLATEC Library that is designed to run
on a variety of computers demands uniformity in handling machine dependencies,
in handling error conditions, and in installation procedures. Thus, while the
decision to add a new subroutine to the library depends mostly on its quality
and whether it fills a gap in the library, these are not the only
considerations. Programming style must also be considered, so that the library
as a whole behaves in a consistent manner. We now list the stylistic and
documentational recommendations and requirements for routines to be
incorporated into the library.
1. The SLATEC Library is intended to have no restriction on its distribution;
therefore, new routines must be in the public domain. This is generally
not a problem since most authors are proud of their work and would like
their routines to be used widely.
2. Routines must be written in FORTRAN 77 (ANSI standard FORTRAN as
defined by ANSI X3.9-1978, reference [6]). Care must be taken so that
machine dependent features are not used.
3. To enhance maintainability codes are to be modular in structure. Codes
must be composed of reasonably small subprograms which in turn are made
up of easily understandable blocks.
4. Equivalent routines of different precision are to look the same where
possible. That is, the logical structure, statement numbers, variable
names, etc. are to be as close to identical as possible. This implies
that generic intrinsics must be used instead of specific intrinsics.
Extraneous use of INT, REAL and DBLE are strongly discouraged; use
mixed-mode expressions in accordance with the Fortran 77 standard.
5. New routines must build on existing routines in the Library, unless
there are compelling reasons to do otherwise. For example, the SLATEC
Library contains the LINPACK and EISPACK routines, so new routines
should use the existing linear system and eigensystem routines rather
than introduce new ones.
6. System or machine dependent values must be obtained by calling routines
D1MACH, I1MACH, and R1MACH. The SLATEC Library has adopted these routines
from the Bell Laboratories' PORT Library [2] [3]. See Appendix B
for a description of these machine dependent routines.
7. The SLATEC Library has a set of routines for handling error messages.
Each user-callable routine, if it can detect errors, must have as one
of its arguments an error flag, whose value upon exiting the routine
indicates the success or failure of the routine. It is acceptable for a
routine to set the error flag and RETURN; however, if the routine wishes
to write an error message, it must call XERMSG (see Appendix C) rather
than use WRITE or PRINT statements. In general, all errors (even serious
ones) should be designated as "recoverable" rather than "fatal," and the
routine should RETURN to the user. This permits the user to try an
alternate strategy if a routine decides a particular calculation is
inappropriate. A description of the entire original error handling
package appears in reference [4].
8. Each user-callable routine (and subsidiary routine if appropriate) must
have a small demonstration routine that can be used as a quick check. This
demonstration routine can be more exhaustive, but in general, it should be
structured to provide a "pass" or "fail" answer on whether the library
routine appears to be functioning properly. A more detailed description
of the required format of the quick checks appears later in this document.
9. Common blocks and SAVEd variables must be avoided. Use subprogram
arguments for interprogram communication. The use of these constructs
often obstructs multiprocessing.
Variables that are statically allocated in memory and are used as
working storage cannot be used simultaneously by several processors.
SAVEd variables and common block variables are most likely to fall into
this category. Such variables are acceptable if they are DATA loaded or
set at run time to values that are to be read (but not written) since it
does not matter in what order multiple processors read the values.
However, such variables should not be used as working storage since no
processor can use the work space while some other processor is using it.
Library routines should ask the user to provide any needed work space
by passing it in as an argument. The user is then responsible for
giving each processor a different work space even though each processor
may be executing the same library routine.
10. Complete self-contained documentation must be supplied as comments in
user-callable routines. This documentation must be self-contained because
SLATEC provides no other documentation for using the routines. This
documentation is called the "prologue" for the routine. The rigid prologue
format for user-callable routines is described below. The prologue must
tell the user how to call the routine but need not go into algorithmic
details since such explanations often require diagrams or non-ASCII
symbols. Subsidiary routines are those called by other library routines
but which are not intended to be called directly by the user. Subsidiary
routines also have prologues, but these prologues are considerably less
elaborate than those of user-callable routines.
11. No output should be printed. Instead, information should be returned
to the user via the subprogram arguments or function values. If there is
some overriding reason that printed output is necessary, the user must be
able to suppress all output by means of a subprogram input variable.
*******************************************************************************
SECTION 7. SOURCE CODE FORMAT
In this section and the two sections on prologues, we use the caret (^)
character to indicate a position in which a single blank character must
appear. Upper case letters are used for information that appears literally.
Lower case is used for material specific to the routine.
1. The first line of a subprogram must start with one of:
SUBROUTINE^name^(arg1,^arg2,^...argn)
FUNCTION^name^(arg1,^arg2,^...argn)
COMPLEX^FUNCTION^name^(arg1,^arg2,^...argn)
DOUBLE^PRECISION^FUNCTION^name^(arg1,^arg2,^...argn)
INTEGER^FUNCTION^name^(arg1,^arg2,^...argn)
REAL^FUNCTION^name^(arg1,^arg2,^...argn)
LOGICAL^FUNCTION^name^(arg1,^arg2,^...argn)
CHARACTER[*len]^FUNCTION^name^(arg1,^arg2,^...argn)
Each of the above lines starts in column 7. If there is an argument
list, then there is exactly one blank after the subprogram name and
after each comma (except if the comma appears in column 72). There is
no embedded blank in any formal parameter, after the leading left
parenthesis, before the trailing right parenthesis, or before any
comma. Formal parameters are never split across lines. Any line to be
continued must end with a comma.
For continuation lines, any legal continuation character may be used in
column 6, columns 7-9 must be blank and arguments or formal parameters
start in column 10 of a continuation line and continue up to the right
parenthesis (or comma if another continuation line is needed). The
brackets in the CHARACTER declaration do not appear literally but
indicate the optional length specification described in the FORTRAN 77
standard.
2. The author must supply a prologue for each subprogram. The prologue
must be in the format that will subsequently be described. The
prologue begins with the first line after the subprogram declaration
(including continuation lines for long argument lists).
3. Except for the "C***" lines (to be described) in the prologue and
the "C***" line marking the first executable statement, no other line
may begin with "C***".
4. The first line of the prologue is the comment line
C***BEGIN^PROLOGUE^^name
where "name", starting in column 21, is the name of the subprogram.
5. The last line of a subprogram is the word "END" starting in column 7.
6. All alphabetic characters, except for those on comment lines or in
character constants, must be upper case, as specified by the FORTRAN 77
standard (see [6]).
7. In the prologue, the comment character in column 1 must be the upper
case "C".
8. All subprogram, common block, and any formal parameter names mentioned in
the prologue must be in upper case.
9. Neither FORTRAN statements nor comment lines can extend beyond column 72.
Columns 73 through 80 are reserved for identification or sequence numbers.
10. Before the first executable statement of every subprogram, user-callable
or not, is the line
C***FIRST^EXECUTABLE^STATEMENT^^name
where "name" (starting in column 33) is the name of the subprogram.
Only comment lines may appear between the C***FIRST EXECUTABLE
STATEMENT line and the first executable statement.
11. The subprogram name consists of a maximum of six characters. Authors
should choose unusual and distinctive subprogram names to minimize
possible name conflicts. Double precision routines should begin with
"D". Subprograms of type complex should begin with "C". The letter "Z"
is reserved for future use by possible double precision complex
subprograms. No other subprograms should begin with either "D", "C", or
"Z".
12. The recommended order for the formal parameters is:
1. Names of external subprograms.
2. Input variables.
3. Variables that are both input and output (except error flags).
4. Output variables.
5. Work arrays.
6. Error flags.
However, array dimensioning parameters should immediately follow the
associated array name.
*******************************************************************************
SECTION 8. PROLOGUE FORMAT FOR SUBPROGRAMS
Each subprogram has a section called a prologue that gives standardized
information about the routine. The prologue consists of comment lines only. A
subsidiary subprogram is one that is usually called by another SLATEC Library
subprogram only and is not meant to be called by a user's routine. The
prologue for a user-callable subprogram is more extensive than the prologue for
a subsidiary subprogram. The prologue for a user-callable subprogram has up to
14 sections, of which 12 are required and one is required if and only if a
common block is present. Several of these sections are optional in subsidiary
programs and in the quick check routines. The sections are always in the
order described in the table below.
Section User-callable Subsidiary Quick Checks
1. BEGIN PROLOGUE Required Required Required
2. SUBSIDIARY Not present Required Optional
3. PURPOSE Required Required Required
4. LIBRARY SLATEC Required Required Required
5. CATEGORY Required Optional Optional
6. TYPE Required Required Required
7. KEYWORDS Required Optional Optional
8. AUTHOR Required Required Required
9. DESCRIPTION Required Optional Optional
10. SEE ALSO Optional Optional Optional
11. REFERENCES Required Optional Optional
12. ROUTINES CALLED Required Required Required
13. COMMON BLOCKS Required*** Required*** Required***
14. REVISION HISTORY Required Required Required
15. END PROLOGUE Required Required Required
***Note: The COMMON BLOCKS section appears in a subprogram prologue
if and only if the subprogram contains a common block.
In the prologue section descriptions that follow, the caret (^)
character is used for emphasis to indicate a required blank character.
1. BEGIN PROLOGUE
This section is a single line that immediately follows the subprogram
declaration and its continuation lines. It is
C***BEGIN^PROLOGUE^^name
where "name" (beginning in column 21) is the name of the subprogram.
2. SUBSIDIARY
This section is the single line
C***SUBSIDIARY
and indicates the routine in which this appears is not intended to be
user-callable.
3. PURPOSE
This section gives one to six lines of information on the purpose of the
subprogram. The letters may be in upper or lower case. There are no blank
lines in the purpose section; i.e., there are no lines consisting solely of
a "C" in column 1. The format for the first line and any continuation
lines is
C***PURPOSE^^information
C^^^^^^^^^^^^more information
Information begins in column 14 of the first line and no earlier than
column 14 of continuation lines.
4. LIBRARY SLATEC
The section is a single line used to show that the routine is a part
of the SLATEC library and, optionally, to indicate other libraries,
collections, or packages (sublibraries) of which the routine is a part
or from which the routine has been derived. The format is
C***LIBRARY^^^SLATEC
or
C***LIBRARY^^^SLATEC^(sublib1,^sublib2,^...sublibn)
The leading left parenthesis is immediately followed by the first member
of the list. Each member, except for the last, is immediately followed by
a comma and a single blank. The last member is immediately followed by
the trailing right parenthesis.
5. CATEGORY
This section is a list of classification system categories to which
this subprogram might reasonably be assigned. There must be at least
one list item. The first category listed is termed the primary
category, and others, if given, should be listed in monotonically
decreasing order of importance. Categories must be chosen from the
classification scheme listed in Appendix A. The required format for the
initial line and any continuation lines is
C***CATEGORY^^cat1,^cat2,^cat3,^...catn,
C^^^^^^^^^^^^^continued list
All alphabetic characters are in upper case.
Items in the list are separated by the two characters, comma and space.
If the list will not fit on one line, the line may be ended at a comma
(with zero or more trailing spaces), and be continued on the next line.
The list and any continuations of the list begin with a nonblank character
in column 15.
6. TYPE
This section gives the datatype of the routine and indicates which
routines, including itself, are equivalent (except possibly for type) to
the routine. The format for this section is
C***TYPE^^^^^^routine_type^(equivalence list
C^^^^^^^^^^^^^continued equivalence list
C^^^^^^^^^^^^^continued equivalence list)
Routine_type, starting in column 15, is the data type of the routine,
and is either SINGLE PRECISION, DOUBLE PRECISION, COMPLEX, INTEGER,
CHARACTER, LOGICAL, or ALL. ALL is a pseudo-type given to routines that
could not reasonably be converted to some other type. Their purpose is
typeless. An example would be the SLATEC routine that prints error
messages.
Equivalence list is a list of the routines (including this one) that are
equivalent to this one, but perhaps of a different type. Each item in the
list consists of a routine name followed by the "-" character and then
followed by the first letter of the type (except use "H" for type
CHARACTER) of the equivalent routine. The order of the items is S, D, C,
I, H, L and A.
The initial item in the list is immediately preceded by a blank and a
left parenthesis and the final item is immediately followed by a right
parenthesis. Items in the list are separated by the two characters,
comma and space. If the list will not fit on one line, the line may be
ended at a comma (with zero or more trailing spaces), and be continued
on the next line. The list and any continuations of the list begin with
a nonblank character in column 15.
All alphabetic characters in this section are in upper case.
Example
C***TYPE SINGLE PRECISION (ACOSH-S, DACOSH-D, CACOSH-C)
7. KEYWORDS
This section gives keywords or keyphrases that can be used by
information retrieval systems to identify subprograms that pertain to
the topic suggested by the keywords. There must be at least one
keyword. Keywords can have embedded blanks but may not have leading or
trailing blanks. A keyword cannot be continued on the next line; it
must be short enough to fit on one line. No keyword can have an embedded
comma. Characters are limited to the FORTRAN 77 character set (in
particular, no lower case letters). There is no comma after the last
keyword in the list. It is suggested that keywords be in either
alphabetical order or decreasing order of importance. The format for
the initial line and any continuation lines is
C***KEYWORDS^^list
C^^^^^^^^^^^^^continued list
Items in the list are separated by the two characters, comma and space.
If the list will not fit on one line, the line may be ended at a comma
(with zero or more trailing spaces), and be continued on the next line.
The list and any continuations of the list begin with a nonblank character
in column 15.
8. AUTHOR
This required section gives the author's name. There must be at least one
author, and there may be coauthors. At least the last name of the author
must be given. The first name (or initials) is optional. The company,
organization, or affiliation of the author is also optional. The brackets
below indicate optional information. Note that if an organization is to be
listed, the remainder of the author's name must also be given. If the
remainder of the author's name is given, the last name is immediately
followed by a comma. If the organization is given, the first name (or
initials) is immediately followed by a comma. The remainder of the name
and the organization name may have embedded blanks. The remainder of the
name may not have embedded commas. This makes it possible for an
information retrieval system to count commas to identify the remainder of
the name and the name of an organization. Additional information about the
author (e.g., address or telephone number) may be given on subsequent
lines. The templates used are
C***AUTHOR^^last-name[,^first-name[,^(org)]]
C^^^^^^^^^^^^^more information
C^^^^^^^^^^^^^more information
.
.
.
C^^^^^^^^^^^last-name[,^first-name[,^(org)]]
C^^^^^^^^^^^^^more information
.
.
.
Each author's name starts in column 13. Continued information starts in
column 15.
9. DESCRIPTION
This section is a description giving the program abstract, method used,
argument descriptions, dimension information, consultants, etc. The
description of the arguments is in exactly the same order in which the
arguments appear in the calling sequence. The description section may use
standard, 7-bit ASCII graphic characters, i.e., the 94 printing characters
plus the blank. Names of subprograms, common blocks, externals, and formal
parameters are all in upper case. Names of variables are also in upper
case. The first line of this section is "C***DESCRIPTION" starting in
column 1. All subsequent lines in this section start with a "C" in column
1 and no character other than a blank in column 2. Lines with only a "C"
in column 1 may be used to improve the appearance of the description.
A suggested format for the DESCRIPTION section is given in Appendix E.
10. SEE ALSO
This section is used for listing other SLATEC routines whose prologues
contain documentation on the routine in which this section appears.
The form is
C***SEE ALSO^^name,^name,^name
where each "name" is the name of a user-callable SLATEC CML subprogram
whose prologue provides a description of this routine. The names are
given as a list (starting in column 15), with successive names separated
by a comma and a single blank.
11. REFERENCES
This section is for references. Any of the 94 ASCII printing characters
plus the blank may be used. There may be more than one reference. If there
are no references, the section will consist of the single line
C***REFERENCES^^(NONE)
If there are references, they will be in the following format:
C***REFERENCES^^reference 1
C^^^^^^^^^^^^^^^^^continuation of reference 1
.
.
.
C^^^^^^^^^^^^^^^reference 2
C^^^^^^^^^^^^^^^^^continuation of reference 2
.
.
.
Information starts in column 17 of the first line of a reference and no
earlier than column 19 of continuation lines.
References should be listed in either alphabetical order by last name or
order of citation. They should be in upper and lower case, have initials
or first names ahead of last names, and (for multiple authors) have
"and" ahead of the last author's name instead of just a comma. The first
word of the title of journal articles should be capitalized as should all
important words in titles of books, pamphlets, research reports, and
proceedings. Titles should be given without quotation marks. The names
of journals should be spelled out completely, or nearly so, because
software users may not be familiar with them.
A complete example of a journal reference is:
C F. N. Fritsch and R. E. Carlson, Monotone piecewise
C cubic interpolation, SIAM Journal on Numerical Ana-
C lysis, 17 (1980), pp. 238-246.
A complete example of a book reference is:
C Carl de Boor, A Practical Guide to Splines, Applied
C Mathematics Series 27, Springer-Verlag, New York,
C 1978.
12. ROUTINES CALLED
This section gives the names of routines in the SLATEC Common Mathematical
Library that are either directly referenced or declared in an EXTERNAL
statement and passed as an argument to a subprogram. Note that the FORTRAN
intrinsics and other formal parameters that represent externals are not
listed. A list is always given for routines called; however, if no routine
is called, the list will be the single item "(NONE)" where the parentheses
are included. If there are genuine items in the list, the items are in
alphabetical order. The collating sequence has "0" through "9" first, then
"A" through "Z". The format is
C***ROUTINES^CALLED^^name,^name,^name,^name,
C^^^^^^^^^^^^^^^^^^^^name,^name,^name
Items in the list are separated by the two characters, comma and space.
If the list will not fit on one line, the line may be ended at a comma
(with zero or more trailing spaces), and be continued on the next line.
The list and any continuations of the list begin with a nonblank character
in column 22.
13. COMMON BLOCKS
This section, that may or may not be required, tells what common blocks are
used by this subprogram. If this subprogram uses no common blocks, this
section does not appear. If this subprogram does use common blocks, this
section must appear. The list of common blocks is in exactly the same
format as the list of routines called and uses the same collating sequence.
In addition, the name of blank common is "(BLANK)" where the parentheses
are included. Blank common should be last in the list if it appears. The
format for this section is
C***COMMON^BLOCKS^^^^name,^name,^name,^name,
C^^^^^^^^^^^^^^^^^^^^name,^name,^name^
The list starts in column 22.
14. REVISION HISTORY
This section provides a summary of the revisions made to this code.
Revision dates and brief reasons for revisions are given. The format is
C***REVISION^HISTORY^^(YYMMDD)
C^^^yymmdd^^DATE^WRITTEN
C^^^yymmdd^^revision description
C^^^^^^^^^^^more revision description
C^^^^^^^^^^^...
C^^^yymmdd^^revision description
C^^^^^^^^^^^more revision description
C^^^^^^^^^^^...
C^^^^^^^^^^^...
where, for each revision, "yy" (starting in column 5) is the last two
digits of the year, "mm" is the month (01, 02, ..., 12), and "dd" is the
day of the month (01, 02, ..., 31). Because this ANSI standard form for
the date may not be familiar to some people, the character string
"(YYMMDD)" (starting in column 23) is included in the first line of the
section to assist in interpreting the sequence of digits. Each line of the
revision descriptions starts in column 13. The second line of this section
contains the date the routine was written, with the characters "DATE
WRITTEN" beginning in column 13. These items must be in chronological
order.
15. END PROLOGUE
The last section is the single line
C***END^PROLOGUE^^name
where "name" is the name of the subprogram.
*******************************************************************************
SECTION 9. EXAMPLES OF PROLOGUES
This section contains examples of prologues for both user-callable
and subsidiary routines. The routines are not from the SLATEC CML and
should be used only as guidelines for preparing routines for SLATEC.
Note that the C***DESCRIPTION sections follow the suggested LDOC format that
is described in Appendix E. Following the suggested LDOC format with its
"C *"subsections helps to ensure that all necessary descriptive information is
provided.
SUBROUTINE ADDXY (X, Y, Z, IERR)
C***BEGIN PROLOGUE ADDXY
C***PURPOSE This routine adds two single precision numbers together
C after forcing both operands to be stored in memory.
C***LIBRARY SLATEC
C***CATEGORY A3A
C***TYPE SINGLE PRECISION (ADDXY-S, DADDXY-D)
C***KEYWORDS ADD, ADDITION, ARITHMETIC, REAL, SUM,
C SUMMATION
C***AUTHOR Fong, K. W., (NMFECC)
C Mail Code L-560
C Lawrence Livermore National Laboratory
C Post Office Box 5509
C Livermore, CA 94550
C Jefferson, T. H., (SNLL)
C Org. 8235
C Sandia National Laboratories Livermore
C Livermore, CA 94550
C Suyehiro, T., (LLNL)
C Mail Code L-316
C Lawrence Livermore National Laboratory
C Post Office Box 808
C Livermore, CA 94550
C***DESCRIPTION
C
C *Usage:
C
C INTEGER IERR
C REAL X, Y, Z
C
C CALL ADDXY (X, Y, Z, IERR)
C
C *Arguments:
C
C X :IN This is one of the operands to be added. It will not
C be modified by ADDXY.
C
C Y :IN This is the other operand to be added. It will not be
C modified by ADDXY.
C
C Z :OUT This is the sum of X and Y. In case of an error,
C this argument will not be modified.
C
C IERR:OUT This argument will be set to 0 if ADDXY added the two
C operands. It will be set to 1 if it appears the addition
C would generate a result that might overflow.
C
C *Description:
C
C ADDXY first divides X and Y by the largest single precision number
C and then adds the quotients. If the absolute value of the sum is
C greater than 1.0, ADDXY returns with IERR set to 1. Otherwise
C ADDXY stores X and Y into an internal array and calls ADDZZ to add
C them. This increases the probability (but does not guarantee) that
C operands and result are stored into memory to avoid retention of
C extra bits in overlength registers or cache.
C
C***REFERENCES W. M. Gentleman and S. B. Marovich, More on algorithms
C that reveal properties of floating point arithmetic
C units, Communications of the ACM, 17 (1974), pp.
C 276-277.
C***ROUTINES CALLED ADDZZ, R1MACH, XERMSG
C***REVISION HISTORY (YYMMDD)
C 831109 DATE WRITTEN
C 880325 Modified to meet new SLATEC prologue standards. Only
C comment lines were modified.
C 881103 Brought DESCRIPTION section up to Appendix E standards.
C 921215 REFERENCE section modified to reflect recommended style.
C***END PROLOGUE ADDXY
DIMENSION R(3)
C***FIRST EXECUTABLE STATEMENT ADDXY
BIG = R1MACH( 2 )
C
C This is an example program, not meant to be taken seriously. The
C following illustrates the use of XERMSG to send an error message.
C
IF ( (ABS((X/BIG)+(Y/BIG))-1.0) .GT. 0.0 ) THEN
IERR = 1
CALL XERMSG ( 'SLATEC', 'ADDXY', 'Addition of the operands '//
* 'is likely to cause overflow', IERR, 1 )
ELSE
IERR = 0
R(1) = X
R(2) = Y
CALL ADDZZ( R )
Z = R(3)
ENDIF
RETURN
END
SUBROUTINE ADDZZ (R)
C***BEGIN PROLOGUE ADDZZ
C***SUBSIDIARY
C***PURPOSE This routine adds two single precision numbers.
C***LIBRARY SLATEC
C***AUTHOR Fong, K. W., (NMFECC)
C Mail Code L-560
C Lawrence Livermore National Laboratory
C Post Office Box 5509
C Livermore, CA 94550
C Jefferson, T. H., (SNLL)
C Org. 8235
C Sandia National Laboratories Livermore
C Livermore, CA 94550
C Suyehiro, T., (LLNL)
C Mail Code L-316
C Lawrence Livermore National Laboratory
C Post Office Box 808
C Livermore, CA 94550
C***SEE ALSO ADDXY
C***ROUTINES CALLED (NONE)
C***REVISION HISTORY (YYMMDD)
C 831109 DATE WRITTEN
C 880325 Modified to meet new SLATEC prologue standards. Only
C comment lines were modified.
C***END PROLOGUE ADDZZ
DIMENSION R(3)
C***FIRST EXECUTABLE STATEMENT ADDZZ
R(3) = R(1) + R(2)
RETURN
END
*******************************************************************************
SECTION 10. SLATEC QUICK CHECK PHILOSOPHY
The SLATEC Library is distributed with a set of test programs that may be used
as an aid to insure that the Library is installed correctly. This set of test
programs is known as the SLATEC quick checks. The quick checks are not meant
to provide an exhaustive test of the Library. Instead they are designed to
protect against gross errors, such as an unsatisfied external. Because the
SLATEC Library runs on a great variety of computers, the quick checks often
detect arithmetic difficulties with either particular Library routines or with
a particular computational environment.
A list of the quick check guidelines follows.
1. A quick check should test a few problems successfully solved by a
particular library subprogram. It is not intended to be an extensive
test of a subprogram.
2. A quick check should provide consistent and minimal output in most
cases, including a "PASS" or "FAIL" indicator. However, more detailed
output should be available on request to help track down problems in the
case of failures.
3. Some reasonable error conditions should be tested by the quick check by
purposefully referencing the routine incorrectly.
4. A quick check subprogram is expected to execute correctly on any machine
with an ANSI Fortran 77 compiler and library. No test should have to be
skipped to avoid an abort on a particular machine.
5. As distributed on the SLATEC tape, the quick check package consists of a
number of quick check main programs and a moderate number of subprograms.
Each quick check main program, more frequently called a quick check driver,
calls one or more quick check subprograms. Usually, a given driver
initiates the tests for a broadly related set of subprograms, e.g. for the
single precision Basic Linear Algebra Subprograms (BLAS). Each quick
check subprogram will test one or more closely related library routines of
the same precision. For example, single precision routines and their
double precision equivalents are not to be tested in the same quick check
subprogram.
6. The format of the quick check package does not rigidly dictate how it
must be executed on a particular machine. For example, memory size of the
machine might preclude loading all quick check modules at once.
*******************************************************************************
SECTION 11. SPECIFIC PROGRAMMING STANDARDS FOR SLATEC QUICK CHECKS
Just as the routines in the SLATEC Common Mathematical Library must meet
certain standards, so must the quick checks. These standards are meant to
ensure that the quick checks adhere to the SLATEC quick check philosophy and
to enhance maintainability. The list of these quick check standards follow.
1. Each module must test only a few related library subprograms.
2. Each module must be in the form of a subroutine with three arguments.
For example:
SUBROUTINE ADTST (LUN, KPRINT, IPASS)
The first is an input argument giving the unit number to which any output
should be written. The second is an input argument specifying the amount
of printing to be done by the quick check subroutine. The third is an
output flag indicating passage or failure of the subroutine.
LUN Unit number to which any output should be written.
KPRINT = 0 No printing is done (pass/fail is presumably monitored at a
higher level, i.e. in the driver). Error messages will not be
printed since the quick check driver sets the error handling
control flag to 0, using CALL XSETF(0) when KPRINT = 0 or 1.
= 1 No printing is done for tests which pass; a short message
(e.g., one line) is printed for tests which fail. Error
messages will not be printed since the quick check driver sets
the error handling control flag to 0, using CALL XSETF(0)
when KPRINT = 0 or 1.
= 2 A short message is printed for tests which pass; more detailed