Math::ModInt::Perl - modular integer arithmetic, powered by native Perl
This documentation refers to version 0.011 of Math::ModInt::Perl.
use Math::ModInt::Perl; $a = Math::ModInt::Perl->new(3, 7); # 3 [mod 7] $b = $a->new(4); # 4 [mod 7] $c = $a + $b; # 0 [mod 7] $d = $a**2 - $b/$a; # 3 [mod 7] $m = $b->modulus; # 7 $r = $b->residue; # 4 $r = $b->signed_residue; # -3 $t = "$b"; # 'mod(4, 7)' $bool = $c == $d; # false $a->optimize_time; # aim for less cpu cycles $a->optimize_space; # aim for less memory space $a->optimize_default; # reset optimization choice
Math::ModInt::Perl is a generic implementation of Math::ModInt for small moduli, using native Perl integer arithmetic. Like all Math::ModInt implementations, it is loaded behind the scenes when there is demand for it, without applications needing to worry about it.
This implementation is capable of different optimization strategies per modulus. See optimize_time, optimize_space, optimize_default in Math::ModInt.
Math::ModInt
Martin Becker, <becker-cpan-mp@cozap.com>
Copyright (c) 2009-2015 by Martin Becker. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6.0 or, at your option, any later version of Perl 5 you may have available.
This library is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
To install Math::ModInt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::ModInt
CPAN shell
perl -MCPAN -e shell install Math::ModInt
For more information on module installation, please visit the detailed CPAN module installation guide.