-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsphere_stereograph.cpp
1642 lines (1503 loc) · 34.5 KB
/
sphere_stereograph.cpp
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
# include <cstdlib>
# include <iostream>
# include <iomanip>
# include <cmath>
# include <ctime>
# include <cstring>
using namespace std;
# include "sphere_stereograph.hpp"
//****************************************************************************80
int i4_max ( int i1, int i2 )
//****************************************************************************80
//
// Purpose:
//
// I4_MAX returns the maximum of two I4's.
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 13 October 1998
//
// Author:
//
// John Burkardt
//
// Parameters:
//
// Input, int I1, I2, are two integers to be compared.
//
// Output, int I4_MAX, the larger of I1 and I2.
//
{
int value;
if ( i2 < i1 )
{
value = i1;
}
else
{
value = i2;
}
return value;
}
//****************************************************************************80
int i4_min ( int i1, int i2 )
//****************************************************************************80
//
// Purpose:
//
// I4_MIN returns the minimum of two I4's.
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 13 October 1998
//
// Author:
//
// John Burkardt
//
// Parameters:
//
// Input, int I1, I2, two integers to be compared.
//
// Output, int I4_MIN, the smaller of I1 and I2.
//
{
int value;
if ( i1 < i2 )
{
value = i1;
}
else
{
value = i2;
}
return value;
}
//****************************************************************************80
void plane_normal_basis_3d ( double pp[3], double pn[3], double pq[3],
double pr[3] )
//****************************************************************************80
//
// Purpose:
//
// PLANE_NORMAL_BASIS_3D finds two perpendicular vectors in a plane in 3D.
//
// Discussion:
//
// The normal form of a plane in 3D is:
//
// PP is a point on the plane,
// N is a normal vector to the plane.
//
// The two vectors to be computed, PQ and PR, can be regarded as
// the basis of a Cartesian coordinate system for points in the plane.
// Any point in the plane can be described in terms of the "origin"
// point PP plus a weighted sum of the two vectors PQ and PR:
//
// P = PP + a * PQ + b * PR.
//
// The vectors PQ and PR have unit length, and are perpendicular to N
// and to each other.
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 27 August 2005
//
// Author:
//
// John Burkardt
//
// Parameters:
//
// Input, double PP[3], a point on the plane.
//
// Input, double PN[3], a normal vector to the plane. The
// vector must not have zero length, but it is not necessary for PN
// to have unit length.
//
// Output, double PQ[3], a vector of unit length, perpendicular
// to the vector PN and the vector PR.
//
// Output, double PR[3], a vector of unit length, perpendicular
// to the vector PN and the vector PQ.
//
{
# define DIM_NUM 3
int i;
double normal_norm;
double pr_norm;
double *temp;
//
// Compute the length of NORMAL.
//
normal_norm = r8vec_norm ( DIM_NUM, pn );
if ( normal_norm == 0.0 )
{
cerr << "\n";
cerr << "PLANE_NORMAL_BASIS_3D - Fatal error!\n";
cerr << " The normal vector is 0.\n";
exit ( 1 );
}
//
// Find a vector PQ that is normal to PN and has unit length.
//
temp = r8vec_any_normal ( DIM_NUM, pn );
r8vec_copy ( DIM_NUM, temp, pq );
delete [] temp;
//
// Now just take the cross product PN x PQ to get the PR vector.
//
temp = r8vec_cross_product_3d ( pn, pq );
pr_norm = r8vec_norm ( DIM_NUM, temp );
for ( i = 0; i < DIM_NUM; i++ )
{
pr[i] = temp[i] / pr_norm;
}
delete [] temp;
return;
# undef DIM_NUM
}
//****************************************************************************80
double r8_abs ( double x )
//****************************************************************************80
//
// Purpose:
//
// R8_ABS returns the absolute value of an R8.
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 14 November 2006
//
// Author:
//
// John Burkardt
//
// Parameters:
//
// Input, double X, the quantity whose absolute value is desired.
//
// Output, double R8_ABS, the absolute value of X.
//
{
double value;
if ( 0.0 <= x )
{
value = + x;
}
else
{
value = - x;
}
return value;
}
//****************************************************************************80
void r8mat_transpose_print ( int m, int n, double a[], string title )
//****************************************************************************80
//
// Purpose:
//
// R8MAT_TRANSPOSE_PRINT prints an R8MAT, transposed.
//
// Discussion:
//
// An R8MAT is a doubly dimensioned array of R8 values, stored as a vector
// in column-major order.
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 10 September 2009
//
// Author:
//
// John Burkardt
//
// Parameters:
//
// Input, int M, N, the number of rows and columns.
//
// Input, double A[M*N], an M by N matrix to be printed.
//
// Input, string TITLE, a title.
//
{
r8mat_transpose_print_some ( m, n, a, 1, 1, m, n, title );
return;
}
//****************************************************************************80
void r8mat_transpose_print_some ( int m, int n, double a[], int ilo, int jlo,
int ihi, int jhi, string title )
//****************************************************************************80
//
// Purpose:
//
// R8MAT_TRANSPOSE_PRINT_SOME prints some of an R8MAT, transposed.
//
// Discussion:
//
// An R8MAT is a doubly dimensioned array of R8 values, stored as a vector
// in column-major order.
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 20 August 2010
//
// Author:
//
// John Burkardt
//
// Parameters:
//
// Input, int M, N, the number of rows and columns.
//
// Input, double A[M*N], an M by N matrix to be printed.
//
// Input, int ILO, JLO, the first row and column to print.
//
// Input, int IHI, JHI, the last row and column to print.
//
// Input, string TITLE, a title.
//
{
# define INCX 5
int i;
int i2;
int i2hi;
int i2lo;
int inc;
int j;
int j2hi;
int j2lo;
cout << "\n";
cout << title << "\n";
if ( m <= 0 || n <= 0 )
{
cout << "\n";
cout << " (None)\n";
return;
}
for ( i2lo = i4_max ( ilo, 1 ); i2lo <= i4_min ( ihi, m ); i2lo = i2lo + INCX )
{
i2hi = i2lo + INCX - 1;
i2hi = i4_min ( i2hi, m );
i2hi = i4_min ( i2hi, ihi );
inc = i2hi + 1 - i2lo;
cout << "\n";
cout << " Row: ";
for ( i = i2lo; i <= i2hi; i++ )
{
cout << setw(7) << i - 1 << " ";
}
cout << "\n";
cout << " Col\n";
cout << "\n";
j2lo = i4_max ( jlo, 1 );
j2hi = i4_min ( jhi, n );
for ( j = j2lo; j <= j2hi; j++ )
{
cout << setw(5) << j - 1 << ":";
for ( i2 = 1; i2 <= inc; i2++ )
{
i = i2lo - 1 + i2;
cout << setw(14) << a[(i-1)+(j-1)*m];
}
cout << "\n";
}
}
return;
# undef INCX
}
//****************************************************************************80
double *r8mat_uniform_01_new ( int m, int n, int *seed )
//****************************************************************************80
//
// Purpose:
//
// R8MAT_UNIFORM_01_NEW returns a unit pseudorandom R8MAT.
//
// Discussion:
//
// An R8MAT is a doubly dimensioned array of R8's, stored as a vector
// in column-major order.
//
// This routine implements the recursion
//
// seed = 16807 * seed mod ( 2**31 - 1 )
// unif = seed / ( 2**31 - 1 )
//
// The integer arithmetic never requires more than 32 bits,
// including a sign bit.
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 03 October 2005
//
// Author:
//
// John Burkardt
//
// Reference:
//
// Paul Bratley, Bennett Fox, Linus Schrage,
// A Guide to Simulation,
// Springer Verlag, pages 201-202, 1983.
//
// Bennett Fox,
// Algorithm 647:
// Implementation and Relative Efficiency of Quasirandom
// Sequence Generators,
// ACM Transactions on Mathematical Software,
// Volume 12, Number 4, pages 362-376, 1986.
//
// Philip Lewis, Allen Goodman, James Miller,
// A Pseudo-Random Number Generator for the System/360,
// IBM Systems Journal,
// Volume 8, pages 136-143, 1969.
//
// Parameters:
//
// Input, int M, N, the number of rows and columns.
//
// Input/output, int *SEED, the "seed" value. Normally, this
// value should not be 0, otherwise the output value of SEED
// will still be 0, and R8_UNIFORM will be 0. On output, SEED has
// been updated.
//
// Output, double R8MAT_UNIFORM_01_NEW[M*N], a matrix of pseudorandom values.
//
{
int i;
int j;
int k;
double *r;
r = new double[m*n];
for ( j = 0; j < n; j++ )
{
for ( i = 0; i < m; i++ )
{
k = *seed / 127773;
*seed = 16807 * ( *seed - k * 127773 ) - k * 2836;
if ( *seed < 0 )
{
*seed = *seed + 2147483647;
}
//
// Although SEED can be represented exactly as a 32 bit integer,
// it generally cannot be represented exactly as a 32 bit real number//
//
r[i+j*m] = ( double ) ( *seed ) * 4.656612875E-10;
}
}
return r;
}
//****************************************************************************80
double *r8vec_any_normal ( int dim_num, double v1[] )
//****************************************************************************80
//
// Purpose:
//
// R8VEC_ANY_NORMAL returns some normal vector to V1.
//
// Discussion:
//
// If DIM_NUM < 2, then no normal vector can be returned.
//
// If V1 is the zero vector, then any unit vector will do.
//
// No doubt, there are better, more robust algorithms. But I will take
// just about ANY reasonable unit vector that is normal to V1.
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 23 August 2005
//
// Author:
//
// John Burkardt
//
// Parameters:
//
// Input, int DIM_NUM, the spatial dimension.
//
// Input, double V1[DIM_NUM], the vector.
//
// Output, double R8VEC_ANY_NORMAL[DIM_NUM], a vector that is
// normal to V2, and has unit Euclidean length.
//
{
int i;
int j;
int k;
double *v2;
double vj;
double vk;
if ( dim_num < 2 )
{
cerr << "\n";
cerr << "R8VEC_ANY_NORMAL - Fatal error!\n";
cerr << " Called with DIM_NUM < 2.\n";
exit ( 1 );
}
v2 = new double[dim_num];
if ( r8vec_norm ( dim_num, v1 ) == 0.0 )
{
r8vec_zero ( dim_num, v2 );
v2[0] = 1.0;
return v2;
}
//
// Seek the largest entry in V1, VJ = V1(J), and the
// second largest, VK = V1(K).
//
// Since V1 does not have zero norm, we are guaranteed that
// VJ, at least, is not zero.
//
j = -1;
vj = 0.0;
k = -1;
vk = 0.0;
for ( i = 0; i < dim_num; i++ )
{
if ( r8_abs ( vk ) < r8_abs ( v1[i] ) || k == -1 )
{
if ( r8_abs ( vj ) < r8_abs ( v1[i] ) || j == -1 )
{
k = j;
vk = vj;
j = i;
vj = v1[i];
}
else
{
k = i;
vk = v1[i];
}
}
}
//
// Setting V2 to zero, except that V2(J) = -VK, and V2(K) = VJ,
// will just about do the trick.
//
r8vec_zero ( dim_num, v2 );
v2[j] = -vk / sqrt ( vk * vk + vj * vj );
v2[k] = vj / sqrt ( vk * vk + vj * vj );
return v2;
}
//****************************************************************************80
void r8vec_copy ( int n, double a1[], double a2[] )
//****************************************************************************80
//
// Purpose:
//
// R8VEC_COPY copies an R8VEC.
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 03 July 2005
//
// Author:
//
// John Burkardt
//
// Parameters:
//
// Input, int N, the number of entries in the vectors.
//
// Input, double A1[N], the vector to be copied.
//
// Input, double A2[N], the copy of A1.
//
{
int i;
for ( i = 0; i < n; i++ )
{
a2[i] = a1[i];
}
return;
}
//****************************************************************************80
double *r8vec_cross_product_3d ( double v1[3], double v2[3] )
//****************************************************************************80
//
// Purpose:
//
// R8VEC_CROSS_PRODUCT_3D computes the cross product of two R8VEC's in 3D.
//
// Discussion:
//
// An R8VEC is a vector of R8's.
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 07 August 2005
//
// Author:
//
// John Burkardt
//
// Parameters:
//
// Input, double V1[3], V2[3], the coordinates of the vectors.
//
// Output, double R8VEC_CROSS_PRODUCT_3D[3], the cross product vector.
//
{
double *v3;
v3 = new double[3];
v3[0] = v1[1] * v2[2] - v1[2] * v2[1];
v3[1] = v1[2] * v2[0] - v1[0] * v2[2];
v3[2] = v1[0] * v2[1] - v1[1] * v2[0];
return v3;
}
//****************************************************************************80
double r8vec_norm ( int n, double a[] )
//****************************************************************************80
//
// Purpose:
//
// R8VEC_NORM returns the L2 norm of an R8VEC.
//
// Discussion:
//
// An R8VEC is a vector of R8's.
//
// The vector L2 norm is defined as:
//
// R8VEC_NORM = sqrt ( sum ( 1 <= I <= N ) A(I)^2 ).
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 01 March 2003
//
// Author:
//
// John Burkardt
//
// Parameters:
//
// Input, int N, the number of entries in A.
//
// Input, double A[N], the vector whose L2 norm is desired.
//
// Output, double R8VEC_NORM, the L2 norm of A.
//
{
int i;
double v;
v = 0.0;
for ( i = 0; i < n; i++ )
{
v = v + a[i] * a[i];
}
v = sqrt ( v );
return v;
}
//****************************************************************************80
double r8vec_norm_affine ( int n, double v0[], double v1[] )
//****************************************************************************80
//
// Purpose:
//
// R8VEC_NORM_AFFINE returns the affine L2 norm of an R8VEC.
//
// Discussion:
//
// The affine vector L2 norm is defined as:
//
// R8VEC_NORM_AFFINE(V0,V1)
// = sqrt ( sum ( 1 <= I <= N ) ( V1(I) - V0(I) )^2
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 27 October 2010
//
// Author:
//
// John Burkardt
//
// Parameters:
//
// Input, int N, the dimension of the vectors.
//
// Input, double V0[N], the base vector.
//
// Input, double V1[N], the vector whose affine L2 norm is desired.
//
// Output, double R8VEC_NORM_AFFINE, the affine L2 norm of V1.
//
{
int i;
double value;
value = 0.0;
for ( i = 0; i < n; i++ )
{
value = value + ( v1[i] - v0[i] ) * ( v1[i] - v0[i] );
}
value = sqrt ( value );
return value;
}
//*****************************************************************************
void r8vec_normal_01 ( int n, int *seed, double x[] )
//*****************************************************************************
//
// Purpose:
//
// R8VEC_NORMAL_01 samples the standard normal probability distribution.
//
// Discussion:
//
// The standard normal probability distribution function (PDF) has
// mean 0 and standard deviation 1.
//
// This routine can generate a vector of values on one call. It
// has the feature that it should provide the same results
// in the same order no matter how we break up the task.
//
// Before calling this routine, the user may call RANDOM_SEED
// in order to set the seed of the random number generator.
//
// The Box-Muller method is used, which is efficient, but
// generates an even number of values each time. On any call
// to this routine, an even number of new values are generated.
// Depending on the situation, one value may be left over.
// In that case, it is saved for the next call.
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 18 August 2004
//
// Author:
//
// John Burkardt
//
// Parameters:
//
// Input, int N, the number of values desired. If N is negative,
// then the code will flush its internal memory; in particular,
// if there is a saved value to be used on the next call, it is
// instead discarded. This is useful if the user has reset the
// random number seed, for instance.
//
// Input/output, int *SEED, a seed for the random number generator.
//
// Output, double X[N], a sample of the standard normal PDF.
//
{
int i;
int m;
double pi = 3.141592653589793;
double *r;
static int made = 0;
static int saved = 0;
int xhi;
int xlo;
static double y = 0.0;
//
// I'd like to allow the user to reset the random number seed.
// But this won't work properly if we have a saved value Y.
// I'm making a crock option that allows the user to signal
// explicitly that any internal memory should be flushed,
// by passing in a negative value for N.
//
if ( n < 0 )
{
made = 0;
saved = 0;
y = 0.0;
return;
}
else if ( n == 0 )
{
return;
}
//
// Record the range of X we need to fill in.
//
xlo = 1;
xhi = n;
//
// Use up the old value, if we have it.
//
if ( saved == 1 )
{
x[0] = y;
saved = 0;
xlo = 2;
}
//
// If we don't need any more values, return.
//
if ( xhi - xlo + 1 == 0 )
{
return;
}
r = new double[n+1];
//
// If we need just one new value, do that here to avoid null arrays.
//
if ( xhi - xlo + 1 == 1 )
{
r8vec_uniform_01 ( 2, seed, r );
x[xhi-1] = sqrt ( -2.0 * log ( r[0] ) ) * cos ( 2.0 * pi * r[1] );
y = sqrt ( -2.0 * log ( r[0] ) ) * sin ( 2.0 * pi * r[1] );
saved = 1;
made = made + 2;
}
//
// If we require an even number of values, that's easy.
//
else if ( ( ( xhi-xlo+1) % 2 ) == 0 )
{
m = ( xhi-xlo+1 ) / 2;
r8vec_uniform_01 ( 2*m, seed, r );
for ( i = 0; i < 2*m; i = i + 2 )
{
x[xlo+i-1] = sqrt ( -2.0 * log ( r[i] ) ) * cos ( 2.0 * pi * r[i+1] );
x[xlo+i] = sqrt ( -2.0 * log ( r[i] ) ) * sin ( 2.0 * pi * r[i+1] );
}
made = made + xhi - xlo + 1;
}
//
// If we require an odd number of values, we generate an even number,
// and handle the last pair specially, storing one in X(N), and
// saving the other for later.
//
else
{
xhi = xhi - 1;
m = ( xhi-xlo+1 ) / 2 + 1;
r8vec_uniform_01 ( 2*m, seed, r );
for ( i = 0; i < 2*m-2; i = i + 2 )
{
x[xlo+i-1] = sqrt ( -2.0 * log ( r[i] ) ) * cos ( 2.0 * pi * r[i+1] );
x[xlo+i ] = sqrt ( -2.0 * log ( r[i] ) ) * sin ( 2.0 * pi * r[i+1] );
}
x[n-1] = sqrt ( -2.0 * log ( r[2*m-2] ) ) * cos ( 2.0 * pi * r[2*m-1] );
y = sqrt ( -2.0 * log ( r[2*m-2] ) ) * sin ( 2.0 * pi * r[2*m-1] );
saved = 1;
made = made + xhi - xlo + 2;
}
delete [] r;
return;
}
//****************************************************************************80
void r8vec_transpose_print ( int n, double x[], string title )
//****************************************************************************80
//
// Purpose:
//
// R8VEC_TRANSPOSE_PRINT prints a vector on one line.
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 11 November 2010
//
// Author:
//
// John Burkardt
//
// Parameters:
//
// Input, int N, the dimension of the vector.
//
// Input, double X[N], the vector.
//
// Input, string TITLE, a title.
//
{
int i;
cout << title;
for ( i = 0; i < n; i++ )
{
cout << " " << x[i];
}
cout << "\n";
return;
}
//****************************************************************************80
void r8vec_uniform_01 ( int n, int *seed, double r[] )
//****************************************************************************80
//
// Purpose:
//
// R8VEC_UNIFORM_01 fills a double precision vector with pseudorandom values.
//
// Discussion:
//
// This routine implements the recursion
//
// seed = 16807 * seed mod ( 2**31 - 1 )
// unif = seed / ( 2**31 - 1 )
//
// The integer arithmetic never requires more than 32 bits,
// including a sign bit.
//
// Licensing:
//
// This code is distributed under the GNU LGPL license.
//
// Modified:
//
// 19 August 2004
//
// Author:
//
// John Burkardt
//
// Reference:
//
// Paul Bratley, Bennett Fox, L E Schrage,
// A Guide to Simulation,
// Springer Verlag, pages 201-202, 1983.
//