Skip to content

Conversation

@karlwessel
Copy link

This is my own try at fixing issue #121.

It works by adding sqrt as a member function to AffineScalarFunc so that numpy knows how to calculate the square root of it.

This also makes some other numpy methods work like numpy.sqrt.

@pkienzle
Copy link

The method used here (adding sqrt to the class) will work for many (all?) of the functions in umath, so for example np.sin(ufloat) would return umath.sin(ufloat). Any interest in extending this patch to include all these functions?

The attribute would be needed for both Variable and AffineScalarFunc.

Some methods will need different names, such as arcsin instead of asin.

@karlwessel
Copy link
Author

karlwessel commented Mar 23, 2020

The method used here (adding sqrt to the class) will work for many (all?) of the functions in umath, so for example np.sin(ufloat) would return umath.sin(ufloat). Any interest in extending this patch to include all these functions?

The attribute would be needed for both Variable and AffineScalarFunc.

Some methods will need different names, such as arcsin instead of asin.

During implementation of the patch I already did that for exp but removed it in the end to keep the PR on point (which is just fixing issue #121).

I think once this PR is merged and has proven to work for some time, one could implement your suggestion in a separate PR.

@AndrewAnnex
Copy link

I can see that some time has past since this pr was last updated, and I just ran into this issue (plus the norm one) when attempting to use uncertainties with statsmodels. Are the failed checks related to an incomplete implementation? If this works as-is I can make progress on my own work by just monkey-patching

@AndrewAnnex
Copy link

I also see an issue where numpy needs an implementation of the conjugate method as the default in numpy is to use the Frobenius norm, although this is really not my area

@jagerber48
Copy link
Contributor

My rewrite, discussed in #251 implements sqrt on UFloat and so would cover this PR and associated issue. In that rewrite the np.linalg.norm functions work on a dtype=object ndarray of UFloat objects, or on the UArray object (thin wrapper for dtype=object ndarray of UFloat).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants