Skip to content

Commit

Permalink
[Unitary Hack] Qint integer division #27
Browse files Browse the repository at this point in the history
  • Loading branch information
ShayanMajumder committed Jun 3, 2024
1 parent 25dd29d commit dcce2cc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion qlasskit/types/qint.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def bitwise_and(cls, tleft: TExp, tright: TExp) -> TExp:
@classmethod
def bitwise_or(cls, tleft: TExp, tright: TExp) -> TExp:
return cls.bitwise_generic(Or, tleft, tright)

@classmethod
def floor_div(cls, tleft: TExp, tright: TExp) -> TExp:
"""Perform floor division on two Qint"""
Expand Down
2 changes: 1 addition & 1 deletion qlasskit/types/qtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def bitwise_and(tleft: TExp, tright: TExp) -> TExp:
@staticmethod
def bitwise_or(tleft: TExp, tright: TExp) -> TExp:
raise Exception("abstract bitwise_or")

@staticmethod
def floor_div(tleft: TExp, tright: TExp) -> TExp:
raise Exception("abstract floor_div")
2 changes: 1 addition & 1 deletion test/qlassf/test_int.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_qint2_to_bin(self):
c = Qint2(1).to_bin()
self.assertEqual(c, "10")
self.assertEqual(c, Qint2(1).export("binary"))

def test_floor_div(self):
self.assertEqual(Qint2.floor_div(Qint2(10), Qint2(3)), Qint2(3))
self.assertEqual(Qint2.floor_div(Qint2(20), Qint2(4)), Qint2(5))
Expand Down

0 comments on commit dcce2cc

Please sign in to comment.