CTile#
- class CTile#
A class representing a ciphertext.
It’s called a CTile because from a high-level point of view we’ll usually use several of these combined for holding a more complicated object such as a matrix. For a lower level documentation of different functionalities (such as the effect on chainIndex), see documentation of the underlying encryption scheme.
- add(self: pyhelayers.CTile, other: pyhelayers.CTile) None #
Add content of another ciphertext to this one, elementwise. Result is stored in place. Depending on scheme, this may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use add_raw() to get the scheme’s raw addition operation.
- Parameters:
other – Other ciphertext to add.
- add_plain(self: pyhelayers.CTile, other: pyhelayers.PTile) None #
Add content of another PTile to this one, elementwise. Result is stored in place. Depending on scheme, this may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use add_plain_raw() to get the scheme’s raw addition operation.
- Parameters:
other – Other PTile to add.
- add_plain_raw(self: pyhelayers.CTile, other: pyhelayers.PTile) None #
See add_plain().
- Parameters:
other – Other PTile to add.
- add_raw(self: pyhelayers.CTile, other: pyhelayers.CTile) None #
See add().
- Parameters:
other – Other ciphertext to add.
- add_scalar(*args, **kwargs)#
Overloaded function.
add_scalar(self: pyhelayers.CTile, scalar: complex) -> None
Adds a complex scalar value to all slots in this ciphertext. :param scalar: value to add. :type scalar: complex
add_scalar(self: pyhelayers.CTile, scalar: float) -> None
Adds a double scalar value to all slots in this ciphertext.
- param scalar:
value to add.
- type scalar:
float
add_scalar(self: pyhelayers.CTile, scalar: int) -> None
Adds an integer scalar value to all slots in this ciphertext.
- param scalar:
integer value to add.
- type scalar:
int
- add_tile(self: pyhelayers.CTile, other: pyhelayers.Tile) None #
Calls add(CTile) or add_plain(PTile) depending on argument type.
- Parameters:
other – Other object to add.
- add_tile_raw(self: pyhelayers.CTile, other: pyhelayers.Tile) None #
See add_tile().
- Parameters:
other – Other object to add.
- assert_correct_scale(self: pyhelayers.CTile, message: str = '', warn_epsilon: float = 1e-20, error_epsilon: float = 1e-10, fix: bool = True, target_scale: float = -1) None #
Verify this CTile has a correct scale, and optionally correct it.
- Parameters:
message – Message to include in case of warning or error. Defaults to an empty string
warn_epsilon – Warn epsilon. Defaults to 1e-20.
error_epsilon – Error epsilon. Defaults to 1e-10.
fix – If True the scale is fixed if to target scale. Defaults to True
target_scale – The scale to test with and to fix. If set to -1, the usual accurate scale for this level is used. Defaults to -1.
- bootstrap(self: pyhelayers.CTile) None #
Bootstrap this CTile, if this is supported by the underlying HeContext. Bootstrapping will raise the chain index of this CTile, allowing more multiplications to be done. However, this operation is likely to be time-consuming, and may add noise to the ciphertext in some schemes (such as CKKS). Bootstrapping is only supported if the HeContext used to create this CTile was initialized to be bootstrappable (see also HeConfigRequirement::bootstrappable). :raises RuntimeError: If the HeContext used to create this CTile is
not bootstrappable.
- clear_last_n_slots(self: pyhelayers.CTile, arg0: int) None #
Sets the last n slots of this CTile to 0, by multiplying it with a relevant mask. If n is 0, does nothing.
- Parameters:
n – The number of slots to clear.
- Raises:
ValueError – If n is negative or greater than the number of slots.
- conjugate(self: pyhelayers.CTile) None #
Conjugates contents of this CTile in place, elementwise. For non-complex numbers this has no effect. Depending on scheme, this may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use conjugate_raw() to get the scheme’s raw conjugate operation.
- conjugate_raw(self: pyhelayers.CTile) None #
See conjugate().
- get_conjugate(self: pyhelayers.CTile) pyhelayers.CTile #
Returns the result of conjugating contents of this CTile, elementwise. For non-complex numbers this has no effect. Depending on scheme, this may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use conjugateRaw() to get the scheme’s raw conjugate operation.
- get_current_device(self: pyhelayers.CTile) Tuple[pyhelayers.DeviceType, int] #
Returns the current device of this CTile.
- Return type:
DeviceType, int
- get_estimated_memory_usage_bytes(self: pyhelayers.CTile) int #
Returns an estimation of the memory usage, or -1 if not supported.
- get_he_context(self: pyhelayers.CTile) pyhelayers.HeContext #
Returns the HE context used to initialize this CTile.
- get_multiply(self: pyhelayers.CTile, other: pyhelayers.CTile) pyhelayers.CTile #
Returns the result of multiplication of this and other CTile. Relies on CTile::multiply().
- Parameters:
other – Other ciphertext to multiply.
- get_size(self: pyhelayers.CTile) int #
Returns the number of polynomials in the ciphertext (as reduced via relinearization).
- Return type:
int
- inner_sum(*args, **kwargs)#
Overloaded function.
inner_sum(self: pyhelayers.CTile) -> None
Computes the inner sum of all of the ciphertext’s slots. Performs the computation by repeated rotations and additions, with rotations 1, 2, 4, up to slotCount (exclusive). The result is duplicated in all slots.
inner_sum(self: pyhelayers.CTile, rot1: int, rot2: int, reverse: bool = False) -> None
Computes the inner sum of some of the ciphertext’s slots. Performs the computation by repeated rotations and additions, with rotations rot1, 2*rot1, 4*rot2, up to rot2 (exclusive). Using this method properly is complicated, and is used by some higher level algorithms.
- param rot1:
First rotation in the rotate-and-add loop.
- type int1:
int
- param rot2:
Last rotation (exclusive) in the rotate-and-add loop.
- type rot2:
int
- param reverse:
If true, flips all rotations (left to right and vice versa). Defaults to false.
- type reverse:
bool
- is_empty(self: pyhelayers.CTile) bool #
Returns true if this CTile does not include an encryption of any value, and false otherwise.
- multiply(self: pyhelayers.CTile, other: pyhelayers.CTile) None #
Multiply another ciphertext with this one, elementwise. Result is stored in place. Depending on scheme, this may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use multiplyRaw() to get the scheme’s raw addition operation.
- Parameters:
other – Other ciphertext to multiply.
- multiply_by_changing_scale(self: pyhelayers.CTile, factor: float) None #
Multiply this ciphertext by a scalar double value, elementwise, by a light-weight scale changing. This multiplies every slot by the given factor. The operation is done by changing the scale meta-data combined with this ciphertext, and is therefore extremely fast. It is not available for all underlying schemes, and also may cause difficulties down the line due to mismatching scales.
- Parameters:
factor (float) – factor to multiply with.
- Raises:
RuntimeError – If not supported.
- multiply_imaginary_unit(self: pyhelayers.CTile) None #
Multiplies all slots in this ciphertext with the imaginary unit (i).
- multiply_plain(self: pyhelayers.CTile, other: pyhelayers.PTile) None #
Multiply the content this PTile by another one, elementwise. Result is stored in place. Depending on scheme, this may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use multiply_plain_raw() to get the scheme’s raw multiplication operation.
- Parameters:
other – Other PTile to multiply.
- multiply_plain_raw(self: pyhelayers.CTile, other: pyhelayers.PTile) None #
See multiply_plain().
- Parameters:
other – Other PTile to multiply.
- multiply_raw(self: pyhelayers.CTile, other: pyhelayers.CTile) None #
See multiply().
- Parameters:
other – Other ciphertext to multiply.
- multiply_scalar(*args, **kwargs)#
Overloaded function.
multiply_scalar(self: pyhelayers.CTile, scalar: int) -> None
Multiplies all slots in this ciphertext with an integer scalar value.
- param scalar:
integer value to multiply.
- type scalar:
int
multiply_scalar(self: pyhelayers.CTile, scalar: complex) -> None
Multiplies all slots in this ciphertext with a complex scalar value. :param scalar: value to multiply. :type scalar: complex
multiply_scalar(self: pyhelayers.CTile, scalar: float) -> None
Multiplies all slots in this ciphertext with a double scalar value.
- param scalar:
value to multiply.
- type scalar:
float
- multiply_scalar_raw(*args, **kwargs)#
Overloaded function.
multiply_scalar_raw(self: pyhelayers.CTile, scalar: complex) -> None
See multiply_scalar().
- param scalar:
value to multiply.
- type scalar:
complex
multiply_scalar_raw(self: pyhelayers.CTile, scalar: float) -> None
See multiply_scalar().
- param scalar:
value to multiply.
- type scalar:
float
- multiply_tile(self: pyhelayers.CTile, other: pyhelayers.Tile) None #
Calls multiply(CTile) or multiply_plain(PTile) depending on argument type.
- Parameters:
other – Other object to multiply.
- multiply_tile_raw(self: pyhelayers.CTile, other: pyhelayers.Tile) None #
See multiply_tile().
- Parameters:
other – Other object to multiply.
- negate(self: pyhelayers.CTile) None #
Negates content of this ciphertext.
- nullify_imaginary_part(self: pyhelayers.CTile) None #
Nullify the imaginary part of each slot in this ciphertext.
- relinearize(self: pyhelayers.CTile) None #
Performs a relinearize operation (reducing ciphertext size after multiplication) The non-raw version of multiplication takes care of this automatically when needed. Ignored if not needed or not supported.
- rescale(self: pyhelayers.CTile) None #
Performs a rescale operation (reducing ciphertext modulus bits and attached meta data scale). The non-raw version of multiplication takes care of this automatically. Ignored if not needed or not supported. Note that depending on scheme, this method may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use rescale_raw() to get the scheme’s raw rescale operation.
- rescale_raw(self: pyhelayers.CTile) None #
See rescale().
- rotate(self: pyhelayers.CTile, n: int) None #
Rotate left. For an offset of n, the element at slots 10 will move to slot 10-n. The first n elements are rotated back to be last.
- Parameters:
n – Rotate offset.
- square(self: pyhelayers.CTile) None #
squares contents of this CTile in place, elementwise. Depending on scheme, this may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use square_raw() to get the scheme’s raw square operation.
- square_raw(self: pyhelayers.CTile) None #
See square().
- sub(self: pyhelayers.CTile, other: pyhelayers.CTile) None #
Subtract the content of another CTile from this one, element-wise. Result is stored in place. Depending on scheme, this may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use sub_raw() to get the scheme’s raw subtraction operation.
- Parameters:
other – Other ciphertext to sub.
- sub_plain(self: pyhelayers.CTile, other: pyhelayers.PTile) None #
sub content of another PTile to this one, elementwise. Result is stored in place. Depending on scheme, this may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use sub_plain_raw() to get the scheme’s raw subtraction operation.
- Parameters:
other – Other PTile to sub.
- sub_plain_raw(self: pyhelayers.CTile, other: pyhelayers.PTile) None #
See sub_plain().
- Parameters:
other – Other PTile to sub.
- sub_raw(self: pyhelayers.CTile, other: pyhelayers.CTile) None #
See sub().
- Parameters:
other – Other ciphertext to sub.
- sub_tile(self: pyhelayers.CTile, other: pyhelayers.Tile) None #
Calls sub(CTile) or sub_plain(PTile) depending on argument type.
- Parameters:
other – Other object to subtract.
- sub_tile_raw(self: pyhelayers.CTile, other: pyhelayers.Tile) None #
See sub_tile().
- Parameters:
other – Other object to subtract.
- sum_exp_by_squaring_left_to_right(self: pyhelayers.CTile, n: int) None #
Sums n slots of this ciphertext. After summing, slot i will contain the sum of slots i, i+1, i+2, …, i+n-1, where indices are cyclic, i.e., roll back to the start if run out over the edge. Summation is done similar to left-to-right repeated squaring algorithm.
- Parameters:
n – number of elements to summarize.
- sum_exp_by_squaring_right_to_left(self: pyhelayers.CTile, n: int) None #
Sums n slots of this ciphertext. After summing, slot i will contain the sum of slots i, i+1, i+2, …, i+n-1, where indices are cyclic, i.e., roll back to the start if run out over the edge. Summation is done similar to right-to-left repeated squaring algorithm.
- Parameters:
n – number of elements to summarize.
- to_device(self: pyhelayers.CTile, type: pyhelayers.DeviceType, device_id: int = 0) None #
Move this CTile to another device.
- Parameters:
type – The device type to move to.
device_id – The device ID to move to. Device ID can be from 0 to n-1,
where n is the the number of devices of the specified type.
-
class CTile : public helayers::Tile#
A class representing a ciphertext.
It’s called a CTile because from a high-level point of view we’ll usually use several of these combined for holding a more complicated object such as a matrix. For a lower level documentation of different functionalities (such as the effect on chainIndex), see documentation of the underlying encryption scheme.
Notice that some of the methods below implement a binary operation between two CTile objects or between a CTile and a PTile object. In these binary operations, and in the case where chain index is a relevant concept for the underlying scheme, the implementation will automatically handle the case where the chain indexes of the two operands are different.
Notice that some of the methods below have two versions: a “raw” and a “non-raw” version. The “raw” version differs from the “non-raw” version by not performing relinearize and rescale as part of the operation.
Public Functions
-
CTile() = default#
-
CTile(const HeContext &he)#
Constructs an empty object.
- Parameters:
he – [in] the underlying context.
-
virtual ~CTile()#
-
CTile &operator=(const CTile &src)#
Copy from another object.
- Parameters:
src – [in] Object to copy.
-
CTile &operator=(CTile &&src) noexcept#
Move from another object.
- Parameters:
src – [in] Object to move.
-
void conjugate()#
Conjugates contents of this CTile in place, elementwise.
For non-complex numbers this has no effect. Depending on scheme, this may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use conjugateRaw() to get the scheme’s raw conjugate operation.
-
CTile getConjugate() const#
Returns the result of conjugating contents of this CTile, elementwise.
For non-complex numbers this has no effect. Depending on scheme, this may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use conjugateRaw() to get the scheme’s raw conjugate operation.
-
void conjugateRaw()#
See conjugate().
-
virtual void rotate(int n) override#
rotate the PTile slots n steps to left
- Parameters:
n – - number of steps
-
void add(const CTile &other)#
Add content of another ciphertext to this one, elementwise.
Result is stored in place. Depending on scheme, this may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use addRaw() to get the scheme’s raw addition operation.
- Parameters:
other – [in] other ciphertext to add.
-
void sub(const CTile &other)#
Subtract content of another ciphertext from this one, elementwise.
Result is stored in place. Depending on scheme, this may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use subRaw() to get the scheme’s raw subtraction operation.
- Parameters:
other – [in] other ciphertext to subtract.
-
void multiply(const CTile &other)#
Multiply another ciphertext with this one, elementwise.
Result is stored in place. Depending on scheme, this may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use multiplyRaw() to get the scheme’s raw multiplication operation.
- Parameters:
other – [in] other ciphertext to multiply.
-
void multiplyRaw(const CTile &other)#
see multiply()
-
CTile getMultiply(const CTile &other) const#
Returns the result of multiplication of this and other CTile.
Relies on CTile::multiply().
- Parameters:
other – Other ciphertext to multiply.
-
void addPlain(const PTile &plain)#
Add content of another PTile to this one, elementwise.
Result is stored in place. Depending on scheme, this may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use addPlainRaw() to get the scheme’s raw addition operation.
- Parameters:
plain – [in] PTile to add.
-
void addPlainRaw(const PTile &plain)#
See addPlain()
-
void subPlain(const PTile &plain)#
Subtract content of another PTile from this one, elementwise.
Result is stored in place. Depending on scheme, this may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use subPlainRaw() to get the scheme’s raw subtract operation.
- Parameters:
plain – [in] PTile to subtract.
-
void subPlainRaw(const PTile &plain)#
See subPlain()
-
void multiplyPlain(const PTile &plain)#
Multiply a PTile with this CTile, elementwise.
Result is stored in place. Depending on scheme, this may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use multiplyPlainRaw() to get the scheme’s raw multiplication operation.
- Parameters:
plain – [in] PTile to multiply with.
-
void multiplyPlainRaw(const PTile &plain)#
See multiplyPlain()
-
void addTile(const Tile &other)#
Calls add(const CTile&) or addPlain(const PTile&) depending on argument type.
- Parameters:
other – Other object to add.
-
void subTile(const Tile &other)#
Calls sub(const CTile&) or subPlain(const PTile&) depending on argument type.
- Parameters:
other – Other object to subtract.
-
void multiplyTile(const Tile &other)#
Calls multiply(const CTile&) or multiplyPlain(const PTile&) depending on argument type.
- Parameters:
other – Other object to multiply.
-
void multiplyTileRaw(const Tile &other)#
See multiplyTile()
-
void square()#
Square content of this ciphertext, elementwise.
Result is stored in place. Depending on scheme, this may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use squareRaw() to get the scheme’s raw square operation.
-
void multiplyByChangingScale(double factor)#
Multiply this ciphertext by a scalar double value, elementwise, by a light-weight scale changing.
This multiplies every slot by the given factor. The operation is done by changing the scale meta-data combined with this ciphertext, and is therefore extremely fast. It is not available for all underlying schemes, and also may cause difficulties down the line due to mismatching scales.
- Parameters:
factor – [in] factor to multiply with.
- Throws:
runtime_error – If not supported
-
void addScalar(int scalar)#
Adds an int scalar value to all slots in this ciphertext.
- Parameters:
scalar – [in] value to add.
-
void addScalar(double scalar)#
Adds a double scalar value to all slots in this ciphertext.
- Parameters:
scalar – [in] value to add.
-
void addScalar(const std::complex<double> &scalar)#
Adds a complex scalar value to all slots in this ciphertext.
- Parameters:
scalar – value to add.
-
void multiplyScalar(int scalar)#
Multiplies all slots in this ciphertext with an int scalar value.
- Parameters:
scalar – [in] value to multiply.
-
void multiplyScalar(double scalar)#
Multiplies all slots in this ciphertext with a double scalar value.
Use multiplyScalarRaw() to get the scheme’s raw multiply scalar operation.
- Parameters:
scalar – [in] value to multiply.
-
void multiplyScalar(const std::complex<double> &scalar)#
Multiplies all slots in this ciphertext with a complex scalar value.
- Parameters:
scalar – value to multiply.
-
void multiplyScalarRaw(double scalar)#
See multiplyScalar().
- Parameters:
scalar – [in] value to multiply.
-
void multiplyScalarRaw(const std::complex<double> &scalar)#
Multiplies all slots in this ciphertext with a complex scalar value.
- Parameters:
scalar – value to multiply.
-
void multiplyImaginaryUnit()#
Multiplies all slots in this ciphertext with the imaginary unit (i).
-
void nullifyImaginaryPart()#
Nullify the imaginary part of each slot in this ciphertext.
-
void relinearize()#
Performs a relinearize operation (reducing ciphertext size after multiplication) The non-raw version of multiplication takes care of this automatically when needed.
Ignored if not needed or not supported.
-
void rescale()#
Performs a rescale operation (reducing ciphertext modulus bits and attached meta data scale).
The non-raw version of multiplication takes care of this automatically. Ignored if not needed or not supported. Note that depending on scheme, this method may perform some additional light-weight tasks allowing for a smooth sequence of operations. Use rescaleRaw() to get the scheme’s raw rescale operation.
-
void negate()#
Negates content of this ciphertext.
-
virtual void setScale(double scale) override#
Sets the attached meta data scale of the ciphertext.
This may change the way its content are interpreted.
- Parameters:
scale – [in] the new scale
- Throws:
runtime_error – If not supported
-
virtual double getScale() const override#
Returns the attached meta data scale of the ciphertext.
-
int getSize() const#
Returns the number of polynomials in the ciphertext (as reduced via relinearization)
-
virtual void reduceChainIndex() override#
Reduces the chain-index property of the ciphertext by 1.
Ignored if not supported.
- Throws:
runtime_error – If chain index is already at lowest value
-
virtual void setChainIndex(int chainIndex) override#
Sets the chain-index property of this object to equal the specified value.
Can only be used if the specified value is less than or equal to the chain index of this object. Ignored if not supported.
- Parameters:
chainIndex – [in] The target value to set the chain index to
- Throws:
runtime_error – If the specified chain index is higher than this
-
virtual int getChainIndex() const override#
Returns the value of the chain-index property of this object, which is a non-negative integer.
Returns a negative value if not supported.
-
virtual int slotCount() const override#
A CTile represents a ciphertext consisting of multiple slots.
This method returns the number of slots in this object.
-
void innerSum()#
Computes the inner sum of all of the ciphertext’s slots.
Performs the computation by repeated rotations and additions, with rotations 1, 2, 4, up to slotCount (exclusive). The result is duplicated in all slots.
-
void innerSum(int rot1, int rot2, bool reverse = false)#
Computes the inner sum of some of the ciphertext’s slots.
Performs the computation by repeated rotations and additions, with rotations rot1, 2*rot1, 4*rot1, up to rot2 (exclusive). Using this method properly is complicated, and is used by some higher level algorithms.
- Parameters:
rot1 – First rotation in the rotate-and-add loop
rot2 – Last rotation (exclusive) in the rotate-and-add loop
reverse – If true, flips all rotations (left to right and vice versa)
-
void sumExpBySquaringLeftToRight(int n)#
Summarizes n slots of this ciphertext.
After summing, slot i will contain the sum of slots i, i+1, i+2, …, i+n-1, where indices are cyclic, i.e., roll back to the start if run out over the edge. Summation is done similar to left-to-right repeated squaring algorithm.
- Parameters:
n – [in] number of elements to summarize
-
void sumExpBySquaringRightToLeft(int n)#
Summarizes n slots of this ciphertext.
After summing, slot i will contain the sum of slots i, i+1, i+2, …, i+n-1, where indices are cyclic, i.e., roll back to the start if run out over the edge. Summation is done similar to right-to-left repeated squaring algorithm.
- Parameters:
n – [in] number of elements to summarize
-
void clearLastNSlots(int n)#
Sets the last n slots of this CTile to 0, by multiplying it with a relevant mask.
If n is 0, does nothing.
- Parameters:
n – The number of slots to clear.
- Throws:
invalid_argument – if n is negative or greater than the number of slots.
-
void bootstrap()#
Bootstrap this CTile, if this is supported by the underlying HeContext.
Bootstrapping will raise the chain index of this CTile, allowing more multiplications to be done. However, this operation is likely to be time-consuming, and may add noise to the ciphertext in some schemes (such as CKKS). Bootstrapping is only supported if the HeContext used to create this CTile was initialized to be bootstrappable (see also HeConfigRequirement::bootstrappable).
-
virtual void toDevice(DeviceType type, int deviceId = 0) override#
Move this CTile to another device.
- Parameters:
type – [in] The device type to move to.
deviceId – [in] The device ID to move to. Device ID can be from 0 to n-1, where n is the the number of devices of the specified type.
-
virtual std::pair<DeviceType, int> getCurrentDevice() const override#
Returns the current device of this CTile.
-
bool isEmpty() const#
Returns true if this CTile does not include an encryption of any value, and false otherwise.
-
virtual void debugPrint(const std::string &title = "", Verbosity verbosity = VERBOSITY_REGULAR, std::ostream &out = std::cout) const override#
Prints the content of this object.
- Parameters:
title – Text to add to the print
verbosity – Verbosity level
out – Output stream
-
inline const AbstractCiphertext &getImpl() const#
Reserved for debugging and internal use.
-
inline AbstractCiphertext &getImpl()#
Reserved for debugging and internal use.
-
virtual int64_t getEstimatedMemoryUsageBytes() const override#
Returns an estimation of the memory usage, or -1 if not supported.
-
inline virtual int32_t getContextId() const override#
Returns the contextId of the HeContext this object was initialized with.
This contextId can be used, for example, to verify HeContext match when loading a saved Saveable object. Returning -1 signals no HeContext.
-
void assertCorrectScale(const std::string &message = "", double warnEpsilon = 1e-20, double errorEpsilon = 1e-10, bool fix = true, double targetScale = -1)#
Verify this CTile has a correct scale, and optionally correct it.
- Parameters:
message – Message to include in case of warning or error.
warnEpsilon – Warn epsilon (used with MathUtils::isEqual)
errorEpsilon – Error epsilon (used with MathUtils::isEqual)
fix – If true (default) the scale is fixed if to target scale.
targetScale – The scale to test with and to fix. If set to -1 (default) the usual accurate scale for this level is used.
-
CTile() = default#