mpnum icon indicating copy to clipboard operation
mpnum copied to clipboard

Added the function mpsmpo.mpo_to_pmps() for rank-1 MPOs

Open MoritzLange opened this issue 7 years ago • 8 comments

Said function was added in collaboration with Milan. It is used in the tests in my py-tedopa program. Apart from that only two checks in mpsmpo.py were improved by adding error messages (also in collaboration with Milan). I was unfortunately not able to write a test for the mpo_to_pmps().

MoritzLange avatar Apr 14 '18 12:04 MoritzLange

Coverage Status

Coverage decreased (-0.3%) to 93.514% when pulling c78ece8bed4af02066aae3f8899e18517fd91252 on MoritzLange:master into ae825b278c913a4607f71af5afc3e8c9ab2c04eb on dseuss:master.

coveralls avatar Apr 14 '18 13:04 coveralls

Coverage Status

Coverage decreased (-0.3%) to 93.514% when pulling c78ece8bed4af02066aae3f8899e18517fd91252 on MoritzLange:master into ae825b278c913a4607f71af5afc3e8c9ab2c04eb on dseuss:master.

coveralls avatar Apr 14 '18 13:04 coveralls

Coverage Status

Coverage decreased (-0.3%) to 93.514% when pulling c78ece8bed4af02066aae3f8899e18517fd91252 on MoritzLange:master into ae825b278c913a4607f71af5afc3e8c9ab2c04eb on dseuss:master.

coveralls avatar Apr 14 '18 13:04 coveralls

Anything new here?

dsuess avatar Apr 15 '18 08:04 dsuess

I'm in contact with Milan and this is being worked on (slowly but steadily :) ). The current state: I'm afraid I'm unable to write the test for this (due to a mixture of lack of time and lack of experience), but this should be a useful extension of your code, so I decided to post a pull request anyway. About the failing Travis CI build, that seems to have nothing to do with the changes I made (together with Milan). I'm a bit unsure about that. The build for Python 3.5 is failing, in particular one test about it. It throws an error about mpnum.factory.random_mpa, which I didn't even touch.

MoritzLange avatar Apr 24 '18 18:04 MoritzLange

Don't worry about the failing tests. I'll have a look.

Regarding tests: What do you think about testing whether mpo -> pmps -> mpo and pmps -> mpo -> pmps are (almost) identities? If you would like to tackle this please let me know.

dsuess avatar Apr 24 '18 23:04 dsuess

I have thought of testing mpo -> pmps -> mpo and pmps -> mpo -> pmps too, but then looked at your other tests and came to the conclusion that you would not like a test which relies on the correct functioning of another function (pmps_to_mpo() in this case). But now that you've suggested it I've tried to implement that test (sorry for the 2 week delay though). It fails because the normdists are apparently pretty much random and can become as high as 257. Assuming the function to be tested, mpo_to_pmps(), works correctly (it looked like it does when I used it), do you maybe have an idea what the problem with this test is?

MoritzLange avatar May 09 '18 12:05 MoritzLange

No worries, looks good so far.

I think we can't really get around tests depending on other parts working correctly. As long as our test-dependency is not circular, I don't mind. The alternative would be to check local tensors by hand, which is much more prone to error.

I'll have a look at the test.

dsuess avatar May 09 '18 23:05 dsuess