You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ok, just thought about it for two more seconds, and i guess what you want is to have an eye function that is 1 where the first two dimensions are equal, so that
a[1,1,1] == a[2,2,1] == a[1,1,2] == a[2,2,2] == 1
Which I guess makes sense if one would do column major style broadcasting for things like matrix product etc, or anything else.
Now this is again leading to more fundamental questions ... wether we could / should support col-major "broadcasting". I fear right now we don't have the manpower for that and it's also not clear that it would bring a lot of advantages. On the other hand, given all the code we already have for row-major broadcasting, it should not be so far out to do it, but it adds some complexity to the overall code base...
Ah this looks heavily related to the prepend / append of new dimension conversation in #57.
Where you have a[1,2,2]=1 (Python and xtensor convention), in the R world we would have subset this as a[2,2,1]=1
To me, both mean "second element of first dimension, second element of second dimension, first element of third dimension"
I don't think it has to do with the way R prints. To be fair, because of these prepend/append of dimension differences (which bleeds into how things print), I think numpy array printing is highly confusing, with R printing being more intuitive.
About to get on a plane! Can chat more later today
Activity
wolfv commentedon Jan 12, 2019
that's definitely a bug it should behave the same way for row- vs col-major (your expectation seems correct)
wolfv commentedon Feb 5, 2019
looking into this right now, so far i couldn't reproduce with "pure" xtensor. checking xtensor-r now!
wolfv commentedon Feb 5, 2019
Ok, I looked into this and I think this is related to R's way of printing.
E.g. check out:
and this is true and works. However, the way R prints multidimensional arrays is very awkward, and leads to this confusion.
What do you think @DavisVaughan ?
Sorry, again, that it took so long to get back to this.
wolfv commentedon Feb 5, 2019
Ok, just thought about it for two more seconds, and i guess what you want is to have an
eyefunction that is1where the first two dimensions are equal, so thatWhich I guess makes sense if one would do column major style broadcasting for things like matrix product etc, or anything else.
Now this is again leading to more fundamental questions ... wether we could / should support col-major "broadcasting". I fear right now we don't have the manpower for that and it's also not clear that it would bring a lot of advantages. On the other hand, given all the code we already have for row-major broadcasting, it should not be so far out to do it, but it adds some complexity to the overall code base...
DavisVaughan commentedon Feb 5, 2019
Ah this looks heavily related to the prepend / append of new dimension conversation in #57.
Where you have
a[1,2,2]=1(Python and xtensor convention), in the R world we would have subset this asa[2,2,1]=1To me, both mean "second element of first dimension, second element of second dimension, first element of third dimension"
I don't think it has to do with the way R prints. To be fair, because of these prepend/append of dimension differences (which bleeds into how things print), I think numpy array printing is highly confusing, with R printing being more intuitive.
About to get on a plane! Can chat more later today
DavisVaughan commentedon Feb 5, 2019
The new equality you show above looks correct to me!
DavisVaughan commentedon May 19, 2019
I think
eye()needs an order/layout template parameter as well, asnumpy.eye()has anorder = 'C'argument. I'm fairly certain that's the fix here.https://docs.scipy.org/doc/numpy/reference/generated/numpy.eye.html