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

◆ rawARingGaloisField()

const Ring * rawARingGaloisField ( int prime,
int dimension )
Todo

why parameters are ints and not longs or mpz's? is an overflow possible?

check prime for primality (probably at top of Macaulay2)

ARingGFGivaro uses tables and may consume a huge amount of memory - pass therefore a 'MaxMemoryConsumption' parameter and if the value is overstepped by ARingGFGivaro, create polynomial representation?

the check if in general polynomial representation is needed cost some additional work, similar to linbox/field/givaro-gfq.h. Use GivaroGfq instead of Givaro::GFqDom in ARingGFGivaro?

Todo
return Macaulay Galois field in some cases.

Definition at line 138 of file aring.cpp.

139{
140 if (dimension < 0)
141 {
142 ERROR(" givaroGF/FFPACK: help, dimension is negative ! ");
143 return nullptr;
144 }
145 try
146 {
147#if 1
148
149 if (prime <= 1)
150 {
151 ERROR("givaroGF/FFPACK: expected a prime number p ");
152 return nullptr;
153 }
154
155 //-- NEED_POLYNOMIAL_REPRESENTATION is not usable(namespace problems) and
156 // is not correct, because the answer depends on the template used for
157 // Givaro::GFqDom.
158 /*if (Givaro::NEED_POLYNOMIAL_REPRESENTATION(prime,dimension) )
159 {
160 ERROR("givaro Galois Field: polynomial representation is needed -
161 todo ");
162 return 0;
163 }*/
164 if (dimension == 1 && M2::ARingZZpFFPACK::getMaxModulus() > prime)
165 {
166 // std::cout << "maximum modulus = " <<
167 // M2::ARingZZpFFPACK::getMaxModulus() << std::endl;
169 }
170 if (dimension == 1)
171 {
172 ERROR("maximum modulus = %f\n", M2::ARingZZpFFPACK::getMaxModulus());
173 return nullptr;
174 }
175 #if 0
176 return M2::ConcreteRing<M2::ARingGFGivaro>::create(prime, dimension);
177 #endif
178 ERROR("calling rawARingGaloisField with no longer allowed values, givaro is no longer available");
179 return nullptr;
180#else
181 ERROR("add --enable-fflas-ffpack --enable-givaro when building M2");
182 return 0;
183#endif
184 } catch (const exc::engine_error& e)
185 {
186 ERROR(e.what());
187 return nullptr;
188 }
189}
static double getMaxModulus()
static ConcreteRing< RingType > * create(std::unique_ptr< RingType > R)
const int ERROR
Definition m2-mem.cpp:55

References M2::ConcreteRing< RingType >::create(), ERROR, and M2::ARingZZpFFPACK::getMaxModulus().