[clean-list] Troubles about Vectors
=?iso-8859-1?q?Alves=20da=20Silva=20Cruz=20Willer?=
willeralves@yahoo.com.br
Wed, 19 Nov 2003 13:46:34 -0300 (ART)
--0-366060412-1069260394=:47678
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Hello Cleaners,
I've been working on a single DFT implementation but I've got in some troubles regarding vectors. Clean returns a share error, wich I can't understand and solve. The error message is something like this:
"some" demanded attribute cannot be offered by shared object.
The testing code follows below. Has someone know what could be wrong with this code?
module test
import StdEnv
Start = DFT 1 8 { 1.0 \\ i <- [1..8] } { 0.0 \\ i <- [1..8] }
DFT :: !Int !Int *{#Real} *{#Real} -> (*{#Real},*{#Real})
DFT dir m x1 y1
#! m = size x1
# x2 = { 0.0 \\ i <- [1..m] }
# y2 = { 0.0 \\ i <- [1..m] }
# (x2,y2) = loop1 0 m dir x1 y1 x2 y2
| dir == 1 = ({ x/(toReal m) \\ x <-: x2},{ y/(toReal m) \\ y <-: y2})
| otherwise = (x2,y2)
where
loop1 :: Int !Int !Int *{#Real} *{#Real} *{#Real} *{#Real} -> (*{#Real},*{#Real})
loop1 i m dir x1 y1 x2 y2
| i == m = (x2,y2)
#! x2 = {x2 & [i]=0.0}
#! y2 = {y2 & [i]=0.0}
#! arg = (~(toReal dir))*2.0*3.141592654*(toReal i)/(toReal m)
# (x2,y2) = loop2 i 0 m arg x1 y1 x2 y2
= loop1 (i+1) m dir x1 y1 x2 y2
loop2 :: Int Int !Int !Real *{#Real} *{#Real} *{#Real} *{#Real} -> (*{#Real},*{#Real})
loop2 i k m arg x1 y1 x2 y2
| k == m = (x2,y2)
#! cosarg = cos ((toReal k)*arg)
#! sinarg = sin ((toReal k)*arg)
#! auxx = x2.[i]
#! auxy = y2.[i]
#! vx = x1.[k]
#! vy = y1.[k]
= loop2 i (k+1) m arg x1 y1 {x2 & [i]=(auxx + (vx*cosarg - vy*sinarg))} {y2 & [i]=(auxy + (vx*sinarg + vy*cosarg))}
Thanks in advance,
Willer Alves
Uberlândia, MG - Brazil
---------------------------------
Yahoo! Mail - 6MB, anti-spam e antivírus gratuito. Crie sua conta agora!
--0-366060412-1069260394=:47678
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
<DIV>
<DIV>Hello Cleaners,</DIV>
<DIV> </DIV>
<DIV>I've been working on a single DFT implementation but I've got in some troubles regarding vectors. Clean returns a share error, wich I can't understand and solve. The error message is something like this:</DIV>
<DIV> </DIV>
<DIV>"some" demanded attribute cannot be offered by shared object.</DIV>
<DIV> </DIV>
<DIV>The testing code follows below. Has someone know what could be wrong with this code?</DIV>
<DIV> </DIV>
<DIV><FONT face=courier>module test<BR>import StdEnv</FONT></DIV>
<DIV><FONT face=courier></FONT> </DIV>
<DIV><FONT face=courier>Start = DFT 1 8 { 1.0 \\ i <- [1..8] } { 0.0 \\ i <- [1..8] }</FONT></DIV>
<DIV><FONT face=courier>DFT :: !Int !Int *{#Real} *{#Real} -> (*{#Real},*{#Real})<BR>DFT dir m x1 y1<BR>#! m = size x1<BR># x2 = { 0.0 \\ i <- [1..m] }<BR># y2 = { 0.0 \\ i <- [1..m] }<BR># (x2,y2) = loop1 0 m dir x1 y1 x2 y2<BR>| dir == 1 = ({ x/(toReal m) \\ x <-: x2},{ y/(toReal m) \\ y <-: y2})<BR>| otherwise = (x2,y2)<BR>where<BR> loop1 :: Int !Int !Int *{#Real} *{#Real} *{#Real} *{#Real} -> (*{#Real},*{#Real})<BR> loop1 i m dir x1 y1 x2 y2<BR> | i == m = (x2,y2)<BR> #! x2 = {x2 & [i]=0.0}<BR> #! y2 = {y2 & [i]=0.0}<BR> #! arg = (~(toReal dir))*2.0*3.141592654*(toReal i)/(toReal m)<BR> # (x2,y2) = loop2 i 0 m arg x1 y1 x2 y2<BR> = loop1 (i+1) m dir x1 y1 x2 y2<BR> <BR> loop2 :: Int Int !Int !Real *{#Real} *{#Real} *{#Real} *{#Real} -> (*{#Real},*{#Real})<BR> loop2 i k m arg x1 y1 x2 y2<BR> | k == m = (x2,y2)<BR> #! cosarg = cos ((toReal k)*arg)<BR> #! sinarg = sin ((toReal
k)*arg)<BR> #! auxx = x2.[i]<BR> #! auxy = y2.[i]<BR> #! vx = x1.[k]<BR> #! vy = y1.[k]<BR> = loop2 i (k+1) m arg x1 y1 {x2 & [i]=(auxx + (vx*cosarg - vy*sinarg))} {y2 & [i]=(auxy + (vx*sinarg + vy*cosarg))}<BR></FONT></DIV>
<DIV><FONT face=courier><FONT face=arial>Thanks in advance,</FONT></FONT></DIV>
<DIV><FONT face=courier><FONT face=Arial></FONT></FONT> </DIV>
<DIV><FONT face=courier><FONT face=Arial>Willer Alves</FONT></FONT></DIV>
<DIV><FONT face=courier><FONT face=Arial>Uberlândia, MG - Brazil</FONT></DIV></FONT></DIV><p><br><hr size=1><b><a href="http://br.rd.yahoo.com//mail_br/tagline/?http://mail.yahoo.com.br">Yahoo! Mail</a></b> - 6MB, anti-spam e antivírus gratuito. <a href="http://br.rd.yahoo.com//mail_br/tagline/?http://br.yahoo.com/info/mail.html">Crie sua conta agora!</a>
--0-366060412-1069260394=:47678--