aboutsummaryrefslogtreecommitdiff
path: root/src/hyper/pages/nagx.ht
blob: 0676bfe37ce2036e8e9cea8de017aa0110300e5d (plain)
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
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
\begin{page}{manpageXXx01}{NAG On-line Documentation: x01}
\beginscroll
\begin{verbatim}



     X01(3NAG)         Foundation Library (12/10/92)         X01(3NAG)



          X01 -- Mathematical Constants                 Introduction -- X01
                                    Chapter X01
                              Mathematical Constants

          1. Scope of the Chapter

          This chapter is concerned with the provision of mathematical
          constants required by other routines within the Library.

          It should be noted that because of the trivial nature of the
          routines individual routine documents are not provided.

          2. Background to the Problems

          Some Library routines require mathematical constants to maximum
          machine precision. These routines call Chapter X01 and thus
          lessen the number of changes that have to be made between
          different implementations of the Library.

          3. Recommendations on Choice and Use of Routines

          Although these routines are primarily intended for use by other
          routines they may be accessed directly by the user:

          Constant           Fortran Specification

          (pi)               DOUBLE PRECISION FUNCTION X01AAF(X)
                             DOUBLE PRECISION X

          (gamma)            DOUBLE PRECISION FUNCTION X01ABF(X)
          (Euler constant)   DOUBLE PRECISION X

          The argument X of these routines is a dummy argument.


          X01 -- Mathematical Constants                     Contents -- X01
          Chapter X01

          Mathematical Constants

          X01AAF  (pi)

          X01ABF  Euler's constant, (gamma)

