Git Product home page Git Product logo

bare_metal_modulo's Introduction

Overview

ModNum and ModNumC are highly ergonomic modular arithmetic structs intended for no_std use.

ModNum objects represent a value modulo m. The value and modulo can be of any primitive integer type. Arithmetic operators include +, - (both unary and binary), *, /, pow(), and ==. Additional capabilities include computing multiplicative inverses and solving modular equations.

ModNumC objects likewise represent a value modulo M, where M is a generic constant of the usize type. Arithmetic operators include +, - (both unary and binary), *, and ==.

This library was originally developed to facilitate bidirectional navigation through fixed-size arrays at arbitrary starting points. This is facilitated by a double-ended iterator that traverses the entire ring starting at any desired value. The iterator supports both ModNum and ModNumC.

Note that ModNum and ModNumC are not designed to work with arbitrary-length integers, as they require their integer type to implement the Copy trait.

Updates

  • 0.11.1:
    • ModNum and ModNumC now implement the Hash trait.
  • 0.11.0:
    • Changed signature of the Chinese remainder solver to take ownership of the iterator upon which it operates.
  • 0.10.0:
    • Now implements PartialOrd with reference to generic integers.
  • 0.9.0:
    • Added the replace() method.
  • 0.8.0:
    • Added the with() method.
    • Updated SaturatingAdd and SaturatingSub documentation.
    • Tested and updated for Rust 2021 edition.
  • 0.7.1:
    • Added some more documentation tests for ModNumC.
  • 0.7:
    • Added ModNumC, which uses const generics to enable compile-time checking of compatible modulo. Its functionality is a proper subset of ModNum.
    • Added MNum trait to allow ModNumIterator to work with both ModNum and ModNumC. Note: To use the .a() and .m() methods, be sure to import MNum (or just use bare_metal_modulo::*;)
  • 0.6:
  • 0.5:
  • 0.4:
    • Added ModNum as a right-hand side option for arithmetic operators.
    • Implemented Display for ModNum objects.
  • 0.3: Added division and modular exponentiation with negative exponents.
  • 0.2: Added modular exponentiation and inverse.

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.