Skip to content

Commit 8f76c6a

Browse files
committed
Remove in-place add, sub, and mul
1 parent d70c2f9 commit 8f76c6a

3 files changed

Lines changed: 0 additions & 84 deletions

File tree

src/flint/test/test_all.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2840,8 +2840,6 @@ def quick_poly():
28402840
assert raises(lambda: mpoly({(0, 0): 2, (0, 1): 2, (1, 0): 3, (2, 2): 4}) + None, TypeError)
28412841
assert raises(lambda: None + mpoly({(0, 0): 2, (0, 1): 2, (1, 0): 3, (2, 2): 4}), TypeError)
28422842
assert raises(lambda: quick_poly() + P(ctx=ctx1), IncompatibleContextError)
2843-
assert raises(lambda: quick_poly().__iadd__(P(ctx=ctx1)), IncompatibleContextError)
2844-
assert quick_poly().__iadd__(None) is NotImplemented
28452843

28462844
assert quick_poly() - mpoly({(0, 0): 5, (0, 1): 6, (1, 0): 7, (2, 2): 8}) \
28472845
== mpoly({(0, 0): -4, (0, 1): -4, (1, 0): -4, (2, 2): -4})
@@ -2855,8 +2853,6 @@ def quick_poly():
28552853
assert raises(lambda: quick_poly() - None, TypeError)
28562854
assert raises(lambda: None - quick_poly(), TypeError)
28572855
assert raises(lambda: quick_poly() - P(ctx=ctx1), IncompatibleContextError)
2858-
assert raises(lambda: quick_poly().__isub__(P(ctx=ctx1)), IncompatibleContextError)
2859-
assert quick_poly().__isub__(None) is NotImplemented
28602856

