← Back to team overview

larry-discuss team mailing list archive

Re: Label indexing

 

On Mon, Feb 8, 2010 at 10:13 AM,  <josef.pktd@xxxxxxxxx> wrote:
> On Mon, Feb 8, 2010 at 12:39 PM, Keith Goodman <kwgoodman@xxxxxxxxx> wrote:
>> Is there a better design? Would it be better to always reorder on
>> binary operations even if the labels are aligned?
>
> I didn't have any good ideas when I briefly looked at the problem. I
> think my example was when I tried to do a diff() (when I didn't know
> much about larry yet), but I don't remember any details.
>
> For the time axis, ordering is important also for the moving functions
> and eg. fill_forward.
> For labels that are names, it would be nice to be able to work with
> arbitrary ordering.
>
> Does _align sort every axis, even if only one axis has disagreement ?

No. Only the axes that are not aligned:

>> y1 = la.larry([[1,2],[3,4]], [[1,0],[0,1]])
>> y2 = la.larry([[1,2],[3,4]], [[1,0],[1,0]])
>> y1 + y2

label_0
    1
    0
label_1
    0
    1
x
array([[3, 3],
       [7, 7]])



Follow ups

References