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:
the ShiftedTemplate and StackedTemplate classes are removed from the code base, because they are not currently used and are more classes that would need maintenance.
all the JSON-related methods are also removed, due to their replacement in #240.
This PR changes how scaling is performed in
tqec
.This fix #241.
Before
Before that PR, the
Dimension
class was storing aLinearFunction
describing how theDimension
was supposed to scale and avalue
representing the current value of theDimension
.The
Template
instance were taking theDimension
instances as input, and were using them to scale internally, but were only outputting integers resulting from the "instantiation" of suchDimension
instances.In this PR
This PR completely removes the
Dimension
class.Template
instances are now responsible for storing the scaling parameterk
along with theLinearFunction
instances needed to scale.The
Template
class now requires the implementation of a newscalable_shape
property that returns the shape of theTemplate
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 aPiecewiseLinearFunction
class due to the use ofmin
/max
in the computation of the methods needed forscalable_shape
.As side (but important) notes:
ShiftedTemplate
andStackedTemplate
classes are removed from the code base, because they are not currently used and are more classes that would need maintenance.