mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 03:55:04 -05:00
enhance(compiler): Add operators == and != for Integer / Tensor Lambda Arguments
This commit is contained in:
@@ -65,6 +65,16 @@ public:
|
||||
unsigned int getPrecision() const { return this->precision; }
|
||||
BackingIntType getValue() const { return this->value; }
|
||||
|
||||
template <typename OtherBackingIntType>
|
||||
bool operator==(const IntLambdaArgument<OtherBackingIntType> &other) const {
|
||||
return getValue() == other.getValue();
|
||||
}
|
||||
|
||||
template <typename OtherBackingIntType>
|
||||
bool operator!=(const IntLambdaArgument<OtherBackingIntType> &other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
static char ID;
|
||||
|
||||
protected:
|
||||
@@ -177,6 +187,26 @@ public:
|
||||
return this->value.data();
|
||||
}
|
||||
|
||||
template <typename OtherScalarArgumentT>
|
||||
bool
|
||||
operator==(const TensorLambdaArgument<OtherScalarArgumentT> &other) const {
|
||||
if (getDimensions() != other.getDimensions())
|
||||
return false;
|
||||
|
||||
for (auto pair : llvm::zip(value, other.value)) {
|
||||
if (std::get<0>(pair) != std::get<1>(pair))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename OtherScalarArgumentT>
|
||||
bool
|
||||
operator!=(const TensorLambdaArgument<OtherScalarArgumentT> &other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
static char ID;
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user