Rosetta Code task.
Raul, in your solution ": and using rplc are indeed time consuming parts.
I divided your solution in three parts:
format=: rplc&(' 0';' ')"1
floydRM=: [: (* ($ $ +/\@,)) >:/~@:i.
and
":
ts 'floydRM 1e3'
0.027576 9.43827e6
adding ":
ts '": floydRM 1e3'
0.374801 2.93652e7
adding format
ts 'format ": floydRM 1e3'
1.34063 2.93655e7
My suggestion for some speedup by means of another approach of format:
(not thoroughly tested, but it works in this RC task)
form17=: {."_1~1 i."_1~' 0'&E."1
speed up:
ts 'form17 ": floydRM 1e3'
0.451446 2.93655e7
If of any use.
--
Met vriendelijke groet,
@@i = Arie Groeneveld
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm