Oh, sorry - it's in my startup script - it does what you'd expect,
range 1 10 2 would be 1 3 5 7 9 . I think/hope it's self-contained
otherwise.
As I said, jpm ran ok on this earlier today using J7.01, so I wonder
what changed
thtough versions 8 & into 9?
Thanks as ever,
Mike
On 20/06/2021 15:12, Raul Miller wrote:
I think that load'numeric' is missing from your self contained script.
load'jpm'
start_jpm_ 100000000
1785713
Sava <.1e6
|value error: range
| r=. range s,e,2
That said, looking at the error you ran into, I suspect that there
must be a (conditional) off-by-one error during the data collection
phase.
The reason I have this suspicion is that the argument to getdetail1 is
a single line which I think represents an invocation of Sava, but the
'rep' variable which is extracted by getdetail2 looks like performance
data for the body of Sava.
The error itself comes from trying to match up that performance data
(variable 'dat' -- 24 rows) with the argument to getdetail1 (variable
'rep' -- 1 row).
I would have to play around with a working invocation of jpm to see if
I could intuit the intent of this part of the code, maybe do some
other studying to see if my suspicion is close to accurate.
I hope this helps,
--
Raul
On Sun, Jun 20, 2021 at 8:47 AM 'Michael Day' via Beta
<[email protected]> wrote:
A recurrent problem with jpm has reasserted itself. I thought we'd
chased it away in earlier
beta versions of J903, but it's been around in earlier releases of J9
and earlier as far as I
recall. (Checking back-correspondence just now, since typing the
earlier pair of sentences, I'm
not sure it was cured after all, but it's still worth observing there
is a problem somewhere in jpm! )
I can vouch for jpm working for a similar test earlier today analysing
essentially the same function,
Sav, in J7.01 on my iPad.
I've corresponded with Henry previously concerning jpm, thought of
sending privately to him
only, but there might be other J-users who wish to comment.
I've been working on Euler Problem 579, solved by many but not yet by
me. As often is the
case, it's easy for small problems, but the required size is 10^12 !
Please avoid the listing further
below if you wish to solve it without misleading distractions!
Here's a mini-session, somewhat contrived for this email:
JVERSION
Engine: j903/j64avx2/windows
Beta-l: commercial/2021-06-17T13:00:27
Library: 9.03.05
Qt IDE: 1.9.2/5.12.10(5.12.10)
Platform: Win 64
Installer: J903 install
InstallPath: c:/d/j903-beta
Contact: www.jsoftware.com
clear'' NB. to do with sending in a self-contained mini-script,
further below.
load'jpm'
start_jpm_ 100000000
1785713
Sava <.1e6
309358254 1
showdetail_jpm_ 'Sava'
recorded all lines
used and max record count: 64 1,785,713
|index error: getdetail1
| lns=.sort(len#replno) {~(;repsno)i.stm
NB. end of session clip
NB. and here's a copy of a temporary self-contained (I hope) mini-script
NB. edited from the working script for the purposes of this enquiry
M =: 1000000007
NB. look-up table
sum4sq =: (M&|@:+/\) 4 (M&|@^) i.55 NB. cum sum of powers of 4 mod M
Sava =: 3 : 0
10000000 Sava y
:
n =. y NB. problem size
b =. (- 2&|) x NB. block/buffer size must be even
e =. _1 NB. previous block end
t =. 0 NB. total mod M
m =. 0 NB. loop counter (diagnostic only)
NB. define finite arithmetic fns modulo M
by =. M&|@:* NB.
bysq =. by~ @ by NB. square of x * y
add =. M&|@+
sum =. M&|@:+/ NB. total
NB. ====================================
g =. +/"1@:#: NB. sum of base-2 rep
logn =. 2 ^. n
while. n >: s =. e + 2 do.
e =. n <. s + b
r =. range s, e, 2 NB. define next block of odd
elements 2i+1, i e. [s, e]%2
m =. >: m NB. increment loop counter
rgr2 =. (bysq g) r NB. square r * g (r)
max2r=. logn <.@- 2 ^. r NB. indices into look-up table
tr =. rgr2 by max2r { sum4sq NB. rgr2 * sum 4^...
t =. sum tr, t NB. accumulate total
end.
t, m NB. return total and number of loops done
)
Thanks for any help,
MIke
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm