Essentially this means supporting arrays via one of two strategies:
Developing a quantity numpydtype with the appropriate properties
Developing a custom array, called quanstants.array or quanstants.ndarray or qarray or quarray
In general there will only be support for arrays of quantities of the same unit. An array will consist of numerical values and a single associated unit.
This should make implementation less complicated and more efficient, as the elements of the array are then purely numerical, and the unit arithmetic only has to be done once per operation. Uncertainties will still have to be tracked though.
I personally need to do more research into the way ndarrays and dtypes work before having an idea as to exactly how the implementation should look.
Sadly decimal numbers are not a supported dtype. This would mean either implementing the behaviour ourselves, or converting the numbers to floats when put into an array.
Applications using numpy are less likely to require the exactness of Decimal anyway, so this seems like a reasonable compromise.
pandas dataframes using numpy arrays would suffer. However, the plan (#6) is to support polars, and then that can be recommended preferentially.
Essentially this means supporting arrays via one of two strategies:
numpy
dtype
with the appropriate propertiesquanstants.array
orquanstants.ndarray
orqarray
orquarray
In general there will only be support for arrays of quantities of the same unit. An array will consist of numerical values and a single associated unit.
This should make implementation less complicated and more efficient, as the elements of the array are then purely numerical, and the unit arithmetic only has to be done once per operation. Uncertainties will still have to be tracked though.
I personally need to do more research into the way
ndarray
s anddtypes
work before having an idea as to exactly how the implementation should look.In any case, a custom array type should follow the Python array API standard.
Sadly decimal numbers are not a supported
dtype
. This would mean either implementing the behaviour ourselves, or converting the numbers to floats when put into an array.Applications using
numpy
are less likely to require the exactness ofDecimal
anyway, so this seems like a reasonable compromise.pandas
dataframes usingnumpy
arrays would suffer. However, the plan (#6) is to supportpolars
, and then that can be recommended preferentially.