Path: usenet.cise.ufl.edu!usenet.eel.ufl.edu!www.nntp.primenet.com!nntp.primenet.com!feed1.news.erols.com!insync!uunet!in3.uu.net!206.58.0.35!news.structured.net!nntp0.teleport.com!usenet
From:
[email protected] (Steffen Beyer)
Newsgroups: comp.lang.perl.announce,comp.lang.perl.misc
Subject: ANNOUNCE: Set::IntegerFast 2.0
Followup-To: comp.lang.perl.misc
Date: 21 Dec 1996 14:53:32 GMT
Organization: sd&m GmbH & Co. KG Munich, Germany
Lines: 298
Approved:
[email protected] (comp.lang.perl.announce)
Message-ID: <
[email protected]>
Reply-To:
[email protected] (Steffen Beyer)
NNTP-Posting-Host: gadget.cscaper.com
X-Disclaimer: The "Approved" header verifies header information for article transmission and does not imply approval of content.
Xref: usenet.cise.ufl.edu comp.lang.perl.announce:73 comp.lang.perl.misc:12888
I'm glad and proud to present
=========================================
Module "Set::IntegerFast" Version 2.0
=========================================
to the Perl community.
Legal stuff:
------------
Copyright (c) 1996 by Steffen Beyer. All rights reserved.
This package is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
Requirements:
-------------
Perl version 5.000 or higher, a compiler complying with ANSI C standards (!).
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
What are the most important differences between versions 1.x and 2.x:
---------------------------------------------------------------------
1) The standard calling convention for the object constructor method
is supported now, i.e.
$set = Set::IntegerFast::Create($elements);
is _gone_ and is replaced by
$set = new Set::IntegerFast($elements);
(and also including all other possibilities of calling a class method
offered by Perl)
2) The object destructor method has also changed its name:
$set->Destroy();
is also _gone_ and replaced by
$set->DESTROY();
Note however that you don't need to call this method explicitly
anymore (!) - Perl will do it automatically for you when the last
reference to your set is deleted, for instance through assigning
a different value to the Perl variable containing the reference
to your set, like in "$set = 0;".
3) The man page is no separate file anymore, it is now included in
the file "IntegerFast.pm" in POD format, where it will automatically
be found and installed in your "man" directory by "make install".
4) A wrapper module named "Set::IntegerRange" has been added to this
package which allows you to use sets of integers in an *arbitrary*
interval (instead of from zero to some positive integer).
What does it do:
----------------
This package allows you to create sets of arbitrary size (only limited
by the size of a machine word (minimum) and available memory on your
system (maximum)) of an interval of positive integers starting with zero,
to dynamically change the size of such a set and to perform all the basic
operations for sets on them, like
- adding or removing elements,
- testing for the presence of a certain element,
- computing the union, intersection, difference, symmetric difference or
complement of sets,
- copying sets,
- testing two sets for equality or inclusion, and
- computing the minimum, the maximum and the norm (number of elements) of
a set.
Note that it is extremely easy to implement sets of arbitrary intervals
of integers using this package (negative indices are no obstacle),
despite the fact that only intervals of positive integers (from
zero to some positive integer) are supported directly.
Please refer to the Set::IntegerFast(3) and Set::IntegerRange(3) man page
to see how this is done!
The package is mainly intended for mathematical or algorithmical computa-
tions. There are also a number of efficient algorithms that rely on sets.
An example of such an efficient algorithm (which uses a different repre-
sentation for sets than this package, however) is Kruskal's algorithm for
minimal spanning trees in graphs. (That algorithm is included in this dis-
tribution as a Perl program (thoroughly commented) for those interested)
Another famous algorithm using sets is the "Seave of Erathostenes" for
calculating prime numbers, which is included here as a demo program.
An important field of application is the computation of "first", "follow"
and "look-ahead" character sets for the construction of LL, SLR, LR and LALR
parsers for compilers (or a compiler-compiler, like "yacc", for instance).
(That's what the C code in this package was initially written for)
(See Aho, Hopcroft, Ullman, "The Design and Analysis of Computer Algorithms"
for an excellent book on efficient algorithms and the famous "Dragon Book"
on how to build compilers by Aho, Sethi, Ullman)
Therefore, this package is designed for efficiency and not for a fancy
user interface.
It only offers a basic functionality and leaves it up to your application
to add whatever special handling it needs (for example, negative indices
can be realized by biasing the whole range with an offset).
(See the "Set::IntegerRange.pm" module in this package for more details)
Sets in this package are implemented as bit vectors, and elements are positive
integers from zero to the maximum number of elements (which you specify when
creating the set) minus one.
Each element (i.e., number or "index") thus corresponds to one bit in the
bit array. Bit number 0 of word number 0 corresponds to element number 0,
element number 1 corresponds to bit number 1 of word number 0, and so on.
The package doesn't use bytes as basic storage unit, it rather uses machine
words, assuming that a machine word is the most efficiently handled size of
all scalar types on any machine (that's what the C standard proposes and
assumes).
In order to achieve this, it automatically determines the number of bits
in a machine word on your system and then adjusts its internal constants
accordingly.
The greater the size of this basic storage unit, the better the complexity
of the methods in this package (but also the greater the average waste of
unused bits in the last word).
See the section on COMPLEXITY in the Set::IntegerFast(3) man page for a
detailed analysis of the complexity of each method!
Note that the C part of this package ("lib_set.c") is designed in such a
way that it may be used independently from Perl and this Perl extension
module as a C library.
For this, you can use the file "lib_set.o" exactly as it is produced when
building this module! It contains no references to Perl, and it doesn't need
any Perl header files in order to compile. (It only needs "lib_defs.h" and
some system header files)
Note however that this C library does not perform any bounds checking
whatsoever! (This is left to your application!)
(See the corresponding explanation in the file "lib_set.c" for more details
and the file "IntegerFast.xs" for an example of how this can be done!)
In this package, all bounds and type checking (which should be absolutely
fool-proof, by the way!) is done in the XS subroutines.
For more details, see the Set::IntegerFast(3) man page!
Version history:
----------------
Version 1.0 was the initial release.
Version 1.1 offered a new "Resize" method which allows you to change the
size of an existing set while keeping the information it contains (as much
of it as will fit into the new set) and fixed some errors in the documen-
tation (the methods Create, Empty, Fill and Copy had complexity n/8 and not
n/b) by changing the implementation of these methods (so that they now have
complexity n/b).
The interface of the C routines was made more consistent (the pointer to
the set is now always the first argument) and a few more paragraphs were
added to the documentation.
The method "ExclusiveOr" (which calculates the symmetric difference X =
(Y + Z) \ (Y * Z) of two sets Y and Z) was also added in this version.
Version 1.1 broke with the next new release of Perl, version 5.002 (problems
with the "Destroy" method and "bad free() ignored" warnings that caused some
of the tests in "make test" to fail).
Version 2.0 fixes the problem that appeared with Perl 5.002 in version 1.1.
As a matter of fact, version 2.0 is a complete rewrite of the XSUB part of
this package. The C part of the package ("lib_set.c") has also been slightly
changed; the functions "lexorder" and "Compare" are handled more efficiently
now (complexity 1..n/b instead of 1..n/8). Parameter types have been adjusted
to reflect their nature as those integers that the sets of this package are
all about. The documentation has been completely rewritten and ported to POD
format.
A new module (in fact a "wrapper" module for the "Set::IntegerFast" module)
named "Set::IntegerRange" has been added in version 2.0 of this package which
allows you to use sets of integers in an *arbitrary* interval (instead of from
zero to some positive integer).
Thanks:
-------
Many thanks to Andreas Koenig <
[email protected]> for his
efforts as upload-manager for the CPAN, his patience, and lots of good
advice and suggestions! Thank you for doing such a tremendous (and time-
consuming) job!!
Also many thanks to David Jenkins <
[email protected]> for reviewing the
first version of this README file and the man page.
Many thanks to Jarkko Hietaniemi <
[email protected]> for his
suggestions while I was developing the first release of this package!
Many thanks also to the people of the perl5-porters <
[email protected]>
mailing list, specifically:
Andreas Koenig <
[email protected]>
Tim Bunce <
[email protected]>
Jarkko Hietaniemi <
[email protected]>
Felix Gallo <
[email protected]>
Mark A Biggar <
[email protected]>
Nick Ing-Simmons <
[email protected]>
John Macdonald <
[email protected]>
for discussing and clarifying the naming and other issues of this package!
Also many thanks to David Thompson <
[email protected]> for reporting a
problem he encountered concerning the inclusion of the Perl distribution
("Unable to find include file ...") and for suggesting a solution for this
problem. (That's the most pleasant kind of problem report, of course! ;-) )
Many thanks to Rob Johnson <
[email protected]> for an improved algorithm
for computing binomials with always integer intermediate results (and
numbers never getting too big)!
Thanks to Banchong Harangsri <
[email protected]> for reporting the
problem of the version 1.1 of this module with Perl 5.002!
Special thanks to Dean Roehrich <
[email protected]> for his assistance
in trying to find the cause of and a remedy for the above problem!
Where to find:
--------------
At the usual ftp sites for Perl (CPAN = "Comprehensive Perl Archive Network"):
.../CPAN/authors/id/STBEY/ Set-IntegerFast-2.0.tar.gz
or
.../CPAN/modules/by-category/06_Data_Type_Utilities/Set/ Set-IntegerFast-2.0.tar.gz
or
.../CPAN/modules/by-module/Set/ Set-IntegerFast-2.0.tar.gz
(See "The Perl 5 Module List" by Tim Bunce and Andreas Koenig
in news:comp.lang.perl.modules for a list of CPAN ftp servers)
Final note:
-----------
If you need any assistance or have any comments, problems, suggestions,
findings, complaints, questions, insights, compliments or donations to give ;-)
then please don't hesitate to send me a mail:
[email protected] (Steffen Beyer)
In fact I'd be glad if you could drop me an e-mail when you are using this
package, so I can see how much interest exists in it and how much time is
reasonable to spend on its further development.
Therefore, I would also be glad to know what you liked and what you disliked
about this package!
And I would also be very interested to know what your application is in
which you found this package to be useful, just to get an idea what can
all be done with it and in which direction it should be developed further.
Many thanks in advance!!
With kind regards,
--
|s |d &|m | Steffen Beyer <
[email protected]> (+49 89) 63812-244 fax -150
| | | | software design & management GmbH & Co. KG
| | | | Thomas-Dehler-Str. 27, 81737 Munich, Germany.