From: Raul Miller <[email protected]> Date: Tue, 22 Oct 2019 13:29:19 -0400 > What do you mean by "more efficient"? (What resource is constrained?)
I listed all 16 elements of the matrix. It being symmetrical with 0s on the diagonal, only 6 elements should be needed. Rather than "more efficient", better wording might have been "without redundant information". I might say "more efficient in use of information". > That said, if it's code golf, you could do something like this: I didn't know the term "code golf" but it seems appropriate. > If you are working on problems where that's not enough to > work on your dataset, ... At present I'm interested only in expressing concepts. Computational cost is not a concern at all. > D=: (+|:)>'';1.5;2 1.5;2.5 2 1.5 0 > > This relies on the use of two placeholders to help represent the full > extent of the array, J's fill mechanism, and addition... Thanks. Definitely helpful. I could create the matrix in a commonplace compiled language without help. Thinking about the calculation in J is worthwhile. Thanks again, ... P. -- https://en.wikibooks.org/wiki/Medical_Machines Tel: +1 604 670 0140 Bcc: peter at easthope. ca ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
