Replaces quick fix in #1357 with a proper fix employing __array_priority__ feature and adds more mixed algebra tests.
Please read and adhere to the contribution guidelines.
Please tick the following:
https://github.com/SyneRBI/SIRF/pull/1373
(2 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@KrisThielemans commented on this pull request.
As I don't know anything about __array_priority__, I'll leave it to @paskino and @casperdcl to review.
BTW, what happens if the sizes are wrong? Shouldn't we add some check?
This will have to be squash merged (after modifying CHANGES and the user's guide appropriately), due to the somewhat horrible history.
> @@ -790,24 +790,47 @@ def data_container_algebra_tests(test, x, eps=1e-4):
t = numpy.linalg.norm(az)
test.check_if_zero_within_tolerance(s, eps * t)
+ z = ay*x
+ az = z.as_array()
are we sure we really want to use as_array() for these tests? Obviously, if replacing it with asarray() we'd have to be very careful for any operatoins that modify the object.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@evgueni-ovtchinnikov commented on this pull request.
> @@ -790,24 +790,47 @@ def data_container_algebra_tests(test, x, eps=1e-4):
t = numpy.linalg.norm(az)
test.check_if_zero_within_tolerance(s, eps * t)
+ z = ay*x
+ az = z.as_array()
better safe than sorry IMHO
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@evgueni-ovtchinnikov commented on this pull request.
> @@ -790,24 +790,47 @@ def data_container_algebra_tests(test, x, eps=1e-4):
t = numpy.linalg.norm(az)
test.check_if_zero_within_tolerance(s, eps * t)
+ z = ay*x
+ az = z.as_array()
BTW, what happens if the sizes are wrong?
assert_validities would raise AssertionError
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@KrisThielemans commented on this pull request.
> @@ -790,24 +790,47 @@ def data_container_algebra_tests(test, x, eps=1e-4):
t = numpy.linalg.norm(az)
test.check_if_zero_within_tolerance(s, eps * t)
+ z = ay*x
+ az = z.as_array()
better safe than sorry IMHO
not necessarily for tests. Probably a good idea to do at least some of the tests with asarray() as well, as the future, it's what is must likely to hit us.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@evgueni-ovtchinnikov commented on this pull request.
> @@ -790,24 +790,47 @@ def data_container_algebra_tests(test, x, eps=1e-4):
t = numpy.linalg.norm(az)
test.check_if_zero_within_tolerance(s, eps * t)
+ z = ay*x
+ az = z.as_array()
Actually, replacing every as_array use with that of asarray is perfectly safe as asarray defaults to copy - to get a view, you need asarray(copy=False) (we probably should keep as_array method in our data container classes for backward compatibility). However, this needs a separate PR I believe, this one just fixes #1357.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@evgueni-ovtchinnikov pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@evgueni-ovtchinnikov pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@KrisThielemans commented on this pull request.
> @@ -790,24 +790,47 @@ def data_container_algebra_tests(test, x, eps=1e-4):
t = numpy.linalg.norm(az)
test.check_if_zero_within_tolerance(s, eps * t)
+ z = ay*x
+ az = z.as_array()
asarraydefaults to copy
no it doesn't. it defaults to view (if the container supports it).
Whatever, I still feel we need to test with the most used function, even if you know in the end it gives the same results (but at some point, it might not)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()