Git Product home page Git Product logo

cairo-binius's Introduction

Binary Field Arithmetic and Polynomial Operations

This repository contains Cairo code for performing arithmetic operations on binary field elements and polynomial operations. The code is divided into three main sections:

  1. Binary Field Arithmetic
  2. Additive Number Theoretic Transform (NTT)
  3. Polynomial Operations and Utilities

Sources

The code in this repository is inspired by the following research paper:

Additionally, a Python implementation of the concepts discussed in the paper can be found in the following GitHub repository:

Binary Field Arithmetic

The BinaryFieldElement struct represents an element in a binary field. It provides implementations for various arithmetic operations, including addition, subtraction, multiplication, division, exponentiation, and inversion. The code also includes a custom binmul function for efficient binary field multiplication.

Additive Number Theoretic Transform (NTT

The code includes functions for performing additive NTT and its inverse. The get_Wi function generates the necessary coefficients for the NTT, while get_Wi_eval evaluates the coefficients at a specific point. The additive_ntt and inv_additive_ntt functions perform the forward and inverse NTT, respectively. The extend function extends a sequence of binary field elements by a specified expansion factor using the NTT.

Polynomial Operations and Utilities

The code provides utility functions for polynomial operations, including:

  • multilinear_poly_eval: Evaluates a multilinear polynomial at a given point.
  • log2: Computes the logarithm base 2 of a power of 2.
  • PolyOps trait: Defines operations for adding, multiplying, and evaluating polynomials.
  • evaluation_tensor_product: Computes the evaluation tensor product of a sequence of binary field elements.
  • max: Returns the maximum of two u128 values.

Testing

The code includes test modules for each section, which contain unit tests to verify the correctness of the implemented functions. To run the tests, use the snforge test command.

cairo-binius's People

Contributors

ametel01 avatar

Stargazers

 avatar JameWade avatar  avatar HAOYUatHZ avatar Kurt Pan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.