I think you are missing my point. My point is that indexed assignments COPY the array instead of just making a minor modification to an existing array. I will comment about the speed on the following email.
Thanks. Blake McBride 2012/1/6 Björn Helgason <gos...@gmail.com>: > For fun I copied this to the scratch area and executing it from there using > esc r the results are only shown in the log if you use smoutput. > changed it to > > x=:1+i.5 > x > 1 2 3 4 5 > x=: 44 (2}) x > 1 2 44 4 5 > smoutput x > > now in the log it shows > > 1 2 44 4 5 > > so you can change the vector and save it again using the same name. > > You can do measurements and see how fast it is. > > So the simple answer to your question is > "Am I missing something here?" > yes. > > 2012/1/6 Blake McBride <bl...@mcbride.name> > >> Greetings, >> >> Going through J I found that: >> >> x=:1+i.5 >> x >> 1 2 3 4 5 >> 44 (2}) x >> 1 2 44 4 5 >> x >> 1 2 3 4 5 >> >> It seems that J doesn't actually make an indexed assignment. It seems >> more like it creates a copy of the array with the specified >> modifications. This is actually quite shocking. Index assignment to >> a very large array in most languages is a very fast and simple >> operation. It is also very memory efficient. Creating a modified >> copy of a very large array has a much, much greater time and space >> cost. Further, multiplying this (unnecessary) cost over a great >> number of operations can drastically (and unnecessarily) affect >> performance negatively. >> >> Am I missing something here? >> >> Thanks. >> >> Blake McBride >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > > > > -- > Björn Helgason, Verkfræðingur > Fornustekkum II > 781 Hornafirði, > t-póst: gos...@gmail.com > gsm: +3546985532 > twitter: @flugfiskur > http://groups.google.com/group/J-Programming > > > Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans > > góður kennari getur stigið á tær án þess að glansinn fari af skónum > /|_ .-----------------------------------. > ,' .\ / | Með léttri lund verður | > ,--' _,' | Dagurinn í dag | > / / | Enn betri en gærdagurinn | > ( -. | `-----------------------------------' > | ) | (\_ _/) > (`-. '--.) (='.'=) ♖♘♗♕♔♙ > `. )----' (")_(") ☃☠ > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm