la icon indicating copy to clipboard operation
la copied to clipboard

Add dot method

Open kwgoodman opened this issue 13 years ago • 2 comments

I think a good addition to la would be la.dot() and/or a dot method:

lar1.dot(lar2, join='inner', fill=np.nan)

where fill is used when the join method ('outer', 'left', 'right') creates new data.

kwgoodman avatar Jan 16 '12 20:01 kwgoodman

This sounds quite nice. There should be no need for a join, at least depending on what we mean by "join"... the axis that would need the same label would be the axis we are multiplying on, which doesn't exist in the output.

We might need to join on that axis (actually, it would be different axes unless both larrys are 1d) before dotting, but then allowing a fill value seems to be confusing and unlikely to be useful. I would think we would just want to either do an inner join or, if the user requests it, raise an error whenever there is not an exact match on the labels.

If we went ahead and did some other join and filled using nans, every single entry in the output would be nan. Filling with zeros would give the exact same answer as an inner join. And filling with anything else, while it would do something, seems unlikely to be useful.

I might not be thinking through all the possibilities, though.

stroxler avatar Jul 10 '12 20:07 stroxler

That sounds good.

kwgoodman avatar Jul 10 '12 21:07 kwgoodman