Your expectation of easy extension is unfounded.

If you want this function, I think you should write your own conjunction for it and get some experience.

In my code, I have sometimes needed to transpose before an operation but very seldom have I needed to transpose before and then transpose back.

Henry Rich

On 1/24/2022 12:06 AM, Elijah Stone wrote:
On Mon, 24 Jan 2022, Hauke Rehr wrote:

How many operations can be optimized
to not actually bring it to the front?
(special combinations wrt the t. family)

I expect that most verbs which currently have IRS (integrated rank support) could be easily extended with integrated transpose support.

When I said 'harder to implement performantly', I was thinking of virtual nouns for verbs _without_ IRS/ITS.  But it occurs to me that it is not actually significantly more work, though you do need a new array representation.  You need shape to be completely virtual, so |: does not do any work.  This approach is used in ngn/apl and described at http://archive.vector.org.uk/art10501160.

(Though I think maintaining verbs with virtual shape over long periods of time is probably a bad idea, because it makes it difficult to reason about locality.)

 -E


Not that many, I think. So it’s better
to actually
1. prepare your data layout and =: the result
2. apply an easily understood algorithm to it

… but I agree with your “advantages” section


Am 24.01.22 um 05:30 schrieb Elijah Stone:
Suppose I would like to normalise a vector.  Easy: %+/&.:*:.  Nice and pretty, gotta love under.

What if I've got an array of vectors, and I want to normalise all of them? There are two ways, corresponding to two different representations: %+/&.:*:"1 and %"_1 _ +/&.:*:.  The former corresponds to an array where the last axis is the axis axis, and the latter to an array where the leading axis is the axis axis (which may seem odd, but I've found it useful).

There are two operations involved: a division and a reduction.  Neither of these _needs_ to be applied at rank, but we cannot avoid ranking _both_ of them.  Now suppose the axis axis is neither leading nor trailing.  Then we need: (%"_1 _ +/&.:*:)"n.

" is inherently eachy.  That is not a bad thing--sometimes there are eaches to be eached--but it does mean it is somewhat heavy-handed.  |: is an interesting alternative.  %"_1 1 can be written as %&.(0&|:`a:). And the sum can be performed moving the axis in question to the front rather than to the back.

I therefore propose a 'transpose-ish' family of conjunctions. Say: t. t: t.. t:: (RIP Taylor series).  u t. n brings axis n to the front (brings it near) before applying u; u t.. n brings axis n to the rear (brings it far, hence the longer suffix); u t: n brings axis n to the front before applying u, but returns it afterwards (hence two dots); t:: should be obvious.

Advantages: encourages holistic, array-oriented thinking over eachy thinking.  Distinguishes rank's role as a vehicle for repetition from its role as a general alternative to the axis operator.  A single application under transpose can replace nested applications at rank.

Disadvantages: harder to teach.  Maybe harder to understand (though operations on high-dimensional arrays may be difficult to understand regardless).  Probably harder to implement performantly.  I propose too many primitives, and if The Powers That Be are not wise enough to reject them all, they will turn the language into C++.

Thoughts?

  -E
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

--
----------------------
mail written using NEO
neo-layout.org

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


--
This email has been checked for viruses by AVG.
https://www.avg.com

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to