HigginsSoft.Math
1.0.6-alpha.27842
See the version list below for details.
dotnet add package HigginsSoft.Math --version 1.0.6-alpha.27842
NuGet\Install-Package HigginsSoft.Math -Version 1.0.6-alpha.27842
<PackageReference Include="HigginsSoft.Math" Version="1.0.6-alpha.27842" />
paket add HigginsSoft.Math --version 1.0.6-alpha.27842
#r "nuget: HigginsSoft.Math, 1.0.6-alpha.27842"
// Install HigginsSoft.Math as a Cake Addin #addin nuget:?package=HigginsSoft.Math&version=1.0.6-alpha.27842&prerelease // Install HigginsSoft.Math as a Cake Tool #tool nuget:?package=HigginsSoft.Math&version=1.0.6-alpha.27842&prerelease
HigginsSoft.Math
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 wellstring
as well as theGmpInt
andmpz_t
types. - Explicit cast operators are defined for all decimal types system types including
float
,double
, anddecimal
, as well as theGmpFloat
andmpz_f
types - Constructors exist in both
GmpInt
andGmpFloat
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>
) andCompareTo
are defined for theGmpInt
andGmpFloat
types and all corresponding system numeric types.
Arithmetic Operators:
- The standard binary arithemtic operators (
+
,-
,*
,/
,%
,--
,++
) as well as unary operators (+
,-'
) are defined for theGmpInt
andGmpFloat
types.
Binary Operators:
- The standard binary operators (
^
,~
, andxor
) are defined for theGmpInt
andGmpFloat
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.
Roadmap
Detail the following:
-
- Introduction
- Brief overview of the project
- Introduction
-
- Motivation
- Discuss why HigginsSoft.Math was created and the problem it solves
- Motivation
-
- Features
- List of features HigginsSoft.Math provides
- Features
-
- Usage
- Quickstart guide to using HigginsSoft.Math in your own project
- In-depth explanation of each feature and how to use it
- Usage
-
- Future plans
-
- Performance
- Discussion on the performance benefits of HigginsSoft.Math
- Benchmarking data
- Performance
-
- Contributing
- Guidelines for contributing to HigginsSoft.Math
- Contributing
-
- License
- Information about the project's license
- 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
- Quickstart guide
- 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 | Versions 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. |
-
net6.0
- Nethermind.Gmp (>= 1.0.1)
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 | 142 | 7/24/2023 |
1.0.26.41852 | 104 | 7/24/2023 |
1.0.26-alpha.24304 | 87 | 7/24/2023 |
1.0.25-alpha.44865 | 86 | 7/24/2023 |
1.0.21.34540 | 96 | 7/23/2023 |
1.0.20-alpha.18288 | 85 | 7/23/2023 |
1.0.17.40824 | 97 | 5/21/2023 |
1.0.16-alpha.497 | 79 | 5/21/2023 |
1.0.13-alpha.18488 | 79 | 5/21/2023 |
1.0.12.22064 | 93 | 5/13/2023 |
1.0.11-alpha.62894 | 80 | 5/13/2023 |
1.0.7.33500 | 85 | 5/10/2023 |
1.0.6-alpha.27842 | 77 | 5/10/2023 |