forked from johannesgerer/jburkardt-f
-
Notifications
You must be signed in to change notification settings - Fork 1
/
subpak.html
601 lines (568 loc) · 17.5 KB
/
subpak.html
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
<html>
<head>
<title>
SUBPAK - A Utility Library
</title>
</head>
<body bgcolor="#EEEEEE" link="#CC0000" alink="#FF3300" vlink="#000055">
<h1 align = "center">
SUBPAK <br> A Utility Library
</h1>
<hr>
<p>
<b>SUBPAK</b>
is a FORTRAN90 library which
contains a number of utility routines.
</p>
<h3 align = "center">
Licensing:
</h3>
<p>
The computer code and data files described and made available on this web page
are distributed under
<a href = "../../txt/gnu_lgpl.txt">the GNU LGPL license.</a>
</p>
<h3 align = "center">
Languages:
</h3>
<p>
<b>SUBPAK</b> is available in
<a href = "../../c_src/subpak/subpak.html">a C version</a> and
<a href = "../../cpp_src/subpak/subpak.html">a C++ version</a> and
<a href = "../../f77_src/subpak/subpak.html">a FORTRAN77 version</a> and
<a href = "../../f_src/subpak/subpak.html">a FORTRAN90 version</a> and
<a href = "../../m_src/subpak/subpak.html">a MATLAB version.</a>
</p>
<h3 align = "center">
Related Data and Programs:
</h3>
<p>
<a href = "../../f_src/c4lib/c4lib.html">
C4LIB</a>,
a FORTRAN90 library which
implements certain elementary functions for "C4" or
single precision complex variables;
</p>
<p>
<a href = "../../f_src/c8lib/c8lib.html">
C8LIB</a>,
a FORTRAN90 library which
implements certain elementary functions for "C8" or
double precision complex variables;
</p>
<p>
<a href = "../../f_src/cell/cell.html">
CELL</a>,
a FORTRAN90 library which
defines a cell array, a generalization of an array which
can compactly store and retrieve vector or matrix data of
varying size, such as the rows of a triangular matrix.
</p>
<p>
<a href = "../../f_src/i4lib/i4lib.html">
I4LIB</a>,
a FORTRAN90 library which
contains many utility routines, using "I4" or "single precision integer"
arithmetic.
</p>
<p>
<a href = "../../f_src/i8lib/i8lib.html">
I8LIB</a>,
a FORTRAN90 library which
contains many utility routines, using "I8" or "double precision integer"
arithmetic.
</p>
<p>
<a href = "../../f_src/index/index.html">
INDEX</a>,
a FORTRAN90 library which
converts a multidimensional vector index to a one-dimensional vector index;
it can handle zero and one based indexing schemes, as well as column major
and row major conventions.
</p>
<p>
<a href = "../../f_src/r16lib/r16lib.html">
R16LIB</a>,
a FORTRAN90 library which
contains many utility routines, using "R16" or
"quadruple precision real" arithmetic.
</p>
<p>
<a href = "../../f_src/r4lib/r4lib.html">
R4LIB</a>,
a FORTRAN90 library which
contains many utility routines, using "R4" or
"single precision real" arithmetic.
</p>
<p>
<a href = "../../f_src/r8lib/r8lib.html">
R8LIB</a>,
a FORTRAN90 library which
contains many utility routines, using "R8" or
"double precision real" arithmetic.
</p>
<h3 align = "center">
Reference:
</h3>
<p>
<ol>
<li>
Milton Abramowitz, Irene Stegun,<br>
Handbook of Mathematical Functions,<br>
National Bureau of Standards, 1964,<br>
ISBN: 0-486-61272-4,<br>
LC: QA47.A34.
</li>
<li>
Book Industry Study Group,<br>
The Evolution in Product Identification:
Sunrise 2005 and the ISBN-13,<br>
<a href = "http://www.bisg.org/docs/The_Evolution_in_Product_ID.pdf">
http://www.bisg.org/docs/The_Evolution_in_Product_ID.pdf</a>
</li>
<li>
Thomas Cormen, Charles Leiserson, Ronald Rivest,<br>
Introduction to Algorithms,<br>
MIT Press, 2001,<br>
ISBN: 0262032937,<br>
LC: QA76.C662.
</li>
<li>
Donald Kreher, Douglas Simpson,<br>
Combinatorial Algorithms,<br>
CRC Press, 1998,<br>
ISBN: 0-8493-3988-X,<br>
LC: QA164.K73.
</li>
<li>
Peter Lewis, Allen Goodman, James Miller,<br>
A Pseudo-Random Number Generator for the System/360,<br>
IBM Systems Journal,<br>
Volume 8, 1969, pages 136-143.
</li>
<li>
MIL-STD 1753,<br>
Fortran, DoD Supplement to American National Standard X3.9-1978,<br>
November, 1978.
</li>
<li>
Albert Nijenhuis, Herbert Wilf,<br>
Combinatorial Algorithms for Computers and Calculators,<br>
Second Edition,<br>
Academic Press, 1978,<br>
ISBN: 0-12-519260-6,<br>
LC: QA164.N54.
</li>
<li>
Branch Rickey,<br>
Goodby to Some Old Baseball Ideas,<br>
Life Magazine,<br>
2 August 1954.
</li>
<li>
Alan Schwarz,<br>
Looking Beyond the Batting Average,<br>
The New York Times, <br>
Sunday, 1 August 2004.
</li>
</ol>
</p>
<h3 align = "center">
Source Code:
</h3>
<p>
<ul>
<li>
<a href = "subpak.f90">subpak.f90</a>, the source code;
</li>
<li>
<a href = "subpak.sh">subpak.sh</a>,
commands to compile the source code;
</li>
</ul>
</p>
<h3 align = "center">
Examples and Tests:
</h3>
<p>
<ul>
<li>
<a href = "subpak_prb.f90">subpak_prb.f90</a>, a sample calling
program;
</li>
<li>
<a href = "subpak_prb.sh">subpak_prb.sh</a>, commands to
compile, link and run the sample calling program;
</li>
<li>
<a href = "subpak_prb_output.txt">subpak_prb_output.txt</a>,
the output file.
</li>
</ul>
</p>
<h3 align = "center">
List of Routines:
</h3>
<p>
<ul>
<li>
<b>ANGLE_SHIFT</b> shifts angle ALPHA to lie between BETA and BETA+2PI.
</li>
<li>
<b>ANGLE_SHIFT_DEG</b> shifts angle ALPHA to lie between BETA and BETA+360.
</li>
<li>
<b>ANGLE_TO_RGB</b> returns a color on the perimeter of the color hexagon.
</li>
<li>
<b>AXIS_LIMITS</b> returns "nice" axis limits for a plot.
</li>
<li>
<b>BAR_CHECK</b> computes the check digit for a barcode.
</li>
<li>
<b>BAR_CODE</b> constructs the 113 character barcode from 11 digits.
</li>
<li>
<b>BAR_DIGIT_CODE_LEFT</b> returns the 7 character left bar code for a digit.
</li>
<li>
<b>BAR_DIGIT_CODE_RIGHT</b> returns the 7 character right bar code for a digit.
</li>
<li>
<b>BMI_ENGLISH</b> computes the body mass index given English measurements.
</li>
<li>
<b>BMI_METRIC</b> computes the body mass index given metric measurements.
</li>
<li>
<b>CH_IS_DIGIT</b> is TRUE if C is a decimal digit.
</li>
<li>
<b>DEGREES_TO_RADIANS</b> converts an angle measure from degrees to radians.
</li>
<li>
<b>E_CONSTANT</b> returns the value of E.
</li>
<li>
<b>EULER_CONSTANT</b> returns the value of the Euler-Mascheroni constant.
</li>
<li>
<b>FAC_DIV</b> divides two quantities represented as prime factors.
</li>
<li>
<b>FAC_GCD</b> finds the GCD of two products of prime factors.
</li>
<li>
<b>FAC_LCM</b> finds the LCM of two products of prime factors.
</li>
<li>
<b>FAC_MUL</b> multiplies two quantities represented as prime factors.
</li>
<li>
<b>FAC_PRINT</b> prints a product of prime factors.
</li>
<li>
<b>FAC_TO_I4</b> converts a product of prime factors into an integer.
</li>
<li>
<b>FAC_TO_RAT</b> converts a prime factorization into a rational value.
</li>
<li>
<b>FEET_TO_METERS</b> converts a measurement in feet to meters.
</li>
<li>
<b>GAUSS_SUM</b> evaluates a function that is the sum of Gaussians.
</li>
<li>
<b>GET_SEED</b> returns a seed for the random number generator.
</li>
<li>
<b>GET_UNIT</b> returns a free FORTRAN unit number.
</li>
<li>
<b>GRID1</b> finds grid points between X1 and X2 in N dimensions.
</li>
<li>
<b>GRID1N</b> finds the I-th grid point between X1 and X2 in N dimensions.
</li>
<li>
<b>GRID2</b> computes grid points between X1 and X2 in N dimensions.
</li>
<li>
<b>GRID2N</b> computes one grid point between X1 and X2 in N dimensions.
</li>
<li>
<b>GRID3</b> computes a grid on the parallelogram set by X1, X2 and X3 in N space.
</li>
<li>
<b>GRID3N</b> computes a parallelogram grid on 3 points in N dimensions.
</li>
<li>
<b>GRID4</b> computes a grid on the parallelogram set by X1, X2 and X3 in N space.
</li>
<li>
<b>GRID4N</b> computes a single point on a parallelogram grid in N space.
</li>
<li>
<b>I4_MODP</b> returns the nonnegative remainder of I4 division.
</li>
<li>
<b>I4_SIGN</b> evaluates the sign of an I4.
</li>
<li>
<b>I4_SWAP</b> swaps two I4's.
</li>
<li>
<b>I4_TO_DIGITS_DECIMAL</b> determines the last N decimal digits of an I4.
</li>
<li>
<b>I4_TO_FAC</b> converts an I4 into a product of prime factors.
</li>
<li>
<b>I4_TO_ISBN</b> converts an I4 to an ISBN digit.
</li>
<li>
<b>I4_UNIFORM</b> returns a scaled pseudorandom I4.
</li>
<li>
<b>I4INT_TO_R8INT</b> maps an I4INT to an R8INT.
</li>
<li>
<b>I4VEC_INDICATOR</b> sets an I4VEC to the indicator vector.
</li>
<li>
<b>I4VEC_MIN</b> computes the minimum element of an I4VEC.
</li>
<li>
<b>I4VEC_PERMUTE</b> permutes an I4VEC in place.
</li>
<li>
<b>I4VEC_PRINT</b> prints an I4VEC.
</li>
<li>
<b>I4VEC_UNIFORM</b> returns a scaled pseudorandom I4VEC.
</li>
<li>
<b>IJ_NEXT</b> returns the next matrix index.
</li>
<li>
<b>IJ_NEXT_GT</b> returns the next matrix index, with the constraint that I < J.
</li>
<li>
<b>INDEX_BOX2_NEXT_2D</b> produces indices on the surface of a box in 2D.
</li>
<li>
<b>INDEX_BOX2_NEXT_3D</b> produces indices on the surface of a box in 3D.
</li>
<li>
<b>INDEX1_COL</b> indexes a 1D vector by columns.
</li>
<li>
<b>INDEX1_ROW</b> indexes a 1D vector by rows.
</li>
<li>
<b>INDEX2_COL</b> indexes a 2D array by columns.
</li>
<li>
<b>INDEX2_ROW</b> indexes a 2D array by row.
</li>
<li>
<b>INDEX3_COL</b> indexes a 3D array by columns.
</li>
<li>
<b>INDEX3_ROW</b> indexes a 3D array by rows.
</li>
<li>
<b>INDEX4_COL</b> indexes a 4D array by columns.
</li>
<li>
<b>INDEX4_ROW</b> indexes a 4D array by rows.
</li>
<li>
<b>INDEXN_COL</b> indexes an ND array by columns.
</li>
<li>
<b>INDEXN_ROW</b> indexes an ND array by rows.
</li>
<li>
<b>ISBN_CHECK</b> checks an ISBN code.
</li>
<li>
<b>ISBN_FILL</b> fills in a missing digit in an ISBN code.
</li>
<li>
<b>ISBN_TO_I4</b> converts an ISBN character into an integer.
</li>
<li>
<b>ISET2_COMPARE</b> compares two I2 sets.
</li>
<li>
<b>ISET2_INDEX_INSERT_UNIQUE</b> inserts unique values into an indexed sorted list.
</li>
<li>
<b>ISET2_INDEX_SEARCH</b> searches for an I2 set value in an indexed sorted list.
</li>
<li>
<b>LCM_12N</b> computes the least common multiple of the integers 1 through N.
</li>
<li>
<b>LMAT_PRINT</b> prints an LMAT.
</li>
<li>
<b>LMAT_PRINT_SOME</b> prints some of an LMAT.
</li>
<li>
<b>LMAT_TRANSPOSE_PRINT</b> prints an LMAT, transposed.
</li>
<li>
<b>LMAT_TRANSPOSE_PRINT_SOME</b> prints some of an LMAT, transposed.
</li>
<li>
<b>LUHN_CHECK</b> computes the Luhn checksum for a string of digits.
</li>
<li>
<b>LVEC_PRINT</b> prints an LVEC.
</li>
<li>
<b>LVEC_PRINT_SOME</b> prints "some" of an LVEC.
</li>
<li>
<b>PAUSE_INPUT</b> waits until an input character is entered.
</li>
<li>
<b>PERM_CHECK</b> checks that a vector represents a permutation.
</li>
<li>
<b>PERM_CYCLE</b> analyzes a permutation.
</li>
<li>
<b>PERM_FREE</b> reports the number of unused items in a partial permutation.
</li>
<li>
<b>PERM_INVERSE</b> inverts a permutation "in place".
</li>
<li>
<b>PERM_NEXT</b> computes all of the permutations on N objects, one at a time.
</li>
<li>
<b>PERM_PRINT</b> prints a permutation.
</li>
<li>
<b>PERM_UNIFORM</b> selects a random permutation of N objects.
</li>
<li>
<b>POUNDS_TO_KILOGRAMS</b> converts a measurement in pounds to kilograms.
</li>
<li>
<b>PRIME</b> returns any of the first PRIME_MAX prime numbers.
</li>
<li>
<b>PRIME_GE</b> returns the smallest prime greater than or equal to N.
</li>
<li>
<b>PRIMER</b> computes the prime numbers up to a given limit.
</li>
<li>
<b>R8_LOG_10</b> returns the logarithm base 10 of an R8.
</li>
<li>
<b>R8_UNIFORM</b> returns a scaled pseudorandom R8.
</li>
<li>
<b>R8_UNIFORM_01</b> returns a unit pseudorandom R8.
</li>
<li>
<b>R8MAT_PRINT</b> prints an R8MAT.
</li>
<li>
<b>R8MAT_PRINT_SOME</b> prints some of an R8MAT.
</li>
<li>
<b>R8MAT_TRANSPOSE_PRINT</b> prints an R8MAT, transposed.
</li>
<li>
<b>R8MAT_TRANSPOSE_PRINT_SOME</b> prints some of an R8MAT, transposed.
</li>
<li>
<b>R8POLY_DEGREE</b> returns the degree of a polynomial.
</li>
<li>
<b>R8POLY_PRINT</b> prints out a polynomial.
</li>
<li>
<b>R8VEC_INDICATOR</b> sets an R8VEC to the indicator vector.
</li>
<li>
<b>R8VEC_MEAN</b> returns the mean of an R8VEC.
</li>
<li>
<b>R8VEC_PRINT</b> prints an R8VEC.
</li>
<li>
<b>R8VEC_VARIANCE</b> returns the variance of an R8VEC.
</li>
<li>
<b>RADIANS_TO_DEGREES</b> converts an angle measure from radians to degrees.
</li>
<li>
<b>RANDOM_INITIALIZE</b> initializes the FORTRAN90 random number seed.
</li>
<li>
<b>RAT_FACTOR</b> factors a rational value into a product of prime factors.
</li>
<li>
<b>RICKEY</b> evaluates Branch Rickey's baseball index.
</li>
<li>
<b>ROOTS_TO_I4POLY</b> converts polynomial roots to polynomial coefficients.
</li>
<li>
<b>ROOTS_TO_R8POLY</b> converts polynomial roots to polynomial coefficients.
</li>
<li>
<b>SORT_HEAP_EXTERNAL</b> externally sorts a list of items into ascending order.
</li>
<li>
<b>TIMESTAMP</b> prints the current YMDHMS date as a time stamp.
</li>
<li>
<b>TUPLE_NEXT2</b> computes the next element of an integer tuple space.
</li>
<li>
<b>TVEC_EVEN</b> computes evenly spaced angles between 0 and 2*PI.
</li>
<li>
<b>TVEC_EVEN2</b> computes evenly spaced angles between 0 and 2*PI.
</li>
<li>
<b>TVEC_EVEN3</b> computes evenly spaced angles between 0 and 2*PI.
</li>
<li>
<b>TVEC_EVEN_BRACKET</b> computes evenly spaced angles between THETA1 and THETA2.
</li>
<li>
<b>TVEC_EVEN_BRACKET2</b> computes evenly spaced angles from THETA1 to THETA2.
</li>
<li>
<b>TVEC_EVEN_BRACKET3</b> computes evenly spaced angles from THETA1 to THETA2.
</li>
<li>
<b>UPC_CHECK_DIGIT</b> returns the check digit of a UPC.
</li>
<li>
<b>VERSINE_PULSE</b> adds a versine pulse to a constant.
</li>
</ul>
</p>
<p>
You can go up one level to <a href = "../f_src.html">
the FORTRAN90 source codes</a>.
</p>
<hr>
<i>
Last revised on 02 November 2011.
</i>
<!-- John Burkardt -->
</body>
</html>