Parrot bindings for GMP integer functions

Bob Kuo

Short description: This project aims to provide bindings for all integer functions in the GMP library as well as associated documentation and tests.

Personal Information

Bob Kuo
bobjkuo@gmail.com - bubaflub (github, IRC)

Project: Parrot bindings for GMP integer functions

Abstract:

This project aims to provide bindings for all integer functions in the GMP library as well as associated documentation and tests.

Benefits:

  • All HLLs get access to GMP for free
  • Easy stepping stone to the other sets - rational and float - of GMP functions
  • First step in providing a Big Number library
  • Allows development of cryptographic and other advanced math libraries

Project Details:

Code will be hosted on github under bubaflub/parrot-gmp or a fork of the official parrot repo.

Documentation work going on throughout - inline POD, comments, external READMEs. Besides inline comments, all documentation will be in POD. Since github supports POD rendering all docs will be accessible online that way.

The distribution will use distutils and the test suite will be using PIR's Test::More. Any examples or code written in an HLL will be tested with that HLL. Functions will be considered tested if each possible branch is covered and there are two or more tests covering each function.

Wrapper classes will be written in Winxed and tested with Rosella.  They will wrap an opaque pointer to the C GMP integer structure, provide convenience functions for initialization, stringification and I/O. Further work will be done to provide convenient ways to do basic math with the wrapper objects - these methods will be slower but more convenient and clearer for users not as concerned about speed.

April 25th - May 23rd - Community bonding period
  Read docs on NCI, GMP, distutils
  Investigate which versions of GMP should be supported
  Build and test other HLLs on Parrot
  Determine / create a reliable way to measure documentation and test coverage of PIR files

May 23rd - Programming start date

May 23rd - 30th -
  Begin work on definition file for ncidef2pir.pl to generate PIR code
  - Should be able to generate this from GMP headers and documentation

May 30th - June 6th -
  Finish work on definition file
  Begin work on PMC wrapper classes

June 6th - June 13th -
  Begin work on library tests

June 13th - July 4th -
  Test coverage to 15-20% of integer functions
  Finish basic work on wrapper classes
    - this will include initialization, stringification, and I/O

July 4th - July 11th -
  Test coverage to 40-50%
  Basic examples on how to use functions in PIR
  Basic usage examples in HLLs like Rakudo or Cardinal

July 11th - Midterm - deliverables
  NCI definition file, wrapper classes, tests, docs, and examples
  At this point all initialization (mpz_init* and mpz_clear*), setting (mpz_set*), combined (mpz_init_set*), conversion (mpz_get*), basic arithmetic (mpz_add*, mpz_mul*, mpz_sub*), exponentiation (mpz_pow*), comparison (mpz_cmp*) and IO functions (mpz_out* and mpz_in*) should be completed.

July 11th - July 25th -
  Test coverage to 100%
  More documentation

August 1st - August 15th -
  Advanced examples
    - real world algorithms
    - HLL usage
  Finish PMC wrapper classes
    - convenience methods for basic math

August 15th - August 22nd -
  Overflow week
  Cage cleaning

August 22nd - Pencils down - all code, tests, and docs submitted

Deliverables: All GMP integer functions mapped through NCI, convenience functions, docs, examples, and 100% test coverage that can be merged with Parrot when the project is complete

If I finish ahead of time, I'd like to

  • implement the rational and float functions in GMP. Time estimate: unknown, but approx. double what it took for implementing the integer functions
  • wrapper classes in other HLLs - Rakduo and Cardinal especially. Time estimate: 2 weeks
  • start porting some advanced math libraries (like Math::Primality) for future work. Time estimate: 1 week for core module
  • provide more advanced examples like a command-line arbitrary precision calculator driven through a PCT language and a complete tutorial on how I built it. Time estimate: unknown, but would likely be a major multi-week project

If I'm running out of time, I'll focus on first the NCI definition file and the core set of functions listed on the midterm date. These can be committed at any step of completion and be continued outside of GSoC.

References:

http://www.gmblib.org
PDD16 for NCI information
Math::GMPz for Perl5 bindings to GMP integer functions

License:

Same as Parrot.

Bio:

I am currently a Masters student living in Champaign-Urbana, IL. I completed my undergrad at University of Illinois - Chicago in Math and Computer Science. I've been a perl programmer for about 7 years and worked through a number of web development companies and am currently employed at Grant Street Group. The last two years I've done Google Summer of Code projects - one for Perl and one through RTEMS. I've been a committer to Parrot for about a year or two.

Eligibility:

I am currently a Masters student and am eligible for the Google Summer of Code.