Randy A MacDonald wrote:
> > That (4&$.)^:_1 does not return the original table is
> > not important to me.
Raul Miller wrote:
> > That's not an inverse.
Randy A MacDonald wrote:
> Yes, in the same sense that useful applications of #^:_1 and
> #.^:_1 are not inverses.
I'm not sure what your point about #^:_1 is, but I'll grant
that #.^:_1 #.v can have a different shape (and different
elements) from v.
Then again, I think the fact that #.^:_1 is not an inverse
is balanced by the fact that it sees quite a bit of use.
> > Useful for what?
>
> I haven't figured that out, but it looks similar to the # and #.
cases.
> > What's wrong with something like
> > [EMAIL PROTECTED] [:(] #: i.@:>:)>./
> > ?
> Give me a half-hour to decipher it (which some would say is the
> problem) and I'll tell you.
It's intended to produce the same values as you have been suggesting
for _4&$.
It does have some hypothetical flaws (for example, it computes
a dense result and then converts that to sparse), but...
whether or not those are actual flaws depends on how (and if)
it gets used.
Here's a simpler version of that, for the case where:
y is the index matrix (which would be produced by $.4)
s is the shape of the desired result matrix
it's OK for the result to be dense
(s #: i. s) e. y
As I understand your proposal for _4&$., you would replace
s with >./y and you would want to convert this result from
a dense matrix to a sparse matrix.
(Then again, one of the potential flaws here is that I
might not understand what you want _4&$. to do...)
> > Anyways... there's lots of different kinds of "useful".
>
> ... therefore I question the need for the scare quotes.
The scare quotes were intended to convey that
the meaning of the word could vary significantly
with the context in which it was considered.
I hope that helps.
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm