HigginsSoft.Math 1.0.12.22064

This package has a SemVer 2.0.0 package version: 1.0.12.22064+56304a66f6.
There is a newer version of this package available.
See the version list below for details.
dotnet add package HigginsSoft.Math --version 1.0.12.22064                
NuGet\Install-Package HigginsSoft.Math -Version 1.0.12.22064                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HigginsSoft.Math" Version="1.0.12.22064" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HigginsSoft.Math --version 1.0.12.22064                
#r "nuget: HigginsSoft.Math, 1.0.12.22064"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install HigginsSoft.Math as a Cake Addin
#addin nuget:?package=HigginsSoft.Math&version=1.0.12.22064

// Install HigginsSoft.Math as a Cake Tool
#tool nuget:?package=HigginsSoft.Math&version=1.0.12.22064                

HigginsSoft.Math

Nuget Release Tests Pre-Release Tests

Installation

HigginsSoft.Math is available as NuGet package can be installed using NuGet:

  • Visual Studio Package Manager
  • Install-Package HigginsSoft.Math
  • DotNet CLI
  • dotnet add package HigginsSoft.Math
  • PackageReference
  • <PackageReference Include="HigginsSoft.Math" />

Instructions for other package managers are availabe on the HigginsSoft.Math NuGet package page.

Introduction

HigginsSoft.Math is a free DotNet library inspired by GmpLib, Yafu, GGNFS, and other libraries that aims to bring high-performance artihmetic and number theory operations to the DotNet world.

It offers specific implemenations as well as wrappers for some of those libraries so they can be used in DotNet as any other type would be without worrying about the underlying low-level implemtations of those libaries.

Usage

To use HigginsSoft.Math, simply reference the HigginsSoft.Math namespace in your code and use the available functions.

Wrappers for GmpLib's mpz_t (multi-precision integer) is available as GmpInt while the mpz_f (multi-precision float) is available as GmpFloat.

Both wrappers have the standard artithmetic, binary, compare and cast operators built-in for implicit/explicit conversion with the built-in DotNet numeric data types, including System.Numerics.BigInteger

    GmpInt a = 1;
    GmpInt b = a << 80;
    BigInteger check = BigInteger.Power(2, 80);
    Assert.IsTrue(() => b == check);
    GmpInt c = check;
    Assert.IsTrue(() => c == check);

Overview

GmpInt and GmpFloat

Cast Operators:
  • Implicit cast operators are defined for all integer based system types including byte, sbyte, int, unit, long, ulong, BigInteger, as well string as well as the GmpInt and mpz_t types.
  • Explicit cast operators are defined for all decimal types system types including float, double, and decimal, as well as the GmpFloat and mpz_f types
  • Constructors exist in both GmpInt and GmpFloat for the system types.

Note: The explicit operators will truncate the decimal types which could lead to unexpected results, so take care when converting between the types.

Comparison Operators:

  • The standard comparison operators (<, <=, ==, !=, >, >=, and >) and CompareTo are defined for the GmpInt and GmpFloat types and all corresponding system numeric types.

Arithmetic Operators:

  • The standard binary arithemtic operators (+, -, *, /, %, --, ++) as well as unary operators (+, -') are defined for the GmpInt and GmpFloat types.

Binary Operators:

  • The standard binary operators (^, ~, and xor) are defined for the GmpInt and GmpFloat types.

Named Methods:

The following named methods are available, many with various overloads:

- - -
Abs GetHashCode ModAsUint32
Add HammingDistance Multiply
And IndexOfOne Negate
Binomial IndexOfZero NextPrimeGMP
BitCount InverseModExists Or
BitLength InvertMod PopCount
Bytes IsDivisibleBy Power
Clone IsEven PowerMod
CompareToAbs IsOdd RawData
CompareToAbs IsOne Remainder
Complement IsPerfectPower RemoveFactor
CountOnes IsPerfectSquare Root
DigitCount IsPowerOfTwo SetBit
Divide IsProbablyPrimeRabinMiller ShiftLeft
DivideExactly IsZero ShiftRight
DivideMod JacobiSymbol Sign
Equals KroneckerSymbol Sqrt
EqualsMod Lcm Square
Factorial LegendreSymbol Subtract
Fibonacci Lucas ToString
Gcd Mod TryInvertMod
GetBit ModAsInt32 Xor

Low-level GMP functions.

While the GmpInt and GmpFloat types offer a fully managed native DotNet experience without the need to worry about managing unsafe types low-level GMP functions are available to throw using gmp_lib by importing MathGmp.Native which the libary currently uses for access to the native GMP library.

Prime Generation:

A PrimeGenerator can be used to generate a list of primes. The default constructor will generate all primes starting from 2. You can also use the constructor overload to specify a starting and/or maximum prime.

The generator is able to produce all primes up to 2^31 in ~.5 seconds when ran in parallel mode using HigginsSoft.DotMpi to launch multi-processor sieving threads.

HigginsSoft.Math Prime Generator

Using the uint data type has a sligh performance hit but the generator can produce all primes up to 2^32 in a little over 1 second.

HigginsSoft.Math Prime Generator

Roadmap

Detail the following:

    • Introduction
      • Brief overview of the project
    • Motivation
      • Discuss why HigginsSoft.Math was created and the problem it solves
    • Features
      • List of features HigginsSoft.Math provides
    • Usage
      • Quickstart guide to using HigginsSoft.Math in your own project
      • In-depth explanation of each feature and how to use it
    • Future plans
    • Performance
      • Discussion on the performance benefits of HigginsSoft.Math
      • Benchmarking data
    • Contributing
      • Guidelines for contributing to HigginsSoft.Math
    • License
      • Information about the project's license

Checklist

  • Introduction
    • Title
    • Brief overview of the project
  • Motivation
    • Explanation of why DotMpi was created and the problem it solves
  • Features
    • List of features DotMpi provides
  • Usage
    • Quickstart guide
      • Installation
      • Setting up a project
      • Basic usage example
    • In-depth explanation of each feature and how to use it
  • Future plans
    • Authentication
    • Remote connections
      • Agent installe
    • Custom serializers
    • Event Api
    • Code Cleanup / Refactoring
    • Unit Tests
    • Docs
    • Wiki
    • Nuget Package
  • Performance
    • Discussion on the performance benefits of HigginsSoft.Math
    • Benchmarking data
  • Contributing
    • Guidelines for contributing to HigginsSoft.Math
  • License
    • Information about the project's license

Contributing

If you are interested in contributing to HigginsSoft.Math, please submit a pull request with your changes and a description of the changes made.

License

HigginsSoft.Nath is licensed under the GNU General Public License v3.0. See the LICENSE file for details about using and redistributing this software.

Acknowledgments

Special thanks to the creators of GmpInt and bbuhrow's Yafu for inspiring and guiding the development of DotMpi.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.27.1918 149 7/24/2023
1.0.26.41852 108 7/24/2023
1.0.26-alpha.24304 89 7/24/2023
1.0.25-alpha.44865 88 7/24/2023
1.0.21.34540 100 7/23/2023
1.0.20-alpha.18288 87 7/23/2023
1.0.17.40824 101 5/21/2023
1.0.16-alpha.497 81 5/21/2023
1.0.13-alpha.18488 81 5/21/2023
1.0.12.22064 97 5/13/2023
1.0.11-alpha.62894 82 5/13/2023
1.0.7.33500 89 5/10/2023
1.0.6-alpha.27842 79 5/10/2023