Class gen_test_number (o2scl)

O2scl : Class List

template<class fp_t = double>
class o2scl::gen_test_number

Generate number sequence for testing.

This class is used to generate combinations of coefficients for testing the polynomial solvers.

For example, the first 15 numbers generated with the default radix are

1.000000e+00
0.000000e+00
-1.000000e+00
5.000000e-01
-5.000000e-01
7.500000e-01
-7.500000e-01
1.500000e+00
-1.500000e+00
2.000000e+00
-2.000000e+00
2.500000e-01
-2.500000e-01
8.750000e-01
-8.750000e-01
1.250000e+00
-1.250000e+00
4.000000e+00
-4.000000e+00
1.250000e-01
-1.250000e-01
9.375000e-01
-9.375000e-01
1.125000e+00
-1.125000e+00
8.000000e+00
-8.000000e+00
6.250000e-02
-6.250000e-02

This function is used in src/other/poly_ts.cpp which tests the polynomial solvers.

Note

With the default radix and double precision, this only gives about 400 unique values before some repetition is encountered. Smaller radices enable more unique values.

Public Functions

inline gen_test_number()
inline void reset()
inline void set_radix(fp_t r)

The base for the number generation sequences.

Only numbers greater than 1.0 are allowed

inline fp_t gen()

Protected Attributes

int n

Count number of numbers generated so far.

fp_t radix

The radix for the nuber generation (default 2.0)