Added the function mpsmpo.mpo_to_pmps() for rank-1 MPOs
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().
Coverage decreased (-0.3%) to 93.514% when pulling c78ece8bed4af02066aae3f8899e18517fd91252 on MoritzLange:master into ae825b278c913a4607f71af5afc3e8c9ab2c04eb on dseuss:master.
Coverage decreased (-0.3%) to 93.514% when pulling c78ece8bed4af02066aae3f8899e18517fd91252 on MoritzLange:master into ae825b278c913a4607f71af5afc3e8c9ab2c04eb on dseuss:master.
Coverage decreased (-0.3%) to 93.514% when pulling c78ece8bed4af02066aae3f8899e18517fd91252 on MoritzLange:master into ae825b278c913a4607f71af5afc3e8c9ab2c04eb on dseuss:master.
Anything new here?
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.
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.
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?
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.