diff --git a/.configs/registration-config-multi-dim.json b/.configs/registration-config-multi-dim.json index e8e0c481d..d3ebe75a4 100644 --- a/.configs/registration-config-multi-dim.json +++ b/.configs/registration-config-multi-dim.json @@ -10,6 +10,15 @@ "bool", "bigint" ] + }, + "binop": { + "dtype": [ + "int", + "uint", + "real", + "bool", + "bigint" + ] } } } diff --git a/.configs/registration-config-single-dim.json b/.configs/registration-config-single-dim.json index 44afced3b..0975fd843 100644 --- a/.configs/registration-config-single-dim.json +++ b/.configs/registration-config-single-dim.json @@ -10,6 +10,15 @@ "bool", "bigint" ] + }, + "binop": { + "dtype": [ + "int", + "uint", + "real", + "bool", + "bigint" + ] } } } diff --git a/arkouda/pdarrayclass.py b/arkouda/pdarrayclass.py index e9fe63dc4..df32b74af 100644 --- a/arkouda/pdarrayclass.py +++ b/arkouda/pdarrayclass.py @@ -482,6 +482,22 @@ def format_other(self, other) -> str: fmt = NUMBER_FORMAT_STRINGS[self.dtype.name] return fmt.format(other) + def _binop_cmd_group(self, op: str) -> str: + """ + get the name of the command that implements an operator + """ + if op in ["+", "-", "*", "%", "**", "//"]: + op_cmd = "arithmeticOp" + elif op in ["==", "!=", "<", ">", "<=", ">="]: + op_cmd = "comparisonOp" + elif op in ["&", "|", "^", "<<", ">>", ">>>", "<<<"]: + op_cmd = "bitwiseOp" + elif op == "/": + op_cmd = "divOp" + else: + raise ValueError(f"unrecognized operator {op}") + return op_cmd + # binary operators def _binop(self, other: pdarray, op: str) -> pdarray: """ @@ -514,13 +530,19 @@ def _binop(self, other: pdarray, op: str) -> pdarray: return NotImplemented if op not in self.BinOps: raise ValueError(f"bad operator {op}") + op_cmd = self._binop_cmd_group(op) + # pdarray binop pdarray if isinstance(other, pdarray): try: x1, x2, tmp_x1, tmp_x2 = broadcast_if_needed(self, other) except ValueError: raise ValueError(f"shape mismatch {self.shape} {other.shape}") - repMsg = generic_msg(cmd=f"binopvv{x1.ndim}D", args={"op": op, "a": x1, "b": x2}) + + repMsg = generic_msg( + cmd=f"{op_cmd}VV<{x1.dtype},{x2.dtype},{x1.ndim}>", + args={"op": op, "a": x1, "b": x2} + ) if tmp_x1: del x1 if tmp_x2: @@ -537,8 +559,8 @@ def _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"binopvs{self.ndim}D", - args={"op": op, "a": self, "dtype": dt, "value": other}, + cmd=f"{op_cmd}VS<{self.dtype},{dt},{self.ndim}>", + args={"op": op, "a": self, "value": other}, ) return create_pdarray(repMsg) @@ -581,9 +603,10 @@ def _r_binop(self, other: pdarray, op: str) -> pdarray: other = self.dtype.type(other) if dt not in DTypes: raise TypeError(f"Unhandled scalar type: {other} ({type(other)})") + op_cmd = self._binop_cmd_group(op) repMsg = generic_msg( - cmd=f"binopsv{self.ndim}D", - args={"op": op, "dtype": dt, "value": other, "a": self}, + cmd=f"{op_cmd}SV<{dt},{self.dtype},{self.ndim}>", + args={"op": op, "value": other, "b": self}, ) return create_pdarray(repMsg) @@ -772,9 +795,13 @@ def opeq(self, other, op): raise ValueError(f"bad operator {op}") # pdarray op= pdarray if isinstance(other, pdarray): + # TODO: shape broadcasting here if needed 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 @@ -787,9 +814,10 @@ def opeq(self, other, op): # Can't cast other as dtype of pdarray raise TypeError(f"Unhandled scalar type: {other} ({type(other)})") + # TODO: shouldn't we use the dtype of 'other' here? generic_msg( - cmd=f"opeqvs{self.ndim}D", - args={"op": op, "a": self, "dtype": self.dtype.name, "value": self.format_other(other)}, + cmd=f"opeqVS<{self.dtype},{self.dtype},{self.ndim}>", + args={"op": op, "a": self, "value": self.format_other(other)}, ) return self diff --git a/registration-config.json b/registration-config.json index 44afced3b..0975fd843 100644 --- a/registration-config.json +++ b/registration-config.json @@ -10,6 +10,15 @@ "bool", "bigint" ] + }, + "binop": { + "dtype": [ + "int", + "uint", + "real", + "bool", + "bigint" + ] } } } diff --git a/src/BinOp.chpl b/src/BinOp.chpl deleted file mode 100644 index 8419c6b0f..000000000 --- a/src/BinOp.chpl +++ /dev/null @@ -1,2061 +0,0 @@ - -module BinOp -{ - use ServerConfig; - - use MultiTypeSymbolTable; - use MultiTypeSymEntry; - use Logging; - use Message; - use BitOps; - use BigInteger; - - - private config const logLevel = ServerConfig.logLevel; - private config const logChannel = ServerConfig.logChannel; - const omLogger = new Logger(logLevel, logChannel); - - /* - Helper function to ensure that floor division cases are handled in accordance with numpy - */ - inline proc floorDivisionHelper(numerator: ?t, denom: ?t2): real { - if (numerator == 0 && denom == 0) || (isInf(numerator) && (denom != 0 || isInf(denom))){ - return nan; - } - else if (numerator > 0 && denom == -inf) || (numerator < 0 && denom == inf){ - return -1:real; - } - else { - return floor(numerator/denom); - } - } - - /* - Helper function to ensure that mod cases are handled in accordance with numpy - */ - inline proc modHelper(dividend: ?t, divisor: ?t2): real { - extern proc fmod(x: real, y: real): real; - - var res = fmod(dividend, divisor); - // to convert fmod (truncated) results into mod (floored) results - // when the dividend and divsor have opposite signs, - // we add the divsor into the result - // except for when res == 0 (divsor even divides dividend) - // see https://en.wikipedia.org/wiki/Modulo#math_1 for more information - if res != 0 && (((dividend < 0) && (divisor > 0)) || ((dividend > 0) && (divisor < 0))) { - // we do + either way because we want to shift up for positive divisors and shift down for negative - res += divisor; - } - return res; - } - - /* - Generic function to execute a binary operation on pdarray entries - in the symbol table - - :arg l: symbol table entry of the LHS operand - - :arg r: symbol table entry of the RHS operand - - :arg e: symbol table entry to store result of operation - - :arg op: string representation of binary operation to execute - :type op: string - - :arg rname: name of the `e` in the symbol table - :type rname: string - - :arg pn: routine name of callsite function - :type pn: string - - :arg st: SymTab to act on - :type st: borrowed SymTab - - :returns: (MsgTuple) - :throws: `UndefinedSymbolError(name)` - */ - proc doBinOpvv(l, r, e, op: string, rname, pn, st) throws { - if e.etype == bool { - // Since we know that the result type is a boolean, we know - // that it either (1) is an operation between bools or (2) uses - // a boolean operator (<, <=, etc.) - if l.etype == bool && r.etype == bool { - select op { - when "|" { - e.a = l.a | r.a; - } - when "&" { - e.a = l.a & r.a; - } - when "^" { - e.a = l.a ^ r.a; - } - when "==" { - e.a = l.a == r.a; - } - when "!=" { - e.a = l.a != r.a; - } - when "<" { - e.a = l.a:int < r.a:int; - } - when ">" { - e.a = l.a:int > r.a:int; - } - when "<=" { - e.a = l.a:int <= r.a:int; - } - when ">=" { - e.a = l.a:int >= r.a:int; - } - when "+" { - e.a = l.a | r.a; - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - // All types support the same binary operations when the resultant - // type is bool and `l` and `r` are not both boolean, so this does - // not need to be specialized for each case. - else { - if ((l.etype == real && r.etype == bool) || (l.etype == bool && r.etype == real)) { - select op { - when "<" { - e.a = l.a:real < r.a:real; - } - when ">" { - e.a = l.a:real > r.a:real; - } - when "<=" { - e.a = l.a:real <= r.a:real; - } - when ">=" { - e.a = l.a:real >= r.a:real; - } - when "==" { - e.a = l.a:real == r.a:real; - } - when "!=" { - e.a = l.a:real != r.a:real; - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - else { - select op { - when "<" { - e.a = l.a < r.a; - } - when ">" { - e.a = l.a > r.a; - } - when "<=" { - e.a = l.a <= r.a; - } - when ">=" { - e.a = l.a >= r.a; - } - when "==" { - e.a = l.a == r.a; - } - when "!=" { - e.a = l.a != r.a; - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // Since we know that both `l` and `r` are of type `int` and that - // the resultant type is not bool (checked in first `if`), we know - // what operations are supported based on the resultant type - else if (l.etype == int && r.etype == int) || - (l.etype == uint && r.etype == uint) { - if e.etype == int || e.etype == uint { - select op { - when "+" { - e.a = l.a + r.a; - } - when "-" { - e.a = l.a - r.a; - } - when "*" { - e.a = l.a * r.a; - } - when "//" { // floordiv - ref ea = e.a; - ref la = l.a; - ref ra = r.a; - [(ei,li,ri) in zip(ea,la,ra)] ei = if ri != 0 then li/ri else 0; - } - when "%" { // modulo - ref ea = e.a; - ref la = l.a; - ref ra = r.a; - [(ei,li,ri) in zip(ea,la,ra)] ei = if ri != 0 then li%ri else 0; - } - when "<<" { - ref ea = e.a; - ref la = l.a; - ref ra = r.a; - [(ei,li,ri) in zip(ea,la,ra)] if (0 <= ri && ri < 64) then ei = li << ri; - } - when ">>" { - ref ea = e.a; - ref la = l.a; - ref ra = r.a; - [(ei,li,ri) in zip(ea,la,ra)] if (0 <= ri && ri < 64) then ei = li >> ri; - } - when "<<<" { - e.a = rotl(l.a, r.a); - } - when ">>>" { - e.a = rotr(l.a, r.a); - } - when "&" { - e.a = l.a & r.a; - } - when "|" { - e.a = l.a | r.a; - } - when "^" { - e.a = l.a ^ r.a; - } - when "**" { - if || reduce (r.a<0){ - //instead of error, could we paste the below code but of type float? - var errorMsg = "Attempt to exponentiate base of type Int64 to negative exponent"; - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - e.a= l.a**r.a; - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } else if e.etype == real { - select op { - // True division is the only integer type that would result in a - // resultant type of `real` - when "/" { - e.a = l.a:real / r.a:real; - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - else if (e.etype == int && r.etype == uint) || - (e.etype == uint && r.etype == int) { - select op { - when ">>" { - ref ea = e.a; - ref la = l.a; - ref ra = r.a; - [(ei,li,ri) in zip(ea,la,ra)] if (0 <= ri && ri < 64) then ei = li >> ri; - } - when "<<" { - ref ea = e.a; - ref la = l.a; - ref ra = r.a; - [(ei,li,ri) in zip(ea,la,ra)] if (0 <= ri && ri < 64) then ei = li << ri; - } - when ">>>" { - e.a = rotr(l.a, r.a); - } - when "<<<" { - e.a = rotl(l.a, r.a); - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } else if (l.etype == uint && r.etype == int) || - (l.etype == int && r.etype == uint) { - select op { - when "+" { - e.a = l.a:real + r.a:real; - } - when "-" { - e.a = l.a:real - r.a:real; - } - when "/" { // truediv - e.a = l.a:real / r.a:real; - } - when "//" { // floordiv - ref ea = e.a; - var la = l.a:real; - var ra = r.a:real; - [(ei,li,ri) in zip(ea,la,ra)] ei = floorDivisionHelper(li, ri); - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // If either RHS or LHS type is real, the same operations are supported and the - // result will always be a `real`, so all 3 of these cases can be shared. - else if ((l.etype == real && r.etype == real) || (l.etype == int && r.etype == real) - || (l.etype == real && r.etype == int)) { - select op { - when "+" { - e.a = l.a + r.a; - } - when "-" { - e.a = l.a - r.a; - } - when "*" { - e.a = l.a * r.a; - } - when "/" { // truediv - e.a = l.a / r.a; - } - when "//" { // floordiv - ref ea = e.a; - ref la = l.a; - ref ra = r.a; - [(ei,li,ri) in zip(ea,la,ra)] ei = floorDivisionHelper(li, ri); - } - when "**" { - e.a= l.a**r.a; - } - when "%" { - ref ea = e.a; - ref la = l.a; - ref ra = r.a; - [(ei,li,ri) in zip(ea,la,ra)] ei = modHelper(li, ri); - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } else if ((l.etype == uint && r.etype == real) || (l.etype == real && r.etype == uint)) { - select op { - when "+" { - e.a = l.a:real + r.a:real; - } - when "-" { - e.a = l.a:real - r.a:real; - } - when "*" { - e.a = l.a:real * r.a:real; - } - when "/" { // truediv - e.a = l.a:real / r.a:real; - } - when "//" { // floordiv - ref ea = e.a; - ref la = l.a; - ref ra = r.a; - [(ei,li,ri) in zip(ea,la,ra)] ei = floorDivisionHelper(li, ri); - } - when "**" { - e.a= l.a:real**r.a:real; - } - when "%" { - ref ea = e.a; - ref la = l.a; - ref ra = r.a; - [(ei,li,ri) in zip(ea,la,ra)] ei = modHelper(li, ri); - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } else if ((l.etype == int && r.etype == bool) || (l.etype == bool && r.etype == int)) { - select op { - when "+" { - // Since we don't know which of `l` or `r` is the int and which is the `bool`, - // we can just cast both to int, which will be a noop for the vector that is - // already `int` - e.a = l.a:int + r.a:int; - } - when "-" { - e.a = l.a:int - r.a:int; - } - when "*" { - e.a = l.a:int * r.a:int; - } - when ">>" { - ref ea = e.a; - ref la = l.a; - ref ra = r.a; - [(ei,li,ri) in zip(ea,la,ra)] if (0 <= ri && ri < 64) then ei = li:int >> ri:int; - } - when "<<" { - ref ea = e.a; - ref la = l.a; - ref ra = r.a; - [(ei,li,ri) in zip(ea,la,ra)] if (0 <= ri && ri < 64) then ei = li:int << ri:int; - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } else if ((l.etype == uint && r.etype == bool) || (l.etype == bool && r.etype == uint)) { - select op { - when "+" { - e.a = l.a:uint + r.a:uint; - } - when "-" { - e.a = l.a:uint - r.a:uint; - } - when "*" { - e.a = l.a:uint * r.a:uint; - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } else if ((l.etype == real && r.etype == bool) || (l.etype == bool && r.etype == real)) { - select op { - when "+" { - e.a = l.a:real + r.a:real; - } - when "-" { - e.a = l.a:real - r.a:real; - } - when "*" { - e.a = l.a:real * r.a:real; - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } else if (l.etype == bool && r.etype == bool) { - select op { - when "<<" { - e.a = l.a:int << r.a:int; - } - when ">>" { - e.a = l.a:int >> r.a:int; - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - var errorMsg = notImplementedError(pn,l.dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - - proc doBinOpvs(l, val, e, op: string, dtype, rname, pn, st) throws { - if e.etype == bool { - // Since we know that the result type is a boolean, we know - // that it either (1) is an operation between bools or (2) uses - // a boolean operator (<, <=, etc.) - if l.etype == bool && val.type == bool { - select op { - when "|" { - e.a = l.a | val; - } - when "&" { - e.a = l.a & val; - } - when "^" { - e.a = l.a ^ val; - } - when "==" { - e.a = l.a == val; - } - when "!=" { - e.a = l.a != val; - } - when "<" { - e.a = l.a:int < val:int; - } - when ">" { - e.a = l.a:int > val:int; - } - when "<=" { - e.a = l.a:int <= val:int; - } - when ">=" { - e.a = l.a:int >= val:int; - } - when "+" { - e.a = l.a | val; - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - // All types support the same binary operations when the resultant - // type is bool and `l` and `r` are not both boolean, so this does - // not need to be specialized for each case. - else { - if ((l.etype == real && val.type == bool) || (l.etype == bool && val.type == real)) { - select op { - when "<" { - e.a = l.a:real < val:real; - } - when ">" { - e.a = l.a:real > val:real; - } - when "<=" { - e.a = l.a:real <= val:real; - } - when ">=" { - e.a = l.a:real >= val:real; - } - when "==" { - e.a = l.a:real == val:real; - } - when "!=" { - e.a = l.a:real != val:real; - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - else { - select op { - when "<" { - e.a = l.a < val; - } - when ">" { - e.a = l.a > val; - } - when "<=" { - e.a = l.a <= val; - } - when ">=" { - e.a = l.a >= val; - } - when "==" { - e.a = l.a == val; - } - when "!=" { - e.a = l.a != val; - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // Since we know that both `l` and `r` are of type `int` and that - // the resultant type is not bool (checked in first `if`), we know - // what operations are supported based on the resultant type - else if (l.etype == int && val.type == int) || - (l.etype == uint && val.type == uint) { - if e.etype == int || e.etype == uint { - select op { - when "+" { - e.a = l.a + val; - } - when "-" { - e.a = l.a - val; - } - when "*" { - e.a = l.a * val; - } - when "//" { // floordiv - ref ea = e.a; - ref la = l.a; - [(ei,li) in zip(ea,la)] ei = if val != 0 then li/val else 0; - } - when "%" { // modulo - ref ea = e.a; - ref la = l.a; - [(ei,li) in zip(ea,la)] ei = if val != 0 then li%val else 0; - } - when "<<" { - if 0 <= val && val < 64 { - e.a = l.a << val; - } - } - when ">>" { - if 0 <= val && val < 64 { - e.a = l.a >> val; - } - } - when "<<<" { - e.a = rotl(l.a, val); - } - when ">>>" { - e.a = rotr(l.a, val); - } - when "&" { - e.a = l.a & val; - } - when "|" { - e.a = l.a | val; - } - when "^" { - e.a = l.a ^ val; - } - when "**" { - e.a= l.a**val; - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } else if e.etype == real { - select op { - // True division is the only integer type that would result in a - // resultant type of `real` - when "/" { - e.a = l.a:real / val:real; - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - else if (e.etype == int && val.type == uint) || - (e.etype == uint && val.type == int) { - select op { - when ">>" { - if 0 <= val && val < 64 { - e.a = l.a >> val:l.etype; - } - } - when "<<" { - if 0 <= val && val < 64 { - e.a = l.a << val:l.etype; - } - } - when ">>>" { - e.a = rotr(l.a, val:l.etype); - } - when "<<<" { - e.a = rotl(l.a, val:l.etype); - } - when "+" { - e.a = l.a + val:l.etype; - } - when "-" { - e.a = l.a - val:l.etype; - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - else if (l.etype == bool && val.type == bool) { - select op { - when ">>" { - if(val){ - e.a = l.a:int >> val:int; - }else{ - e.a = l.a:int; - } - } - when "<<" { - if(val){ - e.a = l.a:int << val:int; - }else{ - e.a = l.a:int; - } - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // If either RHS or LHS type is real, the same operations are supported and the - // result will always be a `real`, so all 3 of these cases can be shared. - else if ((l.etype == real && val.type == real) || (l.etype == int && val.type == real) - || (l.etype == real && val.type == int)) { - select op { - when "+" { - e.a = l.a + val; - } - when "-" { - e.a = l.a - val; - } - when "*" { - e.a = l.a * val; - } - when "/" { // truediv - e.a = l.a / val; - } - when "//" { // floordiv - ref ea = e.a; - ref la = l.a; - [(ei,li) in zip(ea,la)] ei = floorDivisionHelper(li, val); - } - when "**" { - e.a= l.a**val; - } - when "%" { - ref ea = e.a; - ref la = l.a; - [(ei,li) in zip(ea,la)] ei = modHelper(li, val); - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - else if e.etype == real && ((l.etype == uint && val.type == int) || (l.etype == int && val.type == uint)) { - select op { - when "+" { - e.a = l.a: real + val: real; - } - when "-" { - e.a = l.a: real - val: real; - } - when "/" { // truediv - e.a = l.a: real / val: real; - } - when "//" { // floordiv - ref ea = e.a; - var la = l.a; - [(ei,li) in zip(ea,la)] ei = floorDivisionHelper(li, val:real); - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - else if ((l.etype == uint && val.type == real) || (l.etype == real && val.type == uint)) { - select op { - when "+" { - e.a = l.a: real + val: real; - } - when "-" { - e.a = l.a: real - val: real; - } - when "*" { - e.a = l.a: real * val: real; - } - when "/" { // truediv - e.a = l.a: real / val: real; - } - when "//" { // floordiv - ref ea = e.a; - ref la = l.a; - [(ei,li) in zip(ea,la)] ei = floorDivisionHelper(li, val); - } - when "**" { - e.a= l.a: real**val: real; - } - when "%" { - ref ea = e.a; - ref la = l.a; - [(ei,li) in zip(ea,la)] ei = modHelper(li, val); - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } else if ((l.etype == int && val.type == bool) || (l.etype == bool && val.type == int)) { - select op { - when "+" { - // Since we don't know which of `l` or `r` is the int and which is the `bool`, - // we can just cast both to int, which will be a noop for the vector that is - // already `int` - e.a = l.a:int + val:int; - } - when "-" { - e.a = l.a:int - val:int; - } - when "*" { - e.a = l.a:int * val:int; - } - when ">>" { - if 0 <= val:int && val:int < 64 { - e.a = l.a:int >> val:int; - } - } - when "<<" { - if 0 <= val:int && val:int < 64 { - e.a = l.a:int << val:int; - } - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } else if ((l.etype == real && val.type == bool) || (l.etype == bool && val.type == real)) { - select op { - when "+" { - e.a = l.a:real + val:real; - } - when "-" { - e.a = l.a:real - val:real; - } - when "*" { - e.a = l.a:real * val:real; - } - otherwise { - var errorMsg = notImplementedError(pn,l.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - var errorMsg = unrecognizedTypeError(pn, "("+dtype2str(l.dtype)+","+dtype2str(dtype)+")"); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - - proc doBinOpsv(val, r, e, op: string, dtype, rname, pn, st) throws { - if e.etype == bool { - // Since we know that the result type is a boolean, we know - // that it either (1) is an operation between bools or (2) uses - // a boolean operator (<, <=, etc.) - if r.etype == bool && val.type == bool { - select op { - when "|" { - e.a = val | r.a; - } - when "&" { - e.a = val & r.a; - } - when "^" { - e.a = val ^ r.a; - } - when "==" { - e.a = val == r.a; - } - when "!=" { - e.a = val != r.a; - } - when "<" { - e.a = val:int < r.a:int; - } - when ">" { - e.a = val:int > r.a:int; - } - when "<=" { - e.a = val:int <= r.a:int; - } - when ">=" { - e.a = val:int >= r.a:int; - } - when "+" { - e.a = val | r.a; - } - otherwise { - var errorMsg = notImplementedError(pn,dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - // All types support the same binary operations when the resultant - // type is bool and `l` and `r` are not both boolean, so this does - // not need to be specialized for each case. - else { - if ((r.etype == real && val.type == bool) || (r.etype == bool && val.type == real)) { - select op { - when "<" { - e.a = val:real < r.a:real; - } - when ">" { - e.a = val:real > r.a:real; - } - when "<=" { - e.a = val:real <= r.a:real; - } - when ">=" { - e.a = val:real >= r.a:real; - } - when "==" { - e.a = val:real == r.a:real; - } - when "!=" { - e.a = val:real != r.a:real; - } - otherwise { - var errorMsg = notImplementedError(pn,dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - else { - select op { - when "<" { - e.a = val < r.a; - } - when ">" { - e.a = val > r.a; - } - when "<=" { - e.a = val <= r.a; - } - when ">=" { - e.a = val >= r.a; - } - when "==" { - e.a = val == r.a; - } - when "!=" { - e.a = val != r.a; - } - otherwise { - var errorMsg = notImplementedError(pn,dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // Since we know that both `l` and `r` are of type `int` and that - // the resultant type is not bool (checked in first `if`), we know - // what operations are supported based on the resultant type - else if (r.etype == int && val.type == int) || - (r.etype == uint && val.type == uint) { - if e.etype == int || e.etype == uint { - select op { - when "+" { - e.a = val + r.a; - } - when "-" { - e.a = val - r.a; - } - when "*" { - e.a = val * r.a; - } - when "//" { // floordiv - ref ea = e.a; - ref ra = r.a; - [(ei,ri) in zip(ea,ra)] ei = if ri != 0 then val/ri else 0; - } - when "%" { // modulo - ref ea = e.a; - ref ra = r.a; - [(ei,ri) in zip(ea,ra)] ei = if ri != 0 then val%ri else 0; - } - when "<<" { - ref ea = e.a; - ref ra = r.a; - [(ei,ri) in zip(ea,ra)] if (0 <= ri && ri < 64) then ei = val << ri; - } - when ">>" { - ref ea = e.a; - ref ra = r.a; - [(ei,ri) in zip(ea,ra)] if (0 <= ri && ri < 64) then ei = val >> ri; - } - when "<<<" { - e.a = rotl(val, r.a); - } - when ">>>" { - e.a = rotr(val, r.a); - } - when "&" { - e.a = val & r.a; - } - when "|" { - e.a = val | r.a; - } - when "^" { - e.a = val ^ r.a; - } - when "**" { - if || reduce (r.a<0){ - var errorMsg = "Attempt to exponentiate base of type Int64 to negative exponent"; - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - e.a= val**r.a; - } - otherwise { - var errorMsg = notImplementedError(pn,dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } else if e.etype == real { - select op { - // True division is the only integer type that would result in a - // resultant type of `real` - when "/" { - e.a = val:real / r.a:real; - } - otherwise { - var errorMsg = notImplementedError(pn,dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - else if (e.etype == int && val.type == uint) || - (e.etype == uint && val.type == int) { - select op { - when ">>" { - ref ea = e.a; - ref ra = r.a; - [(ei,ri) in zip(ea,ra)] if ri:uint < 64 then ei = val:r.etype >> ri; - } - when "<<" { - ref ea = e.a; - ref ra = r.a; - [(ei,ri) in zip(ea,ra)] if ri:uint < 64 then ei = val:r.etype << ri; - } - when ">>>" { - e.a = rotr(val:r.etype, r.a); - } - when "<<<" { - e.a = rotl(val:r.etype, r.a); - } - when "+" { - e.a = val:r.etype + r.a; - } - when "-" { - e.a = val:r.etype - r.a; - } - otherwise { - var errorMsg = notImplementedError(pn,dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // If either RHS or LHS type is real, the same operations are supported and the - // result will always be a `real`, so all 3 of these cases can be shared. - else if ((r.etype == real && val.type == real) || (r.etype == int && val.type == real) - || (r.etype == real && val.type == int)) { - select op { - when "+" { - e.a = val + r.a; - } - when "-" { - e.a = val - r.a; - } - when "*" { - e.a = val * r.a; - } - when "/" { // truediv - e.a = val:real / r.a:real; - } - when "//" { // floordiv - ref ea = e.a; - ref ra = r.a; - [(ei,ri) in zip(ea,ra)] ei = floorDivisionHelper(val:real, ri); - } - when "**" { - e.a= val**r.a; - } - when "%" { - ref ea = e.a; - ref ra = r.a; - [(ei,ri) in zip(ea,ra)] ei = modHelper(val:real, ri); - } - otherwise { - var errorMsg = notImplementedError(pn,dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - else if e.etype == real && ((r.etype == uint && val.type == int) || (r.etype == int && val.type == uint)) { - select op { - when "+" { - e.a = val:real + r.a:real; - } - when "-" { - e.a = val:real - r.a:real; - } - when "/" { // truediv - e.a = val:real / r.a:real; - } - when "//" { // floordiv - ref ea = e.a; - var ra = r.a; - [(ei,ri) in zip(ea,ra)] ei = floorDivisionHelper(val:real, ri); - } - otherwise { - var errorMsg = notImplementedError(pn,dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - else if ((r.etype == uint && val.type == real) || (r.etype == real && val.type == uint)) { - select op { - when "+" { - e.a = val:real + r.a:real; - } - when "-" { - e.a = val:real - r.a:real; - } - when "*" { - e.a = val:real * r.a:real; - } - when "/" { // truediv - e.a = val:real / r.a:real; - } - when "//" { // floordiv - ref ea = e.a; - ref ra = r.a; - [(ei,ri) in zip(ea,ra)] ei = floorDivisionHelper(val:real, ri); - } - when "**" { - e.a= val:real**r.a:real; - } - when "%" { - ref ea = e.a; - ref ra = r.a; - [(ei,ri) in zip(ea,ra)] ei = modHelper(val:real, ri); - } - otherwise { - var errorMsg = notImplementedError(pn,dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } else if ((r.etype == int && val.type == bool) || (r.etype == bool && val.type == int)) { - select op { - when "+" { - // Since we don't know which of `l` or `r` is the int and which is the `bool`, - // we can just cast both to int, which will be a noop for the vector that is - // already `int` - e.a = val:int + r.a:int; - } - when "-" { - e.a = val:int - r.a:int; - } - when "*" { - e.a = val:int * r.a:int; - } - when ">>" { - ref ea = e.a; - ref ra = r.a; - [(ei,ri) in zip(ea,ra)] if (0 <= ri && ri < 64) then ei = val:int >> ri:int; - } - when "<<" { - ref ea = e.a; - ref ra = r.a; - [(ei,ri) in zip(ea,ra)] if (0 <= ri && ri < 64) then ei = val:int << ri:int; - } - otherwise { - var errorMsg = notImplementedError(pn,dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } else if ((r.etype == real && val.type == bool) || (r.etype == bool && val.type == real)) { - select op { - when "+" { - e.a = val:real + r.a:real; - } - when "-" { - e.a = val:real - r.a:real; - } - when "*" { - e.a = val:real * r.a:real; - } - otherwise { - var errorMsg = notImplementedError(pn,dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } else if (r.etype == bool && val.type == bool) { - select op { - when "<<" { - if(val){ - e.a = val:int << r.a:int; - } - } - when ">>" { - if(val){ - e.a = val:int >> r.a:int; - } - } - otherwise { - var errorMsg = notImplementedError(pn,dtype,op,r.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - var errorMsg = unrecognizedTypeError(pn, "("+dtype2str(dtype)+","+dtype2str(r.dtype)+")"); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - - proc doBigIntBinOpvv(l, r, op: string) throws { - var max_bits = max(l.max_bits, r.max_bits); - var max_size = 1:bigint; - var has_max_bits = max_bits != -1; - if has_max_bits { - max_size <<= max_bits; - max_size -= 1; - } - ref la = l.a; - ref ra = r.a; - var tmp = if l.etype == bigint then la else la:bigint; - // these cases are not mutually exclusive, - // so we have a flag to track if tmp is ever populated - var visted = false; - - // had to create bigint specific BinOp procs which return - // the distributed array because we need it at SymEntry creation time - if l.etype == bigint && r.etype == bigint { - // first we try the ops that only work with - // both being bigint - select op { - when "&" { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - t &= ri; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "|" { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - t |= ri; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "^" { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - t ^= ri; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "/" { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - t /= ri; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - } - } - if l.etype == bigint && (r.etype == bigint || r.etype == int || r.etype == uint) { - // then we try the ops that only work with a - // left hand side of bigint - if r.etype != bigint { - // can't shift a bigint by a bigint - select op { - when "<<" { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - if has_max_bits { - if ri >= max_bits { - t = 0; - } - else { - t <<= ri; - t &= local_max_size; - } - } - else { - t <<= ri; - } - } - visted = true; - } - when ">>" { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - if has_max_bits { - if ri >= max_bits { - t = 0; - } - else { - t >>= ri; - t &= local_max_size; - } - } - else { - t >>= ri; - } - } - visted = true; - } - when "<<<" { - if !has_max_bits { - throw new Error("Must set max_bits to rotl"); - } - var botBits = la; - forall (t, ri, bot_bits) in zip(tmp, ra, botBits) with (var local_max_size = max_size) { - var modded_shift = if r.etype == int then ri % max_bits else ri % max_bits:uint; - t <<= modded_shift; - var shift_amt = if r.etype == int then max_bits - modded_shift else max_bits:uint - modded_shift; - bot_bits >>= shift_amt; - t += bot_bits; - t &= local_max_size; - } - visted = true; - } - when ">>>" { - if !has_max_bits { - throw new Error("Must set max_bits to rotr"); - } - var topBits = la; - forall (t, ri, tB) in zip(tmp, ra, topBits) with (var local_max_size = max_size) { - var modded_shift = if r.etype == int then ri % max_bits else ri % max_bits:uint; - t >>= modded_shift; - var shift_amt = if r.etype == int then max_bits - modded_shift else max_bits:uint - modded_shift; - tB <<= shift_amt; - t += tB; - t &= local_max_size; - } - visted = true; - } - } - } - select op { - when "//" { // floordiv - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - if ri != 0 { - t /= ri; - } - else { - t = 0:bigint; - } - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "%" { // modulo - // we only do in place mod when ri != 0, tmp will be 0 in other locations - // we can't use ei = li % ri because this can result in negatives - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - if ri != 0 { - mod(t, t, ri); - } - else { - t = 0:bigint; - } - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "**" { - if || reduce (ra<0) { - throw new Error("Attempt to exponentiate base of type BigInt to negative exponent"); - } - if has_max_bits { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - powMod(t, t, ri, local_max_size + 1); - } - } - else { - forall (t, ri) in zip(tmp, ra) { - t **= ri:uint; - } - } - visted = true; - } - } - } - if (l.etype == bigint && r.etype == bigint) || - (l.etype == bigint && (r.etype == int || r.etype == uint || r.etype == bool)) || - (r.etype == bigint && (l.etype == int || l.etype == uint || l.etype == bool)) { - select op { - when "+" { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - t += ri; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "-" { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - t -= ri; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "*" { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - t *= ri; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - } - } - if !visted { - throw new Error("Unsupported operation: " + l.etype:string +" "+ op +" "+ r.etype:string); - } - return (tmp, max_bits); - } - - proc doBigIntBinOpvvBoolReturn(l, r, op: string) throws { - select op { - when "<" { - return l.a < r.a; - } - when ">" { - return l.a > r.a; - } - when "<=" { - return l.a <= r.a; - } - when ">=" { - return l.a >= r.a; - } - when "==" { - return l.a == r.a; - } - when "!=" { - return l.a != r.a; - } - otherwise { - // we should never reach this since we only enter this proc - // if boolOps.contains(op) - throw new Error("Unsupported operation: " + l.etype:string +" "+ op +" "+ r.etype:string); - } - } - } - - proc doBigIntBinOpvs(l, val, op: string) throws { - var max_bits = l.max_bits; - var max_size = 1:bigint; - var has_max_bits = max_bits != -1; - if has_max_bits { - max_size <<= max_bits; - max_size -= 1; - } - ref la = l.a; - var tmp = if l.etype == bigint then la else la:bigint; - // these cases are not mutually exclusive, - // so we have a flag to track if tmp is ever populated - var visted = false; - - // had to create bigint specific BinOp procs which return - // the distributed array because we need it at SymEntry creation time - if l.etype == bigint && val.type == bigint { - // first we try the ops that only work with - // both being bigint - select op { - when "&" { - forall t in tmp with (var local_val = val, var local_max_size = max_size) { - t &= local_val; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "|" { - forall t in tmp with (var local_val = val, var local_max_size = max_size) { - t |= local_val; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "^" { - forall t in tmp with (var local_val = val, var local_max_size = max_size) { - t ^= local_val; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "/" { - forall t in tmp with (var local_val = val, var local_max_size = max_size) { - t /= local_val; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - } - } - if l.etype == bigint && (val.type == bigint || val.type == int || val.type == uint) { - // then we try the ops that only work with a - // left hand side of bigint - if val.type != bigint { - // can't shift a bigint by a bigint - select op { - when "<<" { - if has_max_bits && val >= max_bits { - forall t in tmp with (var local_zero = 0:bigint) { - t = local_zero; - } - } - else { - forall t in tmp with (var local_val = val, var local_max_size = max_size) { - t <<= local_val; - if has_max_bits { - t &= local_max_size; - } - } - } - visted = true; - } - when ">>" { - if has_max_bits && val >= max_bits { - forall t in tmp with (var local_zero = 0:bigint) { - t = local_zero; - } - } - else { - forall t in tmp with (var local_max_size = max_size) { - t >>= val; - if has_max_bits { - t &= local_max_size; - } - } - } - visted = true; - } - when "<<<" { - if !has_max_bits { - throw new Error("Must set max_bits to rotl"); - } - var botBits = la; - var modded_shift = if val.type == int then val % max_bits else val % max_bits:uint; - var shift_amt = if val.type == int then max_bits - modded_shift else max_bits:uint - modded_shift; - forall (t, bot_bits) in zip(tmp, botBits) with (var local_val = modded_shift, var local_shift_amt = shift_amt, var local_max_size = max_size) { - t <<= local_val; - bot_bits >>= local_shift_amt; - t += bot_bits; - t &= local_max_size; - } - visted = true; - } - when ">>>" { - if !has_max_bits { - throw new Error("Must set max_bits to rotr"); - } - var topBits = la; - var modded_shift = if val.type == int then val % max_bits else val % max_bits:uint; - var shift_amt = if val.type == int then max_bits - modded_shift else max_bits:uint - modded_shift; - forall (t, tB) in zip(tmp, topBits) with (var local_val = modded_shift, var local_shift_amt = shift_amt, var local_max_size = max_size) { - t >>= local_val; - tB <<= local_shift_amt; - t += tB; - t &= local_max_size; - } - visted = true; - } - } - } - select op { - when "//" { // floordiv - forall t in tmp with (var local_val = val, var local_max_size = max_size) { - if local_val != 0 { - t /= local_val; - } - else { - t = 0:bigint; - } - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "%" { // modulo - // we only do in place mod when val != 0, tmp will be 0 in other locations - // we can't use ei = li % val because this can result in negatives - forall t in tmp with (var local_val = val, var local_max_size = max_size) { - if local_val != 0 { - mod(t, t, local_val); - } - else { - t = 0:bigint; - } - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "**" { - if val<0 { - throw new Error("Attempt to exponentiate base of type BigInt to negative exponent"); - } - if has_max_bits { - forall t in tmp with (var local_val = val, var local_max_size = max_size) { - powMod(t, t, local_val, local_max_size + 1); - } - } - else { - forall t in tmp with (var local_val = val) { - t **= local_val:uint; - } - } - visted = true; - } - } - } - if (l.etype == bigint && val.type == bigint) || - (l.etype == bigint && (val.type == int || val.type == uint || val.type == bool)) || - (val.type == bigint && (l.etype == int || l.etype == uint || l.etype == bool)) { - select op { - when "+" { - forall t in tmp with (var local_val = val, var local_max_size = max_size) { - t += local_val; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "-" { - forall t in tmp with (var local_val = val, var local_max_size = max_size) { - t -= local_val; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "*" { - forall t in tmp with (var local_val = val, var local_max_size = max_size) { - t *= local_val; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - } - } - if !visted { - throw new Error("Unsupported operation: " + l.etype:string +" "+ op +" "+ val.type:string); - } - return (tmp, max_bits); - } - - proc doBigIntBinOpvsBoolReturn(l, val, op: string) throws { - ref la = l.a; - var tmp = makeDistArray((...la.shape), bool); - select op { - when "<" { - forall (t, li) in zip(tmp, la) with (var local_val = val) { - t = (li < local_val); - } - } - when ">" { - forall (t, li) in zip(tmp, la) with (var local_val = val) { - t = (li > local_val); - } - } - when "<=" { - forall (t, li) in zip(tmp, la) with (var local_val = val) { - t = (li <= local_val); - } - } - when ">=" { - forall (t, li) in zip(tmp, la) with (var local_val = val) { - t = (li >= local_val); - } - } - when "==" { - forall (t, li) in zip(tmp, la) with (var local_val = val) { - t = (li == local_val); - } - } - when "!=" { - forall (t, li) in zip(tmp, la) with (var local_val = val) { - t = (li != local_val); - } - } - otherwise { - // we should never reach this since we only enter this proc - // if boolOps.contains(op) - throw new Error("Unsupported operation: " +" "+ l.etype:string + op +" "+ val.type:string); - } - } - return tmp; - } - - proc doBigIntBinOpsv(val, r, op: string) throws { - var max_bits = r.max_bits; - var max_size = 1:bigint; - var has_max_bits = max_bits != -1; - if has_max_bits { - max_size <<= max_bits; - max_size -= 1; - } - ref ra = r.a; - var tmp = makeDistArray((...ra.shape), bigint); - tmp = val:bigint; - // these cases are not mutually exclusive, - // so we have a flag to track if tmp is ever populated - var visted = false; - - // had to create bigint specific BinOp procs which return - // the distributed array because we need it at SymEntry creation time - if val.type == bigint && r.etype == bigint { - // first we try the ops that only work with - // both being bigint - select op { - when "&" { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - t &= ri; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "|" { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - t |= ri; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "^" { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - t ^= ri; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "/" { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - t /= ri; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - } - } - if val.type == bigint && (r.etype == bigint || r.etype == int || r.etype == uint) { - // then we try the ops that only work with a - // left hand side of bigint - if r.etype != bigint { - // can't shift a bigint by a bigint - select op { - when "<<" { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - if has_max_bits { - if ri >= max_bits { - t = 0; - } - else { - t <<= ri; - t &= local_max_size; - } - } - else { - t <<= ri; - } - } - visted = true; - } - when ">>" { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - if has_max_bits { - if ri >= max_bits { - t = 0; - } - else { - t >>= ri; - t &= local_max_size; - } - } - else { - t >>= ri; - } - } - visted = true; - } - when "<<<" { - if !has_max_bits { - throw new Error("Must set max_bits to rotl"); - } - var botBits = makeDistArray((...ra.shape), bigint); - botBits = val; - forall (t, ri, bot_bits) in zip(tmp, ra, botBits) with (var local_max_size = max_size) { - var modded_shift = if r.etype == int then ri % max_bits else ri % max_bits:uint; - t <<= modded_shift; - var shift_amt = if r.etype == int then max_bits - modded_shift else max_bits:uint - modded_shift; - bot_bits >>= shift_amt; - t += bot_bits; - t &= local_max_size; - } - visted = true; - } - when ">>>" { - if !has_max_bits { - throw new Error("Must set max_bits to rotr"); - } - var topBits = makeDistArray((...ra.shape), bigint); - topBits = val; - forall (t, ri, tB) in zip(tmp, ra, topBits) with (var local_max_size = max_size) { - var modded_shift = if r.etype == int then ri % max_bits else ri % max_bits:uint; - t >>= modded_shift; - var shift_amt = if r.etype == int then max_bits - modded_shift else max_bits:uint - modded_shift; - tB <<= shift_amt; - t += tB; - t &= local_max_size; - } - visted = true; - } - } - } - select op { - when "//" { // floordiv - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - if ri != 0 { - t /= ri; - } - else { - t = 0:bigint; - } - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "%" { // modulo - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - if ri != 0 { - mod(t, t, ri); - } - else { - t = 0:bigint; - } - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "**" { - if || reduce (ra<0) { - throw new Error("Attempt to exponentiate base of type BigInt to negative exponent"); - } - if has_max_bits { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - powMod(t, t, ri, local_max_size + 1); - } - } - else { - forall (t, ri) in zip(tmp, ra) { - t **= ri:uint; - } - } - visted = true; - } - } - } - if (val.type == bigint && r.etype == bigint) || - (val.type == bigint && (r.etype == int || r.etype == uint || r.etype == bool)) || - (r.etype == bigint && (val.type == int || val.type == uint || val.type == bool)) { - select op { - when "+" { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - t += ri; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "-" { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - t -= ri; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - when "*" { - forall (t, ri) in zip(tmp, ra) with (var local_max_size = max_size) { - t *= ri; - if has_max_bits { - t &= local_max_size; - } - } - visted = true; - } - } - } - if !visted { - throw new Error("Unsupported operation: " + val.type:string +" "+ op +" "+ r.etype:string); - } - return (tmp, max_bits); - } - - proc doBigIntBinOpsvBoolReturn(val, r, op: string) throws { - ref ra = r.a; - var tmp = makeDistArray((...ra.shape), bool); - select op { - when "<" { - forall (t, ri) in zip(tmp, ra) with (var local_val = val) { - t = (local_val < ri); - } - } - when ">" { - forall (t, ri) in zip(tmp, ra) with (var local_val = val) { - t = (local_val > ri); - } - } - when "<=" { - forall (t, ri) in zip(tmp, ra) with (var local_val = val) { - t = (local_val <= ri); - } - } - when ">=" { - forall (t, ri) in zip(tmp, ra) with (var local_val = val) { - t = (local_val >= ri); - } - } - when "==" { - forall (t, ri) in zip(tmp, ra) with (var local_val = val) { - t = (local_val == ri); - } - } - when "!=" { - forall (t, ri) in zip(tmp, ra) with (var local_val = val) { - t = (local_val != ri); - } - } - otherwise { - // we should never reach this since we only enter this proc - // if boolOps.contains(op) - throw new Error("Unsupported operation: " + val.type:string +" "+ op +" "+ r.etype:string); - } - } - return tmp; - } -} diff --git a/src/NumPyDType.chpl b/src/NumPyDType.chpl index b0697a1e9..d56d7c691 100644 --- a/src/NumPyDType.chpl +++ b/src/NumPyDType.chpl @@ -79,10 +79,6 @@ module NumPyDType } } - proc typeSize(type t): int { - return dtypeSize(whichDtype(t)); - } - /* Turns a dtype string in pythonland into a DType :arg dstr: pythonic dtype to be converted @@ -172,8 +168,8 @@ module NumPyDType if t == int then return "%i"; if t == real(32) then return "%.17r"; if t == real then return "%.17r"; - if t == complex(64) then return "%.17z%"; - if t == complex(128) then return "%.17z%"; + if t == complex(64) then return "%.17z%"; // " + if t == complex(128) then return "%.17z%"; // " if t == bool then return "%s"; if t == bigint then return "%?"; if t == string then return "%s"; @@ -189,189 +185,107 @@ module NumPyDType where t != bool do return b; - /* - Return the dtype that can store the result of - an operation between two dtypes for the following - operations: ``+``, ``-``, ``*``, ``**``, ``//``, ``%``, - ``&``, ``|``, ``^``, ``<<``, ``>>`` + /* + Numpy's type promotion rules - follows Numpy's rules for type promotion - (of which the array-api promotion rules are a subset) - */ - proc commonDType(a: DType, b: DType): DType { - select (scalarDTypeKind(a), scalarDTypeKind(b)) { - when (DTK.Integer, DTK.Integer) { - if isSignedIntegerDType(a) == isSignedIntegerDType(b) { - return maxDType(a, b); + (including some additional rules for bigint) + + see: https://numpy.org/doc/2.1/reference/arrays.promotion.html#numerical-promotion + */ + proc promotedType(type a, type b) type { + if getKind(a) == getKind(b) { + return maxSizedType(a, b); + } else { + if getKind(a) == DTK.BOOL { + return b; + } else if getKind(b) == DTK.BOOL { + return a; + } else if getKind(a) == DTK.SINT && getKind(b) == DTK.UINT { + if typeSize(a) > typeSize(b) + then return a; + else return promoteUIntToSInt(b); + } else if getKind(a) == DTK.UINT && getKind(b) == DTK.SINT { + if typeSize(b) > typeSize(a) + then return b; + else return promoteUIntToSInt(a); + } else if getKind(a) == DTK.REAL && (getKind(b) == DTK.UINT || getKind(b) == DTK.SINT) { + if typeSize(a) > typeSize(b) + then return a; + else return promoteIntToReal(b); + } else if (getKind(a) == DTK.UINT || getKind(a) == DTK.SINT) && getKind(b) == DTK.REAL { + if typeSize(b) > typeSize(a) + then return b; + else return promoteIntToReal(a); + } else if getKind(a) == DTK.COMPLEX && (getKind(b) == DTK.UINT || getKind(b) == DTK.SINT) { + if typeSize(b) < 4 + then return a; + else return complex(128); + } else if (getKind(a) == DTK.UINT || getKind(a) == DTK.SINT) && getKind(b) == DTK.COMPLEX { + if typeSize(a) < 4 + then return b; + else return complex(128); + } else if getKind(a) == DTK.COMPLEX && getKind(b) == DTK.REAL { + if typeSize(b) <= 4 + then return a; + else return complex(128); + } else if getKind(a) == DTK.REAL && getKind(b) == DTK.COMPLEX { + if typeSize(a) <= 4 + then return b; + else return complex(128); + } else if getKind(a) == DTK.BIGINT || getKind(b) == DTK.BIGINT { + // type promotions between bigint and non-integer types don't make + // sense; however, prohibiting such cases needs to be handled outside + // this procedure + return bigint; } else { - const (s, u) = if isSignedIntegerDType(a) then (a, b) else (b, a); - return maxDType(promoteToNextSigned(u), s); + // should be unreachable + return int; } - } - when (DTK.Integer, DTK.Float) - do return maxDType(promoteToNextFloat(a), b); - when (DTK.Float, DTK.Integer) - do return maxDType(promoteToNextFloat(b), a); - when (DTK.Integer, DTK.Complex) - do return maxDType(promoteToNextComplex(a), b); - when (DTK.Complex, DTK.Integer) - do return maxDType(promoteToNextComplex(b), a); - when (DTK.Float, DTK.Float) - do return maxDType(a, b); - when (DTK.Float, DTK.Complex) - do return maxDType(promoteToNextComplex(a), b); - when (DTK.Complex, DTK.Float) - do return maxDType(promoteToNextComplex(b), a); - when (DTK.Complex, DTK.Complex) - do return maxDType(a, b); - otherwise { - if a == DType.Bool && b != DType.Bool then - return b; - else if a != DType.Bool && b == DType.Bool then - return a; - else return DType.Bool; - } } - } + } - /* - Return the dtype that can store the result of - a division operation between two dtypes - (following Numpy's rules for type promotion) - */ - proc divDType(a: DType, b: DType): DType { - select (scalarDTypeKind(a), scalarDTypeKind(b)) { - when (DTK.Integer, DTK.Integer) - do return DType.Float64; - when (DTK.Integer, DTK.Float) - do return if dtypeSize(a) < 4 && b == DType.Float32 - then DType.Float32 - else DType.Float64; - when (DTK.Float, DTK.Integer) - do return if a == DType.Float32 && dtypeSize(b) < 4 - then DType.Float32 - else DType.Float64; - when (DTK.Integer, DTK.Complex) - do return maxDType(promoteToNextComplex(a), b); - when (DTK.Complex, DTK.Integer) - do return maxDType(promoteToNextComplex(b), a); - when (DTK.Float, DTK.Float) - do return maxDType(a, b); - when (DTK.Float, DTK.Complex) - do return maxDType(promoteToNextComplex(a), b); - when (DTK.Complex, DTK.Float) - do return maxDType(promoteToNextComplex(b), a); - when (DTK.Complex, DTK.Complex) - do return maxDType(a, b); - when (DTK.Bool, DTK.Float) - do return b; - when (DTK.Float, DTK.Bool) - do return a; - when (DTK.Bool, DTK.Complex) - do return b; - when (DTK.Complex, DTK.Bool) - do return a; - otherwise do return DType.Float64; - } - } + enum DTK { + SINT, + UINT, + REAL, + COMPLEX, + BOOL, + BIGINT, + } - private proc maxDType(a: DType, b: DType): DType { - if dtypeSize(a) >= dtypeSize(b) - then return a; - else return b; - } + proc getKind(type t) param: DTK { + if isIntType(t) then return DTK.SINT; + if isUintType(t) then return DTK.UINT; + if isRealType(t) then return DTK.REAL; + if isComplexType(t) then return DTK.COMPLEX; + if t == bigint then return DTK.BIGINT; + return DTK.BOOL; + } - enum DTK { - Integer, - Float, - Complex, - Bool, - Other - } + proc maxSizedType(type a, type b) type { + if typeSize(a) >= typeSize(b) + then return a; + else return b; + } - private proc scalarDTypeKind(dt: DType): DTK { - select dt { - when DType.UInt8 do return DTK.Integer; - when DType.UInt16 do return DTK.Integer; - when DType.UInt32 do return DTK.Integer; - when DType.UInt64 do return DTK.Integer; - when DType.Int8 do return DTK.Integer; - when DType.Int16 do return DTK.Integer; - when DType.Int32 do return DTK.Integer; - when DType.Int64 do return DTK.Integer; - when DType.Float32 do return DTK.Float; - when DType.Float64 do return DTK.Float; - when DType.Complex64 do return DTK.Complex; - when DType.Complex128 do return DTK.Complex; - when DType.Bool do return DTK.Bool; - otherwise do return DTK.Other; - } - } + proc promoteUIntToSInt(type t) type { + if t == uint(8) then return int(16); + if t == uint(16) then return int(32); + if t == uint(32) then return int(64); + return real(64); + } - private proc isSignedIntegerDType(dt: DType): bool { - select dt { - when DType.Int8 do return true; - when DType.Int16 do return true; - when DType.Int32 do return true; - when DType.Int64 do return true; - otherwise do return false; - } - } + proc promoteIntToReal(type t) type { + if t == int(8) || t == uint(8) || + t == int(16) || t == uint(16) + then return real(32); + else return real(64); + } - private proc promoteToNextSigned(dt: DType): DType { - select dt { - when DType.Bool do return DType.Int8; - when DType.UInt8 do return DType.Int16; - when DType.UInt16 do return DType.Int32; - when DType.UInt32 do return DType.Int64; - when DType.UInt64 do return DType.Float64; - when DType.Int8 do return DType.Int16; - when DType.Int16 do return DType.Int32; - when DType.Int32 do return DType.Int64; - when DType.Int64 do return DType.Float64; - when DType.Float32 do return DType.Float64; - when DType.Float64 do return DType.Float64; - when DType.Complex64 do return DType.Complex128; - when DType.Complex128 do return DType.Complex128; - otherwise do return DType.UNDEF; - } - } - - private proc promoteToNextFloat(dt: DType): DType { - select dt { - when DType.Bool do return DType.Float32; - when DType.UInt8 do return DType.Float32; - when DType.UInt16 do return DType.Float32; - when DType.UInt32 do return DType.Float64; - when DType.UInt64 do return DType.Float64; - when DType.Int8 do return DType.Float32; - when DType.Int16 do return DType.Float32; - when DType.Int32 do return DType.Float64; - when DType.Int64 do return DType.Float64; - when DType.Float32 do return DType.Float64; - when DType.Float64 do return DType.Float64; - when DType.Complex64 do return DType.Complex128; - when DType.Complex128 do return DType.Complex128; - otherwise do return DType.UNDEF; - } - } + proc typeSize(type t) param: int { + if t == bigint then return 16; + if t == bool then return 1; + return numBytes(t); + } - private proc promoteToNextComplex(dt: DType): DType { - select dt { - when DType.Bool do return DType.Complex64; - when DType.UInt8 do return DType.Complex64; - when DType.UInt16 do return DType.Complex64; - when DType.UInt32 do return DType.Complex128; - when DType.UInt64 do return DType.Complex128; - when DType.Int8 do return DType.Complex64; - when DType.Int16 do return DType.Complex64; - when DType.Int32 do return DType.Complex128; - when DType.Int64 do return DType.Complex128; - when DType.Float32 do return DType.Complex64; - when DType.Float64 do return DType.Complex128; - when DType.Complex64 do return DType.Complex128; - when DType.Complex128 do return DType.Complex128; - otherwise do return DType.UNDEF; - } - } } diff --git a/src/OperatorMsg.chpl b/src/OperatorMsg.chpl index fee41a677..ebb2e3515 100644 --- a/src/OperatorMsg.chpl +++ b/src/OperatorMsg.chpl @@ -2,2264 +2,1827 @@ module OperatorMsg { use ServerConfig; - use Math; use BitOps; use Reflection; use ServerErrors; - use BinOp; use BigInteger; - use MultiTypeSymbolTable; use MultiTypeSymEntry; - use ServerErrorStrings; + use ServerErrorStrings; use Reflection; use Logging; use Message; - use Time; - private config const logLevel = ServerConfig.logLevel; - private config const logChannel = ServerConfig.logChannel; - const omLogger = new Logger(logLevel, logChannel); - /* - Parse and respond to binopvv message. - vv == vector op vector + Supports the following binary operations between two arrays: + +, -, *, %, **, // + */ + @arkouda.instantiateAndRegister + proc arithmeticOpVV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where (binop_dtype_a != bool || binop_dtype_b != bool) && + binop_dtype_a != bigint && binop_dtype_b != bigint + { + const (a, b, op) = arrayArgsVV(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd); - :arg reqMsg: request containing (cmd,op,aname,bname,rname) - :type reqMsg: string + if a.tupShape != b.tupShape then + return MsgTuple.error("array shapes must match for element-wise binary operations"); - :arg st: SymTab to act on - :type st: borrowed SymTab + type resultType = promotedType(binop_dtype_a, binop_dtype_b); + var result = makeDistArray((...a.tupShape), resultType); - :returns: (MsgTuple) - :throws: `UndefinedSymbolError(name)` - */ - @arkouda.registerND - proc binopvvMsg(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, param nd: int): MsgTuple throws { - param pn = Reflection.getRoutineName(); - var repMsg: string; // response message - - const op = msgArgs.getValueOf("op"); - const aname = msgArgs.getValueOf("a"); - const bname = msgArgs.getValueOf("b"); - - var rname = st.nextName(); - var left: borrowed GenSymEntry = getGenericTypedArrayEntry(aname, st); - var right: borrowed GenSymEntry = getGenericTypedArrayEntry(bname, st); - - omLogger.debug(getModuleName(), getRoutineName(), getLineNumber(), - "cmd: %? op: %? left pdarray: %? right pdarray: %?".format( - cmd,op,st.attrib(aname),st.attrib(bname))); - - use Set; - // This boolOps set is a filter to determine the output type for the operation. - // All operations that involve one of these operations result in a `bool` symbol - // table entry. - var boolOps: set(string); - boolOps.add("<"); - boolOps.add("<="); - boolOps.add(">"); - boolOps.add(">="); - boolOps.add("=="); - boolOps.add("!="); - - var realOps: set(string); - realOps.add("+"); - realOps.add("-"); - realOps.add("/"); - realOps.add("//"); - - select (left.dtype, right.dtype) { - when (DType.Int64, DType.Int64) { - var l = toSymEntry(left,int, nd); - var r = toSymEntry(right,int, nd); - - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvv(l, r, e, op, rname, pn, st); - } else if op == "/" { - // True division is the only case in this int, int case - // that results in a `real` symbol table entry. - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, int); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - when (DType.Int64, DType.Float64) { - var l = toSymEntry(left,int, nd); - var r = toSymEntry(right,real, nd); - // Only two possible resultant types are `bool` and `real` - // for this case - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - when (DType.Float64, DType.Int64) { - var l = toSymEntry(left,real, nd); - var r = toSymEntry(right,int, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - when (DType.UInt64, DType.Float64) { - var l = toSymEntry(left,uint, nd); - var r = toSymEntry(right,real, nd); - // Only two possible resultant types are `bool` and `real` - // for this case - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - when (DType.Float64, DType.UInt64) { - var l = toSymEntry(left,real, nd); - var r = toSymEntry(right,uint, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - when (DType.Float64, DType.Float64) { - var l = toSymEntry(left,real, nd); - var r = toSymEntry(right,real, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - // For cases where a boolean operand is involved, the only - // possible resultant type is `bool` - when (DType.Bool, DType.Bool) { - var l = toSymEntry(left,bool, nd); - var r = toSymEntry(right,bool, nd); - if (op == "<<") || (op == ">>" ) { - var e = st.addEntry(rname, l.tupShape, int); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - when (DType.Bool, DType.Int64) { - var l = toSymEntry(left,bool, nd); - var r = toSymEntry(right,int, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, int); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - when (DType.Int64, DType.Bool) { - var l = toSymEntry(left,int, nd); - var r = toSymEntry(right,bool, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, int); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - when (DType.Bool, DType.Float64) { - var l = toSymEntry(left,bool, nd); - var r = toSymEntry(right,real, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - when (DType.Float64, DType.Bool) { - var l = toSymEntry(left,real, nd); - var r = toSymEntry(right,bool, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvv(l, r, e, op, rname, pn, st); + param isRealBoolOp = (binop_dtype_a == bool && isRealType(binop_dtype_b)) || + (binop_dtype_b == bool && isRealType(binop_dtype_a)); + + select op { + when '+' do result = a.a:resultType + b.a:resultType; + when '-' do result = a.a:resultType - b.a:resultType; + when '*' do result = a.a:resultType * b.a:resultType; + when '%' { // ' + if isRealBoolOp then return MsgTuple.error("'//' not supported between real and bool arrays"); + ref aa = a.a; + ref bb = b.a; + if isRealType(resultType) + then [(ri,ai,bi) in zip(result,aa,bb)] ri = modHelper(ai:resultType, bi:resultType); + else [(ri,ai,bi) in zip(result,aa,bb)] ri = if bi != 0:binop_dtype_b then (ai % bi):resultType else 0:resultType; + } + when '**' { + if isRealBoolOp then return MsgTuple.error("'//' not supported between real and bool arrays"); + + if isIntegralType(binop_dtype_a) && (|| reduce (a.a < 0)) { + return MsgTuple.error("Attempt to exponentiate integer base to negative exponent"); } - when (DType.Bool, DType.UInt64) { - var l = toSymEntry(left,bool, nd); - var r = toSymEntry(right,uint, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, uint); - return doBinOpvv(l, r, e, op, rname, pn, st); + result = a.a:resultType ** b.a:resultType; + } + when '//' { + if isRealBoolOp then return MsgTuple.error("'//' not supported between real and bool arrays"); + + ref aa = a.a; + ref bb = b.a; + if isRealType(resultType) + then [(ri,ai,bi) in zip(result,aa,bb)] ri = floorDivisionHelper(ai:resultType, bi:resultType); + else [(ri,ai,bi) in zip(result,aa,bb)] ri = if bi != 0:binop_dtype_b then (ai / bi):resultType else 0:resultType; + } + otherwise return MsgTuple.error("unknown arithmetic binary operation: " + op); + } + + return st.insert(new shared SymEntry(result)); + } + + // special handling for bool-bool arithmetic + proc arithmeticOpVV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where binop_dtype_a == bool && binop_dtype_b == bool + { + const (a, b, op) = arrayArgsVV(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd); + + // TODO: implement %, **, and // following NumPy's behavior + select op { + when '+' do { + const result = a.a | b.a; + return st.insert(new shared SymEntry(result)); + } + when '-' do return MsgTuple.error("cannot subtract boolean arrays"); + when '*' { + const result = a.a & b.a; + return st.insert(new shared SymEntry(result)); + } + when '%' do return MsgTuple.error("modulo between two boolean arrays is not supported"); // ' + when '**' do return MsgTuple.error("exponentiation between two boolean arrays is not supported"); + when '//' do return MsgTuple.error("floor-division between two boolean arrays is not supported"); + otherwise return MsgTuple.error("unknown arithmetic binary operation: " + op); + } + } + + // special handling for bigint arithmetic + proc arithmeticOpVV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where (binop_dtype_a == bigint || binop_dtype_b == bigint) && + !isRealType(binop_dtype_a) && !isRealType(binop_dtype_b) + { + const (a, b, op) = arrayArgsVV(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd), + (has_max_bits, max_size, max_bits) = getMaxBits(a, b); + + param bigintBoolOp = binop_dtype_a == bigint && binop_dtype_b == bool || + binop_dtype_b == bigint && binop_dtype_a == bool; + + var result = makeDistArray((...a.tupShape), bigint); + result = a.a:bigint; + ref ba = b.a; + + select op { + when '+' { + forall (rx, bx) in zip(result, ba) with (const local_max_size = max_size) { + rx += bx; + if has_max_bits then rx &= local_max_size; } - when (DType.UInt64, DType.Bool) { - var l = toSymEntry(left,uint, nd); - var r = toSymEntry(right,bool, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, uint); - return doBinOpvv(l, r, e, op, rname, pn, st); + } + when '-' { + forall (rx, bx) in zip(result, ba) with (const local_max_size = max_size) { + rx -= bx; + if has_max_bits then rx &= local_max_size; } - when (DType.UInt64, DType.UInt64) { - var l = toSymEntry(left,uint, nd); - var r = toSymEntry(right,uint, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - if op == "/"{ - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvv(l, r, e, op, rname, pn, st); - } else { - var e = st.addEntry(rname, l.tupShape, uint); - return doBinOpvv(l, r, e, op, rname, pn, st); - } + } + when '*' { + forall (rx, bx) in zip(result, ba) with (const local_max_size = max_size) { + rx *= bx; + if has_max_bits then rx &= local_max_size; } - when (DType.UInt64, DType.Int64) { - var l = toSymEntry(left,uint, nd); - var r = toSymEntry(right,int, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvv(l, r , e, op, rname, pn, st); - } - // +, -, /, // both result in real outputs to match NumPy - if realOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvv(l, r, e, op, rname, pn, st); - } else { - // isn't +, -, /, // so we can use LHS to determine type - var e = st.addEntry(rname, l.tupShape, uint); - return doBinOpvv(l, r, e, op, rname, pn, st); - } + } + when '%' { // ' + if bigintBoolOp then return MsgTuple.error("'%' between bigint and bool arrays is not supported"); + forall (rx, bx) in zip(result, ba) with (const local_max_size = max_size) { + if bx != 0 then mod(rx, rx, bx); + else rx = 0; + if has_max_bits then rx &= local_max_size; } - when (DType.Int64, DType.UInt64) { - var l = toSymEntry(left,int, nd); - var r = toSymEntry(right,uint, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvv(l, r, e, op, rname, pn, st); - } - // +, -, /, // both result in real outputs to match NumPy - if realOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvv(l, r, e, op, rname, pn, st); - } else { - // isn't +, -, /, // so we can use LHS to determine type - var e = st.addEntry(rname, l.tupShape, int); - return doBinOpvv(l, r, e, op, rname, pn, st); - } + } + when '**' { + if bigintBoolOp then return MsgTuple.error("'**' between bigint and bool arrays is not supported"); + + if || reduce (b.a < 0) then + return MsgTuple.error("Attempt to exponentiate bigint base to negative exponent"); + + forall (rx, bx) in zip(result, ba) with (const local_max_size = max_size) do + powMod(rx, rx, bx, local_max_size + 1); + } + when '//' { + if bigintBoolOp then return MsgTuple.error("'//' between bigint and bool arrays is not supported"); + + forall (rx, bx) in zip(result, ba) with (const local_max_size = max_size) { + if bx != 0 then rx /= bx; + else rx = 0; + if has_max_bits then rx &= local_max_size; } - when (DType.BigInt, DType.BigInt) { - var l = toSymEntry(left,bigint, nd); - var r = toSymEntry(right,bigint, nd); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpvvBoolReturn(l, r, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpvv(l, r, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + } + + return st.insert(new shared SymEntry(result, max_bits)); + } + + proc arithmeticOpVV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where (binop_dtype_a == bigint && isRealType(binop_dtype_b)) || + (binop_dtype_b == bigint && isRealType(binop_dtype_a)) + { + return MsgTuple.error("binary arithmetic operations between real and bigint arrays are not supported"); + } + + /* + Supports the following binary operations between two arrays: + ==, !=, <, <=, >, >= + */ + @arkouda.instantiateAndRegister + proc comparisonOpVV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where !(binop_dtype_a == bigint && isRealType(binop_dtype_b)) && + !(binop_dtype_b == bigint && isRealType(binop_dtype_a)) + { + const (a, b, op) = arrayArgsVV(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd); + var result = makeDistArray((...a.tupShape), bool); + + if (binop_dtype_a == real && binop_dtype_b == bool) || + (binop_dtype_a == bool && binop_dtype_b == real) + { + select op { + when '==' do result = a.a:real == b.a:real; + when '!=' do result = a.a:real != b.a:real; + when '<' do result = a.a:real < b.a:real; + when '<=' do result = a.a:real <= b.a:real; + when '>' do result = a.a:real > b.a:real; + when '>=' do result = a.a:real >= b.a:real; + otherwise return MsgTuple.error("unknown comparison binary operation: " + op); + } + } else { + select op { + when '==' do result = a.a == b.a; + when '!=' do result = a.a != b.a; + when '<' do result = a.a < b.a; + when '<=' do result = a.a <= b.a; + when '>' do result = a.a > b.a; + when '>=' do result = a.a >= b.a; + otherwise return MsgTuple.error("unknown comparison binary operation: " + op); + } + } + + return st.insert(new shared SymEntry(result)); + } + + proc comparisonOpVV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where (binop_dtype_a == bigint && isRealType(binop_dtype_b)) || + (binop_dtype_b == bigint && isRealType(binop_dtype_a)) + { + // return MsgTuple.error("comparison operations between real and bigint arrays are not supported"); + halt("nope"); + } + + /* + Supports the following binary operations between two arrays: + |, &, ^, <<, >>, <<<, >>> + */ + @arkouda.instantiateAndRegister + proc bitwiseOpVV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where binop_dtype_a != bigint && binop_dtype_b != bigint && + !isRealType(binop_dtype_a) && !isRealType(binop_dtype_b) && + !(binop_dtype_a == bool && binop_dtype_b == bool) + { + const (a, b, op) = arrayArgsVV(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd); + + type resultType = if (isIntType(binop_dtype_a) && isUintType(binop_dtype_b)) || + (isUintType(binop_dtype_a) && isIntType(binop_dtype_b)) + then binop_dtype_a // use LHS type for integer types with non-matching signed-ness + else promotedType(binop_dtype_a, binop_dtype_b); // otherwise, use regular type promotion + var result = makeDistArray((...a.tupShape), resultType); + + select op { + when '|' do result = (a.a | b.a):resultType; + when '&' do result = (a.a & b.a):resultType; + when '^' do result = (a.a ^ b.a):resultType; + when '<<' { + ref aa = a.a; + ref bb = b.a; + [(ri,ai,bi) in zip(result,aa,bb)] if 0 <= bi && bi < 64 then ri = ai:resultType << bi:resultType; + } + when '>>' { + ref aa = a.a; + ref bb = b.a; + [(ri,ai,bi) in zip(result,aa,bb)] if 0 <= bi && bi < 64 then ri = ai:resultType >> bi:resultType; + } + when '<<<' { + if !isIntegral(binop_dtype_a) || !isIntegral(binop_dtype_b) + then return MsgTuple.error("cannot perform bitwise rotation with boolean arrays"); + result = rotl(a.a, b.a):resultType; + } + when '>>>' { + if !isIntegral(binop_dtype_a) || !isIntegral(binop_dtype_b) + then return MsgTuple.error("cannot perform bitwise rotation with boolean arrays"); + result = rotr(a.a, b.a):resultType; + } + otherwise return MsgTuple.error("unknown bitwise binary operation: " + op); + } + + return st.insert(new shared SymEntry(result)); + } + + // special handling for bitwise ops with two boolean arrays + proc bitwiseOpVV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where binop_dtype_a == bool && binop_dtype_b == bool + { + const (a, b, op) = arrayArgsVV(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd); + + if op == '<<' || op == '>>' { + var result = makeDistArray((...a.tupShape), int); + + if op == '<<' { + ref aa = a.a; + ref bb = b.a; + [(ri,ai,bi) in zip(result,aa,bb)] if 0 <= bi && bi < 64 then ri = ai:int << bi:int; + } else { + ref aa = a.a; + ref bb = b.a; + [(ri,ai,bi) in zip(result,aa,bb)] if 0 <= bi && bi < 64 then ri = ai:int >> bi:int; + } + + return st.insert(new shared SymEntry(result)); + } else { + var result = makeDistArray((...a.tupShape), bool); + + select op { + when '|' do result = a.a | b.a; + when '&' do result = a.a & b.a; + when '^' do result = a.a ^ b.a; + when '<<<' do return MsgTuple.error("bitwise rotation on boolean arrays is not supported"); + when '>>>' do return MsgTuple.error("bitwise rotation on boolean arrays is not supported"); + otherwise return MsgTuple.error("unknown bitwise binary operation: " + op); + } + + return st.insert(new shared SymEntry(result)); + } + } + + // special handling for bitwise ops with at least one bigint array + proc bitwiseOpVV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where (binop_dtype_a == bigint || binop_dtype_b == bigint) && + !isRealType(binop_dtype_a) && !isRealType(binop_dtype_b) + { + const (a, b, op) = arrayArgsVV(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd), + (has_max_bits, max_size, max_bits) = getMaxBits(a, b); + + if a.tupShape != b.tupShape then + return MsgTuple.error("array shapes must match for element-wise binary operations"); + + // 'a' must be a bigint, and 'b' must not be real for the operations below + // (for some operations, both a and b must be bigint) + if binop_dtype_a != bigint || isRealType(binop_dtype_b) then + return MsgTuple.error("bitwise operations between a LHS bigint and RHS non-bigint arrays are not supported"); + + var result = makeDistArray((...a.tupShape), bigint); + result = a.a:bigint; + ref ba = b.a; + param bothBigint = binop_dtype_a == bigint && binop_dtype_b == bigint; + + select op { + when '|' { + if !bothBigint then return MsgTuple.error("bitwise OR between bigint and non-bigint arrays is not supported"); + forall (rx, bx) in zip(result, ba) with (const local_max_size = max_size) { + rx |= bx; + if has_max_bits then rx &= local_max_size; } - when (DType.BigInt, DType.Int64) { - var l = toSymEntry(left,bigint, nd); - var r = toSymEntry(right,int, nd); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpvvBoolReturn(l, r, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpvv(l, r, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + when '&' { + if !bothBigint then return MsgTuple.error("bitwise AND between bigint and non-bigint arrays is not supported"); + forall (rx, bx) in zip(result, ba) with (const local_max_size = max_size) { + rx &= bx; + if has_max_bits then rx &= local_max_size; } - when (DType.BigInt, DType.UInt64) { - var l = toSymEntry(left,bigint, nd); - var r = toSymEntry(right,uint, nd); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpvvBoolReturn(l, r, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpvv(l, r, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + when '^' { + if !bothBigint then return MsgTuple.error("bitwise XOR between bigint and non-bigint arrays is not supported"); + forall (rx, bx) in zip(result, ba) with (const local_max_size = max_size) { + rx ^= bx; + if has_max_bits then rx &= local_max_size; } - when (DType.BigInt, DType.Bool) { - var l = toSymEntry(left,bigint, nd); - var r = toSymEntry(right,bool, nd); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpvvBoolReturn(l, r, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + when '<<' { + if binop_dtype_b == bigint then return MsgTuple.error("left-shift of a bigint array by a non-bigint array is not supported"); + forall (rx, bx) in zip(result, ba) with (const local_max_size = max_size) { + if has_max_bits { + if bx >= max_bits { + rx = 0; + } + else { + rx <<= bx; + rx &= local_max_size; + } + } + else { + rx <<= bx; } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpvv(l, r, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); } - when (DType.Int64, DType.BigInt) { - var l = toSymEntry(left,int, nd); - var r = toSymEntry(right,bigint, nd); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpvvBoolReturn(l, r, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + when '>>' { + if binop_dtype_b == bigint then return MsgTuple.error("right-shift of a bigint array by a non-bigint array is not supported"); + forall (rx, bx) in zip(result, ba) with (const local_max_size = max_size) { + if has_max_bits { + if bx >= max_bits { + rx = 0; + } + else { + rx >>= bx; + rx &= local_max_size; + } + } + else { + rx >>= bx; } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpvv(l, r, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); } - when (DType.UInt64, DType.BigInt) { - var l = toSymEntry(left,uint, nd); - var r = toSymEntry(right,bigint, nd); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpvvBoolReturn(l, r, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpvv(l, r, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + when '<<<' { + if !has_max_bits then return MsgTuple.error("bitwise rotation on bigint arrays requires a max_bits value"); + if binop_dtype_b == bigint then return MsgTuple.error("right-shift of a bigint array by a non-bigint array is not supported"); + forall (rx, bx) in zip(result, ba) with (var local_max_size = max_size) { + var bot_bits = rx; + const modded_shift = if binop_dtype_b == int then bx%max_bits else bx%max_bits:uint; + rx <<= modded_shift; + const shift_amt = if binop_dtype_b == int then max_bits - modded_shift else max_bits:uint - modded_shift; + bot_bits >>= shift_amt; + rx += bot_bits; + rx &= local_max_size; } - when (DType.Bool, DType.BigInt) { - var l = toSymEntry(left,bool, nd); - var r = toSymEntry(right,bigint, nd); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpvvBoolReturn(l, r, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpvv(l, r, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + when '>>>' { + if !has_max_bits then return MsgTuple.error("bitwise rotation on bigint arrays requires a max_bits value"); + if binop_dtype_b == bigint then return MsgTuple.error("right-shift of a bigint array by a non-bigint array is not supported"); + forall (rx, bx) in zip(result, ba) with (var local_max_size = max_size) { + var top_bits = rx; + const modded_shift = if binop_dtype_b == int then bx%max_bits else bx%max_bits:uint; + rx >>= modded_shift; + const shift_amt = if binop_dtype_b == int then max_bits - modded_shift else max_bits:uint - modded_shift; + top_bits <<= shift_amt; + rx += top_bits; + rx &= local_max_size; } } - var errorMsg = unrecognizedTypeError(pn, "("+dtype2str(left.dtype)+","+dtype2str(right.dtype)+")"); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); + otherwise return MsgTuple.error("unknown bitwise binary operation: " + op); + } + + return st.insert(new shared SymEntry(result, max_bits)); } - + + // special error message for bitwise ops with real-valued arrays + proc bitwiseOpVV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where isRealType(binop_dtype_a) || isRealType(binop_dtype_b) + do return MsgTuple.error("bitwise operations with real-valued arrays are not supported"); + /* - Parse and respond to binopvs message. - vs == vector op scalar + Supports real division between two arrays + */ + @arkouda.instantiateAndRegister + proc divOpVV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws { + const (a, b, _) = arrayArgsVV(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd);; + + if a.tupShape != b.tupShape then + return MsgTuple.error("array shapes must match for element-wise binary operations"); + + const result = a.a:real / b.a:real; + + return st.insert(new shared SymEntry(result)); + } + + // special handling for bigint-bigint division + proc divOpVV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where binop_dtype_a == bigint && binop_dtype_b == bigint + { + const (a, b, _) = arrayArgsVV(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd), + (has_max_bits, max_size, max_bits) = getMaxBits(a, b); - :arg reqMsg: request containing (cmd,op,aname,dtype,value) - :type reqMsg: string + if a.tupShape != b.tupShape then + return MsgTuple.error("array shapes must match for element-wise binary operations"); - :arg st: SymTab to act on - :type st: borrowed SymTab + var result = a.a; + ref ba = b.a; - :returns: (MsgTuple) - :throws: `UndefinedSymbolError(name)` + forall (rx, bx) in zip(result, ba) with (const local_max_size = max_size) { + rx /= bx; + if has_max_bits then rx &= local_max_size; + } + + return st.insert(new shared SymEntry(result, max_bits)); + } + + /* + Supports the following binary operations between an array and scalar: + +, -, *, %, **, // */ - @arkouda.registerND - proc binopvsMsg(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, param nd: int): MsgTuple throws { - param pn = Reflection.getRoutineName(); - var repMsg: string = ""; // response message - - const aname = msgArgs.getValueOf("a"); - const op = msgArgs.getValueOf("op"); - const value = msgArgs.get("value"); - - const dtype = str2dtype(msgArgs.getValueOf("dtype")); - var rname = st.nextName(); - var left: borrowed GenSymEntry = getGenericTypedArrayEntry(aname, st); - - omLogger.debug(getModuleName(),getRoutineName(),getLineNumber(), - "op: %s dtype: %? pdarray: %? scalar: %?".format( - op,dtype,st.attrib(aname),value.getValue())); - - use Set; - // This boolOps set is a filter to determine the output type for the operation. - // All operations that involve one of these operations result in a `bool` symbol - // table entry. - var boolOps: set(string); - boolOps.add("<"); - boolOps.add("<="); - boolOps.add(">"); - boolOps.add(">="); - boolOps.add("=="); - boolOps.add("!="); - - var realOps: set(string); - realOps.add("+"); - realOps.add("-"); - realOps.add("/"); - realOps.add("//"); - - select (left.dtype, dtype) { - when (DType.Int64, DType.Int64) { - var l = toSymEntry(left,int, nd); - var val = value.getIntValue(); - - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } else if op == "/" { - // True division is the only case in this int, int case - // that results in a `real` symbol table entry. - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, int); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - when (DType.Int64, DType.Float64) { - var l = toSymEntry(left,int, nd); - var val = value.getRealValue(); - // Only two possible resultant types are `bool` and `real` - // for this case - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - when (DType.Float64, DType.Int64) { - var l = toSymEntry(left,real, nd); - var val = value.getIntValue(); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - when (DType.UInt64, DType.Float64) { - var l = toSymEntry(left,uint, nd); - var val = value.getRealValue(); - // Only two possible resultant types are `bool` and `real` - // for this case - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - when (DType.Float64, DType.UInt64) { - var l = toSymEntry(left,real, nd); - var val = value.getUIntValue(); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); + @arkouda.instantiateAndRegister + proc arithmeticOpVS(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where (binop_dtype_a != bool || binop_dtype_b != bool) && + binop_dtype_a != bigint && binop_dtype_b != bigint + { + const (a, val, op) = arrayArgsVS(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd); + + param isRealBoolOp = (binop_dtype_a == bool && isRealType(binop_dtype_b)) || + (binop_dtype_b == bool && isRealType(binop_dtype_a)); + + type resultType = promotedType(binop_dtype_a, binop_dtype_b); + var result = makeDistArray((...a.tupShape), resultType); + + select op { + when '+' do result = a.a:resultType + val:resultType; + when '-' do result = a.a:resultType - val:resultType; + when '*' do result = a.a:resultType * val:resultType; + when '%' { // ' + if isRealBoolOp then return MsgTuple.error("'%' not supported between real and bool arrays"); + ref aa = a.a; + if isRealType(resultType) + then [(ai,ri) in zip(aa,result)] ri = modHelper(ai:resultType, val:resultType); + else [(ai,ri) in zip(aa,result)] ri = if val != 0:binop_dtype_b then ai:resultType % val:resultType else 0:resultType; + } + when '**' { + if isRealBoolOp then return MsgTuple.error("'**' not supported between real and bool arrays"); + if isIntegralType(binop_dtype_a) && (|| reduce (a.a < 0)) { + return MsgTuple.error("Attempt to exponentiate integer base to negative exponent"); } - when (DType.Float64, DType.Float64) { - var l = toSymEntry(left,real, nd); - var val = value.getRealValue(); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); + result = a.a:resultType ** val:resultType; + } + when '//' { + if isRealBoolOp then return MsgTuple.error("'//' not supported between real and bool arrays"); + ref aa = a.a; + if isRealType(resultType) + then [(ai,ri) in zip(aa,result)] ri = floorDivisionHelper(ai:resultType, val:resultType); + else [(ai,ri) in zip(aa,result)] ri = if val != 0:binop_dtype_b then (ai / val):resultType else 0:resultType; + } + otherwise return MsgTuple.error("unknown arithmetic binary operation: " + op); + } + + return st.insert(new shared SymEntry(result)); + } + + // special handling for bool-bool arithmetic + proc arithmeticOpVS(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where binop_dtype_a == bool && binop_dtype_b == bool + { + const (a, val, op) = arrayArgsVS(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd); + + // TODO: implement %, **, and // following NumPy's behavior + select op { + when '+' { + const result = a.a | val; + return st.insert(new shared SymEntry(result)); + } + when '-' do return MsgTuple.error("cannot subtract boolean from boolean array"); + when '*' { + const result = a.a & val; + return st.insert(new shared SymEntry(result)); + } + when '%' do return MsgTuple.error("modulo of boolean array by a boolean is not supported"); // ' + when '**' do return MsgTuple.error("exponentiation of a boolean array by a boolean is not supported"); + when '//' do return MsgTuple.error("floor-division of a boolean array by a boolean is not supported"); + otherwise return MsgTuple.error("unknown arithmetic binary operation: " + op); + } + } + + // special handling for bigint arithmetic + proc arithmeticOpVS(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where (binop_dtype_a == bigint && !isRealType(binop_dtype_b)) || + (binop_dtype_b == bigint && !isRealType(binop_dtype_a)) + { + const (a, val, op) = arrayArgsVS(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd), + (has_max_bits, max_size, max_bits) = getMaxBits(a); + + param bigintBoolOp = binop_dtype_a == bigint && binop_dtype_b == bool || + binop_dtype_b == bigint && binop_dtype_a == bool; + + var result = makeDistArray((...a.tupShape), bigint); + result = a.a:bigint; + + select op { + when '+' { + forall rx in result with (const local_val = val, const local_max_size = max_size) { + rx += local_val; + if has_max_bits then rx &= local_max_size; } - // For cases where a boolean operand is involved, the only - // possible resultant type is `bool` - when (DType.Bool, DType.Bool) { - var l = toSymEntry(left,bool, nd); - var val = value.getBoolValue(); - if (op == "<<") || (op == ">>") { - var e = st.addEntry(rname, l.tupShape, int); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); + } + when '-' { + forall rx in result with (const local_val = val, const local_max_size = max_size) { + rx -= local_val; + if has_max_bits then rx &= local_max_size; } - when (DType.Bool, DType.Int64) { - var l = toSymEntry(left,bool, nd); - var val = value.getIntValue(); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, int); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); + } + when '*' { + forall rx in result with (const local_val = val, const local_max_size = max_size) { + rx *= local_val; + if has_max_bits then rx &= local_max_size; } - when (DType.Int64, DType.Bool) { - var l = toSymEntry(left,int, nd); - var val = value.getBoolValue(); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, int); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); + } + when '%' { // ' + if bigintBoolOp then return MsgTuple.error("'%' between bigint and bool values is not supported"); + forall rx in result with (const local_val = val, const local_max_size = max_size) { + if local_val != 0 then mod(rx, rx, local_val); + else rx = 0; + if has_max_bits then rx &= local_max_size; } - when (DType.Bool, DType.Float64) { - var l = toSymEntry(left,bool, nd); - var val = value.getRealValue(); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); + } + when '**' { + if bigintBoolOp then return MsgTuple.error("'**' between bigint and bool values is not supported"); + + forall rx in result with (const local_val = val, const local_max_size = max_size) do + powMod(rx, rx, local_val, local_max_size + 1); + } + when '//' { + if bigintBoolOp then return MsgTuple.error("'//' between bigint and bool values is not supported"); + + forall rx in result with (const local_val = val, const local_max_size = max_size) { + if local_val != 0 then rx /= local_val; + else rx = 0; + if has_max_bits then rx &= local_max_size; } - when (DType.Float64, DType.Bool) { - var l = toSymEntry(left,real, nd); - var val = value.getBoolValue(); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); + } + } + + return st.insert(new shared SymEntry(result, max_bits)); + } + + proc arithmeticOpVS(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where (binop_dtype_a == bigint && isRealType(binop_dtype_b)) || + (binop_dtype_b == bigint && isRealType(binop_dtype_a)) + do return MsgTuple.error("binary arithmetic operations between real and bigint arrays/values are not supported"); + + /* + Supports the following binary operations between an array and scalar: + ==, !=, <, <=, >, >= + */ + @arkouda.instantiateAndRegister + proc comparisonOpVS(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where !(binop_dtype_a == bigint && isRealType(binop_dtype_b)) && + !(binop_dtype_b == bigint && isRealType(binop_dtype_a)) + { + const (a, val, op) = arrayArgsVS(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd); + + var result = makeDistArray((...a.tupShape), bool); + + if (binop_dtype_a == real && binop_dtype_b == bool) || + (binop_dtype_a == bool && binop_dtype_b == real) + { + select op { + when '==' do result = a.a:real == val:real; + when '!=' do result = a.a:real != val:real; + when '<' do result = a.a:real < val:real; + when '<=' do result = a.a:real <= val:real; + when '>' do result = a.a:real > val:real; + when '>=' do result = a.a:real >= val:real; + otherwise return MsgTuple.error("unknown comparison binary operation: " + op); + } + } else { + select op { + when '==' do result = a.a == val; + when '!=' do result = a.a != val; + when '<' do result = a.a < val; + when '<=' do result = a.a <= val; + when '>' do result = a.a > val; + when '>=' do result = a.a >= val; + otherwise return MsgTuple.error("unknown comparison binary operation: " + op); + } + } + + return st.insert(new shared SymEntry(result)); + } + + proc comparisonOpVS(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where (binop_dtype_a == bigint && isRealType(binop_dtype_b)) || + (binop_dtype_b == bigint && isRealType(binop_dtype_a)) + do return MsgTuple.error("comparison operations between real and bigint arrays/values are not supported"); + + /* + Supports the following binary operations between an array and scalar + |, &, ^, <<, >>, <<<, >>> + */ + @arkouda.instantiateAndRegister + proc bitwiseOpVS(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where binop_dtype_a != bigint && binop_dtype_b != bigint && + !isRealType(binop_dtype_a) && !isRealType(binop_dtype_b) && + !(binop_dtype_a == bool && binop_dtype_b == bool) + { + const (a, val, op) = arrayArgsVS(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd); + + type resultType = if (isIntType(binop_dtype_a) && isUintType(binop_dtype_b)) || + (isUintType(binop_dtype_a) && isIntType(binop_dtype_b)) + then binop_dtype_a // use LHS type for integer types with non-matching signed-ness + else promotedType(binop_dtype_a, binop_dtype_b); // otherwise, use regular type promotion + var result = makeDistArray((...a.tupShape), resultType); + + select op { + when '|' do result = (a.a | val):resultType; + when '&' do result = (a.a & val):resultType; + when '^' do result = (a.a ^ val):resultType; + when '<<' { + ref aa = a.a; + [(ri,ai) in zip(result,aa)] if 0 <= val && val < 64 then ri = ai:resultType << val:resultType; + } + when '>>' { + ref aa = a.a; + [(ri,ai) in zip(result,aa)] if 0 <= val && val < 64 then ri = ai:resultType >> val:resultType; + } + when '<<<' { + if !isIntegral(binop_dtype_a) || !isIntegral(binop_dtype_b) + then return MsgTuple.error("cannot perform bitwise rotation with boolean arrays"); + result = rotl(a.a, val):resultType; + } + when '>>>' { + if !isIntegral(binop_dtype_a) || !isIntegral(binop_dtype_b) + then return MsgTuple.error("cannot perform bitwise rotation with boolean arrays"); + result = rotr(a.a, val):resultType; + } + otherwise return MsgTuple.error("unknown bitwise binary operation: " + op); + } + + return st.insert(new shared SymEntry(result)); + } + + // special handling for bitwise ops with two boolean arrays + proc bitwiseOpVS(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where binop_dtype_a == bool && binop_dtype_b == bool + { + const (a, val, op) = arrayArgsVS(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd); + + if op == '<<' || op == '>>' { + var result = makeDistArray((...a.tupShape), int); + + if op == '<<' { + ref aa = a.a; + [(ri,ai) in zip(result,aa)] if 0 <= val && val < 64 then ri = ai:int << val:int; + } else { + ref aa = a.a; + [(ri,ai) in zip(result,aa)] if 0 <= val && val < 64 then ri = ai:int >> val:int; + } + + return st.insert(new shared SymEntry(result)); + } else { + var result = makeDistArray((...a.tupShape), bool); + + select op { + when '|' do result = a.a | val; + when '&' do result = a.a & val; + when '^' do result = a.a ^ val; + when '<<<' do return MsgTuple.error("bitwise rotation on boolean arrays is not supported"); + when '>>>' do return MsgTuple.error("bitwise rotation on boolean arrays is not supported"); + otherwise return MsgTuple.error("unknown bitwise binary operation: " + op); + } + + return st.insert(new shared SymEntry(result)); + } + } + + // special handling for bitwise ops with at least one bigint array/value + proc bitwiseOpVS(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where (binop_dtype_a == bigint || binop_dtype_b == bigint) && + !isRealType(binop_dtype_a) && !isRealType(binop_dtype_b) + { + const (a, val, op) = arrayArgsVS(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd), + (has_max_bits, max_size, max_bits) = getMaxBits(a); + + // 'a' must be a bigint, and 'b' must not be real for the operations below + // (for some operations, both a and b must be bigint) + if binop_dtype_a != bigint || isRealType(binop_dtype_b) then + return MsgTuple.error("bitwise operations between a LHS bigint and RHS non-bigint arrays are not supported"); + + var result = makeDistArray((...a.tupShape), bigint); + result = a.a:bigint; + param bothBigint = binop_dtype_a == bigint && binop_dtype_b == bigint; + + select op { + when '|' { + if !bothBigint then return MsgTuple.error("bitwise OR between bigint and non-bigint arrays/values is not supported"); + forall rx in result with (var local_val = val, const local_max_size = max_size) { + rx |= local_val; + if has_max_bits then rx &= local_max_size; } - when (DType.Bool, DType.UInt64) { - var l = toSymEntry(left,bool, nd); - var val = value.getUIntValue(); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, uint); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); + } + when '&' { + if !bothBigint then return MsgTuple.error("bitwise AND between bigint and non-bigint arrays/values is not supported"); + forall rx in result with (var local_val = val, const local_max_size = max_size) { + rx &= local_val; + if has_max_bits then rx &= local_max_size; } - when (DType.UInt64, DType.Bool) { - var l = toSymEntry(left,uint, nd); - var val = value.getBoolValue(); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, l.tupShape, uint); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); + } + when '^' { + if !bothBigint then return MsgTuple.error("bitwise XOR between bigint and non-bigint arrays/values is not supported"); + forall rx in result with (var local_val = val, const local_max_size = max_size) { + rx ^= local_val; + if has_max_bits then rx &= local_max_size; } - when (DType.UInt64, DType.UInt64) { - var l = toSymEntry(left,uint, nd); - var val = value.getUIntValue(); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - if op == "/"{ - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } else { - var e = st.addEntry(rname, l.tupShape, uint); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); + } + when '<<' { + if binop_dtype_b == bigint then return MsgTuple.error("left-shift of a bigint array by a non-bigint value is not supported"); + forall rx in result with (var local_val = val, const local_max_size = max_size) { + rx <<= local_val; + if has_max_bits { + if local_val >= max_bits then rx = 0; + else { + rx <<= local_val; + rx &= local_max_size; + } } } - when (DType.UInt64, DType.Int64) { - var l = toSymEntry(left,uint, nd); - var val = value.getIntValue(); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - // +, -, /, // both result in real outputs to match NumPy - if realOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } else { - // isn't +, -, /, // so we can use LHS to determine type - var e = st.addEntry(rname, l.tupShape, uint); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); + } + when '>>' { + if binop_dtype_b == bigint then return MsgTuple.error("right-shift of a bigint array by a non-bigint value is not supported"); + forall rx in result with (var local_val = val, const local_max_size = max_size) { + rx >>= local_val; + if has_max_bits { + if local_val >= max_bits then rx = 0; + else { + rx >>= local_val; + rx &= local_max_size; + } } } - when (DType.Int64, DType.UInt64) { - var l = toSymEntry(left,int, nd); - var val = value.getUIntValue(); - if boolOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, bool); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } - // +, -, /, // both result in real outputs to match NumPy - if realOps.contains(op) { - var e = st.addEntry(rname, l.tupShape, real); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } else { - // isn't +, -, /, // so we can use LHS to determine type - var e = st.addEntry(rname, l.tupShape, int); - return doBinOpvs(l, val, e, op, dtype, rname, pn, st); - } + } + when '<<<' { + if !has_max_bits then return MsgTuple.error("bitwise rotation on bigint arrays requires a max_bits value"); + if binop_dtype_b == bigint then return MsgTuple.error("right-shift of a bigint array by a non-bigint array is not supported"); + forall rx in result with (var local_val = val, var local_max_size = max_size) { + var bot_bits = rx; + const modded_shift = if binop_dtype_b == int then local_val%max_bits else local_val%max_bits:uint; + rx <<= modded_shift; + const shift_amt = if binop_dtype_b == int then max_bits - modded_shift else max_bits:uint - modded_shift; + bot_bits >>= shift_amt; + rx += bot_bits; + rx &= local_max_size; } - when (DType.BigInt, DType.BigInt) { - var l = toSymEntry(left,bigint, nd); - var val = value.getBigIntValue(); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpvsBoolReturn(l, val, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpvs(l, val, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + when '>>>' { + if !has_max_bits then return MsgTuple.error("bitwise rotation on bigint arrays requires a max_bits value"); + if binop_dtype_b == bigint then return MsgTuple.error("right-shift of a bigint array by a non-bigint array is not supported"); + forall rx in result with (var local_val = val, var local_max_size = max_size) { + var top_bits = rx; + const modded_shift = if binop_dtype_b == int then local_val%max_bits else local_val%max_bits:uint; + rx >>= modded_shift; + const shift_amt = if binop_dtype_b == int then max_bits - modded_shift else max_bits:uint - modded_shift; + top_bits <<= shift_amt; + rx += top_bits; + rx &= local_max_size; } - when (DType.BigInt, DType.Int64) { - var l = toSymEntry(left,bigint, nd); - var val = value.getIntValue(); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpvsBoolReturn(l, val, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpvs(l, val, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + otherwise return MsgTuple.error("unknown bitwise binary operation: " + op); + } + + return st.insert(new shared SymEntry(result, max_bits)); + } + + // special error message for bitwise ops with real-valued arrays + proc bitwiseOpVS(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where isRealType(binop_dtype_a) || isRealType(binop_dtype_b) + do return MsgTuple.error("bitwise operations with real-valued arrays are not supported"); + + /* + Supports real division between an array and a scalar + */ + @arkouda.instantiateAndRegister + proc divOpVS(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws { + const (a, val, _) = arrayArgsVS(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd), + result = a.a:real / val:real; + + return st.insert(new shared SymEntry(result)); + } + + // special handling for bigint-bigint division + proc divOpVS(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where binop_dtype_a == bigint && binop_dtype_b == bigint + { + const (a, val, op) = arrayArgsVS(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd), + (has_max_bits, max_size, max_bits) = getMaxBits(a); + + var result = a.a; + forall rx in result with (const local_val = val, const local_max_size = max_size) { + rx /= local_val; + if has_max_bits then rx &= local_max_size; + } + + return st.insert(new shared SymEntry(result, max_bits)); + } + + /* + Supports the following binary operations between an array and scalar: + +, -, *, %, **, // + */ + @arkouda.instantiateAndRegister + proc arithmeticOpSV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where (binop_dtype_a != bool || binop_dtype_b != bool) && + binop_dtype_a != bigint && binop_dtype_b != bigint + { + const (val, b, op) = arrayArgsSV(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd); + + type resultType = promotedType(binop_dtype_a, binop_dtype_b); + var result = makeDistArray((...b.tupShape), resultType); + + select op { + when '+' do result = val:resultType + b.a:resultType; + when '-' do result = val:resultType - b.a:resultType; + when '*' do result = val:resultType * b.a:resultType; + when '%' { // ' + ref bb = b.a; + if isRealType(resultType) + then [(bi,ri) in zip(bb,result)] ri = modHelper(val:resultType, bi:resultType); + else [(bi,ri) in zip(bb,result)] ri = if val != 0:binop_dtype_a then val:resultType % bi:resultType else 0:resultType; + } + when '**' { + if isIntegralType(binop_dtype_b) && (|| reduce (b.a < 0)) { + return MsgTuple.error("Attempt to exponentiate integer base to negative exponent"); } - when (DType.BigInt, DType.UInt64) { - var l = toSymEntry(left,bigint, nd); - var val = value.getUIntValue(); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpvsBoolReturn(l, val, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpvs(l, val, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + result = val:resultType ** b.a:resultType; + } + when '//' { + ref bb = b.a; + if isRealType(resultType) + then [(bi,ri) in zip(bb,result)] ri = floorDivisionHelper(val:resultType, bi:resultType); + else [(bi,ri) in zip(bb,result)] ri = if val != 0:binop_dtype_a then (val / bi):resultType else 0:resultType; + } + otherwise return MsgTuple.error("unknown arithmetic binary operation: " + op); + } + + return st.insert(new shared SymEntry(result)); + } + + // special handling for bool-bool arithmetic + proc arithmeticOpSV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where binop_dtype_a == bool && binop_dtype_b == bool + { + const (val, b, op) = arrayArgsSV(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd); + var result = makeDistArray((...b.tupShape), bool); + + // TODO: implement %, **, and // following NumPy's behavior + select op { + when '+' do result = val | b.a; + when '-' do return MsgTuple.error("cannot subtract boolean array from boolean"); + when '*' do result = val & b.a; + when '%' do return MsgTuple.error("modulo of boolean by a boolean array is not supported"); // ' + when '**' do return MsgTuple.error("exponentiation of a boolean by a boolean array is not supported"); + when '//' do return MsgTuple.error("floor-division of a boolean by a boolean array is not supported"); + otherwise return MsgTuple.error("unknown arithmetic binary operation: " + op); + } + + return st.insert(new shared SymEntry(result)); + } + + // special handling for bigint arithmetic + proc arithmeticOpSV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where (binop_dtype_a == bigint && !isRealType(binop_dtype_b)) || + (binop_dtype_b == bigint && !isRealType(binop_dtype_a)) + { + const (val, b, op) = arrayArgsSV(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd), + (has_max_bits, max_size, max_bits) = getMaxBits(b); + + var result = makeDistArray((...b.tupShape), bigint); + result = val:bigint; + ref bb = b.a; + + select op { + when '+' { + forall (rx, bi) in zip(result, bb) with (const local_max_size = max_size) { + rx += bi; + if has_max_bits then rx &= local_max_size; } - when (DType.BigInt, DType.Bool) { - var l = toSymEntry(left,bigint, nd); - var val = value.getBoolValue(); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpvsBoolReturn(l, val, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpvs(l, val, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + when '-' { + forall (rx, bi) in zip(result, bb) with (const local_max_size = max_size) { + rx -= bi; + if has_max_bits then rx &= local_max_size; } - when (DType.Int64, DType.BigInt) { - var l = toSymEntry(left,int, nd); - var val = value.getBigIntValue(); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpvsBoolReturn(l, val, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpvs(l, val, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + when '*' { + forall (rx, bi) in zip(result, bb) with (const local_max_size = max_size) { + rx *= bi; + if has_max_bits then rx &= local_max_size; } - when (DType.UInt64, DType.BigInt) { - var l = toSymEntry(left,uint, nd); - var val = value.getBigIntValue(); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpvsBoolReturn(l, val, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpvs(l, val, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + when '%' { // ' + if binop_dtype_a != bigint then return MsgTuple.error("cannot mod a non-bigint value by a bigint array"); + if binop_dtype_b == bool then return MsgTuple.error("cannot mod a bigint value by a bool array"); + forall (rx, bi) in zip(result, bb) with (const local_max_size = max_size) { + if bi != 0 then mod(rx, rx, bi); else rx = 0:bigint; + if has_max_bits then rx &= local_max_size; } - when (DType.Bool, DType.BigInt) { - var l = toSymEntry(left,bool, nd); - var val = value.getBigIntValue(); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpvsBoolReturn(l, val, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpvs(l, val, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + when '**' { + if binop_dtype_a != bigint then return MsgTuple.error("cannot exponentiate a non-bigint value by a bigint array"); + if binop_dtype_b == bool then return MsgTuple.error("cannot exponentiate a bigint value by a bool array"); + if || reduce (bb < 0) then return MsgTuple.error("Attempt to exponentiate bigint base to negative exponent"); + + if has_max_bits + then forall (rx, bi) in zip(result, bb) with (const local_max_size = max_size) do + powMod(rx, rx, bi, local_max_size + 1); + else forall (rx, bi) in zip(result, bb) do + rx **= bi:uint; + } + when '//' { + if binop_dtype_a != bigint then return MsgTuple.error("cannot floor-div a non-bigint value by a bigint array"); + if binop_dtype_b == bool then return MsgTuple.error("cannot floor-div a bigint value by a bool array"); + + forall (rx, bi) in zip(result, bb) with (const local_max_size = max_size) { + if bi != 0 then rx /= bi; else rx = 0:bigint; + if has_max_bits then rx &= local_max_size; } } - var errorMsg = unrecognizedTypeError(pn, "("+dtype2str(left.dtype)+","+dtype2str(dtype)+")"); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); + } + + return st.insert(new shared SymEntry(result, max_bits)); } + proc arithmeticOpSV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where (binop_dtype_a == bigint && isRealType(binop_dtype_b)) || + (binop_dtype_b == bigint && isRealType(binop_dtype_a)) + do return MsgTuple.error("binary arithmetic operations between real and bigint arrays/values are not supported"); + /* - Parse and respond to binopsv message. - sv == scalar op vector + Supports the following binary operations between an array and scalar: + ==, !=, <, <=, >, >= + */ + @arkouda.instantiateAndRegister + proc comparisonOpSV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where !(binop_dtype_a == bigint && isRealType(binop_dtype_b)) && + !(binop_dtype_b == bigint && isRealType(binop_dtype_a)) + { + const (val, b, op) = arrayArgsSV(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd); + var result = makeDistArray((...b.tupShape), bool); - :arg reqMsg: request containing (cmd,op,dtype,value,aname) - :type reqMsg: string + if (binop_dtype_a == real && binop_dtype_b == bool) || + (binop_dtype_a == bool && binop_dtype_b == real) + { + select op { + when '==' do result = val:real == b.a:real; + when '!=' do result = val:real != b.a:real; + when '<' do result = val:real < b.a:real; + when '<=' do result = val:real <= b.a:real; + when '>' do result = val:real > b.a:real; + when '>=' do result = val:real >= b.a:real; + otherwise return MsgTuple.error("unknown comparison binary operation: " + op); + } + } else { + select op { + when '==' do result = val == b.a; + when '!=' do result = val != b.a; + when '<' do result = val < b.a; + when '<=' do result = val <= b.a; + when '>' do result = val > b.a; + when '>=' do result = val >= b.a; + otherwise return MsgTuple.error("unknown comparison binary operation: " + op); + } + } + + return st.insert(new shared SymEntry(result)); + } - :arg st: SymTab to act on - :type st: borrowed SymTab + proc comparisonOpSV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where (binop_dtype_a == bigint && isRealType(binop_dtype_b)) || + (binop_dtype_b == bigint && isRealType(binop_dtype_a)) + do return MsgTuple.error("comparison operations between real and bigint arrays/values are not supported"); - :returns: (MsgTuple) - :throws: `UndefinedSymbolError(name)` + /* + Supports the following binary operations between an array and scalar + |, &, ^, <<, >>, <<<, >>> */ - @arkouda.registerND - proc binopsvMsg(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, param nd: int): MsgTuple throws { - param pn = Reflection.getRoutineName(); - var repMsg: string = ""; // response message - - const op = msgArgs.getValueOf("op"); - const aname = msgArgs.getValueOf("a"); - const value = msgArgs.get("value"); - - var dtype = str2dtype(msgArgs.getValueOf("dtype")); - var rname = st.nextName(); - var right: borrowed GenSymEntry = getGenericTypedArrayEntry(aname, st); - - omLogger.debug(getModuleName(),getRoutineName(),getLineNumber(), - "command = %? op = %? scalar dtype = %? scalar = %? pdarray = %?".format( - cmd,op,dtype2str(dtype),value,st.attrib(aname))); - - use Set; - // This boolOps set is a filter to determine the output type for the operation. - // All operations that involve one of these operations result in a `bool` symbol - // table entry. - var boolOps: set(string); - boolOps.add("<"); - boolOps.add("<="); - boolOps.add(">"); - boolOps.add(">="); - boolOps.add("=="); - boolOps.add("!="); - - var realOps: set(string); - realOps.add("+"); - realOps.add("-"); - realOps.add("/"); - realOps.add("//"); - - select (dtype, right.dtype) { - when (DType.Int64, DType.Int64) { - var val = value.getIntValue(); - var r = toSymEntry(right,int, nd); - - if boolOps.contains(op) { - var e = st.addEntry(rname, r.tupShape, bool); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } else if op == "/" { - // True division is the only case in this int, int case - // that results in a `real` symbol table entry. - var e = st.addEntry(rname, r.tupShape, real); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, r.tupShape, int); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } - when (DType.Int64, DType.Float64) { - var val = value.getIntValue(); - var r = toSymEntry(right,real, nd); - // Only two possible resultant types are `bool` and `real` - // for this case - if boolOps.contains(op) { - var e = st.addEntry(rname, r.tupShape, bool); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, r.tupShape, real); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } - when (DType.Float64, DType.Int64) { - var val = value.getRealValue(); - var r = toSymEntry(right,int, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, r.tupShape, bool); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, r.tupShape, real); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } - when (DType.UInt64, DType.Float64) { - var val = value.getUIntValue(); - var r = toSymEntry(right,real, nd); - // Only two possible resultant types are `bool` and `real` - // for this case - if boolOps.contains(op) { - var e = st.addEntry(rname, r.tupShape, bool); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, r.tupShape, real); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); + @arkouda.instantiateAndRegister + proc bitwiseOpSV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where binop_dtype_a != bigint && binop_dtype_b != bigint && + !isRealType(binop_dtype_a) && !isRealType(binop_dtype_b) && + !(binop_dtype_a == bool && binop_dtype_b == bool) + { + const (val, b, op) = arrayArgsSV(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd); + + type resultType = if (isIntType(binop_dtype_a) && isUintType(binop_dtype_b)) || + (isUintType(binop_dtype_a) && isIntType(binop_dtype_b)) + then binop_dtype_a // use LHS type for integer types with non-matching signed-ness + else promotedType(binop_dtype_a, binop_dtype_b); // otherwise, use regular type promotion + var result = makeDistArray((...b.tupShape), resultType); + + select op { + when '|' do result = (val | b.a):resultType; + when '&' do result = (val & b.a):resultType; + when '^' do result = (val ^ b.a):resultType; + when '<<' { + ref bb = b.a; + [(ri,bi) in zip(result,bb)] if 0 <= bi && bi < 64 then ri = val:resultType << bi:resultType; + } + when '>>' { + ref bb = b.a; + [(ri,bi) in zip(result,bb)] if 0 <= bi && bi < 64 then ri = val:resultType >> bi:resultType; + } + when '<<<' { + if !isIntegral(binop_dtype_a) || !isIntegral(binop_dtype_b) + then return MsgTuple.error("cannot perform bitwise rotation with boolean arrays"); + result = rotl(val, b.a):resultType; + } + when '>>>' { + if !isIntegral(binop_dtype_a) || !isIntegral(binop_dtype_b) + then return MsgTuple.error("cannot perform bitwise rotation with boolean arrays"); + result = rotr(val, b.a):resultType; + } + otherwise return MsgTuple.error("unknown bitwise binary operation: " + op); + } + + return st.insert(new shared SymEntry(result)); + } + + // special handling for bitwise ops with two boolean arrays + proc bitwiseOpSV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where binop_dtype_a == bool && binop_dtype_b == bool + { + const (val, b, op) = arrayArgsSV(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd); + + if op == '<<' || op == '>>' { + var result = makeDistArray((...b.tupShape), int); + + if op == '<<' { + ref bb = b.a; + [(ri,bi) in zip(result,bb)] if 0 <= bi && bi < 64 then ri = val:int << bi:int; + } else { + ref bb = b.a; + [(ri,bi) in zip(result,bb)] if 0 <= bi && bi < 64 then ri = val:int >> bi:int; + } + + return st.insert(new shared SymEntry(result)); + } else { + var result = makeDistArray((...b.tupShape), bool); + + select op { + when '|' do result = val | b.a; + when '&' do result = val & b.a; + when '^' do result = val ^ b.a; + when '<<<' do return MsgTuple.error("bitwise rotation on boolean arrays is not supported"); + when '>>>' do return MsgTuple.error("bitwise rotation on boolean arrays is not supported"); + otherwise return MsgTuple.error("unknown bitwise binary operation: " + op); + } + + return st.insert(new shared SymEntry(result)); + } + } + + // special handling for bitwise ops with at least one bigint array/value + proc bitwiseOpSV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where (binop_dtype_a == bigint || binop_dtype_b == bigint) && + !isRealType(binop_dtype_a) && !isRealType(binop_dtype_b) + { + const (val, b, op) = arrayArgsSV(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd), + (has_max_bits, max_size, max_bits) = getMaxBits(b); + + // 'a' must be a bigint, and 'b' must not be real for the operations below + // (for some operations, both a and b must be bigint) + if binop_dtype_a != bigint || isRealType(binop_dtype_b) then + return MsgTuple.error("bitwise operations between a LHS bigint and RHS non-bigint arrays are not supported"); + + var result = makeDistArray((...b.tupShape), bigint); + result = val:bigint; + param bothBigint = binop_dtype_a == bigint && binop_dtype_b == bigint; + ref bb = b.a; + + select op { + when '|' { + if !bothBigint then return MsgTuple.error("bitwise OR between bigint and non-bigint arrays/values is not supported"); + forall (rx, bi) in zip(result, bb) with (const local_max_size = max_size) { + rx |= bi; + if has_max_bits then rx &= local_max_size; } - when (DType.Float64, DType.UInt64) { - var val = value.getRealValue(); - var r = toSymEntry(right,uint, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, r.tupShape, bool); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, r.tupShape, real); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); + } + when '&' { + if !bothBigint then return MsgTuple.error("bitwise AND between bigint and non-bigint arrays/values is not supported"); + forall (rx, bi) in zip(result, bb) with (const local_max_size = max_size) { + rx &= bi; + if has_max_bits then rx &= local_max_size; } - when (DType.Float64, DType.Float64) { - var val = value.getRealValue(); - var r = toSymEntry(right,real, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, r.tupShape, bool); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, r.tupShape, real); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); + } + when '^' { + if !bothBigint then return MsgTuple.error("bitwise XOR between bigint and non-bigint arrays/values is not supported"); + forall (rx, bi) in zip(result, bb) with (const local_max_size = max_size) { + rx ^= bi; + if has_max_bits then rx &= local_max_size; } - // For cases where a boolean operand is involved, the only - // possible resultant type is `bool` - when (DType.Bool, DType.Bool) { - var val = value.getBoolValue(); - var r = toSymEntry(right,bool, nd); - if (op == "<<") || (op == ">>") { - var e = st.addEntry(rname, r.tupShape, int); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); + } + when '<<' { + if binop_dtype_b == bigint then return MsgTuple.error("left-shift of a bigint array by a non-bigint value is not supported"); + forall (rx, bi) in zip(result, bb) with (const local_max_size = max_size) { + if has_max_bits { + if bi >= max_bits then rx = 0:bigint; + else { + rx <<= bi; + rx &= local_max_size; + } + } else { + rx <<= bi; } - var e = st.addEntry(rname, r.tupShape, bool); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); } - when (DType.Bool, DType.Int64) { - var val = value.getBoolValue(); - var r = toSymEntry(right,int, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, r.tupShape, bool); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); + } + when '>>' { + if binop_dtype_b == bigint then return MsgTuple.error("right-shift of a bigint array by a non-bigint value is not supported"); + forall (rx, bi) in zip(result, bb) with (const local_max_size = max_size) { + if has_max_bits { + if bi >= max_bits then rx = 0:bigint; + else { + rx >>= bi; + rx &= local_max_size; + } + } else { + rx >>= bi; } - var e = st.addEntry(rname, r.tupShape, int); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); } - when (DType.Int64, DType.Bool) { - var val = value.getIntValue(); - var r = toSymEntry(right,bool, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, r.tupShape, bool); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, r.tupShape, int); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); + } + when '<<<' { + if !has_max_bits then return MsgTuple.error("bitwise rotation on bigint arrays requires a max_bits value"); + if binop_dtype_a == bigint then return MsgTuple.error("right-shift of a bigint array by a non-bigint array is not supported"); + forall (rx, bi) in zip(result, bb) with (const local_max_size = max_size) { + var bot_bits = rx; + const modded_shift = if binop_dtype_b == int then bi%max_bits else bi%max_bits:uint; + rx <<= modded_shift; + const shift_amt = if binop_dtype_b == int then max_bits - modded_shift else max_bits:uint - modded_shift; + bot_bits >>= shift_amt; + rx += bot_bits; + rx &= local_max_size; } - when (DType.Bool, DType.Float64) { - var val = value.getBoolValue(); - var r = toSymEntry(right,real, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, r.tupShape, bool); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, r.tupShape, real); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); + } + when '>>>' { + if !has_max_bits then return MsgTuple.error("bitwise rotation on bigint arrays requires a max_bits value"); + if binop_dtype_a == bigint then return MsgTuple.error("right-shift of a bigint array by a non-bigint array is not supported"); + forall (rx, bi) in zip(result, bb) with (const local_max_size = max_size) { + var top_bits = rx; + const modded_shift = if binop_dtype_b == int then bi%max_bits else bi%max_bits:uint; + rx >>= modded_shift; + const shift_amt = if binop_dtype_b == int then max_bits - modded_shift else max_bits:uint - modded_shift; + top_bits <<= shift_amt; + rx += top_bits; + rx &= local_max_size; } - when (DType.Float64, DType.Bool) { - var val = value.getRealValue(); - var r = toSymEntry(right,bool, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, r.tupShape, bool); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, r.tupShape, real); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); + } + otherwise return MsgTuple.error("unknown bitwise binary operation: " + op); + } + + return st.insert(new shared SymEntry(result, max_bits)); + } + + // special error message for bitwise ops with real-valued arrays + proc bitwiseOpSV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where isRealType(binop_dtype_a) || isRealType(binop_dtype_b) + do return MsgTuple.error("bitwise operations with real-valued arrays are not supported"); + + /* + Supports real division between a scalar and an array + */ + @arkouda.instantiateAndRegister + proc divOpSV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws { + const (val, b, _) = arrayArgsSV(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd), + result = val:real / b.a:real; + + return st.insert(new shared SymEntry(result)); + } + + // special handling for bigint-bigint division + proc divOpSV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where binop_dtype_a == bigint && binop_dtype_b == bigint + { + const (val, b, _) = arrayArgsSV(msgArgs, st, binop_dtype_a, binop_dtype_b, array_nd), + (has_max_bits, max_size, max_bits) = getMaxBits(b); + + var result = makeDistArray((...b.tupShape), bigint); + result = val:bigint; + ref bb = b.a; + + forall (rx, bi) in zip(result, bb) with (const local_max_size = max_size) { + rx /= bi; + if has_max_bits then rx &= local_max_size; + } + + return st.insert(new shared SymEntry(result, max_bits)); + } + + // helpers for parsing array arguments in above binary operations + proc arrayArgsVV( + msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, type binop_dtype_b, param array_nd: int + ) throws { + const a = st[msgArgs['a']]: borrowed SymEntry(binop_dtype_a, array_nd), + b = st[msgArgs['b']]: borrowed SymEntry(binop_dtype_b, array_nd), + op = msgArgs['op'].toScalar(string); + + if a.tupShape != b.tupShape then + throw new Error("array shapes must match for element-wise binary operations"); + + return (a, b, op); + } + + proc arrayArgsVS( + msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, type binop_dtype_b, param array_nd: int + ) throws { + const a = st[msgArgs['a']]: borrowed SymEntry(binop_dtype_a, array_nd), + val = msgArgs['value'].toScalar(binop_dtype_b), + op = msgArgs['op'].toScalar(string); + + return (a, val, op); + } + + proc arrayArgsSV( + msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, type binop_dtype_b, param array_nd: int + ) throws { + const val = msgArgs['value'].toScalar(binop_dtype_a), + b = st[msgArgs['b']]: borrowed SymEntry(binop_dtype_b, array_nd), + op = msgArgs['op'].toScalar(string); + + return (val, b, op); + } + + @arkouda.instantiateAndRegister + proc opeqVV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + // result of operation must be the same type as the left operand + where binop_dtype_a == promotedType(binop_dtype_a, binop_dtype_b) && + binop_dtype_a != bigint && binop_dtype_b != bigint + { + const a = st[msgArgs['a']]: borrowed SymEntry(binop_dtype_a, array_nd), + b = st[msgArgs['b']]: borrowed SymEntry(binop_dtype_b, array_nd), + op = msgArgs['op'].toScalar(string); + + const unsupErrorMsg = "unsupported op=: %s %s %s".format(binop_dtype_a:string, op, binop_dtype_b:string); + + if isIntegralType(binop_dtype_a) && isIntegralType(binop_dtype_b) { + select op { + when "+=" do a.a += b.a; + when "-=" do a.a -= b.a; + when "*=" do a.a *= b.a; + when ">>=" do a.a >>= b.a; + when "<<=" do a.a <<= b.a; + when "//=" { + ref aa = a.a; + ref bb = b.a; + [(ai,bi) in zip(aa,bb)] ai = if bi != 0 then ai/bi else 0; + } + when "%=" { + ref aa = a.a; + ref bb = b.a; + [(ai,bi) in zip(aa,bb)] ai = if bi != 0 then ai%bi else 0; + } + when "**=" { + if || reduce (b.a<0) + then return MsgTuple.error("Attempt to exponentiate base of type Int64 to negative exponent"); + else a.a **= b.a; + } + otherwise do return MsgTuple.error(unsupErrorMsg); + } + } else if isIntegralType(binop_dtype_a) && binop_dtype_b == bool { + select op { + when "+=" do a.a += b.a:binop_dtype_a; + when "-=" do a.a -= b.a:binop_dtype_a; + when "*=" do a.a *= b.a:binop_dtype_a; + when ">>=" do a.a >>= b.a:binop_dtype_a; + when "<<=" do a.a <<= b.a:binop_dtype_a; + otherwise do return MsgTuple.error(unsupErrorMsg); + } + } else if binop_dtype_a == bool && binop_dtype_b == bool { + select op { + when "|=" do a.a |= b.a; + when "&=" do a.a &= b.a; + when "^=" do a.a ^= b.a; + when "+=" do a.a |= b.a; + otherwise do return MsgTuple.error(unsupErrorMsg); + } + } else if isRealType(binop_dtype_a) && (isRealType(binop_dtype_b) || isIntegralType(binop_dtype_b)) { + select op { + when "+=" do a.a += b.a; + when "-=" do a.a -= b.a; + when "*=" do a.a *= b.a; + when "/=" do a.a /= b.a:binop_dtype_a; + when "//=" { + ref aa = a.a; + ref bb = b.a; + [(ai,bi) in zip(aa,bb)] ai = floorDivisionHelper(ai, bi); + } + when "**=" do a.a **= b.a; + when "%=" { + ref aa = a.a; + ref bb = b.a; + [(ai,bi) in zip(aa,bb)] ai = modHelper(ai, bi); + } + otherwise do return MsgTuple.error(unsupErrorMsg); + } + } else if isRealType(binop_dtype_a) && binop_dtype_b == bool { + select op { + when "+=" do a.a += b.a:binop_dtype_a; + when "-=" do a.a -= b.a:binop_dtype_a; + when "*=" do a.a *= b.a:binop_dtype_a; + otherwise do return MsgTuple.error(unsupErrorMsg); + } + } else { + return MsgTuple.error(unsupErrorMsg); + } + + return MsgTuple.success(); + } + + // special handling for bigint ops + proc opeqVV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where (binop_dtype_a == bigint || binop_dtype_b == bigint) && + !isRealType(binop_dtype_b) + { + const op = msgArgs['op'].toScalar(string), + unsupErrorMsg = "unsupported op=: %s %s %s".format(binop_dtype_a:string, op, binop_dtype_b:string); + + if binop_dtype_a != bigint then return MsgTuple.error(unsupErrorMsg); + + const a = st[msgArgs['a']]: borrowed SymEntry(binop_dtype_a, array_nd), + b = st[msgArgs['b']]: borrowed SymEntry(binop_dtype_b, array_nd); + + const (has_max_bits, max_size, max_bits) = + if binop_dtype_b == bigint then getMaxBits(a, b) else getMaxBits(a); + + ref aa = a.a; + ref bb = b.a; + + select op { + when "+=" { + forall (ai, bi) in zip(aa, bb) with (var local_max_size = max_size) { + ai += bi; + if has_max_bits then ai &= local_max_size; } - when (DType.Bool, DType.UInt64) { - var val = value.getBoolValue(); - var r = toSymEntry(right,uint, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, r.tupShape, bool); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, r.tupShape, uint); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); + } + when "-=" { + forall (ai, bi) in zip(aa, bb) with (var local_max_size = max_size) { + ai -= bi; + if has_max_bits then ai &= local_max_size; } - when (DType.UInt64, DType.Bool) { - var val = value.getUIntValue(); - var r = toSymEntry(right,bool, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, r.tupShape, bool); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } - var e = st.addEntry(rname, r.tupShape, uint); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); + } + when "*=" { + forall (ai, bi) in zip(aa, bb) with (var local_max_size = max_size) { + ai *= bi; + if has_max_bits then ai &= local_max_size; } - when (DType.UInt64, DType.UInt64) { - var val = value.getUIntValue(); - var r = toSymEntry(right,uint, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, r.tupShape, bool); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } - if op == "/"{ - var e = st.addEntry(rname, r.tupShape, real); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } else { - var e = st.addEntry(rname, r.tupShape, uint); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } + } + when "//=" { + if binop_dtype_b == bool then return MsgTuple.error(unsupErrorMsg); + forall (ai, bi) in zip(aa, bb) with (var local_max_size = max_size) { + if bi != 0 then ai /= bi; else ai = 0:bigint; + if has_max_bits then ai &= local_max_size; } - when (DType.UInt64, DType.Int64) { - var val = value.getUIntValue(); - var r = toSymEntry(right,int, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, r.tupShape, bool); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } - // +, -, /, // both result in real outputs to match NumPy - if realOps.contains(op) { - var e = st.addEntry(rname, r.tupShape, real); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } else { - // isn't +, -, /, // so we can use LHS to determine type - var e = st.addEntry(rname, r.tupShape, uint); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } + } + when "%=" { + if binop_dtype_b == bool then return MsgTuple.error(unsupErrorMsg); + // we can't use ai %= bi because this can result in negatives + forall (ai, bi) in zip(aa, bb) with (var local_max_size = max_size) { + if bi != 0 then mod(ai, ai, bi); else ai = 0:bigint; + if has_max_bits then ai &= local_max_size; } - when (DType.Int64, DType.UInt64) { - var val = value.getIntValue(); - var r = toSymEntry(right,uint, nd); - if boolOps.contains(op) { - var e = st.addEntry(rname, r.tupShape, bool); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); + } + when "**=" { + if binop_dtype_b == bool then return MsgTuple.error(unsupErrorMsg); + if || reduce (b.a<0) then return MsgTuple.error("Attempt to exponentiate base of type BigInt to negative exponent"); + if has_max_bits { + forall (ai, bi) in zip(aa, bb) with (var local_max_size = max_size) { + powMod(ai, ai, bi, local_max_size + 1); } - // +, -, /, // both result in real outputs to match NumPy - if realOps.contains(op) { - var e = st.addEntry(rname, r.tupShape, real); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); - } else { - // isn't +, -, /, // so we can use LHS to determine type - var e = st.addEntry(rname, r.tupShape, int); - return doBinOpsv(val, r, e, op, dtype, rname, pn, st); + } else { + forall (ai, bi) in zip(aa, bb) { + ai **= bi:uint; } } - when (DType.BigInt, DType.BigInt) { - var val = value.getBigIntValue(); - var r = toSymEntry(right,bigint, nd); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpsvBoolReturn(val, r, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpsv(val, r, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + otherwise do return MsgTuple.error(unsupErrorMsg); + } + + return MsgTuple.success(); + } + + // error message when result could not be stored in 'binop_dtype_a' + proc opeqVV(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws { + const op = msgArgs['op'].toScalar(string); + return MsgTuple.error(notImplementedError( + cmd, + whichDtype(binop_dtype_a), + op, + whichDtype(binop_dtype_b) + )); + } + + + @arkouda.instantiateAndRegister + proc opeqVS(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + // result of operation must be the same type as the left operand + where binop_dtype_a == promotedType(binop_dtype_a, binop_dtype_b) && + binop_dtype_a != bigint && binop_dtype_b != bigint + { + const a = st[msgArgs['a']]: borrowed SymEntry(binop_dtype_a, array_nd), + val = msgArgs['value'].toScalar(binop_dtype_b), + op = msgArgs['op'].toScalar(string); + + const unsupErrorMsg = "unsupported op=: %s %s %s".format(binop_dtype_a:string, op, binop_dtype_b:string); + + if isIntegralType(binop_dtype_a) && isIntegralType(binop_dtype_b) { + select op { + when "+=" do a.a += val; + when "-=" do a.a -= val; + when "*=" do a.a *= val; + when ">>=" do a.a >>= val; + when "<<=" do a.a <<= val; + when "//=" { + if val != 0 then a.a /= val; else a.a = 0; + } + when "%=" { + if val != 0 then a.a %= val; else a.a = 0; + } + when "**=" { + if val<0 + then return MsgTuple.error("Attempt to exponentiate base of type Int64 to negative exponent"); + else a.a **= val; + } + otherwise do return MsgTuple.error(unsupErrorMsg); + } + } else if isIntegralType(binop_dtype_a) && binop_dtype_b == bool { + select op { + when "+=" do a.a += val:binop_dtype_a; + when "-=" do a.a -= val:binop_dtype_a; + when "*=" do a.a *= val:binop_dtype_a; + when ">>=" do a.a >>= val:binop_dtype_a; + when "<<=" do a.a <<= val:binop_dtype_a; + otherwise do return MsgTuple.error(unsupErrorMsg); + } + } else if binop_dtype_a == bool && binop_dtype_b == bool { + select op { + when "|=" do a.a |= val; + when "&=" do a.a &= val; + when "^=" do a.a ^= val; + when "+=" do a.a |= val; + otherwise do return MsgTuple.error(unsupErrorMsg); + } + } else if isRealType(binop_dtype_a) && (isRealType(binop_dtype_b) || isIntegralType(binop_dtype_b)) { + select op { + when "+=" do a.a += val; + when "-=" do a.a -= val; + when "*=" do a.a *= val; + when "/=" do a.a /= val:binop_dtype_a; + when "//=" { + ref aa = a.a; + [ai in aa] ai = floorDivisionHelper(ai, val); + } + when "**=" do a.a **= val; + when "%=" { + ref aa = a.a; + [ai in aa] ai = modHelper(ai, val); + } + otherwise do return MsgTuple.error(unsupErrorMsg); + } + } else if isRealType(binop_dtype_a) && binop_dtype_b == bool { + select op { + when "+=" do a.a += val:binop_dtype_a; + when "-=" do a.a -= val:binop_dtype_a; + when "*=" do a.a *= val:binop_dtype_a; + otherwise do return MsgTuple.error(unsupErrorMsg); + } + } else { + return MsgTuple.error(unsupErrorMsg); + } + + return MsgTuple.success(); + } + + // special handling for bigint ops + proc opeqVS(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws + where (binop_dtype_a == bigint || binop_dtype_b == bigint) && + !isRealType(binop_dtype_b) + { + const op = msgArgs['op'].toScalar(string), + unsupErrorMsg = "unsupported op=: %s %s %s".format(binop_dtype_a:string, op, binop_dtype_b:string); + + if binop_dtype_a != bigint then return MsgTuple.error(unsupErrorMsg); + + const a = st[msgArgs['a']]: borrowed SymEntry(binop_dtype_a, array_nd), + val = msgArgs['value'].toScalar(binop_dtype_b), + (has_max_bits, max_size, max_bits) = getMaxBits(a); + ref aa = a.a; + + select op { + when "+=" { + forall ai in aa with (var local_val = val, var local_max_size = max_size) { + ai += local_val; + if has_max_bits then ai &= local_max_size; } - when (DType.BigInt, DType.Int64) { - var val = value.getBigIntValue(); - var r = toSymEntry(right,int, nd); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpsvBoolReturn(val, r, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpsv(val, r, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + when "-=" { + forall ai in aa with (var local_val = val, var local_max_size = max_size) { + ai -= local_val; + if has_max_bits then ai &= local_max_size; } - when (DType.BigInt, DType.UInt64) { - var val = value.getBigIntValue(); - var r = toSymEntry(right,uint, nd); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpsvBoolReturn(val, r, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpsv(val, r, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + when "*=" { + forall ai in aa with (var local_val = val, var local_max_size = max_size) { + ai *= local_val; + if has_max_bits then ai &= local_max_size; } - when (DType.BigInt, DType.Bool) { - var val = value.getBigIntValue(); - var r = toSymEntry(right,bool, nd); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpsvBoolReturn(val, r, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpsv(val, r, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + when "//=" { + if binop_dtype_b == bool then return MsgTuple.error(unsupErrorMsg); + forall ai in aa with (var local_val = val, var local_max_size = max_size) { + if local_val != 0 then ai /= local_val; else ai = 0:bigint; + if has_max_bits then ai &= local_max_size; } - when (DType.Int64, DType.BigInt) { - var val = value.getIntValue(); - var r = toSymEntry(right,bigint, nd); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpsvBoolReturn(val, r, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpsv(val, r, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + when "%=" { + if binop_dtype_b == bool then return MsgTuple.error(unsupErrorMsg); + // we can't use ai %= bi because this can result in negatives + forall ai in aa with (var local_val = val, var local_max_size = max_size) { + if local_val != 0 then mod(ai, ai, local_val); else ai = 0:bigint; + if has_max_bits then ai &= local_max_size; } - when (DType.UInt64, DType.BigInt) { - var val = value.getUIntValue(); - var r = toSymEntry(right,bigint, nd); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpsvBoolReturn(val, r, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } + when "**=" { + if binop_dtype_b == bool then return MsgTuple.error(unsupErrorMsg); + if val < 0 then return MsgTuple.error("Attempt to exponentiate base of type BigInt to negative exponent"); + if has_max_bits { + forall ai in aa with (var local_val = val, var local_max_size = max_size) { + powMod(ai, ai, local_val, local_max_size + 1); } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpsv(val, r, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); - } - when (DType.Bool, DType.BigInt) { - var val = value.getBoolValue(); - var r = toSymEntry(right,bigint, nd); - if boolOps.contains(op) { - // call bigint specific func which returns distr bool array - var e = st.addEntry(rname, createSymEntry(doBigIntBinOpsvBoolReturn(val, r, op))); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); + } else { + forall ai in aa with (var local_val = val) { + ai **= local_val:uint; } - // call bigint specific func which returns dist bigint array - var (tmp, max_bits) = doBigIntBinOpsv(val, r, op); - var e = st.addEntry(rname, createSymEntry(tmp, max_bits)); - var repMsg = "created %s".format(st.attrib(rname)); - return new MsgTuple(repMsg, MsgType.NORMAL); } } - var errorMsg = unrecognizedTypeError(pn, "("+dtype2str(dtype)+","+dtype2str(right.dtype)+")"); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } + otherwise do return MsgTuple.error(unsupErrorMsg); + } - /* - Parse and respond to opeqvv message. - vector op= vector + return MsgTuple.success(); + } - :arg reqMsg: request containing (cmd,op,aname,bname) - :type reqMsg: string + // error message when result could not be stored in 'binop_dtype_a' + proc opeqVS(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, + type binop_dtype_a, + type binop_dtype_b, + param array_nd: int + ): MsgTuple throws { + const op = msgArgs['op'].toScalar(string); + return MsgTuple.error(notImplementedError( + cmd, + whichDtype(binop_dtype_a), + op, + whichDtype(binop_dtype_b) + )); + } - :arg st: SymTab to act on - :type st: borrowed SymTab + /* + Helper to determine the max_bits between two SymEntry's - :returns: (MsgTuple) - :throws: `UndefinedSymbolError(name)` + returns a three tuple with: + * bool: whether at least on SymEntry has a max_bits setting + * bigint: the maximum size + * max_bits: the maximum of the two array's max_bits values */ - @arkouda.registerND - proc opeqvvMsg(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, param nd: int): MsgTuple throws { - param pn = Reflection.getRoutineName(); - var repMsg: string; // response message - - const op = msgArgs.getValueOf("op"); - const aname = msgArgs.getValueOf("a"); - const bname = msgArgs.getValueOf("b"); - - // retrieve left and right pdarray objects - var left: borrowed GenSymEntry = getGenericTypedArrayEntry(aname, st); - var right: borrowed GenSymEntry = getGenericTypedArrayEntry(bname, st); - - omLogger.debug(getModuleName(),getRoutineName(),getLineNumber(), - "cmd: %s op: %s left pdarray: %s right pdarray: %s".format(cmd,op, - st.attrib(aname),st.attrib(bname))); - - select (left.dtype, right.dtype) { - when (DType.Int64, DType.Int64) { - var l = toSymEntry(left,int, nd); - var r = toSymEntry(right,int, nd); - select op { - when "+=" { l.a += r.a; } - when "-=" { l.a -= r.a; } - when "*=" { l.a *= r.a; } - when ">>=" { l.a >>= r.a;} - when "<<=" { l.a <<= r.a;} - when "//=" { - //l.a /= r.a; - ref la = l.a; - ref ra = r.a; - [(li,ri) in zip(la,ra)] li = if ri != 0 then li/ri else 0; - }//floordiv - when "%=" { - //l.a /= r.a; - ref la = l.a; - ref ra = r.a; - [(li,ri) in zip(la,ra)] li = if ri != 0 then li%ri else 0; - } - when "**=" { - if || reduce (r.a<0){ - var errorMsg = "Attempt to exponentiate base of type Int64 to negative exponent"; - return new MsgTuple(errorMsg, MsgType.ERROR); - } - else{ l.a **= r.a; } - } - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.Int64, DType.UInt64) { - // The result of operations between int and uint are float by default which doesn't fit in either type - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - when (DType.Int64, DType.Float64) { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - when (DType.Int64, DType.Bool) { - var l = toSymEntry(left, int, nd); - var r = toSymEntry(right, bool, nd); - select op { - when "+=" {l.a += r.a:int;} - when "-=" {l.a -= r.a:int;} - when "*=" {l.a *= r.a:int;} - when ">>=" { l.a >>= r.a:int;} - when "<<=" { l.a <<= r.a:int;} - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.Int64, DType.BigInt) { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - when (DType.UInt64, DType.Int64) { - // The result of operations between int and uint are float by default which doesn't fit in either type - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - when (DType.UInt64, DType.UInt64) { - var l = toSymEntry(left,uint, nd); - var r = toSymEntry(right,uint, nd); - select op { - when "+=" { l.a += r.a; } - when "-=" { - l.a -= r.a; - } - when "*=" { l.a *= r.a; } - when "//=" { - //l.a /= r.a; - ref la = l.a; - ref ra = r.a; - [(li,ri) in zip(la,ra)] li = if ri != 0 then li/ri else 0; - }//floordiv - when "%=" { - //l.a /= r.a; - ref la = l.a; - ref ra = r.a; - [(li,ri) in zip(la,ra)] li = if ri != 0 then li%ri else 0; - } - when "**=" { - l.a **= r.a; - } - when ">>=" { l.a >>= r.a;} - when "<<=" { l.a <<= r.a;} - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.UInt64, DType.Float64) { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - when (DType.UInt64, DType.Bool) { - var l = toSymEntry(left, uint, nd); - var r = toSymEntry(right, bool, nd); - select op { - when "+=" {l.a += r.a:uint;} - when "-=" {l.a -= r.a:uint;} - when "*=" {l.a *= r.a:uint;} - when ">>=" { l.a >>= r.a:uint;} - when "<<=" { l.a <<= r.a:uint;} - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.UInt64, DType.BigInt) { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - when (DType.Float64, DType.Int64) { - var l = toSymEntry(left,real, nd); - var r = toSymEntry(right,int, nd); - - select op { - when "+=" {l.a += r.a;} - when "-=" {l.a -= r.a;} - when "*=" {l.a *= r.a;} - when "/=" {l.a /= r.a:real;} //truediv - when "//=" { //floordiv - ref la = l.a; - ref ra = r.a; - [(li,ri) in zip(la,ra)] li = floorDivisionHelper(li, ri); - } - when "**=" { l.a **= r.a; } - when "%=" { - ref la = l.a; - ref ra = r.a; - [(li,ri) in zip(la,ra)] li = modHelper(li, ri); - } - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.Float64, DType.UInt64) { - var l = toSymEntry(left,real, nd); - var r = toSymEntry(right,uint, nd); - - select op { - when "+=" {l.a += r.a;} - when "-=" {l.a -= r.a;} - when "*=" {l.a *= r.a;} - when "/=" {l.a /= r.a:real;} //truediv - when "//=" { //floordiv - ref la = l.a; - ref ra = r.a; - [(li,ri) in zip(la,ra)] li = floorDivisionHelper(li, ri); - } - when "**=" { l.a **= r.a; } - when "%=" { - ref la = l.a; - ref ra = r.a; - [(li,ri) in zip(la,ra)] li = modHelper(li, ri); - } - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.Float64, DType.Float64) { - var l = toSymEntry(left,real, nd); - var r = toSymEntry(right,real, nd); - select op { - when "+=" {l.a += r.a;} - when "-=" {l.a -= r.a;} - when "*=" {l.a *= r.a;} - when "/=" {l.a /= r.a;}//truediv - when "//=" { //floordiv - ref la = l.a; - ref ra = r.a; - [(li,ri) in zip(la,ra)] li = floorDivisionHelper(li, ri); - } - when "**=" { l.a **= r.a; } - when "%=" { - ref la = l.a; - ref ra = r.a; - [(li,ri) in zip(la,ra)] li = modHelper(li, ri); - } - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.Float64, DType.Bool) { - var l = toSymEntry(left, real, nd); - var r = toSymEntry(right, bool, nd); - select op { - when "+=" {l.a += r.a:real;} - when "-=" {l.a -= r.a:real;} - when "*=" {l.a *= r.a:real;} - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.Float64, DType.BigInt) { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - when (DType.Bool, DType.Bool) { - var l = toSymEntry(left, bool, nd); - var r = toSymEntry(right, bool, nd); - select op { - when "|=" {l.a |= r.a;} - when "&=" {l.a &= r.a;} - when "^=" {l.a ^= r.a;} - when "+=" {l.a |= r.a;} - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.BigInt, DType.Int64) { - var l = toSymEntry(left,bigint, nd); - var r = toSymEntry(right,int, nd); - ref la = l.a; - ref ra = r.a; - var max_bits = l.max_bits; - var max_size = 1:bigint; - var has_max_bits = max_bits != -1; - if has_max_bits { - max_size <<= max_bits; - max_size -= 1; - } - select op { - when "+=" { - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - li += ri; - if has_max_bits { - li &= local_max_size; - } - } - } - when "-=" { - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - li -= ri; - if has_max_bits { - li &= local_max_size; - } - } - } - when "*=" { - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - li *= ri; - if has_max_bits { - li &= local_max_size; - } - } - } - when "//=" { - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - if ri != 0 { - li /= ri; - } - else { - li = 0:bigint; - } - if has_max_bits { - li &= local_max_size; - } - } - } - when "%=" { - // we can't use li %= ri because this can result in negatives - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - if ri != 0 { - mod(li, li, ri); - } - else { - li = 0:bigint; - } - if has_max_bits { - li &= local_max_size; - } - } - } - when "**=" { - if || reduce (ra<0) { - throw new Error("Attempt to exponentiate base of type BigInt to negative exponent"); - } - if has_max_bits { - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - powMod(li, li, ri, local_max_size + 1); - } - } - else { - forall (li, ri) in zip(la, ra) { - li **= ri:uint; - } - } - } - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.BigInt, DType.UInt64) { - var l = toSymEntry(left,bigint, nd); - var r = toSymEntry(right,uint, nd); - ref la = l.a; - ref ra = r.a; - var max_bits = l.max_bits; - var max_size = 1:bigint; - var has_max_bits = max_bits != -1; - if has_max_bits { - max_size <<= max_bits; - max_size -= 1; - } - select op { - when "+=" { - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - li += ri; - if has_max_bits { - li &= local_max_size; - } - } - } - when "-=" { - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - li -= ri; - if has_max_bits { - li &= local_max_size; - } - } - } - when "*=" { - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - li *= ri; - if has_max_bits { - li &= local_max_size; - } - } - } - when "//=" { - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - if ri != 0 { - li /= ri; - } - else { - li = 0:bigint; - } - if has_max_bits { - li &= local_max_size; - } - } - } - when "%=" { - // we can't use li %= ri because this can result in negatives - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - if ri != 0 { - mod(li, li, ri); - } - else { - li = 0:bigint; - } - if has_max_bits { - li &= local_max_size; - } - } - } - when "**=" { - if || reduce (ra<0) { - throw new Error("Attempt to exponentiate base of type BigInt to negative exponent"); - } - if has_max_bits { - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - powMod(li, li, ri, local_max_size + 1); - } - } - else { - forall (li, ri) in zip(la, ra) { - li **= ri:uint; - } - } - } - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.BigInt, DType.Float64) { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - when (DType.BigInt, DType.Bool) { - var l = toSymEntry(left,bigint, nd); - var r = toSymEntry(right,bool, nd); - ref la = l.a; - var ra = r.a:bigint; - var max_bits = l.max_bits; - var max_size = 1:bigint; - var has_max_bits = max_bits != -1; - if has_max_bits { - max_size <<= max_bits; - max_size -= 1; - } - select op { - when "+=" { - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - li += ri; - if has_max_bits { - li &= local_max_size; - } - } - } - when "-=" { - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - li -= ri; - if has_max_bits { - li &= local_max_size; - } - } - } - when "*=" { - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - li *= ri; - if has_max_bits { - li &= local_max_size; - } - } - } - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.BigInt, DType.BigInt) { - var l = toSymEntry(left,bigint, nd); - var r = toSymEntry(right,bigint, nd); - ref la = l.a; - ref ra = r.a; - var max_bits = l.max_bits; - var max_size = 1:bigint; - var has_max_bits = max_bits != -1; - if has_max_bits { - max_size <<= max_bits; - max_size -= 1; - } - select op { - when "+=" { - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - li += ri; - if has_max_bits { - li &= local_max_size; - } - } - } - when "-=" { - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - li -= ri; - if has_max_bits { - li &= local_max_size; - } - } - } - when "*=" { - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - li *= ri; - if has_max_bits { - li &= local_max_size; - } - } - } - when "//=" { - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - if ri != 0 { - li /= ri; - } - else { - li = 0:bigint; - } - if has_max_bits { - li &= local_max_size; - } - } - } - when "%=" { - // we can't use li %= ri because this can result in negatives - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - if ri != 0 { - mod(li, li, ri); - } - else { - li = 0:bigint; - } - if has_max_bits { - li &= local_max_size; - } - } - } - when "**=" { - if || reduce (ra<0) { - throw new Error("Attempt to exponentiate base of type BigInt to negative exponent"); - } - if has_max_bits { - forall (li, ri) in zip(la, ra) with (var local_max_size = max_size) { - powMod(li, li, ri, local_max_size + 1); - } - } - else { - forall (li, ri) in zip(la, ra) { - li **= ri:uint; - } - } - } - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,right.dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - otherwise { - var errorMsg = unrecognizedTypeError(pn, - "("+dtype2str(left.dtype)+","+dtype2str(right.dtype)+")"); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - repMsg = "opeqvv success"; - omLogger.debug(getModuleName(),getRoutineName(),getLineNumber(),repMsg); - return new MsgTuple(repMsg, MsgType.NORMAL); + proc getMaxBits(a: borrowed SymEntry(?), b: borrowed SymEntry(?)): (bool, bigint, int) { + return _getMaxBits(max(a.max_bits, b.max_bits)); } - /* - Parse and respond to opeqvs message. - vector op= scalar + proc getMaxBits(a: borrowed SymEntry(?)): (bool, bigint, int) { + return _getMaxBits(a.max_bits); + } - :arg reqMsg: request containing (cmd,op,aname,bname,rname) - :type reqMsg: string + proc _getMaxBits(max_bits: int): (bool, bigint, int) { + const has_max_bits = max_bits != -1; - :arg st: SymTab to act on - :type st: borrowed SymTab + var max_size = 1:bigint; + if has_max_bits { + max_size <<= max_bits; + max_size -= 1; + } - :returns: (MsgTuple) - :throws: `UndefinedSymbolError(name)` + return (has_max_bits, max_size, max_bits); + } + + /* + Helper function to ensure that floor division cases are handled in accordance with numpy */ - @arkouda.registerND - proc opeqvsMsg(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab, param nd: int): MsgTuple throws { - param pn = Reflection.getRoutineName(); - var repMsg: string; // response message - - const op = msgArgs.getValueOf("op"); - const aname = msgArgs.getValueOf("a"); - const value = msgArgs.get("value"); - var dtype = str2dtype(msgArgs.getValueOf("dtype")); - - omLogger.debug(getModuleName(),getRoutineName(),getLineNumber(), - "cmd: %s op: %s aname: %s dtype: %s scalar: %s".format( - cmd,op,aname,dtype2str(dtype),value.getValue())); - - var left: borrowed GenSymEntry = getGenericTypedArrayEntry(aname, st); - - omLogger.debug(getModuleName(),getRoutineName(),getLineNumber(), - "op: %? pdarray: %? scalar: %?".format(op,st.attrib(aname),value.getValue())); - select (left.dtype, dtype) { - when (DType.Int64, DType.Int64) { - var l = toSymEntry(left,int, nd); - var val = value.getIntValue(); - select op { - when "+=" { l.a += val; } - when "-=" { l.a -= val; } - when "*=" { l.a *= val; } - when ">>=" { l.a >>= val; } - when "<<=" { l.a <<= val; } - when "//=" { - if val != 0 {l.a /= val;} else {l.a = 0;} - }//floordiv - when "%=" { - if val != 0 {l.a %= val;} else {l.a = 0;} - } - when "**=" { - if val<0 { - var errorMsg = "Attempt to exponentiate base of type Int64 to negative exponent"; - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(), - errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - else{ l.a **= val; } - - } - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.Int64, DType.UInt64) { - var l = toSymEntry(left,int, nd); - var val = value.getUIntValue(); - select op { - when ">>=" { l.a >>= val; } - when "<<=" { l.a <<= val; } - otherwise { - // The result of operations between int and uint are float by default which doesn't fit in either type - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.Int64, DType.Float64) { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - when (DType.Int64, DType.Bool) { - var l = toSymEntry(left, int, nd); - var val = value.getBoolValue(); - select op { - when "+=" {l.a += val:int;} - when "-=" {l.a -= val:int;} - when "*=" {l.a *= val:int;} - when ">>=" {l.a >>= val:int; } - when "<<=" {l.a <<= val:int; } - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.Int64, DType.BigInt) { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - when (DType.UInt64, DType.Int64) { - var l = toSymEntry(left, uint, nd); - var val = value.getIntValue(); - select op { - when ">>=" { l.a >>= val; } - when "<<=" { l.a <<= val; } - otherwise { - // The result of operations between int and uint are float by default which doesn't fit in either type - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.UInt64, DType.UInt64) { - var l = toSymEntry(left,uint, nd); - var val = value.getUIntValue(); - select op { - when "+=" { l.a += val; } - when "-=" { - l.a -= val; - } - when "*=" { l.a *= val; } - when "//=" { - if val != 0 {l.a /= val;} else {l.a = 0;} - }//floordiv - when "%=" { - if val != 0 {l.a %= val;} else {l.a = 0;} - } - when "**=" { - l.a **= val; - } - when ">>=" { l.a >>= val; } - when "<<=" { l.a <<= val; } - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.UInt64, DType.Float64) { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - when (DType.UInt64, DType.Bool) { - var l = toSymEntry(left, uint, nd); - var val = value.getBoolValue(); - select op { - when "+=" {l.a += val:uint;} - when "-=" {l.a -= val:uint;} - when "*=" {l.a *= val:uint;} - when ">>=" { l.a >>= val:uint;} - when "<<=" { l.a <<= val:uint;} - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.Bool, DType.Bool) { - var l = toSymEntry(left, bool, nd); - var val = value.getBoolValue(); - select op { - when "+=" {l.a |= val;} - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.UInt64, DType.BigInt) { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - when (DType.Float64, DType.Int64) { - var l = toSymEntry(left,real, nd); - var val = value.getIntValue(); - select op { - when "+=" {l.a += val;} - when "-=" {l.a -= val;} - when "*=" {l.a *= val;} - when "/=" {l.a /= val:real;} //truediv - when "//=" { //floordiv - ref la = l.a; - [li in la] li = floorDivisionHelper(li, val); - } - when "**=" { l.a **= val; } - when "%=" { - ref la = l.a; - [li in la] li = modHelper(li, val); - } - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.Float64, DType.UInt64) { - var l = toSymEntry(left,real, nd); - var val = value.getUIntValue(); - select op { - when "+=" { l.a += val; } - when "-=" { l.a -= val; } - when "*=" { l.a *= val; } - when "//=" { - ref la = l.a; - [li in la] li = floorDivisionHelper(li, val); - }//floordiv - when "**=" { - l.a **= val; - } - when "%=" { - ref la = l.a; - [li in la] li = modHelper(li, val); - } - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.Float64, DType.Float64) { - var l = toSymEntry(left,real, nd); - var val = value.getRealValue(); - select op { - when "+=" {l.a += val;} - when "-=" {l.a -= val;} - when "*=" {l.a *= val;} - when "/=" {l.a /= val;}//truediv - when "//=" { //floordiv - ref la = l.a; - [li in la] li = floorDivisionHelper(li, val); - } - when "**=" { l.a **= val; } - when "%=" { - ref la = l.a; - [li in la] li = modHelper(li, val); - } - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.Float64, DType.Bool) { - var l = toSymEntry(left, real, nd); - var val = value.getBoolValue(); - select op { - when "+=" {l.a += val:real;} - when "-=" {l.a -= val:real;} - when "*=" {l.a *= val:real;} - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.Float64, DType.BigInt) { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - when (DType.BigInt, DType.Int64) { - var l = toSymEntry(left,bigint, nd); - var val = value.getIntValue(); - ref la = l.a; - var max_bits = l.max_bits; - var max_size = 1:bigint; - var has_max_bits = max_bits != -1; - if has_max_bits { - max_size <<= max_bits; - max_size -= 1; - } - select op { - when "+=" { - forall li in la with (var local_val = val, var local_max_size = max_size) { - li += local_val; - if has_max_bits { - li &= local_max_size; - } - } - } - when "-=" { - forall li in la with (var local_val = val, var local_max_size = max_size) { - li -= local_val; - if has_max_bits { - li &= local_max_size; - } - } - } - when "*=" { - forall li in la with (var local_val = val, var local_max_size = max_size) { - li *= local_val; - if has_max_bits { - li &= local_max_size; - } - } - } - when "//=" { - forall li in la with (var local_val = val, var local_max_size = max_size) { - if local_val != 0 { - li /= local_val; - } - else { - li = 0:bigint; - } - if has_max_bits { - li &= local_max_size; - } - } - } - when "%=" { - // we can't use li %= val because this can result in negatives - forall li in la with (var local_val = val, var local_max_size = max_size) { - if local_val != 0 { - mod(li, li, local_val); - } - else { - li = 0:bigint; - } - if has_max_bits { - li &= local_max_size; - } - } - } - when "**=" { - if val<0 { - throw new Error("Attempt to exponentiate base of type BigInt to negative exponent"); - } - if has_max_bits { - forall li in la with (var local_val = val, var local_max_size = max_size) { - powMod(li, li, local_val, local_max_size + 1); - } - } - else { - forall li in la with (var local_val = val) { - li **= local_val:uint; - } - } - } - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.BigInt, DType.UInt64) { - var l = toSymEntry(left,bigint, nd); - var val = value.getUIntValue(); - ref la = l.a; - var max_bits = l.max_bits; - var max_size = 1:bigint; - var has_max_bits = max_bits != -1; - if has_max_bits { - max_size <<= max_bits; - max_size -= 1; - } - select op { - when "+=" { - forall li in la with (var local_val = val, var local_max_size = max_size) { - li += local_val; - if has_max_bits { - li &= local_max_size; - } - } - } - when "-=" { - forall li in la with (var local_val = val, var local_max_size = max_size) { - li -= local_val; - if has_max_bits { - li &= local_max_size; - } - } - } - when "*=" { - forall li in la with (var local_val = val, var local_max_size = max_size) { - li *= local_val; - if has_max_bits { - li &= local_max_size; - } - } - } - when "//=" { - forall li in la with (var local_val = val, var local_max_size = max_size) { - if local_val != 0 { - li /= local_val; - } - else { - li = 0:bigint; - } - if has_max_bits { - li &= local_max_size; - } - } - } - when "%=" { - // we can't use li %= val because this can result in negatives - forall li in la with (var local_val = val, var local_max_size = max_size) { - if local_val != 0 { - mod(li, li, local_val); - } - else { - li = 0:bigint; - } - if has_max_bits { - li &= local_max_size; - } - } - } - when "**=" { - if val<0 { - throw new Error("Attempt to exponentiate base of type BigInt to negative exponent"); - } - if has_max_bits { - forall li in la with (var local_val = val, var local_max_size = max_size) { - powMod(li, li, local_val, local_max_size + 1); - } - } - else { - forall li in la with (var local_val = val) { - li **= local_val:uint; - } - } - } - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.BigInt, DType.Float64) { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - when (DType.BigInt, DType.Bool) { - var l = toSymEntry(left, bigint, nd); - var val = value.getBoolValue(); - ref la = l.a; - var max_bits = l.max_bits; - var max_size = 1:bigint; - var has_max_bits = max_bits != -1; - if has_max_bits { - max_size <<= max_bits; - max_size -= 1; - } - select op { - // TODO change once we can cast directly from bool to bigint - when "+=" { - forall li in la with (var local_val = val:int:bigint, var local_max_size = max_size) { - li += local_val; - if has_max_bits { - li &= local_max_size; - } - } - } - when "-=" { - forall li in la with (var local_val = val:int:bigint, var local_max_size = max_size) { - li -= local_val; - if has_max_bits { - li &= local_max_size; - } - } - } - when "*=" { - forall li in la with (var local_val = val:int:bigint, var local_max_size = max_size) { - li *= local_val; - if has_max_bits { - li &= local_max_size; - } - } - } - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - when (DType.BigInt, DType.BigInt) { - var l = toSymEntry(left,bigint, nd); - var val = value.getBigIntValue(); - ref la = l.a; - var max_bits = l.max_bits; - var max_size = 1:bigint; - var has_max_bits = max_bits != -1; - if has_max_bits { - max_size <<= max_bits; - max_size -= 1; - } - select op { - when "+=" { - forall li in la with (var local_val = val, var local_max_size = max_size) { - li += local_val; - if has_max_bits { - li &= local_max_size; - } - } - } - when "-=" { - forall li in la with (var local_val = val, var local_max_size = max_size) { - li -= local_val; - if has_max_bits { - li &= local_max_size; - } - } - } - when "*=" { - forall li in la with (var local_val = val, var local_max_size = max_size) { - li *= local_val; - if has_max_bits { - li &= local_max_size; - } - } - } - when "//=" { - forall li in la with (var local_val = val, var local_max_size = max_size) { - if local_val != 0 { - li /= local_val; - } - else { - li = 0:bigint; - } - if has_max_bits { - li &= local_max_size; - } - } - } - when "%=" { - // we can't use li %= val because this can result in negatives - forall li in la with (var local_val = val, var local_max_size = max_size) { - if local_val != 0 { - mod(li, li, local_val); - } - else { - li = 0:bigint; - } - if has_max_bits { - li &= local_max_size; - } - } - } - when "**=" { - if val<0 { - throw new Error("Attempt to exponentiate base of type BigInt to negative exponent"); - } - if has_max_bits { - forall li in la with (var local_val = val, var local_max_size = max_size) { - powMod(li, li, local_val, local_max_size + 1); - } - } - else { - forall li in la with (var local_val = val) { - li **= local_val:uint; - } - } - } - otherwise { - var errorMsg = notImplementedError(pn,left.dtype,op,dtype); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - } - otherwise { - var errorMsg = unrecognizedTypeError(pn, - "("+dtype2str(left.dtype)+","+dtype2str(dtype)+")"); - omLogger.error(getModuleName(),getRoutineName(),getLineNumber(),errorMsg); - return new MsgTuple(errorMsg, MsgType.ERROR); - } - } - repMsg = "opeqvs success"; - omLogger.debug(getModuleName(),getRoutineName(),getLineNumber(),repMsg); - return new MsgTuple(repMsg, MsgType.NORMAL); + inline proc floorDivisionHelper(numerator: ?t, denom: ?t2): real { + if (numerator == 0 && denom == 0) || (isInf(numerator) && (denom != 0 || isInf(denom))){ + return nan; + } + else if (numerator > 0 && denom == -inf) || (numerator < 0 && denom == inf){ + return -1:real; + } + else { + return floor(numerator/denom); + } + } + + /* + Helper function to ensure that mod cases are handled in accordance with numpy + */ + inline proc modHelper(dividend: ?t, divisor: ?t2): real { + extern proc fmod(x: real, y: real): real; + + var res = fmod(dividend, divisor); + // to convert fmod (truncated) results into mod (floored) results + // when the dividend and divsor have opposite signs, + // we add the divsor into the result + // except for when res == 0 (divsor even divides dividend) + // see https://en.wikipedia.org/wiki/Modulo#math_1 for more information + if res != 0 && (((dividend < 0) && (divisor > 0)) || ((dividend > 0) && (divisor < 0))) { + // we do + either way because we want to shift up for positive divisors and shift down for negative + res += divisor; + } + return res; } } diff --git a/src/TimeClassMsg.chpl b/src/TimeClassMsg.chpl index d89c0fb42..ecf0f7261 100644 --- a/src/TimeClassMsg.chpl +++ b/src/TimeClassMsg.chpl @@ -8,7 +8,7 @@ module TimeClassMsg { use MultiTypeSymbolTable; use MultiTypeSymEntry; use ServerErrorStrings; - use BinOp; + use OperatorMsg only floorDivisionHelper; use Time; use Map; diff --git a/src/registry/Commands.chpl b/src/registry/Commands.chpl index 931074e4b..5a6195b77 100644 --- a/src/registry/Commands.chpl +++ b/src/registry/Commands.chpl @@ -19,6 +19,15 @@ param regConfig = """ "bool", "bigint" ] + }, + "binop": { + "dtype": [ + "int", + "uint", + "real", + "bool", + "bigint" + ] } } } @@ -1576,6 +1585,1408 @@ proc ark_repeatFlat_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: bor return ManipulationMsg.repeatFlatMsg(cmd, msgArgs, st, array_dtype=bigint, array_nd=1); registerFunction('repeatFlat', ark_repeatFlat_bigint_1, 'ManipulationMsg', 902); +import OperatorMsg; + +proc ark_arithmeticOpVV_int_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=int, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_int_int_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_int_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=uint, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_int_uint_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_int_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=real, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_int_real_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_int_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bool, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_int_bool_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_int_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bigint, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_int_bigint_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_uint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=int, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_uint_int_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_uint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=uint, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_uint_uint_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_uint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=real, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_uint_real_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_uint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bool, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_uint_bool_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_uint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bigint, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_uint_bigint_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_real_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=int, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_real_int_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_real_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=uint, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_real_uint_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_real_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=real, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_real_real_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_real_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bool, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_real_bool_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_real_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bigint, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_real_bigint_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_bool_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=int, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_bool_int_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_bool_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=uint, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_bool_uint_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_bool_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=real, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_bool_real_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_bool_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bool, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_bool_bool_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_bool_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bigint, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_bool_bigint_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_bigint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=int, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_bigint_int_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_bigint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=uint, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_bigint_uint_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_bigint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=real, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_bigint_real_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_bigint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bool, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_bigint_bool_1, 'OperatorMsg', 30); + +proc ark_arithmeticOpVV_bigint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bigint, array_nd=1); +registerFunction('arithmeticOpVV', ark_arithmeticOpVV_bigint_bigint_1, 'OperatorMsg', 30); + +proc ark_comparisonOpVV_int_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=int, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_int_int_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_int_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=uint, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_int_uint_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_int_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=real, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_int_real_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_int_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bool, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_int_bool_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_int_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bigint, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_int_bigint_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_uint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=int, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_uint_int_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_uint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=uint, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_uint_uint_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_uint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=real, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_uint_real_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_uint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bool, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_uint_bool_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_uint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bigint, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_uint_bigint_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_real_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=int, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_real_int_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_real_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=uint, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_real_uint_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_real_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=real, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_real_real_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_real_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bool, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_real_bool_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_real_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bigint, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_real_bigint_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_bool_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=int, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_bool_int_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_bool_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=uint, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_bool_uint_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_bool_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=real, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_bool_real_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_bool_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bool, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_bool_bool_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_bool_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bigint, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_bool_bigint_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_bigint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=int, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_bigint_int_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_bigint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=uint, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_bigint_uint_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_bigint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=real, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_bigint_real_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_bigint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bool, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_bigint_bool_1, 'OperatorMsg', 207); + +proc ark_comparisonOpVV_bigint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bigint, array_nd=1); +registerFunction('comparisonOpVV', ark_comparisonOpVV_bigint_bigint_1, 'OperatorMsg', 207); + +proc ark_bitwiseOpVV_int_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=int, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_int_int_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_int_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=uint, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_int_uint_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_int_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=real, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_int_real_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_int_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bool, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_int_bool_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_int_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bigint, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_int_bigint_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_uint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=int, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_uint_int_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_uint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=uint, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_uint_uint_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_uint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=real, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_uint_real_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_uint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bool, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_uint_bool_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_uint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bigint, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_uint_bigint_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_real_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=int, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_real_int_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_real_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=uint, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_real_uint_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_real_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=real, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_real_real_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_real_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bool, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_real_bool_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_real_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bigint, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_real_bigint_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_bool_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=int, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_bool_int_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_bool_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=uint, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_bool_uint_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_bool_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=real, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_bool_real_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_bool_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bool, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_bool_bool_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_bool_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bigint, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_bool_bigint_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_bigint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=int, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_bigint_int_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_bigint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=uint, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_bigint_uint_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_bigint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=real, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_bigint_real_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_bigint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bool, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_bigint_bool_1, 'OperatorMsg', 267); + +proc ark_bitwiseOpVV_bigint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bigint, array_nd=1); +registerFunction('bitwiseOpVV', ark_bitwiseOpVV_bigint_bigint_1, 'OperatorMsg', 267); + +proc ark_divOpVV_int_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=int, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_int_int_1, 'OperatorMsg', 489); + +proc ark_divOpVV_int_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=uint, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_int_uint_1, 'OperatorMsg', 489); + +proc ark_divOpVV_int_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=real, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_int_real_1, 'OperatorMsg', 489); + +proc ark_divOpVV_int_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bool, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_int_bool_1, 'OperatorMsg', 489); + +proc ark_divOpVV_int_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bigint, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_int_bigint_1, 'OperatorMsg', 489); + +proc ark_divOpVV_uint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=int, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_uint_int_1, 'OperatorMsg', 489); + +proc ark_divOpVV_uint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=uint, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_uint_uint_1, 'OperatorMsg', 489); + +proc ark_divOpVV_uint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=real, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_uint_real_1, 'OperatorMsg', 489); + +proc ark_divOpVV_uint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bool, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_uint_bool_1, 'OperatorMsg', 489); + +proc ark_divOpVV_uint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bigint, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_uint_bigint_1, 'OperatorMsg', 489); + +proc ark_divOpVV_real_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=int, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_real_int_1, 'OperatorMsg', 489); + +proc ark_divOpVV_real_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=uint, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_real_uint_1, 'OperatorMsg', 489); + +proc ark_divOpVV_real_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=real, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_real_real_1, 'OperatorMsg', 489); + +proc ark_divOpVV_real_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bool, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_real_bool_1, 'OperatorMsg', 489); + +proc ark_divOpVV_real_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bigint, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_real_bigint_1, 'OperatorMsg', 489); + +proc ark_divOpVV_bool_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=int, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_bool_int_1, 'OperatorMsg', 489); + +proc ark_divOpVV_bool_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=uint, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_bool_uint_1, 'OperatorMsg', 489); + +proc ark_divOpVV_bool_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=real, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_bool_real_1, 'OperatorMsg', 489); + +proc ark_divOpVV_bool_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bool, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_bool_bool_1, 'OperatorMsg', 489); + +proc ark_divOpVV_bool_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bigint, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_bool_bigint_1, 'OperatorMsg', 489); + +proc ark_divOpVV_bigint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=int, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_bigint_int_1, 'OperatorMsg', 489); + +proc ark_divOpVV_bigint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=uint, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_bigint_uint_1, 'OperatorMsg', 489); + +proc ark_divOpVV_bigint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=real, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_bigint_real_1, 'OperatorMsg', 489); + +proc ark_divOpVV_bigint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bool, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_bigint_bool_1, 'OperatorMsg', 489); + +proc ark_divOpVV_bigint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bigint, array_nd=1); +registerFunction('divOpVV', ark_divOpVV_bigint_bigint_1, 'OperatorMsg', 489); + +proc ark_arithmeticOpVS_int_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=int, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_int_int_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_int_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=uint, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_int_uint_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_int_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=real, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_int_real_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_int_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bool, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_int_bool_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_int_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bigint, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_int_bigint_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_uint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=int, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_uint_int_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_uint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=uint, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_uint_uint_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_uint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=real, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_uint_real_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_uint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bool, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_uint_bool_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_uint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bigint, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_uint_bigint_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_real_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=int, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_real_int_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_real_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=uint, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_real_uint_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_real_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=real, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_real_real_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_real_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bool, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_real_bool_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_real_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bigint, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_real_bigint_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_bool_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=int, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_bool_int_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_bool_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=uint, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_bool_uint_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_bool_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=real, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_bool_real_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_bool_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bool, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_bool_bool_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_bool_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bigint, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_bool_bigint_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_bigint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=int, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_bigint_int_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_bigint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=uint, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_bigint_uint_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_bigint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=real, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_bigint_real_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_bigint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bool, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_bigint_bool_1, 'OperatorMsg', 536); + +proc ark_arithmeticOpVS_bigint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bigint, array_nd=1); +registerFunction('arithmeticOpVS', ark_arithmeticOpVS_bigint_bigint_1, 'OperatorMsg', 536); + +proc ark_comparisonOpVS_int_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=int, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_int_int_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_int_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=uint, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_int_uint_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_int_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=real, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_int_real_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_int_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bool, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_int_bool_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_int_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bigint, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_int_bigint_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_uint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=int, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_uint_int_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_uint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=uint, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_uint_uint_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_uint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=real, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_uint_real_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_uint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bool, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_uint_bool_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_uint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bigint, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_uint_bigint_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_real_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=int, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_real_int_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_real_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=uint, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_real_uint_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_real_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=real, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_real_real_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_real_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bool, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_real_bool_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_real_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bigint, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_real_bigint_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_bool_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=int, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_bool_int_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_bool_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=uint, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_bool_uint_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_bool_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=real, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_bool_real_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_bool_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bool, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_bool_bool_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_bool_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bigint, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_bool_bigint_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_bigint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=int, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_bigint_int_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_bigint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=uint, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_bigint_uint_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_bigint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=real, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_bigint_real_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_bigint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bool, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_bigint_bool_1, 'OperatorMsg', 690); + +proc ark_comparisonOpVS_bigint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bigint, array_nd=1); +registerFunction('comparisonOpVS', ark_comparisonOpVS_bigint_bigint_1, 'OperatorMsg', 690); + +proc ark_bitwiseOpVS_int_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=int, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_int_int_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_int_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=uint, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_int_uint_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_int_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=real, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_int_real_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_int_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bool, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_int_bool_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_int_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bigint, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_int_bigint_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_uint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=int, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_uint_int_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_uint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=uint, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_uint_uint_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_uint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=real, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_uint_real_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_uint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bool, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_uint_bool_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_uint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bigint, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_uint_bigint_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_real_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=int, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_real_int_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_real_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=uint, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_real_uint_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_real_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=real, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_real_real_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_real_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bool, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_real_bool_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_real_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bigint, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_real_bigint_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_bool_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=int, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_bool_int_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_bool_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=uint, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_bool_uint_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_bool_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=real, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_bool_real_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_bool_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bool, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_bool_bool_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_bool_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bigint, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_bool_bigint_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_bigint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=int, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_bigint_int_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_bigint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=uint, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_bigint_uint_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_bigint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=real, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_bigint_real_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_bigint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bool, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_bigint_bool_1, 'OperatorMsg', 747); + +proc ark_bitwiseOpVS_bigint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bigint, array_nd=1); +registerFunction('bitwiseOpVS', ark_bitwiseOpVS_bigint_bigint_1, 'OperatorMsg', 747); + +proc ark_divOpVS_int_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=int, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_int_int_1, 'OperatorMsg', 950); + +proc ark_divOpVS_int_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=uint, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_int_uint_1, 'OperatorMsg', 950); + +proc ark_divOpVS_int_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=real, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_int_real_1, 'OperatorMsg', 950); + +proc ark_divOpVS_int_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bool, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_int_bool_1, 'OperatorMsg', 950); + +proc ark_divOpVS_int_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bigint, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_int_bigint_1, 'OperatorMsg', 950); + +proc ark_divOpVS_uint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=int, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_uint_int_1, 'OperatorMsg', 950); + +proc ark_divOpVS_uint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=uint, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_uint_uint_1, 'OperatorMsg', 950); + +proc ark_divOpVS_uint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=real, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_uint_real_1, 'OperatorMsg', 950); + +proc ark_divOpVS_uint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bool, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_uint_bool_1, 'OperatorMsg', 950); + +proc ark_divOpVS_uint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bigint, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_uint_bigint_1, 'OperatorMsg', 950); + +proc ark_divOpVS_real_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=int, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_real_int_1, 'OperatorMsg', 950); + +proc ark_divOpVS_real_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=uint, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_real_uint_1, 'OperatorMsg', 950); + +proc ark_divOpVS_real_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=real, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_real_real_1, 'OperatorMsg', 950); + +proc ark_divOpVS_real_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bool, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_real_bool_1, 'OperatorMsg', 950); + +proc ark_divOpVS_real_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bigint, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_real_bigint_1, 'OperatorMsg', 950); + +proc ark_divOpVS_bool_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=int, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_bool_int_1, 'OperatorMsg', 950); + +proc ark_divOpVS_bool_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=uint, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_bool_uint_1, 'OperatorMsg', 950); + +proc ark_divOpVS_bool_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=real, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_bool_real_1, 'OperatorMsg', 950); + +proc ark_divOpVS_bool_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bool, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_bool_bool_1, 'OperatorMsg', 950); + +proc ark_divOpVS_bool_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bigint, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_bool_bigint_1, 'OperatorMsg', 950); + +proc ark_divOpVS_bigint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=int, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_bigint_int_1, 'OperatorMsg', 950); + +proc ark_divOpVS_bigint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=uint, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_bigint_uint_1, 'OperatorMsg', 950); + +proc ark_divOpVS_bigint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=real, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_bigint_real_1, 'OperatorMsg', 950); + +proc ark_divOpVS_bigint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bool, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_bigint_bool_1, 'OperatorMsg', 950); + +proc ark_divOpVS_bigint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bigint, array_nd=1); +registerFunction('divOpVS', ark_divOpVS_bigint_bigint_1, 'OperatorMsg', 950); + +proc ark_arithmeticOpSV_int_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=int, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_int_int_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_int_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=uint, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_int_uint_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_int_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=real, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_int_real_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_int_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bool, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_int_bool_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_int_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bigint, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_int_bigint_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_uint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=int, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_uint_int_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_uint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=uint, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_uint_uint_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_uint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=real, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_uint_real_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_uint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bool, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_uint_bool_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_uint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bigint, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_uint_bigint_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_real_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=int, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_real_int_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_real_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=uint, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_real_uint_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_real_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=real, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_real_real_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_real_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bool, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_real_bool_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_real_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bigint, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_real_bigint_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_bool_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=int, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_bool_int_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_bool_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=uint, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_bool_uint_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_bool_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=real, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_bool_real_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_bool_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bool, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_bool_bool_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_bool_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bigint, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_bool_bigint_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_bigint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=int, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_bigint_int_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_bigint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=uint, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_bigint_uint_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_bigint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=real, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_bigint_real_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_bigint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bool, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_bigint_bool_1, 'OperatorMsg', 989); + +proc ark_arithmeticOpSV_bigint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.arithmeticOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bigint, array_nd=1); +registerFunction('arithmeticOpSV', ark_arithmeticOpSV_bigint_bigint_1, 'OperatorMsg', 989); + +proc ark_comparisonOpSV_int_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=int, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_int_int_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_int_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=uint, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_int_uint_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_int_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=real, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_int_real_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_int_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bool, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_int_bool_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_int_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bigint, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_int_bigint_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_uint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=int, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_uint_int_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_uint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=uint, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_uint_uint_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_uint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=real, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_uint_real_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_uint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bool, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_uint_bool_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_uint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bigint, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_uint_bigint_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_real_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=int, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_real_int_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_real_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=uint, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_real_uint_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_real_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=real, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_real_real_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_real_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bool, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_real_bool_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_real_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bigint, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_real_bigint_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_bool_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=int, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_bool_int_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_bool_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=uint, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_bool_uint_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_bool_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=real, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_bool_real_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_bool_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bool, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_bool_bool_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_bool_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bigint, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_bool_bigint_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_bigint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=int, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_bigint_int_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_bigint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=uint, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_bigint_uint_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_bigint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=real, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_bigint_real_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_bigint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bool, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_bigint_bool_1, 'OperatorMsg', 1147); + +proc ark_comparisonOpSV_bigint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.comparisonOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bigint, array_nd=1); +registerFunction('comparisonOpSV', ark_comparisonOpSV_bigint_bigint_1, 'OperatorMsg', 1147); + +proc ark_bitwiseOpSV_int_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=int, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_int_int_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_int_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=uint, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_int_uint_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_int_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=real, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_int_real_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_int_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bool, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_int_bool_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_int_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bigint, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_int_bigint_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_uint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=int, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_uint_int_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_uint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=uint, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_uint_uint_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_uint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=real, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_uint_real_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_uint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bool, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_uint_bool_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_uint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bigint, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_uint_bigint_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_real_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=int, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_real_int_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_real_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=uint, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_real_uint_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_real_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=real, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_real_real_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_real_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bool, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_real_bool_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_real_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bigint, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_real_bigint_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_bool_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=int, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_bool_int_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_bool_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=uint, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_bool_uint_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_bool_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=real, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_bool_real_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_bool_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bool, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_bool_bool_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_bool_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bigint, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_bool_bigint_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_bigint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=int, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_bigint_int_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_bigint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=uint, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_bigint_uint_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_bigint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=real, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_bigint_real_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_bigint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bool, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_bigint_bool_1, 'OperatorMsg', 1204); + +proc ark_bitwiseOpSV_bigint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.bitwiseOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bigint, array_nd=1); +registerFunction('bitwiseOpSV', ark_bitwiseOpSV_bigint_bigint_1, 'OperatorMsg', 1204); + +proc ark_divOpSV_int_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=int, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_int_int_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_int_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=uint, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_int_uint_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_int_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=real, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_int_real_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_int_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bool, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_int_bool_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_int_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bigint, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_int_bigint_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_uint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=int, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_uint_int_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_uint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=uint, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_uint_uint_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_uint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=real, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_uint_real_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_uint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bool, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_uint_bool_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_uint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bigint, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_uint_bigint_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_real_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=int, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_real_int_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_real_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=uint, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_real_uint_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_real_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=real, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_real_real_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_real_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bool, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_real_bool_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_real_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bigint, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_real_bigint_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_bool_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=int, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_bool_int_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_bool_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=uint, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_bool_uint_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_bool_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=real, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_bool_real_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_bool_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bool, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_bool_bool_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_bool_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bigint, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_bool_bigint_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_bigint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=int, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_bigint_int_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_bigint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=uint, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_bigint_uint_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_bigint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=real, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_bigint_real_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_bigint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bool, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_bigint_bool_1, 'OperatorMsg', 1410); + +proc ark_divOpSV_bigint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.divOpSV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bigint, array_nd=1); +registerFunction('divOpSV', ark_divOpSV_bigint_bigint_1, 'OperatorMsg', 1410); + +proc ark_opeqVV_int_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=int, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_int_int_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_int_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=uint, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_int_uint_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_int_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=real, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_int_real_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_int_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bool, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_int_bool_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_int_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bigint, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_int_bigint_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_uint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=int, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_uint_int_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_uint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=uint, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_uint_uint_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_uint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=real, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_uint_real_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_uint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bool, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_uint_bool_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_uint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bigint, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_uint_bigint_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_real_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=int, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_real_int_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_real_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=uint, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_real_uint_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_real_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=real, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_real_real_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_real_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bool, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_real_bool_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_real_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bigint, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_real_bigint_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_bool_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=int, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_bool_int_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_bool_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=uint, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_bool_uint_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_bool_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=real, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_bool_real_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_bool_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bool, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_bool_bool_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_bool_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bigint, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_bool_bigint_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_bigint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=int, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_bigint_int_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_bigint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=uint, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_bigint_uint_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_bigint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=real, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_bigint_real_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_bigint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bool, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_bigint_bool_1, 'OperatorMsg', 1448); + +proc ark_opeqVV_bigint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVV(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bigint, array_nd=1); +registerFunction('opeqVV', ark_opeqVV_bigint_bigint_1, 'OperatorMsg', 1448); + +proc ark_opeqVS_int_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=int, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_int_int_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_int_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=uint, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_int_uint_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_int_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=real, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_int_real_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_int_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bool, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_int_bool_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_int_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=int, binop_dtype_b=bigint, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_int_bigint_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_uint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=int, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_uint_int_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_uint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=uint, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_uint_uint_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_uint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=real, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_uint_real_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_uint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bool, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_uint_bool_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_uint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=uint, binop_dtype_b=bigint, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_uint_bigint_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_real_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=int, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_real_int_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_real_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=uint, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_real_uint_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_real_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=real, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_real_real_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_real_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bool, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_real_bool_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_real_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=real, binop_dtype_b=bigint, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_real_bigint_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_bool_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=int, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_bool_int_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_bool_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=uint, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_bool_uint_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_bool_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=real, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_bool_real_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_bool_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bool, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_bool_bool_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_bool_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=bool, binop_dtype_b=bigint, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_bool_bigint_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_bigint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=int, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_bigint_int_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_bigint_uint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=uint, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_bigint_uint_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_bigint_real_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=real, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_bigint_real_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_bigint_bool_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bool, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_bigint_bool_1, 'OperatorMsg', 1630); + +proc ark_opeqVS_bigint_bigint_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do + return OperatorMsg.opeqVS(cmd, msgArgs, st, binop_dtype_a=bigint, binop_dtype_b=bigint, array_nd=1); +registerFunction('opeqVS', ark_opeqVS_bigint_bigint_1, 'OperatorMsg', 1630); + import RandMsg; proc ark_randint_int_1(cmd: string, msgArgs: borrowed MessageArgs, st: borrowed SymTab): MsgTuple throws do diff --git a/src/registry/register_commands.py b/src/registry/register_commands.py index 6834d9f3c..92d3d923b 100644 --- a/src/registry/register_commands.py +++ b/src/registry/register_commands.py @@ -872,7 +872,7 @@ def main(): with open(sys.argv[3] + "/registry/Commands.chpl", "w") as f: f.write(chpl_src.replace("\t", " ")) - print("registered ", n, " commands from ", len(source_files), " modules") + print("registered ", n, " commands from ", len(source_files), " modules (", len(DEFAULT_MODS), " default modules)") if __name__ == "__main__":