Macaulay2 Engine
Loading...
Searching...
No Matches

◆ TEST() [3/3]

TEST ( ARingGFFlint ,
random  )

Definition at line 132 of file ARingGFTest.cpp.

133{
134 M2::ARingGFFlint R(7, 2);
136 R.init(a);
137 int counts[49];
138 for (int i = 0; i < 49; i++) counts[i] = 0;
139 for (int i = 0; i < 49 * 200; i++)
140 {
141 R.random(a);
142 EXPECT_TRUE(a >= 0);
143 EXPECT_TRUE(a < 49);
144 counts[a]++;
145 }
146#if 0
147 double sum = 0;
148 for (int i=0; i<49; i++)
149 {
150 std::cout << i << " " << counts[i] << std::endl;
151 sum += (counts[i]-200)^2;
152 }
153
154 sum /= (49*200);
155 std::cout << "chi = " << sum << std::endl;
156 for (int i=0; i<49; i++)
157 {
158 a = i;
159 M2_arrayint f = R.fieldElementToM2Array(a);
160 dintarray(f);
161 std::cout << std::endl;
162 }
163#endif
164 R.clear(a);
165}
fq_zech_struct ElementType
aring-style adapter for FLINT's Zech-logarithm representation of small finite fields GF(p^n).
MPREAL_MSVC_DEBUGVIEW_DATA void clear(::mpfr_ptr)
Definition mpreal.h:770
void dintarray(M2_arrayint a)
Definition debug.cpp:19
const mpreal sum(const mpreal tab[], const unsigned long int n, int &status, mp_rnd_t mode=mpreal::get_default_rnd())
Definition mpreal.h:2600

References M2::ARingGFFlint::clear(), dintarray(), M2::ARingGFFlint::init(), and M2::ARingGFFlint::random().