Hi Ralf,<br>
Thanks for your help on this problem!<br>
The code I sent was intended to give some idea of what I was
doing.&nbsp; Luckily, I discovered that the problem was with the aldor
optimizer.&nbsp; Down the road of compilation it did wrong additions
because of the way I used some variables.&nbsp; <br>
<br>
As an Example:<br>
k had value 0, j also 0 and m 2 but the optimizer gave
index k+j+m as 7 in some few instances when I tried to access an array
with A.(k+j+m) instead of:<br><br>
kjm := k+j+m and then A.kjm.<br>
&nbsp; <br>
This was an intermittent problem&nbsp; that disappeard when I
surrounded the code with extraneous stdouts but is fixed now at my code level. I will file a bug report later.<br>
<br>
As for the usage of the PrimeField, this is the spec:<br>
%27 &gt;&gt; PrimeField<br>
&nbsp; () @ (p: AldorInteger) -&gt; (<br>
PrimeFieldCategory with <br>
&nbsp;&nbsp;&nbsp; == PrimeField0(p) add ()<br>
)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
That means PrimeField(p:AldorInteger) is permissible.<br>
<br>
I have also been told by some Aldor experts to do &quot;macro constv ==
value&quot; which I do follow even though I don't see the penalty of constv
== value to define a constant.<br>
<br>
Thanks again for all your time.<br>
Akpodigha.<br>
<br>
<br><br><div><span class="gmail_quote">On 9/28/05, <b class="gmail_sendername">Ralf Hemmecke</b> &lt;<a href="mailto:ralf@hemmecke.de">ralf@hemmecke.de</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Hi Akpodigha,<br><br>I cannot compile your code. It is incomplete. Neither<br>FFTMultiplicationPackage nor PrimitiveRootOfUnitFinder is in my Aldor<br>distribution. So I cannot reproduce your bug. Maybe it is even better do
<br>file your problem with complete code at<br><a href="http://www.aldor.org/bugreport.html">http://www.aldor.org/bugreport.html</a><br>so that the compiler people can try to trace the bug. I cannot because,<br>I don't have the compiler sources.
<br><br>But perhaps I can give some experiences with some constructions.<br><br> &gt; p:Z := 17;<br> &gt; K == PrimeField(p);<br><br>I really wonder whether this should compile at all. p is a variable here<br>and thus the compiler should reject it as an argument to PrimeField.
<br>Only constants are allowed as an argument to a domain constructor.<br><br>A workaround would be to put things inside a function<br><br>foo(p: Z): () == {<br>&nbsp;&nbsp; K == PrimeField p;<br>&nbsp;&nbsp; U == DenseUnivariatePolynomial(K,-&quot;x&quot;);
<br>&nbsp;&nbsp;&nbsp;&nbsp;...<br>}<br><br>and then call foo(17).<br><br>Further, I remember that I often had problems with defining domain<br>constants in my code. Like the<br><br>&nbsp;&nbsp; K == PrimeField p;<br><br>line above. I was told by some Aldor developer long ago that I should
<br>try something like<br>&nbsp;&nbsp; macro K == PrimeField p;<br>instead. I don't know what the compiler does exactly in both cases, but<br>if one looks at instantiations in both cases PrimeField(p) gets only<br>instantiated once even if it is used later several times.
<br>If some compiler developer could say some words here, I would be happy.<br><br>Ralf<br><br>Akpodigha Filatei wrote:<br>&gt; On Tue, 27 Sep 2005, Ralf Hemmecke wrote:<br>&gt; Thanks Ralf for your reply.&nbsp;&nbsp;I have corrected my algebrad usage
<br>&gt; according to the documentation you referred to with same result.<br>&gt; Pasted below is the content of a revised <a href="http://dfttest.as">dfttest.as</a>.&nbsp;&nbsp;Here I test the<br>&gt; 'dft' in the package aliased as FFTMPKG against an exact (same) function
<br>&gt; local to <a href="http://dfttest.as">dfttest.as</a> and got diff results with -lalgebra but correct same<br>&gt; result with -lalgebrad.<br>&gt;<br>&gt; One more weird thing about this is that I could get it to work by
<br>&gt; placing &quot;stderr&quot; or &quot;stdout&quot; in the dft function at the package.&nbsp;&nbsp;This,<br>&gt; I noticed by chance as I was profiling the function.&nbsp;&nbsp;It is taking me a<br>&gt; heck of a time to specify exact location and minimum number of
<br>&gt; stderr/stdout statements that would make it make but I am willing to do<br>&gt; this.<br>&gt;<br>&gt; I think you are right to say this is a compiler bug but I am working on<br>&gt; a work-around as I have had to do in some other instances.
<br>&gt;<br>&gt; #include &quot;algebra&quot;<br>&gt;<br>&gt; macro {<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Z==Integer;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MI == MachineInteger;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FFTMPKG == FFTMultiplicationPackage;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PRUF == PrimitiveRootOfUnityFinder;
<br>&gt; }<br>&gt;<br>&gt; import from TextWriter,String,Character,Symbol;<br>&gt; p:Z := 17;<br>&gt;<br>&gt; K == PrimeField(p);<br>&gt;<br>&gt; U == DenseUnivariatePolynomial(K,-&quot;x&quot;);<br>&gt; PAK == PrimitiveArray K;
<br>&gt;<br>&gt; import from K,U,FFTMPKG(K,U),Partial(K), PRUF(K);<br>&gt; import from PAK,MI;<br>&gt; x == monom;<br>&gt;<br>&gt; main():() == {<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; local n,k:MI;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Y1:U := x^(3@Z) + x^(2@Z)+x+1::K::U;
<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; Y2:U := x^(3@Z) + (3::K)*x + 1::K::U;<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; s:MI := fftSize(Y1,Y2);<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; stdout &lt;&lt; &quot;fftSize? &quot;&lt;&lt; s &lt;&lt;newline;<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; n := shift(1,s); -- 2^s<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; ww:Partial(K) := primitiveRootOfUnity(n);
<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; assert( not failed?(ww) );<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; w := retract(ww);<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; y1a:PAK := new(n,0$K);<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; y11a:PAK := new(n,0$K);<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; kk := 0;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; for k in coefficients(Y1) repeat {
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; y1a.kk := k;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; kk := next(kk);<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; wp:PAK := omegaPowers(w,n);<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; stdout &lt;&lt; &quot; DFT TEST ----- &quot; &lt;&lt; newline;<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; dftres11:PAK := dftt(s,y1a,wp);
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; dftres21:PAK := dft!(s,y1a,wp);<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; stdout&lt;&lt;&quot;dft local [&quot;;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; for k in 0..prev(n) repeat {<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stdout&nbsp;&nbsp;&lt;&lt; dftres11.k &lt;&lt;&quot; &quot;;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; }
<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; stdout&lt;&lt;&quot;]&quot;&lt;&lt;newline;<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; stdout&lt;&lt;&quot;dft from package [ &quot;;<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; for k in 0..prev(n) repeat {<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stdout&nbsp;&nbsp;&lt;&lt; dftres21.k

 &lt;&lt;&quot; &quot;;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; stdout&lt;&lt;&quot;]&quot;&lt;&lt;newline;<br>&gt;<br>&gt; }<br>&gt;<br>&gt; dftt(s:MI,pol:PAK,wp:PAK):PAK == {....}<br>&gt;<br>&gt; main()<br></blockquote></div><br><br clear="all">