28612857
assert quick_poly() * mpoly({(1, 0): 5, (0, 1): 6}) \
28622858
== mpoly({
@@ -2878,8 +2874,6 @@ def quick_poly():
28782874
assert raises(lambda: quick_poly() * None, TypeError)
28792875
assert raises(lambda: None * quick_poly(), TypeError)
28802876
assert raises(lambda: quick_poly() * P(ctx=ctx1), IncompatibleContextError)
2881-
assert raises(lambda: quick_poly().__imul__(P(ctx=ctx1)), IncompatibleContextError)
2882-
assert quick_poly().__imul__(None) is NotImplemented
28832877

28842878
assert quick_poly() // mpoly({(1, 1): 1}) == mpoly({(1, 1): 4})
28852879
assert quick_poly() % mpoly({(1, 1): 1}) \

src/flint/types/fmpq_mpoly.pyx

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -348,19 +348,6 @@ cdef class fmpq_mpoly(flint_mpoly):
348348
return res
349349
return NotImplemented
350350

351-
def __iadd__(self, other):
352-
if typecheck(other, fmpq_mpoly):
353-
if (<fmpq_mpoly>self).ctx is not (<fmpq_mpoly>other).ctx:
354-
raise IncompatibleContextError(f"{(<fmpq_mpoly>self).ctx} is not {(<fmpq_mpoly>other).ctx}")
355-
fmpq_mpoly_add((<fmpq_mpoly>self).val, (<fmpq_mpoly>self).val, (<fmpq_mpoly>other).val, self.ctx.val)
356-
return self
357-
else:
358-
other = any_as_fmpq(other)
359-
if other is not NotImplemented:
360-
fmpq_mpoly_add_fmpq((<fmpq_mpoly>self).val, (<fmpq_mpoly>self).val, (<fmpq>other).val, self.ctx.val)
361-
return self
362-
return NotImplemented
363-
364351
def __sub__(self, other):
365352
cdef fmpq_mpoly res
366353
if typecheck(other, fmpq_mpoly):
@@ -386,19 +373,6 @@ cdef class fmpq_mpoly(flint_mpoly):
386373
return -res
387374
return NotImplemented
388375

389-
def __isub__(self, other):
390-
if typecheck(other, fmpq_mpoly):
391-
if (<fmpq_mpoly>self).ctx is not (<fmpq_mpoly>other).ctx:
392-
raise IncompatibleContextError(f"{(<fmpq_mpoly>self).ctx} is not {(<fmpq_mpoly>other).ctx}")
393-
fmpq_mpoly_sub((<fmpq_mpoly>self).val, (<fmpq_mpoly>self).val, (<fmpq_mpoly>other).val, self.ctx.val)
394-
return self
395-
else:
396-
other = any_as_fmpq(other)
397-
if other is not NotImplemented:
398-
fmpq_mpoly_sub_fmpq((<fmpq_mpoly>self).val, (<fmpq_mpoly>self).val, (<fmpq>other).val, self.ctx.val)
399-
return self
400-
return NotImplemented
401-
402376
def __mul__(self, other):
403377
cdef fmpq_mpoly res
404378
if typecheck(other, fmpq_mpoly):
@@ -424,19 +398,6 @@ cdef class fmpq_mpoly(flint_mpoly):
424398
return res
425399
return NotImplemented
426400

427-
def __imul__(self, other):
428-
if typecheck(other, fmpq_mpoly):
429-
if (<fmpq_mpoly>self).ctx is not (<fmpq_mpoly>other).ctx:
430-
raise IncompatibleContextError(f"{(<fmpq_mpoly>self).ctx} is not {(<fmpq_mpoly>other).ctx}")
431-
fmpq_mpoly_mul((<fmpq_mpoly>self).val, (<fmpq_mpoly>self).val, (<fmpq_mpoly>other).val, self.ctx.val)
432-
return self
433-
else:
434-
other = any_as_fmpq(other)
435-
if other is not NotImplemented:
436-
fmpq_mpoly_scalar_mul_fmpq(self.val, (<fmpq_mpoly>self).val, (<fmpq>other).val, self.ctx.val)
437-
return self
438-
return NotImplemented
439-
440401
def __pow__(self, other, modulus):
441402
cdef fmpq_mpoly res
442403
if modulus is not None:

src/flint/types/fmpz_mpoly.pyx

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -328,19 +328,6 @@ cdef class fmpz_mpoly(flint_mpoly):
328328
return res
329329
return NotImplemented
330330

331-
def __iadd__(self, other):
332-
if typecheck(other, fmpz_mpoly):
333-
if (<fmpz_mpoly>self).ctx is not (<fmpz_mpoly>other).ctx:
334-
raise IncompatibleContextError(f"{(<fmpz_mpoly>self).ctx} is not {(<fmpz_mpoly>other).ctx}")
335-
fmpz_mpoly_add((<fmpz_mpoly>self).val, (<fmpz_mpoly>self).val, (<fmpz_mpoly>other).val, self.ctx.val)
336-
return self
337-
else:
338-
zval = any_as_fmpz(other)
339-
if zval is not NotImplemented:
340-
fmpz_mpoly_add_fmpz((<fmpz_mpoly>self).val, (<fmpz_mpoly>self).val, (<fmpz>zval).val, self.ctx.val)
341-
return self
342-
return NotImplemented
343-
344331
def __sub__(self, other):
345332
cdef fmpz_mpoly res
346333
if typecheck(other, fmpz_mpoly):
@@ -366,19 +353,6 @@ cdef class fmpz_mpoly(flint_mpoly):
366353
return -res
367354
return NotImplemented
368355

369-
def __isub__(self, other):
370-
if typecheck(other, fmpz_mpoly):
371-
if (<fmpz_mpoly>self).ctx is not (<fmpz_mpoly>other).ctx:
372-
raise IncompatibleContextError(f"{(<fmpz_mpoly>self).ctx} is not {(<fmpz_mpoly>other).ctx}")
373-
fmpz_mpoly_sub((<fmpz_mpoly>self).val, (<fmpz_mpoly>self).val, (<fmpz_mpoly>other).val, self.ctx.val)
374-
return self
375-
else:
376-
other = any_as_fmpz(other)
377-
if other is not NotImplemented:
378-
fmpz_mpoly_sub_fmpz((<fmpz_mpoly>self).val, (<fmpz_mpoly>self).val, (<fmpz>other).val, self.ctx.val)
379-
return self
380-
return NotImplemented
381-
382356
def __mul__(self, other):
383357
cdef fmpz_mpoly res
384358
if typecheck(other, fmpz_mpoly):
@@ -404,19 +378,6 @@ cdef class fmpz_mpoly(flint_mpoly):
404378
return res
405379
return NotImplemented
406380

407-
def __imul__(self, other):
408-
if typecheck(other, fmpz_mpoly):
409-
if (<fmpz_mpoly>self).ctx is not (<fmpz_mpoly>other).ctx:
410-
raise IncompatibleContextError(f"{(<fmpz_mpoly>self).ctx} is not {(<fmpz_mpoly>other).ctx}")
411-
fmpz_mpoly_mul((<fmpz_mpoly>self).val, (<fmpz_mpoly>self).val, (<fmpz_mpoly>other).val, self.ctx.val)
412-
return self
413-
else:
414-
other = any_as_fmpz(other)
415-
if other is not NotImplemented:
416-
fmpz_mpoly_scalar_mul_fmpz(self.val, (<fmpz_mpoly>self).val, (<fmpz>other).val, self.ctx.val)
417-
return self
418-
return NotImplemented
419-
420381
def __pow__(self, other, modulus):
421382
cdef fmpz_mpoly res
422383
if modulus is not None:

0 commit comments

Comments
 (0)