Closed mstechly closed 3 years ago
Hello @mstechly, thank you for your interest in Mitiq! If this is a bug report, please provide screenshots and/or minimum viable code to reproduce your issue, so we can do our best to help get it fixed. If you have any questions in the meantime, you can also ask us on the Unitary Fund Discord.
Thanks @mstechly! We want Mitiq to be as user friendly as possible and so this kind of constructive criticism and feedback is very useful.
I write down some proposals:
extrapolate
and extrapolate_with_full_output
(suggested by @mstechly).full_output
option.Tuple[float, Dict[str, Any]]
, where the float is the zne value and the dictionary contains all the rest. See e.g. this function https://github.com/unitaryfund/mitiq/blob/master/mitiq/pec/pec.py#L40.Dict[str, Any]]
where the zne value is one of the elements.Personally, I lean towards 2 + 3. But other opinions are welcome.
What about a custom return type?
class WhateverFullOutputReturns:
...
class Factory:
...
def extrapolate(...) -> Union[float, WhateverFullOutputReturns]:
Or use the custom return type in all cases?
class ExtrapolateOutput:
...
class Factory:
...
def extrapolate(...) -> ExtrapolateOutput:
@rmlarose I like this idea, perhaps ExtrapolateOutput
could be a NamedTuple
?
It could still use the flag to avoid calculating all the additional quantities if they're not needed. They would be just set to None
if the flag is not specified?
@rmlarose I like this idea, perhaps
ExtrapolateOutput
could be aNamedTuple
?
Yeah, something like this. Whatever minimizes the annotation while not hurting usability is fine by me.
Also worth pointing out that this will break backward compatibility.
Discussed at Mitiq meeting, strong preference for this option.
class ExtrapolateOutput: ... class Factory: ... def extrapolate(...) -> ExtrapolateOutput:
Pre-Report Checklist
Issue Description
The return type of
extrapolate
inRichardsonFactory
is a non-obviousUnion
, which seems to be a bad solution for a couple of reasons:One solution that I can think of is having two functions, e.g.
extrapolate
andextrapolate_with_full_output
? Any other ideas @dexter2206 ?Code Snippet