Skip to content

Expand integer math operations #1143

@lognorman20

Description

@lognorman20

What is the problem you want to solve and can not with the current version?
Currently, tfhe-rs supports basic operations on integers such as arithmetic, bitwise operations, comparisons, and min/max comparison. I propose this project to extend these existing primitives to more complicated integer operations in areas such as number theory. With this addition to tfhe-rs, users can abstract away functions they would have needed to implement themselves and focus on building meaningful projects. Further, this project aims to ensure its functions are high-speed and reliable.

Describe the solution you'd like
An extension of tfhe-rs with more functions similar to Rust's BigInt library.

Describe alternatives you've considered
Writing my own functions using already existing primitive operations (addition, multiplication, etc..)

Additional context
A few examples of functions to be added are the following:

  • nth_root
  • modinv
  • modpow
  • gcd
  • lcm
  • divides
  • is_multiple_of
  • is_even/odd
  • next/prev_multiple_of
  • median
  • approx_log

These functions will leverage the already existing implementations of basic arithmetic. They would be added for both FheUint and FheInt.

Related links/References:
Python Math Library
Sage Integer Arithmetic
GNU Exponentiation and Logarithms
Rust num-bigint
ruint

I am happy to work on this project and discuss it further.

Metadata

Metadata

Assignees

Labels

feature_requestSomething I need does not exist

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions