The signature for af_add:

af_add (af_array *out, const af_array lhs, const af_array rhs, const bool batch)

with lhs and rhs as parameter names, I don't think J users would get lost if 
they called the "cover function" dyadically the same way they call +

I'm not suggesting altering any existing code that does follow the "C spec" 
closely.  Just adding adverbs on top of them to provide an intuitive J 
interface to the functions.

consider the J function

insert =: 1 : 'u/"x y' (_&$: :)

it is "monadic only" version of /.  With optional rank parameter as dyadic 
number

  + insert i.3 3

9 12 15

1 + insert i.3 3

3 12 21

J does not need such an adverb ("x is easy to type/add and "name context 
free"), but "lesser languages" do.  Although when they do use such an 
implementation, they capture the full flexibility of ranked-modified insert.  A 
more important flexibility than being able to turn insert into, a very 
different adverb, table.

this insert adverb definition would work like a lesser language modifier.... 

like af_sum, af_product group.

One of the reasons to make this consistency change is to simplify conversion to 
and from J<->arrayfire including the great matmul demonstration you have 
provided.





On Wednesday, January 26, 2022, 12:23:52 p.m. EST, Eric Iverson 
<eric.b.iver...@gmail.com> wrote: 





Pascal,

Interesting ideas on arrayfire args.

I will probably resist the idea of making dop verbs dyadic. I think it
better to stick closer to the arrayfire syntax.

But it makes sense to avoid unnecessary boxing.

  af_add_jaf_ afad;afbd NB. works
  af_add_jaf_ afad,afbd NB. fails, but probably should work



On Wed, Jan 26, 2022 at 10:03 AM 'Pascal Jasmin' via Programming <
programm...@jsoftware.com> wrote:

> An interface suggestion would be to transform all verbs that currently
> take 2 boxed arguments into unboxed dyad arguments.
>
> this can be done by adding the adverb (@:;) for the dop class verbs.  and
> (@:;~) for the reduce class verbs such that the operating axis is the x
> term.  The reduce class could have the additional adverb (0&$: : ) to make
> supplying the axis an optional parameter.  The explicitly constructed
> functions in arrayfire.ijs that take 2 boxed y parameters (matmul) can also
> be decorated with (@: ;)
>
> These changes would more naturally leverage J's processing/modifier
> capabilities, and processing list of arrayfire array handles.  Arrayfire
> sparse support seems to be limited to rank 2 arrays.  J could circumvent
> these limitations by shaping multiple arrayfire handles managing the
> nesting logic in J instead.
>
> There are many uses of arrayfire that are made easier with a list of array
> handles.
>
>
>
>
> On Tuesday, January 25, 2022, 04:39:36 p.m. EST, Eric Iverson <
> eric.b.iver...@gmail.com> wrote:
>
>
>
>
>
> Pascal,
>
> Thanks for the feedback. Coming from you, it means a lot to me.
>
> There are some rough edges for windows and mac (I work mostly in linux)
> that I will fix tomorrow morning.
>
> On Tue, Jan 25, 2022 at 3:52 PM 'Pascal Jasmin' via Programming <
> programm...@jsoftware.com> wrote:
>
> > looks good.  A small bug:
> >
> > if you define
> >
> > reduce_z_ =: ]: NB. adverb
> >
> > prior to loading arrayfire.ijs
> >
> > load will fail.
> >
> > The reason is the families.ijs file creates a bunch of forks with their
> > middle verbs defined after the forks are created.
> >
> > An easy fix is to define all of the explicit verbs used in families.ijs
> > above the line that "require families.ijs"
> >
> >
> > fixed it for me.
> >
> >
> >
> > On Tuesday, January 25, 2022, 10:56:54 a.m. EST, Eric Iverson <
> > eric.b.iver...@gmail.com> wrote:
> >
> >
> >
> >
> >
> > ~addons/math/arrayfire is a new addon for J903 and later.
> >
> > The addon allows high performance computing of matrix product
> > and many other mathematical array operations. Multiple cpu
> > cores and hardware such as Nvidia gpus are used as appropriate.
> >
> > Browse https://arrayfire.org for more info.
> >
> > The addon will prompt you for the ArrayFire software install if
> > it is not already installed.
> >
> > Use pacman to install the addon. For example,
> >  load'pacman'
> >  'install' jpkg 'math/arrayfire'
> >
> > Get started:
> >  load '~addons/math/arrayfire/arrayfire.ijs'
> >  man_jaf_ 'intro'
> > ...
> >  init_jaf_ 'cpu'
> >  tut_jaf_ 'basic' NB. run basic tutorial
> > ...
> >  man_jaf_ 'credits' NB. credit to some J-ArrayFire pioneers
> > ...
> >
> > *** preliminary version
> > We think this is an important step for J in high performance computing.
> > If this proves to be the case, Jsoftware will actively pursue further
> > development in this area.
> >
> > *** from the addon description
> > cd bindings and utilities for ArrayFire shared library
> >
> > https://arrayfire.org
> >
> > "ArrayFire is a high performance software library for
> > parallel computing with an easy-to-use API. Its array based
> > function set makes parallel programming more accessible."
> >
> > J-ArrayFire cd bindings make it easy to have
> > high performance computing for things like matrix multiply
> > with cpu cores, Nvidia gpus, and opencl.
> > ***
> > ----------------------------------------------------------------------
> > 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
> ----------------------------------------------------------------------
> 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

Reply via email to