(I had intended to send this earlier - I use a gmail addon which gives me a short time to rethink sending an email, and cancel it before it goes out. Unfortunately, if I navigate away from the message before it gets sent "for real" it stays in draft form. Anyways... )
Your vector processing example was a good one, yes. That said, this thread has gotten to be very "no programming" which is not good for the programming forum, so here are a few really quick bits of *. code: B=:4 4 ?@$2 C=:4 4 ?@$2 B 1 0 0 0 1 0 0 1 0 1 1 1 0 1 1 1 C 1 1 1 1 0 0 1 0 0 0 0 1 0 1 1 0 B *. C 1 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 *. table~ i:5 ┌──┬───────────────────────────────────────┐ │*.│ _5 _4 _3 _2 _1 0 1 2 3 4 5│ ├──┼───────────────────────────────────────┤ │_5│ 5 20 15 10 5 0 _5 _10 _15 _20 _5│ │_4│ 20 4 12 4 4 0 _4 _4 _12 _4 _20│ │_3│ 15 12 3 6 3 0 _3 _6 _3 _12 _15│ │_2│ 10 4 6 2 2 0 _2 _2 _6 _4 _10│ │_1│ 5 4 3 2 1 0 _1 _2 _3 _4 _5│ │ 0│ 0 0 0 0 0 0 0 0 0 0 0│ │ 1│ _5 _4 _3 _2 _1 0 1 2 3 4 5│ │ 2│_10 _4 _6 _2 _2 0 2 2 6 4 10│ │ 3│_15 _12 _3 _6 _3 0 3 6 3 12 15│ │ 4│_20 _4 _12 _4 _4 0 4 4 12 4 20│ │ 5│ _5 _20 _15 _10 _5 0 5 10 15 20 5│ └──┴───────────────────────────────────────┘ Thanks, -- Raul On Wed, Nov 8, 2017 at 8:56 AM, Don Guinn <dongu...@gmail.com> wrote: > Yes, Raul. It was a stupid J expression. Wasn't thinking about what I > wrote, but I was thinking about what I was told when I first learned APL, > "Often it is better to go ahead and calculate a result, then throw it away, > than try to figure out if you really need the calculation". > > I brought up AVX because it makes that observation even more true. Working > with the IBM 370 vector unit many years ago, it could process arrays at > what was an unbelievable speed at that time. Of course, not any more. But > it was extremely important to "not interrupt the pipeline". Setting up a > vector unit operation was expensive but once going it flew. > > It presented a dilemma because the setting up an instruction was expensive > and it didn't work well for short vectors. But it was implemented into > APL2. It worked well, but made even more true what I first learned in APL > for the 1130, where (I think) the game of APL one-liners began. > > Hopefully, the instruction setup for AVX is easier and more efficient than > the 370 vector unit, but even so, it is probably very important to not > interrupt the instruction and let it run on as long of vectors as it can. > So, I was trying to illustrate the effort to remove numbers from the vector > that wouldn't be used in the final result. It would be so much trouble and > require so much compressing and expanding that it would be better to "just > calculate the result and throw it away later". > > The idea of skipping calculation that will never be used is useful in some > cases, but can easily spend more time determining whether to skip than > going ahead with the calculation. This is particularly true in the world of > arrays. Making it an important requirement only works in a scalar world, > and is questionable even then and easily made incorrect as hardware is > enhanced. > > On Wed, Nov 8, 2017 at 2:15 AM, Erling Hellenäs <erl...@erlinghellenas.se> > wrote: > >> I don't need anything. The discussion was not about any question of mine. >> The discussion ended, so I guess the people having questions got their >> answers. /Erling >> >> >> Den 2017-11-08 kl. 10:02, skrev Raul Miller: >> >>> Please let me know what you need beyond the information I laid out in >>> http://jsoftware.com/pipermail/programming/2017-November/049599.html >>> >>> Thanks, >>> >>> >> ---------------------------------------------------------------------- >> 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