\end{verbatim}
\endscroll
\end{page}
\begin{page}{manpageXXx02}{NAG On-line Documentation: x02}
\beginscroll
\begin{verbatim}



     X02(3NAG)         Foundation Library (12/10/92)         X02(3NAG)



          X02 -- Machine Constants                      Introduction -- X02
                                    Chapter X02
                                 Machine Constants

          1. Scope of the Chapter

          This chapter is concerned with parameters which characterise
          certain aspects of the computing environment in which the NAG
          Foundation Library is implemented. They relate primarily to
          floating-point arithmetic, but also to integer arithmetic and the
          elementary functions. The values of the parameters vary from one
          implementation of the Library to another, but within the context
          of a single implementation they are constants.

          The parameters are intended for use primarily by other routines
          in the Library, but users of the Library may sometimes need to
          refer to them directly.

          Each parameter-value is returned by a separate Fortran function.
          Because of the trivial nature of the functions, individual
          routine documents are not provided; the necessary details are
          given in Section 3 of this Introduction.

          2. Background to the Problems

          2.1. Floating-Point Arithmetic

          2.1.1.  A model of floating-point arithmetic

          In order to characterise the important properties of floating-
          point arithmetic by means of a small number of parameters, NAG
          uses a simplified model of floating-point arithmetic. The
          parameters of the model can be chosen to provide a sufficiently
          close description of the behaviour of actual implementations of
          floating-point arithmetic, but not, in general, an exact
          description; actual implementations vary too much in the details
          of how numbers are represented or arithmetic operations are
          performed.

          The model is based on that developed by Brown [1], but differs in
          some respects. The essential features are summarised here.

          The model is characterised by four integer parameters and one
          logical parameter. The four integer parameters are:

                b  :  the base

                p  :  the precision (i.e. the number of significant base-B
                      digits)

              e    :  the minimum exponent
               min

              e    :  the maximum exponent
               max

          These parameters define a set of numerical values of the form:

                                           e
                                        f*b

          where the exponent e must lie in the range [e   ,e   ], and the
                                                       min  max
          fraction f (also called the mantissa or significand) lies in the
          range [1/b,1), and may be written:

                                    f=0.f f ...f
                                         1 2    p

          Thus f is a p-digit fraction to the base b; the f  are the base-b
                                                           i
          digits of the fraction: they are integers in the range 0 to b-1,
          and the leading digit f  must not be zero.
                                 1

          The set of values so defined (together with zero) are called
          model numbers. For example, if b=10, p=5, e   =-99 and e   =+99,
                                                     min          max
                                                   67
          then a typical model number is 0.12345*10  .

          The model numbers must obey certain rules for the computed
          results of the following basic arithmetic operations: addition,
          subtraction, multiplication, negation, absolute value, and
          comparisons. The rules depend on the value of the logical
          parameter ROUNDS.

          If ROUNDS is true, then the computed result must be the nearest
          model number to the exact result (assuming that overflow or
          underflow does not occur); if the exact result is midway between
          two model numbers, then it may be rounded either way.

          If ROUNDS is false, then: if the exact result is a model number,
          the computed result must be equal to the exact result; otherwise,
          the computed result may be either of the adjacent model numbers
          on either side of the exact result.

          For division and square root, this latter rule is further relaxed
          (regardless of the value of ROUNDS): the computed result may also
          be one of the next adjacent model numbers on either side of the
          permitted values just stated.

          On some machines, the full set of representable floating-point
          numbers conforms to the rules of the model with appropriate
          values of b, p, e   , e    and ROUNDS. For example, for machines
                           min   max
          with IEEE arithmetic, in double precision:

              b    =  2

              p    =  53

              e    =-1021
               min

              e    =1024 and ROUNDS is true.
               max

          For other machines, values of the model parameters must be chosen
          which define a large subset of the representable numbers;
          typically it may be necessary to decrease p by 1 (in which case
          ROUNDS is always set to false), or to increase e    or decrease
                                                          min
          e    by a little bit. There are additional rules to ensure that
           max
          arithmetic operations on those representable numbers which are
          not model numbers, are consistent with arithmetic on model
          numbers.

          (Note: the model used here differs from that described in Brown
          [1] in the following respects: square-root is treated, like
          division, as a weakly supported operator; and the logical
          parameter ROUNDS has been introduced to take account of machines
          with good rounding.)

          2.1.2.  Derived parameters of floating-point arithmetic

          Most numerical algorithms require access, not to the basic
          parameters of the model, but to certain derived values, of which
          the most important are:

                                   (1)  1-p
          the machine precision =  (-)*b    if ROUNDS is true,
          (epsilon):               (2)

                                    1-p
                                =  b    otherwise (but see Note below).

                                    e   -1
                                     min
          the smallest positive =  b
          model number:

                                            e
                                       -p    max
          the largest positive  =  (1-b  )*b
          model number:

          Note: this value is increased very slightly in some
          implementations to ensure that the computed result of 1+(epsilon)
          or 1-(epsilon) differs from 1. For example in IEEE binary single
                                                    -24  -47
          precision arithmetic the value is set to 2   +2   .

          Two additional derived values are used in the NAG Foundation
          Library. Their definitions depend not only on the properties of
          the basic arithmetic operations just considered, but also on
          properties of some of the elementary functions. We define the
          safe range parameter to be the smallest positive model number z
          such that for any x in the range [z,1/z] the following can be
          computed without undue loss of accuracy, overflow, underflow or
          other error:

              -x

              1/x

              -1/x

              SQRT(x)

              LOG(x)

              EXP(LOG(x))

              y**(LOG(x)/LOG(y)) for any y

          In a similar fashion we define the safe range parameter for
          complex arithmetic as the smallest positive model number z such
          that for any x in the range [z,1/z] the following can be computed
          without any undue loss of accuracy, overflow, underflow or other
          error:

              -w

              1/w

              -1/w

              SQRT(w)

              LOG(w)

              EXP(LOG(w))

              y**(LOG(w)/LOG(y)) for any y

              ABS(w)

          where w is any of x, ix, x+ix, 1/x, i/x, 1/x+i/x, and i is the
          square root of -1.

          This parameter was introduced to take account of the quality of
          complex arithmetic on the machine. On machines with well
          implemented complex arithmetic, its value will differ from that
          of the real safe range parameter by a small multiplying factor
          less than 10. For poorly implemented complex arithmetic this
          factor may be larger by many orders of magnitude.

          2.2. Other Aspects of the Computing Environment

          No attempt has been made to characterise comprehensively any
          other aspects of the computing environment. The other functions
          in this chapter provide specific information that is occasionally
          required by routines in the Library.

          2.3. References

          [1]   Brown W S (1981) A Simple but Realistic Model of Floating-
                point Computation. ACM Trans. Math. Softw. 7 445--480.

          3. Recommendations on Choice and Use of Routines

          3.1. Parameters of Floating-point Arithmetic

          DOUBLE PRECISION FUNCTION returns the machine precision i.e.
          X02AJF()                  (1)  1-p                       1-p
                                    (-)*b    if ROUNDS is true or b
                                    (2)
                                    otherwise (or a value very slightly
                                    larger than this, see Section 2.1.2)

          DOUBLE PRECISION FUNCTION returns the smallest positive model
          X02AKF()                               e   -1
                                                  min
                                    number i.e. b

          DOUBLE PRECISION FUNCTION returns the largest positive model
          X02ALF()                                       e
                                                    -p    max
                                    number i.e. (1-b  )*b


          DOUBLE PRECISION FUNCTION returns the safe range parameter as
          X02AMF()                  defined in Section 2.1.2

          DOUBLE PRECISION FUNCTION returns the safe range parameter for
          X02ANF()                  complex arithmetic as defined in
                                    Section 2.1.2

          INTEGER FUNCTION X02BHF() returns the model parameter b

          INTEGER FUNCTION X02BJF() returns the model parameter p

          INTEGER FUNCTION X02BKF() returns the model parameter e
                                                                 min

          INTEGER FUNCTION X02BLF() returns the model parameter e
                                                                 max

          LOGICAL FUNCTION X02DJF() returns the model parameter ROUNDS

          3.2. Parameters of Other Aspects of the Computing Environment

          DOUBLE PRECISION FUNCTION returns the largest positive real
          X02AHF(X)                 argument for which the SIN and COS
          DOUBLE PRECISION X        routines return a result with some
                                    meaningful accuracy

          INTEGER FUNCTION X02BBF   returns the largest positive integer
          (X)                       value
          DOUBLE PRECISION X

          INTEGER FUNCTION X02BEF   returns the maximum number of decimal
          (X)                       digits which can be accurately
          DOUBLE PRECISION X        represented over the whole range of
                                    floating-point numbers

          The argument X of these routines is a dummy argument.

          4. Example Program Text

          The example program simply prints the values of all the functions
          in Chapter X02. Obviously the results will vary from one
          implementation of the Library to another.


          X02 -- Machine Constants                          Contents -- X02
          Chapter X02

          Machine Constants

          X02AHF  Largest permissible argument for SIN and COS

          X02AJF  Machine precision

          X02AKF  Smallest positive model number

          X02ALF  Largest positive model number

          X02AMF  Safe range of floating-point arithmetic

          X02ANF  Safe range of complex floating-point arithmetic

          X02BBF  Largest representable integer

          X02BEF  Maximum number of decimal digits that can be represented

          X02BHF  Parameter of floating-point arithmetic model, b

          X02BJF  Parameter of floating-point arithmetic model, p

          X02BKF  Parameter of floating-point arithmetic model, e
                                                                 min

          X02BLF  Parameter of floating-point arithmetic model, e
                                                                 max

          X02DJF  Parameter of floating-point arithmetic model, ROUNDS

\end{verbatim}
\endscroll
\end{page}
\begin{page}{manpageXXx04}{NAG On-line Documentation: x04}
\beginscroll
\begin{verbatim}



     X04(3NAG)         Foundation Library (12/10/92)         X04(3NAG)



          X04 -- Input/Output Utilities                 Introduction -- X04
                                    Chapter X04
                              Input/Output Utilities

          1. Scope of the Chapter

          This chapter contains utility routines concerned with input and
          output to or from an external file.

          2. Background to the Problems

          2.1. Output from NAG Foundation Library Routines

          Output from NAG Foundation Library routines to an external file
          falls into two categories:

          (a)   Error messages which are always associated with an error
                exit from a routine, that is, with a non-zero value of
                IFAIL as specified in Section 6 of the routine document.

          (b)   Advisory messages which include output of final results,
                output of intermediate results to monitor the course of a
                computation, and various warning or informative messages.

          Each category of output is written to its own Fortran output unit
          - the  error message unit  or the  advisory message unit. In
          practice these may be the same unit number. Default unit numbers
          are provided for each implementation of the Library (see the
          Users' Note); they may be changed by users. Output of error
          messages may be controlled by the setting of IFAIL (see the
          Essential Introduction). Output of advisory messages may usually
          be controlled by the setting of some other parameter (e.g.
          MSGLVL) (or in some routines also by IFAIL). An alternative
          mechanism for completely suppressing output is to set the
          relevant unit number < 0.

          For further information about error and advisory messages, see
          Chapter P01.

          2.2. Matrix Printing Routines

          Routines are provided to allow formatted output of general
          rectangular or triangular matrices stored in a two-dimensional
          array (real and complex data types).

          All output is directed to the unit number for output of advisory
          messages, which may be altered by a call to X04ABF.

          3. Recommendations on Choice and Use of Routines

          Apart from the obvious utility of the matrix printing routines,
          users of the Library may need to call routines in Chapter X04 for
          the following purposes:

               if the default unit number for error messages (given in the
               Users' Note for your implementation) is not satisfactory,
               it may be changed to a new value NERR by the statement

                     CALL X04AAF(1,NERR)

               Similarly the unit number for advisory messages may be
               changed to a new value NADV by the statement

                     CALL X04ABF(1,NADV)

          4. Index

          Accessing unit number:
               of advisory message unit                              X04ABF
               of error message unit                                 X04AAF
          Printing matrices:
               general complex matrix                                X04DAF
               general real matrix                                   X04CAF



          X04 -- Input/Output Utilities                     Contents -- X04
          Chapter X04

          Input/Output Utilities

          X04AAF  Return or set unit number for error messages

          X04ABF  Return or set unit number for advisory messages

          X04CAF  Print a real general matrix

          X04DAF  Print a complex general matrix

\end{verbatim}
\endscroll
\end{page}
\begin{page}{manpageXXx04aaf}{NAG On-line Documentation: x04aaf}
\beginscroll
\begin{verbatim}



     X04AAF(3NAG)      Foundation Library (12/10/92)      X04AAF(3NAG)



          X04 -- Input/Output Utilities                              X04AAF
                  X04AAF -- NAG Foundation Library Routine Document

          Note: Before using this routine, please read the Users' Note for
          your implementation to check implementation-dependent details.
          The symbol (*) after a NAG routine name denotes a routine that is
          not included in the Foundation Library.

          1. Purpose

          X04AAF returns the value of the current error message unit
          number, or sets the current error message unit number to a new
          value.

          2. Specification

                 SUBROUTINE X04AAF (IFLAG, NERR)
                 INTEGER          IFLAG, NERR

          3. Description

          This routine enables those library routines which output error
          messages, to determine the number of the output unit to which the
          error messages are to be sent; in this case X04AAF is called with
          IFLAG = 0. X04AAF may also be called with IFLAG = 1 to set the
          unit number to a specified value. Otherwise a default value
          (stated in the Users' Note for your implementation) is returned.

          Records written to this output unit by other library routines are
          at most 80 characters long (including a line-printer carriage
          control character).

          Note that if the unit number is set < 0, no messages will be
          output.

          4. References

          None.

          5. Parameters

           1:  IFLAG -- INTEGER                                       Input
               On entry: the action to be taken (see NERR). Constraint:
               IFLAG = 0 or 1.

           2:  NERR -- INTEGER                                 Input/Output
               On entry:
                    if IFLAG = 0, NERR need not be set;

                    if IFLAG = 1, NERR must specify the new error message
                    unit number.
               On exit:
                    if IFLAG = 0, NERR is set to the current error message
                    unit number,

                    if IFLAG = 1, NERR is unchanged.
               Note that Fortran unit numbers must be positive or zero. If
               NERR is set < 0, output of error messages is totally
               suppressed.

          6. Error Indicators and Warnings

          None.

          7. Accuracy

          Not applicable.

          8. Further Comments

          The time taken by the routine is negligible.

          9. Example

          In this example X04AAF is called by the user's main program to
          make the error message from the routine DUMMY appear on the same
          unit as the rest of the output (unit 6). Normally a NAG
          Foundation Library routine with an IFAIL parameter (see Essential
          Introduction) would take the place of DUMMY.

          The example program is not reproduced here. The source code for
          all example programs is distributed with the NAG Foundation
          Library software and should be available on-line.
\end{verbatim}
\endscroll
\end{page}
\begin{page}{manpageXXx04abf}{NAG On-line Documentation: x04abf}
\beginscroll
\begin{verbatim}



     X04ABF(3NAG)      Foundation Library (12/10/92)      X04ABF(3NAG)



          X04 -- Input/Output Utilities                              X04ABF
                  X04ABF -- NAG Foundation Library Routine Document

          Note: Before using this routine, please read the Users' Note for
          your implementation to check implementation-dependent details.
          The symbol (*) after a NAG routine name denotes a routine that is
          not included in the Foundation Library.

          1. Purpose

          X04ABF returns the value of the current advisory message unit
          number, or sets the current advisory message unit number to a new
          value.

          2. Specification

                 SUBROUTINE X04ABF (IFLAG, NADV)
                 INTEGER          IFLAG, NADV

          3. Description

          This routine enables those library routines which output advisory
          messages, to determine the number of the output unit to which the
          advisory messages are to be sent; in this case X04ABF is called
          with IFLAG = 0. X04ABF may also be called with IFLAG = 1 to set
          the unit number to a specified value. Otherwise a default value
          (stated in the User's Note for your implementation) is returned.

          Records written to this output unit by other library routines are
          at most 120 characters long (including a line-printer carriage
          control character), unless those library routines allow users to
          specify longer records.

          Note that if the unit number is set < 0, no messages will be
          output.

          4. References

          None.

          5. Parameters

           1:  IFLAG -- INTEGER                                       Input
               On entry: the action to be taken (see NADV). Constraint:
               IFLAG = 0 or 1.

           2:  NADV -- INTEGER                                 Input/Output
               On entry:
                    if IFLAG = 0, NADV need not be set;

                    if IFLAG = 1, NADV must specify the new advisory
                    message unit number.
               On exit:
                    if IFLAG = 0, NADV is set to the current advisory
                    message unit number;

                    if IFLAG = 1, NADV is unchanged.
               Note that Fortran unit numbers must be positive or zero. If
               NADV is set < 0, output of advisory messages is totally
               suppressed.

          6. Error Indicators and Warnings

          None.

          7. Accuracy

          Not applicable.

          8. Further Comments

          The time taken by this routine is negligible.

          9. Example

          In this example X04ABF is called by the user's main program to
          make the advisory message from the routine DUMMY appear on the
          same unit as the rest of the output (unit 6). Normally a NAG
          Foundation Library routine with an IFAIL parameter (see Essential
          Introduction) would take the place of DUMMY.

          The example program is not reproduced here. The source code for
          all example programs is distributed with the NAG Foundation
          Library software and should be available on-line.
\end{verbatim}
\endscroll
\end{page}
\begin{page}{manpageXXx04caf}{NAG On-line Documentation: x04caf}
\beginscroll
\begin{verbatim}



     X04CAF(3NAG)      Foundation Library (12/10/92)      X04CAF(3NAG)



          X04 -- Input/Output Utilities                              X04CAF
                  X04CAF -- NAG Foundation Library Routine Document

          Note: Before using this routine, please read the Users' Note for
          your implementation to check implementation-dependent details.
          The symbol (*) after a NAG routine name denotes a routine that is
          not included in the Foundation Library.

          1. Purpose

          X04CAF is an easy-to-use routine to print a real matrix stored in
          a two-dimensional array.

          2. Specification

                 SUBROUTINE X04CAF (MATRIX, DIAG, M, N, A, LDA, TITLE,
                1                   IFAIL)
                 INTEGER          M, N, LDA, IFAIL
                 DOUBLE PRECISION A(LDA,*)
                 CHARACTER*1      MATRIX, DIAG
                 CHARACTER*(*)    TITLE

          3. Description

          X04CAF prints a real matrix. It is an easy-to-use driver for
          X04CBF(*). The routine uses default values for the format in
          which numbers are printed, for labelling the rows and columns,
          and for output record length.

          X04CAF will choose a format code such that numbers will be
          printed with either an F8.4, F11.4 or a 1PE13.4 format. The F8.4
          code is chosen if the sizes of all the matrix elements to be
          printed lie between 0.001 and 1.0. The F11.4 code is chosen if
          the sizes of all the matrix elements to be printed lie between 0.
          001 and 9999.9999. Otherwise the 1PE13.4 code is chosen.

          The matrix is printed with integer row and column labels, and
          with a maximum record length of 80.

          The matrix is output to the unit defined by X04ABF.

          4. References

          None.

          5. Parameters

           1:  MATRIX -- CHARACTER*1                                  Input
               On entry: indicates the part of the matrix to be printed, as
               follows:

               MATRIX = 'G' (General), the whole of the rectangular matrix.

               MATRIX = 'L' (Lower), the lower triangle of the matrix, or
               the lower trapezium if the matrix has more rows than
               columns.

               MATRIX = 'U' (Upper), the upper triangle of the matrix, or
               the upper trapezium if the matrix has more columns than
               rows. Constraint: MATRIX must be one of 'G', 'L' or 'U'.

           2:  DIAG -- CHARACTER*1                                    Input
               On entry: unless MATRIX = 'G', DIAG must specify whether the
               diagonal elements of the matrix are to be printed, as
               follows:

               DIAG = 'B' (Blank), the diagonal elements of the matrix are
               not referenced and not printed.

               DIAG = 'U' (Unit diagonal), the diagonal elements of the
               matrix are not referenced, but are assumed all to be unity,
               and are printed as such.

               DIAG = 'N' (Non-unit diagonal), the diagonal elements of the
               matrix are referenced and printed.

               If MATRIX = 'G', then DIAG need not be set. Constraint: If
               MATRIX /= 'G', then DIAG must be one of 'B', 'U' or 'N'.

           3:  M -- INTEGER                                           Input

           4:  N -- INTEGER                                           Input
               On entry: the number of rows and columns of the matrix,
               respectively, to be printed.

               If either of M or N is less than 1, X04CAF will exit
               immediately after printing TITLE; no row or column labels
               are printed.

           5:  A(LDA,*) -- DOUBLE PRECISION array                     Input
               Note: the second dimension of the array A must be at least
               max(1,N).
               On entry: the matrix to be printed. Only the elements that
               will be referred to, as specified by parameters MATRIX and
               DIAG, need be set.

           6:  LDA -- INTEGER                                         Input
               On entry:
               the first dimension of the array A as declared in the
               (sub)program from which X04CAF is called.
               Constraint: LDA >= M.

           7:  TITLE -- CHARACTER*(*)                                 Input
               On entry: a title to be printed above the matrix. If TITLE =
               ' ', no title (and no blank line) will be printed.

               If TITLE contains more than 80 characters, the contents of
               TITLE will be wrapped onto more than one line, with the
               break after 80 characters.

               Any trailing blank characters in TITLE are ignored.

           8:  IFAIL -- INTEGER                                Input/Output
               On entry: IFAIL must be set to 0, -1 or 1. For users not
               familiar with this parameter (described in the Essential
               Introduction) the recommended value is 0.

               On exit: IFAIL = 0 unless the routine detects an error (see
               Section 6).

          6. Error Indicators and Warnings

          Errors detected by the routine:

          If on entry IFAIL = 0 or -1, explanatory error messages are
          output on the current error message unit (as defined by X04AAF).

          IFAIL= 1
               On entry MATRIX /= 'G', 'L' or 'U'.

          IFAIL= 2
               On entry MATRIX = 'L' or 'U', but DIAG /= 'N', 'U' or 'B'.

          IFAIL= 3
               On entry LDA < M.

          7. Accuracy

          Not applicable.

          8. Further Comments

          A call to X04CAF is equivalent to a call to X04CBF(*) with the
          following argument values:


                NCOLS = 80
                INDENT = 0
                LABROW = 'I'
                LABCOL = 'I'
                FORMAT = ' '


          9. Example

          This example program calls X04CAF twice, first to print a 3 by 5
          rectangular matrix, and then to print a 5 by 5 lower triangular
          matrix.

          The example program is not reproduced here. The source code for
          all example programs is distributed with the NAG Foundation
          Library software and should be available on-line.

\end{verbatim}
\endscroll
\end{page}
\begin{page}{manpageXXx04daf}{NAG On-line Documentation: x04daf}
\beginscroll
\begin{verbatim}



     X04DAF(3NAG)      Foundation Library (12/10/92)      X04DAF(3NAG)



          X04 -- Input/Output Utilities                              X04DAF
                  X04DAF -- NAG Foundation Library Routine Document

          Note: Before using this routine, please read the Users' Note for
          your implementation to check implementation-dependent details.
          The symbol (*) after a NAG routine name denotes a routine that is
          not included in the Foundation Library.

          1. Purpose

          X04DAF is an easy-to-use routine to print a complex matrix stored
          in a two-dimensional array.

          2. Specification

                 SUBROUTINE X04DAF (MATRIX, DIAG, M, N, A, LDA, TITLE,
                1                   IFAIL)
                 INTEGER              M, N, LDA, IFAIL
                 COMPLEX(KIND(1.0D0)) A(LDA,*)
                 CHARACTER*1          MATRIX, DIAG
                 CHARACTER*(*)        TITLE

          3. Description

          X04DAF prints a complex matrix. It is an easy-to-use driver for
          X04DBF(*). The routine uses default values for the format in
          which numbers are printed, for labelling the rows and columns,
          and for output record length.

          X04DAF will choose a format code such that numbers will be
          printed with either an F8.4, F11.4 or a 1PE13.4 format. The F8.4
          code is chosen if the sizes of all the matrix elements to be
          printed lie between 0.001 and 1.0. The F11.4 code is chosen if
          the sizes of all the matrix elements to be printed lie between 0.
          001 and 9999.9999. Otherwise the 1PE13.4 code is chosen. The
          chosen code is used to print each complex element of the matrix
          with the real part above the imaginary part.

          The matrix is printed with integer row and column labels, and
          with a maximum record length of 80.

          The matrix is output to the unit defined by X04ABF.

          4. References

          None.

          5. Parameters

           1:  MATRIX -- CHARACTER*1                                  Input
               On entry: indicates the part of the matrix to be printed, as
               follows:

               MATRIX = 'G' (General), the whole of the rectangular matrix.

               MATRIX = 'L' (Lower), the lower triangle of the matrix, or
               the lower trapezium if the matrix has more rows than
               columns.

               MATRIX = 'U' (Upper), the upper triangle of the matrix, or
               the upper trapezium if the matrix has more columns than
               rows. Constraint: MATRIX must be one of 'G', 'L' or 'U'.

           2:  DIAG -- CHARACTER*1                                    Input
               On entry: unless MATRIX = 'G', DIAG must specify whether the
               diagonal elements of the matrix are to be printed, as
               follows:

               DIAG = 'B' (Blank), the diagonal elements of the matrix are
               not referenced and not printed.

               DIAG = 'U' (Unit diagonal), the diagonal elements of the
               matrix are not referenced, but are assumed all to be unity,
               and are printed as such.

               DIAG = 'N' (Non-unit diagonal), the diagonal elements of the
               matrix are referenced and printed.

               If MATRIX = 'G', then DIAG need not be set. Constraint: If
               MATRIX /= 'G', then DIAG must be one of 'B', 'U' or 'N'.

           3:  M -- INTEGER                                           Input

           4:  N -- INTEGER                                           Input
               On entry: the number of rows and columns of the matrix,
               respectively, to be printed.

               If either of M or N is less than 1, X04DAF will exit
               immediately after printing TITLE; no row or column labels
               are printed.

           5:  A(LDA,*) -- COMPLEX(KIND(1.0D)) array                  Input
               Note: the second dimension of the array A must be at least
               max(1,N).
               On entry: the matrix to be printed. Only the elements that
               will be referred to, as specified by parameters MATRIX and
               DIAG, need be set.

           6:  LDA -- INTEGER                                         Input
               On entry:
               the first dimension of the array A as declared in the
               (sub)program from which X04DAF is called.
               Constraint: LDA >= M.

           7:  TITLE -- CHARACTER*(*)                                 Input

               On entry: a title to be printed above the matrix. If TITLE =
               ' ', no title (and no blank line) will be printed.

               If TITLE contains more than 80 characters, the contents of
               TITLE will be wrapped onto more than one line, with the
               break after 80 characters.

               Any trailing blank characters in TITLE are ignored.

           8:  IFAIL -- INTEGER                                Input/Output
               On entry: IFAIL must be set to 0, -1 or 1. For users not
               familiar with this parameter (described in the Essential
               Introduction) the recommended value is 0.

               On exit: IFAIL = 0 unless the routine detects an error (see
               Section 6).

          6. Error Indicators and Warnings

          Errors detected by the routine:

          If on entry IFAIL = 0 or -1, explanatory error messages are
          output on the current error message unit (as defined by X04AAF).

          IFAIL= 1
               On entry MATRIX /= 'G', 'L' or 'U'.

          IFAIL= 2
               On entry MATRIX = 'L' or 'U', but DIAG /= 'N', 'U' or 'B'.

          IFAIL= 3
               On entry LDA < M.

          7. Accuracy

          Not applicable.

          8. Further Comments

          A call to X04DAF is equivalent to a call to X04DBF(*) with the
          following argument values:


                NCOLS = 80
                INDENT = 0
                LABROW = 'I'
                LABCOL = 'I'
                FORMAT = ' '
                USEFRM = 'A'


          9. Example

          This example program calls X04DAF twice, first to print a 4 by 3
          rectangular matrix, and then to print a 4 by 4 lower triangular
          matrix.

          The example program is not reproduced here. The source code for
          all example programs is distributed with the NAG Foundation
          Library software and should be available on-line.


\end{verbatim}
\endscroll
\end{page}
\begin{page}{manpageXXx05}{NAG On-line Documentation: x05}
\beginscroll
\begin{verbatim}



     X05(3NAG)         Foundation Library (12/10/92)         X05(3NAG)



          X05 -- Date and Time Utilities                Introduction -- X05
                                    Chapter X05
                              Date and Time Utilities

          1. Scope of the Chapter

          This chapter provides routines to obtain the current real time,
          and the amount of processor time used.

          2. Background to the Problems

          2.1. Real Time

          Routines are provided to obtain the current time in two different
          formats, and to compare two such times.

          2.2. Processor Time

          A routine is provided to return the current amount of processor
          time used. This allows the timing of a particular routine or
          section of code.

          3. Recommendations on Choice and Use of Routines

          X05AAF     returns the current date/time in integer format.

          X05ABF     converts from integer to character string date/time.

          X05ACF     compares two date/time character strings.

          X05BAF     returns the amount of processor time used.


          X05 -- Date and Time Utilities                    Contents -- X05
          Chapter X05

          Date and Time Utilities

          X05AAF  Return date and time as an array of integers

          X05ABF  Convert array of integers representing date and time to
                  character string

          X05ACF  Compare two character strings representing date and time

          X05BAF  Return the CPU time

\end{verbatim}
\endscroll
\end{page}
\begin{page}{manpageXXx05aaf}{NAG On-line Documentation: x05aaf}
\beginscroll
\begin{verbatim}



     X05AAF(3NAG)      Foundation Library (12/10/92)      X05AAF(3NAG)



          X05 -- Date and Time Utilities                             X05AAF
                  X05AAF -- NAG Foundation Library Routine Document

          Note: Before using this routine, please read the Users' Note for
          your implementation to check implementation-dependent details.
          The symbol (*) after a NAG routine name denotes a routine that is
          not included in the Foundation Library.

          1. Purpose

          X05AAF returns the current date and time.

          2. Specification

                 SUBROUTINE X05AAF (ITIME)
                 INTEGER          ITIME(7)

          3. Description

          X05AAF returns the current date and time as a set of seven
          integers.

          4. References

          None.

          5. Parameters

           1:  ITIME(7) -- INTEGER array                             Output
               On exit: the current date and time, as follows:

               ITIME(1) contains the current year.

               ITIME(2) contains the current month, in the range 1--12.

               ITIME(3) contains the current day, in the range 1--31.

               ITIME(4) contains the current hour, in the range 0--23.

               ITIME(5) contains the current minute, in the range 0--59.

               ITIME(6) contains the current second, in the range 0--59.

               ITIME(7) contains the current millisecond, in the range 0--
               999.

          6. Error Indicators and Warnings

          None.

          7. Accuracy

          The accuracy of this routine depends on the accuracy of the host
          machine. In particular, on some machines it may not be possible
          to return a value for the current millisecond, for example. In
          this case, the value returned will be zero.

          8. Further Comments

          None.

          9. Example

          This program prints out the vector ITIME after a call to X05AAF.

          The example program is not reproduced here. The source code for
          all example programs is distributed with the NAG Foundation
          Library software and should be available on-line.
\end{verbatim}
\endscroll
\end{page}
\begin{page}{manpageXXx05abf}{NAG On-line Documentation: x05abf}
\beginscroll
\begin{verbatim}



     X05ABF(3NAG)      Foundation Library (12/10/92)      X05ABF(3NAG)



          X05 -- Date and Time Utilities                             X05ABF
                  X05ABF -- NAG Foundation Library Routine Document

          Note: Before using this routine, please read the Users' Note for
          your implementation to check implementation-dependent details.
          The symbol (*) after a NAG routine name denotes a routine that is
          not included in the Foundation Library.

          1. Purpose

          X05ABF converts from a seven-integer format time and date, as
          returned by X05AAF, into a character string, returned via the
          routine name.

          2. Specification

                 CHARACTER*30 FUNCTION X05ABF (ITIME)
                 INTEGER          ITIME(7)

          3. Description

          X05ABF returns a character string of length 30 which contains the
          date and time as supplied in argument ITIME. On exit, the
          character string has the following format:


                `DAY XXTH MTH YEAR HR:MN:SC.MIL',


            where  DAY   is one of 'Sun', 'Mon', 'Tue', 'Wed', 'Thu',
                         'Fri', 'Sat',

                   XX    is an integer denoting the day of the month,

                   TH    is one of 'st', 'nd', 'rd', 'th',

                   MTH   is one of 'Jan', 'Feb', 'Mar', 'Apr', 'May',
                         'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',

                   YEAR  is the year as a four digit integer,

                   HR    is the hour,

                   MN    is the minute,

                   SC    is the second,

                   MIL   is the millisecond.

          If on entry the date in ITIME is invalid, the string returned is

          4. References

          None.

          5. Parameters

           1:  ITIME(7) -- INTEGER array                              Input
               On entry: a date and time in the format returned by X05AAF,
               as follows:
                   ITIME   must contain the year as a positive integer.
                   (1)

                   ITIME   must contain the month, in the range 1-12.
                   (2)

                   ITIME   must contain the day, in the range 1 to p, where
                   (3)     p = 28, 29, 30 or 31, depending on the month and
                           year.

                   ITIME   must contain the hour, in the range 0-23.
                   (4)

                   ITIME   must contain the minute, in the range 0-59.
                   (5)

                   ITIME   must contain the second, in the range 0-59.
                   (6)

                   ITIME   must contain the millisecond, in the range 0-
                   (7)     999.

          6. Error Indicators and Warnings

          None.

          7. Accuracy

          The day name included as part of the character string returned by
          this routine is calculated assuming that the date is part of the
          Gregorian calendar. This calendar has been in operation in Europe
          since October the 15th 1582, and in Great Britain since September
          the 14th 1752. Entry to this routine with a date earlier than
          these will therefore not return a day name that is historically
          accurate.

          8. Further Comments

          Two dates stored in character string format, as returned by this
          routine, may be compared by X05ACF.

          9. Example

          This program initialises a time in ITIME, and converts it to
          character format by a call to X05ABF.

          The example program is not reproduced here. The source code for
          all example programs is distributed with the NAG Foundation
          Library software and should be available on-line.
\end{verbatim}
\endscroll
\end{page}
\begin{page}{manpageXXx05acf}{NAG On-line Documentation: x05acf}
\beginscroll
\begin{verbatim}



     X05ACF(3NAG)      Foundation Library (12/10/92)      X05ACF(3NAG)



          X05 -- Date and Time Utilities                             X05ACF
                  X05ACF -- NAG Foundation Library Routine Document

          Note: Before using this routine, please read the Users' Note for
          your implementation to check implementation-dependent details.
          The symbol (*) after a NAG routine name denotes a routine that is
          not included in the Foundation Library.

          1. Purpose

          X05ACF compares two date/time character strings, each stored in
          the format returned by X05ABF.

          2. Specification

                 INTEGER FUNCTION X05ACF (CTIME1, CTIME2)
                 CHARACTER*(*)    CTIME1, CTIME2

          3. Description

          X05ACF compares two date/time character strings, and returns an
          integer that specifies which one is the earliest. The result is
          an integer returned through the routine name, with meaning as
          follows:

               X05ACF = -1: the first date/time string is earlier than the
               second.

               X05ACF = 0: the two date/time strings are equivalent.

               X05ACF = 1: the first date/time string is later than the
               second.

          4. References

          None.

          5. Parameters

           1:  CTIME1 -- CHARACTER*(*)                                Input

           2:  CTIME2 -- CHARACTER*(*)                                Input
               On entry: the date/time strings to be compared. These are
               expected be in the format returned by X05ABF, although
               X05ACF will still attempt to interpret the strings if they
               vary slightly from this format. See Section 8 for further
               details.

          6. Error Indicators and Warnings

          None.

          7. Accuracy

          Not applicable.

          8. Further Comments

          For flexibility, X05ACF will accept various formats for the two
          date/time strings CTIME1 and CTIME2.

          The strings do not have to be the same length. It is permissible,
          for example, to enter with one or both of the strings truncated
          to a smaller length, in which case missing fields are treated as
          zero.

          Each character string may be of any length, but everything after
          character 80 is ignored.

          Each string may or may not include an alphabetic day name, such
          as 'Wednesday', at its start. These day names are ignored, and no
          check is made that the day name corresponds correctly to the rest
          of the date.

          The month name may contain any number of characters provided it
          uniquely identifies the month, however all characters that are
          supplied are significant.

          Each field in the character string must be separated by one or
          more spaces.

          The case of all alphabetic characters is insignificant.

          Any field in a date time string that is indecipherable according
          to the above rules will be converted to a zero value internally.
          Thus two strings that are completely indecipherable will compare
          equal.

          According to these rules, all the following date/time strings are
          equivalent:

              'Thursday 10th July 1958 12:43:17.320'

              'THU 10th JULY 1958 12:43:17.320'

              '10th Jul 1958 12:43:17.320'

          9. Example

          This program initialises two date/time strings, and compares them
          by a call to X05ACF.


          The example program is not reproduced here. The source code for
          all example programs is distributed with the NAG Foundation
          Library software and should be available on-line.

\end{verbatim}
\endscroll
\end{page}
\begin{page}{manpageXXx05baf}{NAG On-line Documentation: x05baf}
\beginscroll
\begin{verbatim}



     X05BAF(3NAG)      Foundation Library (12/10/92)      X05BAF(3NAG)



          X05 -- Date and Time Utilities                             X05BAF
                  X05BAF -- NAG Foundation Library Routine Document

          Note: Before using this routine, please read the Users' Note for
          your implementation to check implementation-dependent details.
          The symbol (*) after a NAG routine name denotes a routine that is
          not included in the Foundation Library.

          1. Purpose

          X05BAF returns the amount of processor time used since an
          unspecified previous time, via the routine name.

          2. Specification

                 DOUBLE PRECISION FUNCTION X05BAF ()

          3. Description

          X05BAF returns the number of seconds of processor time used since
          some previous time. The previous time is system dependent, but
          may be, for example, the time the current job or the current
          program started running.

          If the system clock of the host machine is inaccessible for any
          reason, X05BAF returns the value zero.

          4. References

          None.

          5. Parameters

          None.

          6. Error Indicators and Warnings

          None.

          7. Accuracy

          The accuracy of the value returned depends on the accuracy of the
          system clock on the host machine.

          8. Further Comments

          Since the value returned by X05BAF is the amount of processor
          time since some unspecified earlier time, no significance should
          be placed on the value other than as a marker to be compared with
          some later figure returned by X05BAF. The amount of processor
          time that has elapsed between two calls of X05BAF can be simply
          calculated as the earlier value subtracted from the later value.

          9. Example

          This program makes a call to X05BAF, performs some computations,
          makes another call to X05BAF, and gives the time used by the
          computations as the difference between the two returned values.

          The example program is not reproduced here. The source code for
          all example programs is distributed with the NAG Foundation
          Library software and should be available on-line.
\end{verbatim}
\endscroll
\end{page}