I came from he pint package, disappointed with its numpy support to scimath in hopes that the UnitArray could present some interesting possibilities. Unfortunately this is not the case. I would like to run a unit-aware dot product using 2 unit arrays, but this won't work:
a = UnitArray(np.linspace(0, 5, 6), units="cm")
b = UnitArray(np.linspace(0, 9, 6), units="sec")
c = np.dot(a,b)
type(c) shows that this is a numpy.float64 object and not a UnitArray of length 0 or a UnitScalar as I would expect. This makes it difficult for me to see the use of UnitArrays since they currently only appear to support element wise multiplication in numpy...
Is there a concise way of doing a unit-aware dot product with scimath? If so how? If not how to implement it?
I came from he
pintpackage, disappointed with itsnumpysupport toscimathin hopes that theUnitArraycould present some interesting possibilities. Unfortunately this is not the case. I would like to run a unit-aware dot product using 2 unit arrays, but this won't work:type(c)shows that this is anumpy.float64object and not aUnitArrayof length 0 or aUnitScalaras I would expect. This makes it difficult for me to see the use ofUnitArrayssince they currently only appear to support element wise multiplication in numpy...Is there a concise way of doing a unit-aware dot product with
scimath? If so how? If not how to implement it?