MCPcopy
hub / github.com/keon/algorithms / clone

Method clone

algorithms/math/polynomial.py:219–228  ·  view source on GitHub ↗

Create a deep copy of this monomial. Returns: A new Monomial with the same variables and coefficient.

(self)

Source from the content-addressed store, hash-verified

217 return self.__truediv__(other)
218
219 def clone(self) -> Monomial:
220 """Create a deep copy of this monomial.
221
222 Returns:
223 A new Monomial with the same variables and coefficient.
224 """
225 temp_variables = {i: self.variables[i] for i in self.variables}
226 return Monomial(
227 temp_variables, Monomial._rationalize_if_possible(self.coeff)
228 ).clean()
229
230 def clean(self) -> Monomial:
231 """Remove variables with zero power.

Callers 6

test_polynomial_cloneMethod · 0.45
test_monomial_cloneMethod · 0.45
__add__Method · 0.45
__sub__Method · 0.45
__mul__Method · 0.45
cloneMethod · 0.45

Calls 3

MonomialClass · 0.85
cleanMethod · 0.80

Tested by 2

test_polynomial_cloneMethod · 0.36
test_monomial_cloneMethod · 0.36