Post Reply 
[VA] SRC #012a - Then and Now: Probability
10-20-2022, 09:39 PM
Post: #77
RE: [VA] SRC #012a - Then and Now: Probability
This has been a very interesting thread.
This is a sys-rpl version for HP50g of CReth SRC12a.
On an actual HP50g the calculation time for the 30 60 problem is 5 min 21sec.
p= 9.51234350207E-6

"
!RPL
!NO CODE
!JAZZ
::
CK2NOLASTWD
CK&DISPATCH2
#11
:: COERCE2
'
CODE
GOSBVL POP2# RSTK=C SAVE
B=A.A A*A.A A-B.A ASRB.A
C=RSTK A+C.A
GOSBVL PUSH#ALOOP
ENDCODE
3PICK DUP 3PICK EVAL SWAP 2 SWAPOVER
{{ r s d m Tind ii }}
r #1+_ONE_DO (i)
INDEX @ #1+_ONE_DO (j)
3
DUP INDEX@ #1<> ?SKIP #1-
JINDEX@ INDEX@ #<> ?SKIP #1-
JINDEX@ r #<> ?SKIP #1-
UNCOERCE %/
LOOP (j)
LOOP (i)
d UNCOERCE ONE{}N FPTR2 ^XEQ>ARRY
DUP %0 xCON
%1 BINT1 PUTREALEL
s #1+_ONE_DO (k)
INDEX@ #>$ BIGDISPROW1
2DUP m m 2GETEVAL DUP4UNROLL TOTEMPOB (n)
#1+_ONE_DO (q)
SWAP INDEX@ PULLREALEL
ROT INDEX@ PULLREALEL
ROT %* 4UNROLL
LOOP (q)
2DROP
UNCOERCE ONE{}N x>ARRY
m #1+_ONE_DO (i)
INDEX@ #2 #/ #+ #1+_ONE_DO (j)
JINDEX@ INDEX@ 2GETEVAL
PULLREALEL
%CHS
JINDEX@ TOTEMPOB !ii
1 JINDEX@ #1- #MAX
JINDEX@ #1+ m #MIN
#1+ SWAP DO (a)
1 JINDEX@ INDEX@ ii #> ?SKIP #1- MAX
JINDEX@ ii INDEX@ #> ?SKIP #1+ INDEX@ MIN
#1+SWAP DO (b)
SWAP JINDEX@ INDEX@ 2GETEVAL PULLREALEL
ROT %+
LOOP (b)
LOOP (a)
ROT
JINDEX@ INDEX@ 2GETEVAL
3PICKSWAP PUTREALEL
JINDEX@ #1+ INDEX@ #-
2GETEVAL
ROTSWAP
PUTREALEL
SWAP
LOOP (j)
LOOP (i)
DROP
m DUP r #>=_ ?SKIP #1+ !m
LOOP (k)
SWAP %0 xCON
r 1 2GETEVAL
UNCOERCE
xDO %1 xPUTI xUNTIL
% -64 xFS?
xENDDO
xDROP
xDOT
%6
s UNCOERCE
x^
x/
ABND
;
;
@
"
I hope I got it without typing errors.
The small code object "Tind" reduces calculation time with 29%, from about 450sec to 321.
I lost the userRPL version, but it was many times slower.
br Gjermund
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] SRC #012a - Then and Now: Probability - Gjermund Skailand - 10-20-2022 09:39 PM



User(s) browsing this thread: 1 Guest(s)