[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference rusure::math

Title:Mathematics at DEC
Moderator:RUSURE::EDP
Created:Mon Feb 03 1986
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2083
Total number of notes:14613

1683.0. "LARGE SQUARES" by AMCUCS::HUNTER (Senior Systems Engineer) Mon Oct 26 1992 23:41

I am working on a project that requires squaring rather
large numbers (up to 1 million bits) and am looking for
either a s/w package that can handle this type of 
work and is callable, or a set of routines that someone
has hanging around to handle this type of calculations.

Any takers ?

David Hunter
T.RTitleUserPersonal
Name
DateLines
1683.1some random thoughts..STAR::ABBASII love DECspellTue Oct 27 1992 01:4427
    i've tried MAPLE, it can do up to 800,000 bit long integers, it
    took long time to multiply 2 integers each about 10^(280,000), which
    is about 2^(800,000) roughly..

    it could not take one million bit integer.

    I dont know if MAPLE is call'able, probably not.

    I assume you mean integer multiplications? not floating points...

    how about that class BigInt.h that is available on C++ on some platforms?
    
    how is the data being inputted to your program?

    may be the DXML library has something like that? just saw a DXML 
    qualifier under fortran compile command...
    
    by the way, may be one can replace multiplication of 2 numbers by
    some other operation that might take less time, like
                  y= x*x = x^2
                  log y= 2 log x
                  y = 10^(2 log x)
    
    since x is know, take its log, multiply by 2, call it z, and do 10^z.
    ...humm .. that does not seem to help much.. 
    
    /nasser
1683.23D::ROTHGeometry is the real life!Tue Oct 27 1992 02:4617
    Gnu MP (multiprecision arithmetic) is reported to have an FFT based
    fast multiplication algorithm.  It's available from decwrl::"/pub/GNU"
    do a directory and look for the gmp something-or-other tar file.

    I don't have any experience with it, but 1 million bits is up there
    where FFT starts to win.

    Another possibility is look thru this notesfile, someone posted a
    Mersenne primality test program which used such a multiplication
    routine, you could just snarf the subroutines you need out of this
    program.

    I once wrote such a multiply routine but it's no longer on line
    (and was vax specific anyhow.)  It's not too hard to do from
    scratch.

    - Jim
1683.3but WHY do you need to square such large numbers ?HANNAH::OSMANsee HANNAH::IGLOO$:[OSMAN]ERIC.VT240Tue Oct 27 1992 13:105
What are you really trying to do  ?  Maybe there's a way to solve your
problem *without* squaring such huge numbers.

/Eric
1683.4CommentsCADSYS::COOPERTopher CooperTue Oct 27 1992 13:2911
    The following reply (about 300 lines) may be useful.

    Note in particular the package called BigNum.  I kinda remember that
    there is a pointer somewhere in this conference.

    Note that knowing the context can help.  Multiplying two 1,000,000 bit
    number modulo 2^1,000,000 can be done much faster than simply
    multiplying two 1,000,000 bit numbers (much less multiplying them and
    then truncating).

				    Topher
1683.5List of big integer packages.CADSYS::COOPERTopher CooperTue Oct 27 1992 13:30284
From: mrr@scss3.cl.msu.edu (Mark Riordan)
Newsgroups: sci.crypt,sci.math
Subject: List of Bignum packages (updated)
Date: 12 May 92 20:01:00 GMT
Organization: Michigan State University
Lines: 277

This is the file BIGNUMS.TXT from cl-next2.cl.msu.edu.

In response to Email requests, I have assembled this list of
large-integer arithmetic packages of which I have heard.

           Last updated:  12 May 1992

For your convenience, I have placed copies of
some of these on cl-next2.cl.msu.edu (35.8.4.22).  They are
available for anonymous FTP in the directory "bignum".
However, what I have may not be the most current version in all cases.
Also, this server does not allow connections from outside the
USA and Canada.  (Sorry.)

Here they are, in no particular order:

mp
    Multiple Precision package that comes with some Unixes
    
    Multiple precision package accessed via -lmp flag on your
    compiler.  Provides +, -, *, /, gcd, exponentiation,
    sqrt.  Comes with SunOS, NeXT Mach, BBN Mach 1000, 
    and probably a few others.  See "man mp".  
    Object code only, of course.

PARI
    Henri Cohen, et al., Universite Bordeaux I, Paris, FRANCE
    
    Multiple precision desk calculator and library routines.
    Contains optimized assembly code for Motorola 68020, 
    semi-optimized code for SPARC, and apparently rather slow
    generic C version.  Does both integers and reals.
    Does vectors and matrices as well as scalars.
    Contains a number of advanced functions, some of which I've
    never heard of.  ("Weber's function"?)
    Has a factorization function, primality test, & other related stuff.
    Plenty of TEX documentation.
    Public domain, but you can't distribute modified versions.
    Available via anonymous FTP from math.ucla.edu.  There seem to
    be Mac- and NeXT-specific versions there in addition to:
    Filename:  pari-1.35a.tar.Z
    
Arithmetic in Global Fields  (Arith)
    Kevin R. Coombes, David R. Grant
    
    Package of routines for arbitrary precision integers or
    polynomials over finite fields.  Includes basic +, -, *, /
    and a few others like gcd.  Source code in C.
    Distributed under the terms of the GNU public license.
    Includes man pages and TEX documentation.
    Filename:  arith.tar.Z

Arbitrary Precision Math Library
    Lloyd Zusman   Los Gatos, CA
    
    C package which supports basic +, -, *, /.  Provides for radix
    points (i.e., non-integers).  Not as polished as the others here.
    Posted to comp.sources.misc in October 1988.
    Filename:  apml.tar.Z
    
BigNum
    J. Vuillemin, INRIA, FRANCE, and others.
    Distributed by Digital Equipment Paris Research Lab (DECPRL)
    
    A "portable and efficient arbitrary-precision integer" package.
    C code, with generic C "kernel", plus assembly "kernels" for
    MC680x0, Intel i960, MIPS, NS32032, Pyramid, and of course VAX.
    This is probably one of the better-known packages of this type.
    Implements +, -, *, /, mod, plus logical operations OR, AND, XOR.
    Both signed and unsigned arithmetic available.
    Available via email from librarian@decprl.dec.com.
    You will receive 5 shell archives.  Give your postal address
    and you will also receive printed documentation from France.
    Package includes TEX documentation.
    Publicly available for non-commercial use.
    I removed this from my archive when I heard a rumor that PRL
    doesn't like others to distribute it.  Send to the email address above.

Lenstra's package
    Arjen Lenstra   Bellcore
    
    Portable unsigned integer package written entirely in C.
    Includes +, -, *, /, exponentiation, mod, primality testing,
    sqrt, random number generator, and a few others.  The package
    was uncommented and undocumented; I have tried to add enough
    comments to get by.  This is the only of these packages that I
    have actually used.  It works well and is very portable.  
    I haven't done any benchmarks against the others, but the code 
    looks clever & Lenstra is an accomplished number theorist.
    Unlike the other packages here, this one requires you to allocate
    storage statically--only a problem if your numbers are really huge.
    Arjen has placed the code in the public domain.  
    Filename:  lenstra.tar.Z

lenstra_3
    Arjen Lenstra,  Bellcore

    An improved version of Arjen's package above.  This one
    does signed arithmetic and can do dynamic memory management as
    an option.  Has a few new routines, too.  "lenstra_3" contains
    minor bugfixes to the previously-available "lenstra_2".
    Filename:  lenstra_3.c
    
bmp  (Brent's Multiple Precision?)
    R. P. Brent

    1981 vintage FORTRAN code to do extended precision floating &
    fixed point arithmetic.  Includes most of the mathematical
    functions you'd find in a FORTRAN run-time library.
    This code is an ACM algorithm, number 524.
    To obtain, send a mail message to  netlib@ornl.gov
    containing the line "send mp.f from bmp" or better yet, perhaps
    just start with "help".

SPX
    Kannan Alagappan & Joseph Tardo, DEC
    
    This is a huge prototype public key authentication system
    based on RSA.  I mention it here because those who have heard
    of SPX have probably correctly guessed that it contains a large
    integer package and I want to inform you that the large integer
    package it contains is indeed DEC's BigNum from France.
    You can get a beta test copy of SPX from crl.dec.com (192.58.206.2). 
    Use it only for testing, as it "may" expire on a certain date.

amp  (Antti's Multiple Precision?)
    Antti Louko   alo@kampi.hut.fi

    Multiple precision integer package in C.  Includes +, -, *, /, %,
    pow, mod, 1/x mod y, random, sqrt, gcd.  Available for non-commercial
    use.  The package includes "share-secret", a public key system based
    on the Diffie-Hellman algorithm.
    This is normally part of the well-known "des-dist.tar.Z",
    but I have removed the DES part to avoid having to deal with 
    cryptographic export laws, and have named the result:
    Filename:  amp.tar.Z

gennum  
    Per Bothner   U of Wisconsin-Madison

    C++ routines and classes to do generic arithmetic, both
    integer and rational.  
    Obtain from sevenlayer.cs.wis.edu.

MIRACL
    (By someone in Dublin, Ireland)

    Integer and fractional multiple precision package.
    Includes factorization, primality testing, encryption.
    Not public domain, apparently.  It is available from the Austin
    Code Works.  (See ads in Byte Magazine or Dr. Dobbs.)

precision
    Dave Barrett  barrettd@tigger.colorado.edu

    Multiple precision integer package in C with +,-,*,/, sqrt, rand,
    mod, pow, log.  Simple vector support.  Does dynamic allocation of memory.
    Free as long as you don't sell it or any program that uses it.
    Filename:  precision.tar.Z

UBASIC
    Unknown (to me)

    Multiple-precision version of the BASIC programming language,
    for MS-DOS.  Includes floating point.  Said (by Keith Briggs)
    to be pretty fast.  Object only, I think.  ervin@morekypr.bitnet
    says:  "This is the best package that I know of for
    fast arithmetic.  Has a version optimized for 386 machines.  Includes
    routines to do MPQS, the fastest currently known general factoring
    algorithm.  An additional file is at both sites to allow MPQS to use
    hard drives so that it can factor up to 80 digits.  Many number
    theoretical functions are included in UBASIC.  It allows over 2500
    digits of precision."
    Available via anonymous FTP from shape.mps.ohio-state.edu,
    or simtel20.army.mil, or wuarchive.wustl.edu.

calc_v22
    Unknown

    MS-DOS C-like language that allows "infinite" precision.
    Nice intrinsic functions.  ervin@morekypr.bitnet reports problems
    when changing precision on the fly.
    See simtel20 or wuarchive.

briggs_arith
    Keith Briggs (kbriggs@mundoe.maths.mu.oz.au)

    Turbo Pascal 5 source for routines that do multiple-precision
    +, -, *, /, sqrt, gcd, factoring, rand for integers; also includes
    +, -, *, / and rand for rational numbers.
    Filename:  briggs_arith.pas

Institute fur Experimentelle Mathematik
    Dr Gerhard Schneider (?)

    Fast C multiple-precision subroutine library.
    I don't know anything about it; sl25@ely.cl.cam.ac.uk says
    to contact MAT420@DE0HRZ1A.BITNET for more info.
    Postal Address:
    Institute fur Experimentelle Mathematik
    EllernStr 29
    D4300 Essen-12    GERMANY

LongInt
    Markus Mueller (mueller@komsys.tik.ethz.ch)

    "Multi precision arithmetic written in MODULA-2, with the most time critical
    parts written in Assembler. Includes basic arithmetics (+, -, *, /, %) as
    well as arithmetics MODULO a number. An additional module provides a
    collection of procedures for primality testing, gcd, multiplicative
    inverse and more. The package is part of a Privacy Enhanced Mail (PEM)
    package which includes a PEM mailer, RSA key generator and Certificate
    generation tools."

    Source is in Modula-2, C, and assembler for Sun 3.  LongInt has
    also been ported to MS-DOS under Logitech Modula-2 and Turbo
    Assembler.  Availability:  free for university use (research and
    education); otherwise, a source license is required.  To obtain,
    write or email to:

        Markus Mueller
        Bertastrasse 7
        CH-8953 Dietikon
        Switzerland
        email:  mueller@komsys.tik.ethz.ch

bignum-1.2
    Henrik.Johansson@Nexus.Comm.SE

    Bignum package written in portable C.  Will in the future
    conform to the Common Lisp functions that handles integers.
    Currently includes +, -, *, /, exponentiation, "exptmod",
    comparison, random numbers, and gcd.
    Filename: bignum-1.2

GNU Multiple Precision
    GNU (Free Software Foundation) multiple precision package.
    I haven't looked at it yet.  This is current as of April 1992,
    but there may be a more recent version by the time you read 
    this.  This package is very widely available on FTP sites.
    Filename: gmp-1.2.tar.Z

Elliptic Curve Primality Proving 
    By Francois Morian, France.

    Large package to prove the primality of any prime.
    Includes Inria's BIGNUM package. 
    Obtained from ftp.inria.fr (128.93.1.26).
    Filename: ecpp.V3.4.1.tar.Z

Bell's Arbitrary Precision Calculator
    David I. Bell, Australia  (dbell@pdact.pd.necisa.oz.au)

    Arbitrary-precision calculator with good online help, C-like
    language, many builtin functions, support for integers,
    rational numbers (they work like floating point), complex numbers,
    matrices, strings, lists, files, "objects".  Includes 
    gcd, primality testing, even trig functions.  Recommended.
    (Large package, though.)  Obtained from alt.sources.
    Free for personal use.
    Filename: bell-calc.tar.Z

Built-in support in other languages
    Various

    Multiple precision arithmetic is available in a number of 
    programming languages, such as Lisp and ABC (cf. mcsun.eu.net).
    Perl (by Larry Wall, available from devvax.jpl.nasa.gov)
    includes source, in Perl, for such a package, but it's probably
    not suitable for serious use.
    For some of these, source code may be available.  This list is
    long enough, so I'm not going to pursue it aggressively.

Thanks to Ed Vielmetti and several others who contributed to this list.

Mark Riordan   riordanmr@clvax1.cl.msu.edu
Michigan State University  
1683.6WHAT WE ARE DOINGAMCUCS::HUNTERSenior Systems EngineerTue Oct 27 1992 14:4720
Thanks for the responses.  I know about the speed of the
FFT routines for large numbers and was hoping that someone
would know where I could get a copy of it.

What we are doing is using a series of 21064 based machines
to calidate the Mersenne Primes and ensure that there
is not one between 28 - 29 -30 and then look for the 
next one.  What we are doing know is to clock the
squaring algoritiums to determine how long we think
it will take.  The current "guestimate" is that the
number will be on the order of 2^1000000 - 1.

We are currently working with a mathamitician that was 
involved with finding the 27th Mersenne Prime.

I will copy over BigNum and see if I have to rewrite the
portion to run on Alpha.

Thank....
David
1683.7BigNumCADSYS::COOPERTopher CooperTue Oct 27 1992 19:0411
    I believe that the BigNum package is designed to be completely (or
    almost completely) transportable.  It contains a kernal, however, which
    is intended to be rewritten in a machine dependent way to get maximum
    speed.


    I seem to remember that BigNum does contain an FFT multiplication
    routine -- invoked when the arguments are big enough, but I wouldn't
    swear to it.

				    Topher
1683.8BigNum PointerAMCUCS::HUNTERSenior Systems EngineerTue Oct 27 1992 19:127
Any idea as to a netkit for BigNum.  I sent off a note 
to the PRL libririan but got an "unknown address".

I am willing to rewrite the "kernal" part to be Alpha 
specific.

David
1683.9STAR::ABBASII love DECspellWed Oct 28 1992 03:085
    Iam not sure about a netkit, but note #813 in c_plus_plus notes file
    on turris::  has a discussion on bignum. packages , they mention
    libg++
    
    /nasser
1683.103D::ROTHGeometry is the real life!Wed Oct 28 1992 15:127
    I have a copy of BigNum which I've played with... I'm nearly sure
    it does not use FFT based multiplication (but gmp, the gnu mp
    packag does.)  BigNum uses Karatsuba multiplication which is
    faster than the usual O(n^2) method but not as fast as FFT
    for really large numbers.

    - Jim
1683.11Straight Dope.CADSYS::COOPERTopher CooperFri Oct 30 1992 16:2748
I got the following by sending a request to DECPRC::Librarian.

				Topher
------------------------------------------------------------------------------
From:	DECPRL::PATAT "Jean-Christophe Patat : Good news from tomorrow..." 30-OCT-1992 08:35:24.73
To:	27-Oct-1992 1619 <cadsys::cooper>
CC:	
Subj:	Re: Request for information on BigNum package. 

Hello,
 
 
 
You have requested the BIGNUM Package, or the BIGNUM REPORT.
 
* To get the Bignum package, send a new mail to :
 
	doc-server@prl.dec.com
	or
	decprl::doc-server
 
	with subject message   "send package bignum"
 
 
* To get electronic postscript version of the BIGNUM Report, send mail to :
 
 
	doc-server@prl.dec.com
	or
	decprl::doc-server
 
	with subject message   "send report 2"
 
 
* To get the (printed ) PRL Research Report No 2 "BIGNUM" , send mail to :
	librarian@prl.dec.com
	or
	decprl::librarian
 
	with subject message   "Order report 2"
	and a message with your postal adress.
 
 
 
 
 
Jean-Christophe Patat
Librarian (librarian@prl.dec.com)