Here's a tentative implementation of part of what I think you have described:

commute=:3 :0
  assert.2=#$y
  assert.=/$y
  assert. 0={.u b. 0
  mask=. <:/~i.#y
  inds=. (>. |:)mask*i.$y
  inds{u mask #&, y
)

That said, I don't think this would work for you - this winds up
testing each item independently so there's no comparison involved.

Perhaps you could flesh out an example to better show what you mean?

Thanks,

-- 
Raul

On Fri, Jun 29, 2018 at 12:04 PM David Lambert <[email protected]> wrote:
>
> I have an equality test.  If a=b then b=a .  (In my case "find overlapping
> spheres", in other words the equality test may be non-trivial.)  The new
> adverb would compute only the upper triangular set of cases and thereby
> save about half the time.
>
>    NB. assuming the main diagonal could be interesting
>    NB. the new adverb would compute these cases
>    <:/~ i.7
> 1 1 1 1 1 1 1
> 0 1 1 1 1 1 1
> 0 0 1 1 1 1 1
> 0 0 0 1 1 1 1
> 0 0 0 0 1 1 1
> 0 0 0 0 0 1 1
> 0 0 0 0 0 0 1
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to