Skip to content

Commit

Permalink
finish refactoring OperatorMsg
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremiah Corrado <jeremiah.corrado@hpe.com>
  • Loading branch information
jeremiah-corrado committed Sep 17, 2024
1 parent a78fd96 commit c6c2935
Show file tree
Hide file tree
Showing 4 changed files with 1,321 additions and 1,498 deletions.
14 changes: 9 additions & 5 deletions arkouda/pdarrayclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,8 @@ def _r_binop(self, other: pdarray, op: str) -> pdarray:
if dt not in DTypes:
raise TypeError(f"Unhandled scalar type: {other} ({type(other)})")
repMsg = generic_msg(
cmd=f"binopsv{self.ndim}D",
args={"op": op, "dtype": dt, "value": other, "a": self},
cmd=f"binopsv<{self.dtype},{dt},{self.ndim}>",
args={"op": op, "dtype": dt, "a": self, "value": other},
)
return create_pdarray(repMsg)

Expand Down Expand Up @@ -777,7 +777,10 @@ def opeq(self, other, op):
if isinstance(other, pdarray):
if self.shape != other.shape:
raise ValueError(f"shape mismatch {self.shape} {other.shape}")
generic_msg(cmd=f"opeqvv{self.ndim}D", args={"op": op, "a": self, "b": other})
generic_msg(
cmd=f"opeqvv<{self.dtype},{other.dtype},{self.ndim}>",
args={"op": op, "a": self, "b": other}
)
return self
# pdarray binop scalar
# opeq requires scalar to be cast as pdarray dtype
Expand All @@ -791,8 +794,9 @@ def opeq(self, other, op):
raise TypeError(f"Unhandled scalar type: {other} ({type(other)})")

generic_msg(
cmd=f"opeqvs{self.ndim}D",
args={"op": op, "a": self, "dtype": self.dtype.name, "value": self.format_other(other)},
# TODO: does opeqvs really need to select over pairs of dtypes?
cmd=f"opeqvs<{self.dtype},{self.dtype},{self.ndim}>",
args={"op": op, "a": self, "value": self.format_other(other)},
)
return self

Expand Down
Loading

0 comments on commit c6c2935

Please sign in to comment.