bertiniteam / b2

Bertini 2.0: The redevelopment of Bertini in C++.
90 stars 34 forks source link

precision problems when calling `run` for an endgame #145

Closed ofloveandhate closed 6 years ago

ofloveandhate commented 6 years ago

I'm working on an example using the endgames to compute singular endpoints, and while broadly successful, am getting the following error:

RuntimeError                              Traceback (most recent call last)
<ipython-input-9-2d50f2cbad6b> in <module>()
     10         target_time.precision( midpath_points[ii][0].precision())
     11         print('before {} {} {}'.format(eg_boundary.precision(), target_time.precision(), midpath_points[ii][0].precision()))
---> 12         eg.run(start_time=eg_boundary, target_time=target_time, start_point=midpath_points[ii])
     13         final_points[ii] = eg.final_approximation()
     14         print('after {} {} {}'.format(eg_boundary.precision(), target_time.precision(), midpath_points[ii][0].precision()))

RuntimeError: CauchyEG Run time and point must be of matching precision. (16!=20)

checking the precisions of the inputs seems to reveal them to be uniform; however, the internals of the core disagree. what's up with that?

ofloveandhate commented 6 years ago

the issue is that the way Eigen::Vector<T> is exposed through minieigen, the return type for get_item is not a reference, but a copy. Hence, while checking the precision of a vector in python via v[0].precision(), we are not actually checking the precision of the element of the vector, but a copy of it -- which is inevitably at current default precision.

see https://github.com/eudoxos/minieigen/issues/15

ofloveandhate commented 6 years ago

issued a pull request, after forking minieigen into bertiniteam and changing the submodule to refer to bertiniteam/minieigen instead of eudoxus/minieigen

https://github.com/eudoxos/minieigen/pull/16