-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: new types for independent measurements and dependent measurements #7
Comments
Addresses issue #7. This is mostly a proof of concept, does not work very well. Complex numbers may not currently work (at a first glance, it looks impossible to have Complex{IndependentMeasurement}, see for example log(::Complex{T}) which internally has log(convert(T,2))::T which cannot be true). As a work around, complex numbers may be forced to Complex{DependentMeasurement}, which however defeats the purpose of this change. Still TODO: implement specific methods for `result` function with `IndependentMeasurement`-only arguments, which will greatly improve performance.
Addresses issue #7. This is mostly a proof of concept, does not work very well. Complex numbers may not currently work (at a first glance, it looks impossible to have Complex{IndependentMeasurement}, see for example log(::Complex{T}) which internally has log(convert(T,2))::T which cannot be true). As a work around, complex numbers may be forced to Complex{DependentMeasurement}, which however defeats the purpose of this change. Still TODO: implement specific methods for `result` function with `IndependentMeasurement`-only arguments, which will greatly improve performance.
Different approach in |
I support this evolution. As far as I understand, the Python uncertainties packages works in this way. I have written code to do elaborations of uncertain and correlated quantities in R and resorted to the same concepts. It seems to me the most straightforward way to easily track down correlations when doing elaborations using quantities that themselves depend on overlapping sets of uncertain variables. |
The reason why that I never went on with this idea is that it creates lots of type-instabilities, or it makes it more likely to have inhomogeneous containers which include both If one wants to distinguish an "independent" measure from a derived quantity, I believe traits would be a better approach. |
We could make
Measurement
type abstract, and define two concrete types,IndependentMeasurement
andDependentMeasurement
(the latter may be an abuse of language but gives the idea):measurement
function would createIndependentMeasurement
objects, whileresult
function insrc/math.jl
would createDependentMeasurement
objects. This function could have a specialized method forIndependentMeasurement
only arguments, which could be fairly efficient.Ideally, there would not be user-visible changes, apart from performance improvements.
I'm not sure this proposal will actually improve performance, I'm leaving this as a memo for me open for discussion.
The text was updated successfully, but these errors were encountered: