QCHackers / tqec

Design automation software tools for Topological Quantum Error Correction
https://tqec.app
Apache License 2.0
58 stars 15 forks source link

Use scalable variant in templates #254

Closed nelimee closed 1 week ago

nelimee commented 1 week ago

This PR changes how scaling is performed in tqec.

This fix #241.

Before

Before that PR, the Dimension class was storing a LinearFunction describing how the Dimension was supposed to scale and a value representing the current value of the Dimension.

The Template instance were taking the Dimension instances as input, and were using them to scale internally, but were only outputting integers resulting from the "instantiation" of such Dimension instances.

In this PR

This PR completely removes the Dimension class. Template instances are now responsible for storing the scaling parameter k along with the LinearFunction instances needed to scale.

The Template class now requires the implementation of a new scalable_shape property that returns the shape of the Template instance as a fully scalable structure. It basically returns the full information (the full function) instead of returning its value on one specific point (before). For that, ComposedTemplate needed a PiecewiseLinearFunction class due to the use of min/max in the computation of the methods needed for scalable_shape.

As side (but important) notes:

review-notebook-app[bot] commented 1 week ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

nelimee commented 1 week ago

This is ready for review.