MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

A question on finite field package performance

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49540] A question on finite field package performance
  • From: Sergey Afonin <serg at msu.ru>
  • Date: Fri, 23 Jul 2004 05:59:27 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I have tried to expand a product of two polynomials over a finite
field using the FiniteFields package and found that it works *very* 
slow. It seems that this an old problem:

http://forums.wolfram.com/mathgroup/archive/2001/Oct/msg00356.html

but from my point of view the problem is outside FiniteFields package.
Consider the following example:

Needs["Algebra`FiniteFields`"]
p = 127;
n = 18;
rv = Table[GF[p][{Random[Integer, {0, p - 1}]}], {n}];
Print@Timing[Fold[Times, First[rv], Rest[rv]]];
Print@Timing[Times @@ rv];

The results are as follows:

{0. Second, result}, {11.43 Second, result} for n=18, and
{0. Second, result}, {108.4 Second, result} for n=21.

(a+a+a)+(a+a+a) is also faster then (a+a+a+a+a+a+a) for GF objects.

I have tried to rewrite addition of GF objects, but without any success:
the delay is related to function call (pattern matching for Plus?), not 
evaluation. If function name is other then Plus, say xPlus, then 
everything is ok.

Can anyone suggest a solution for this problem?

Thanks in advance,
Sergey Afonin


  • Prev by Date: Re: Plotting 2D functions with discontinuities
  • Next by Date: New GUIKit for Mathematica
  • Previous by thread: Re: Re: Further information about size limits for Normal[SparseArray[<>]]?
  • Next by thread: New GUIKit for Mathematica