error in "xtimes" dfun in dfns.dyalog.com (Complex.numbers)

Learning APL or new to Dyalog? Ask "silly" questions here, without fear...

error in "xtimes" dfun in dfns.dyalog.com (Complex.numbers)

Postby Stu on Wed Jul 06, 2016 12:04 am

Has anyone tried using "xtimes"? The code is extremely compact and aesthetically pleasing, but the examples given produce this error:

RANK ERROR: Invalid axis
floop[0] floop←{(⊣/⍺)∇⍣(×m)⊢(+⌿⍵),[m-0.5]⍺×[⍳m←≢⍴⍺]-⌿⍵}

Did anyone encounter this, and, if so, were you able to fix it?
Stu
 
Posts: 97
Joined: Thu Dec 31, 2015 1:30 am

Re: error in "xtimes" dfun in dfns.dyalog.com (Complex.numbe

Postby JohnS|Dyalog on Wed Jul 06, 2016 7:10 am

Hi Stu,
Which example goes wrong?
You can see more examples in the test script: http://dfns.dyalog.com/s_xtimes.htm
John
JohnS|Dyalog
 

Re: error in "xtimes" dfun in dfns.dyalog.com (Complex.numbe

Postby Stu on Wed Jul 06, 2016 7:29 pm

I tried this example because I was mainly interested in just the FFT and iFFT:
x
9 3 5 8 1 0 5
y
6 2 3 7 4

iFFT (FFT 16↑x) × (FFT 16↑y)
54J¯9.32587E¯15 36J¯3.51108E¯15 63J¯6.38378E¯15 ...

floop seems to be the problem. I assumed I could take the definitions of FFT and iFFT out of the definition of xtimes and use them independently.
Stu
 
Posts: 97
Joined: Thu Dec 31, 2015 1:30 am

Re: error in "xtimes" dfun in dfns.dyalog.com (Complex.numbe

Postby JohnS|Dyalog on Wed Jul 06, 2016 8:05 pm

I think the code is assuming an index origin of 0. Try:
      ⎕IO ← 0
JohnS|Dyalog
 

Re: error in "xtimes" dfun in dfns.dyalog.com (Complex.numbe

Postby Stu on Wed Jul 06, 2016 9:38 pm

⎕IO←0 did the trick, so now I can use FFT and iFFT. Cool!

I tried a couple of examples from the webpage you sent me to. I get "VALUE ERROR" on the final expression here:

x←¯50+?23⍴100
y←¯50+?17⍴100
(¯1+(⍴x)+⍴y)≡⍴x rconvolve y ⍝ OK
(x rconvolve y)≡x rconvolve⍨y ⍝ OK
(x convolve y)≡⌊0.5+9○x rconvolve y ⍝ PRODUCES VALUE ERROR
Stu
 
Posts: 97
Joined: Thu Dec 31, 2015 1:30 am

Re: error in "xtimes" dfun in dfns.dyalog.com (Complex.numbe

Postby JohnS|Dyalog on Thu Jul 07, 2016 9:28 am

I can't see anything wrong with your last line - and if I copy/paste it into my session, it works. Could you copy the output from a whole session, from starting up Dyalog - to getting the VALUE ERROR into an email please and send it to support at dyalog dot com? A bit like this:

      Dyalog APL/W Version 15.0.27638
Serial No : 000000
Unicode Edition
Thu Jul 7 10:13:52 2016
clear ws
)load dfns
C:\15.0.dss\svn\misc\ws\unicode\dfns.dws saved Wed Jul 6 17:51:28 2016

An assortment of D Functions and Operators (unicode).

tree # ⍝ Workspace map.
↑¯10↑↓attrib ⎕nl 3 4 ⍝ What's new?
⍕notes find 'Word' ⍝ Apropos "Word".
⎕ed'notes.contents' ⍝ Workspace overview.

⎕io←0
roots ← {×\1,1↓(⍵÷2)⍴¯1*2÷⍵}
cube ← {⍵⍴⍨2⍴⍨2⍟⍴⍵}
extend ← {(2*⌈2⍟¯1+(⍴⍺)+⍴⍵)↑¨⍺ ⍵}
floop ← {(⊣/⍺)∇⍣(×m)⊢(+⌿⍵),[m-0.5]⍺×[⍳m←≢⍴⍺]-⌿⍵}
FFT ← { ,(cube roots ⍴⍵)floop cube ⍵}
iFFT ← {(⍴⍵)÷⍨,(cube +roots ⍴⍵)floop cube ⍵}
⍝ ... etc
JohnS|Dyalog
 

Re: error in "xtimes" dfun in dfns.dyalog.com (Complex.numbe

Postby Stu on Thu Jul 07, 2016 4:21 pm

I tried again, this time in a clean workspace. It works fine. I don't know why that last expression wouldn't work in my original workspace. Sorry for the trouble!
Stu
 
Posts: 97
Joined: Thu Dec 31, 2015 1:30 am


Return to New to Dyalog?

Who is online

Users browsing this forum: No registered users and 1 guest