Changeset 2172
- Timestamp:
- 06/07/08 09:23:03 (6 months ago)
- Files:
-
- psad/trunk/Bit-Vector/BitVector.c (modified) (8 diffs)
- psad/trunk/Bit-Vector/BitVector.h (modified) (6 diffs)
- psad/trunk/Bit-Vector/CHANGES.txt (modified) (2 diffs)
- psad/trunk/Bit-Vector/CREDITS.txt (modified) (2 diffs)
- psad/trunk/Bit-Vector/INSTALL.txt (modified) (6 diffs)
- psad/trunk/Bit-Vector/MANIFEST (modified) (2 diffs)
- psad/trunk/Bit-Vector/Makefile.PL (modified) (2 diffs)
- psad/trunk/Bit-Vector/README.txt (modified) (15 diffs)
- psad/trunk/Bit-Vector/ToolBox.h (modified) (3 diffs)
- psad/trunk/Bit-Vector/VERSION (modified) (1 diff)
- psad/trunk/Bit-Vector/Vector.pm (modified) (2 diffs)
- psad/trunk/Bit-Vector/Vector.pod (modified) (10 diffs)
- psad/trunk/Bit-Vector/Vector.xs (modified) (2 diffs)
- psad/trunk/Bit-Vector/examples/SetObject.pl (modified) (1 diff)
- psad/trunk/Bit-Vector/examples/benchmk1.pl (added)
- psad/trunk/Bit-Vector/examples/benchmk2.pl (added)
- psad/trunk/Bit-Vector/examples/benchmk3.pl (added)
- psad/trunk/Bit-Vector/examples/primes.pl (modified) (1 diff)
- psad/trunk/Bit-Vector/examples/test.c (modified) (1 diff)
- psad/trunk/Bit-Vector/lib/Bit/Vector/Overload.pm (modified) (2 diffs)
- psad/trunk/Bit-Vector/lib/Bit/Vector/Overload.pod (modified) (2 diffs)
- psad/trunk/Bit-Vector/lib/Bit/Vector/String.pm (added)
- psad/trunk/Bit-Vector/lib/Bit/Vector/String.pod (added)
- psad/trunk/Bit-Vector/t/00____version.t (modified) (4 diffs)
- psad/trunk/Bit-Vector/t/40__auxiliary.t (added)
- psad/trunk/Bit-Vector/typemap (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
psad/trunk/Bit-Vector/BitVector.c
r1175 r2172 223 223 224 224 N_int Set_Norm (wordptr addr); /* = | X | */ 225 N_int Set_Norm2 (wordptr addr); /* = | X | */ 226 N_int Set_Norm3 (wordptr addr); /* = | X | */ 225 227 Z_long Set_Min (wordptr addr); /* = min(X) */ 226 228 Z_long Set_Max (wordptr addr); /* = max(X) */ … … 265 267 #define ERRCODE_ZERO "division by zero error" 266 268 #define ERRCODE_OOPS "unexpected internal error - please contact author" 269 270 const N_int BitVector_BYTENORM[256] = 271 { 272 0x00, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x03, 273 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, /* 0x00 */ 274 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 275 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, /* 0x10 */ 276 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 277 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, /* 0x20 */ 278 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 279 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, /* 0x30 */ 280 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 281 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, /* 0x40 */ 282 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 283 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, /* 0x50 */ 284 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 285 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, /* 0x60 */ 286 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 287 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, /* 0x70 */ 288 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 289 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, /* 0x80 */ 290 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 291 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, /* 0x90 */ 292 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 293 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, /* 0xA0 */ 294 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 295 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, /* 0xB0 */ 296 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 297 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, /* 0xC0 */ 298 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 299 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, /* 0xD0 */ 300 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 301 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, /* 0xE0 */ 302 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, 303 0x05, 0x06, 0x06, 0x07, 0x06, 0x07, 0x07, 0x08 /* 0xF0 */ 304 }; 267 305 268 306 /*****************************************************************************/ … … 573 611 charptr BitVector_Version(void) 574 612 { 575 return((charptr)"6. 3");613 return((charptr)"6.4"); 576 614 } 577 615 … … 780 818 { 781 819 lastY = Y + sizeY - 1; 782 *lastY &= maskY; 820 if ( (*lastY AND (maskY AND NOT (maskY >> 1))) == 0 ) *lastY &= maskY; 821 else 822 { 823 fill = (N_word) ~0L; 824 *lastY |= NOT maskY; 825 } 783 826 while ((sizeX > 0) and (sizeY > 0)) 784 827 { … … 787 830 sizeY--; 788 831 } 789 if ( (*lastY AND (maskY AND NOT (maskY >> 1))) != 0 ) 790 { 791 fill = (N_word) ~0L; 792 *(X-1) |= NOT maskY; 793 } 832 *lastY &= maskY; 794 833 } 795 834 while (sizeX-- > 0) *X++ = fill; … … 3472 3511 N_int Set_Norm(wordptr addr) /* = | X | */ 3473 3512 { 3513 byteptr byte; 3514 N_word bytes; 3515 N_int n; 3516 3517 byte = (byteptr) addr; 3518 bytes = size_(addr) << FACTOR; 3519 n = 0; 3520 while (bytes-- > 0) 3521 { 3522 n += BitVector_BYTENORM[*byte++]; 3523 } 3524 return(n); 3525 } 3526 3527 N_int Set_Norm2(wordptr addr) /* = | X | */ 3528 { 3529 N_word size = size_(addr); 3530 N_word w0,w1; 3531 N_int n,k; 3532 3533 n = 0; 3534 while (size-- > 0) 3535 { 3536 k = 0; 3537 w1 = NOT (w0 = *addr++); 3538 while (w0 and w1) 3539 { 3540 w0 &= w0 - 1; 3541 w1 &= w1 - 1; 3542 k++; 3543 } 3544 if (w0 == 0) n += k; 3545 else n += BITS - k; 3546 } 3547 return(n); 3548 } 3549 3550 N_int Set_Norm3(wordptr addr) /* = | X | */ 3551 { 3474 3552 N_word size = size_(addr); 3475 3553 N_int count = 0; … … 3738 3816 3739 3817 /*****************************************************************************/ 3740 /* VERSION: 6. 3*/3818 /* VERSION: 6.4 */ 3741 3819 /*****************************************************************************/ 3742 3820 /* VERSION HISTORY: */ 3743 3821 /*****************************************************************************/ 3744 3822 /* */ 3823 /* Version 6.4 03.10.04 Added C++ comp. directives. Improved "Norm()". */ 3745 3824 /* Version 6.3 28.09.02 Added "Create_List()" and "GCD2()". */ 3746 3825 /* Version 6.2 15.09.02 Overhauled error handling. Fixed "GCD()". */ … … 3780 3859 /*****************************************************************************/ 3781 3860 /* */ 3782 /* Copyright (c) 1995 - 200 2by Steffen Beyer. */3861 /* Copyright (c) 1995 - 2004 by Steffen Beyer. */ 3783 3862 /* All rights reserved. */ 3784 3863 /* */ psad/trunk/Bit-Vector/BitVector.h
r1175 r2172 1 1 #ifndef MODULE_BIT_VECTOR 2 2 #define MODULE_BIT_VECTOR 3 #ifdef __cplusplus 4 extern "C" 5 { 6 #endif 3 7 /*****************************************************************************/ 4 8 /* MODULE NAME: BitVector.h MODULE TYPE: (adt) */ … … 223 227 224 228 N_int Set_Norm (wordptr addr); /* = | X | */ 229 N_int Set_Norm2 (wordptr addr); /* = | X | */ 230 N_int Set_Norm3 (wordptr addr); /* = | X | */ 225 231 Z_long Set_Min (wordptr addr); /* = min(X) */ 226 232 Z_long Set_Max (wordptr addr); /* = max(X) */ … … 266 272 #define ERRCODE_OOPS "unexpected internal error - please contact author" 267 273 274 extern const N_int BitVector_BYTENORM[256]; 275 /* 276 { 277 0x00, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x03, 278 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 279 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 280 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 281 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 282 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 283 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 284 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 285 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 286 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 287 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 288 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 289 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 290 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 291 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 292 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, 293 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 294 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 295 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 296 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 297 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 298 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 299 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 300 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, 301 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 302 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 303 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 304 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, 305 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 306 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, 307 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, 308 0x05, 0x06, 0x06, 0x07, 0x06, 0x07, 0x07, 0x08 309 }; 310 */ 311 268 312 /*****************************************************************************/ 269 313 /* MODULE IMPLEMENTATION: */ … … 271 315 272 316 /*****************************************************************************/ 273 /* VERSION: 6. 3*/317 /* VERSION: 6.4 */ 274 318 /*****************************************************************************/ 275 319 /* VERSION HISTORY: */ 276 320 /*****************************************************************************/ 277 321 /* */ 322 /* Version 6.4 03.10.04 Added C++ comp. directives. Improved "Norm()". */ 278 323 /* Version 6.3 28.09.02 Added "Create_List()" and "GCD2()". */ 279 324 /* Version 6.2 15.09.02 Overhauled error handling. Fixed "GCD()". */ … … 313 358 /*****************************************************************************/ 314 359 /* */ 315 /* Copyright (c) 1995 - 200 2by Steffen Beyer. */360 /* Copyright (c) 1995 - 2004 by Steffen Beyer. */ 316 361 /* All rights reserved. */ 317 362 /* */ … … 338 383 /* */ 339 384 /*****************************************************************************/ 385 #ifdef __cplusplus 386 } 340 387 #endif 388 #endif psad/trunk/Bit-Vector/CHANGES.txt
r1175 r2172 1 1 ===================================== 2 Package "Bit::Vector" Version 6. 32 Package "Bit::Vector" Version 6.4 3 3 ===================================== 4 4 5 5 6 Copyright (c) 1995 - 200 2by Steffen Beyer.6 Copyright (c) 1995 - 2004 by Steffen Beyer. 7 7 All rights reserved. 8 8 … … 10 10 Version history: 11 11 ---------------- 12 13 Version 6.4 03.10.2004 14 15 + Added compiler directives for C++. 16 + Improved the method "Norm()". 17 + Removed "Carp::Clan" from the distribution (available separately). 18 + Added "Bit::Vector::String" for generic string import/export functions. 19 + Added a new test file "t/40__auxiliary.t" for "Bit::Vector::String". 20 + Fixed a bug in method "Copy()" concerning sign (MSB) extension. 12 21 13 22 Version 6.3 28.09.2002 psad/trunk/Bit-Vector/CREDITS.txt
r1175 r2172 1 1 ===================================== 2 Package "Bit::Vector" Version 6. 32 Package "Bit::Vector" Version 6.4 3 3 ===================================== 4 4 5 5 6 Copyright (c) 1995 - 200 2by Steffen Beyer.6 Copyright (c) 1995 - 2004 by Steffen Beyer. 7 7 All rights reserved. 8 8 … … 170 170 with C++ compilers. 171 171 172 Many thanks to Runip Gopisetty <Runip.Gopisetty@Procket.com> for sending 173 a patch for adding functions for generic string import and export functions. 174 However, I decided to realize these in Perl instead (at least for the time 175 being); you can find them in the new module "Bit::Vector::String". This way 176 even octal representation and enumerations are supported. 172 177 178 Many heartfelt thanks go to Jamie Blustein <jamie@cs.dal.ca> / 179 <jamie@csd.uwo.ca> / <jamie@ACM.org> for sending me the article 180 "Performance Investigation of Bit-Counting Algorithms with a 181 Speedup to Lookup Table", by Eyas El-Qawasmeh, Department of 182 Computer Science and Information Systems, Jordan University of 183 Science and Technology, cited from the Journal of Research and 184 Practice in Information Technology, Vol. 32, No. 3/4, August/ 185 November 2000, thus prompting my reconsideration of the 186 implementation of the "Norm()" method in this module. 187 188 See also his web pages, especially the pages about bit vectors, 189 at: 190 http://www.cs.dal.ca/~jamie/ 191 http://www.csd.uwo.ca/~jamie/ 192 http://www.csd.uwo.ca/%7ejamie/.Refs/code.html 193 http://www.csd.uwo.ca/%7ejamie/publications.html#BitVectors 194 http://www.csd.uwo.ca/~jamie/BitVectors/ 195 196 psad/trunk/Bit-Vector/INSTALL.txt
r1175 r2172 1 1 ===================================== 2 Package "Bit::Vector" Version 6. 32 Package "Bit::Vector" Version 6.4 3 3 ===================================== 4 4 5 5 6 Copyright (c) 1995 - 200 2by Steffen Beyer.6 Copyright (c) 1995 - 2004 by Steffen Beyer. 7 7 All rights reserved. 8 8 … … 23 23 Perl version 5.000 or higher, and an ANSI C compiler. (!) 24 24 ^^^^^^ 25 If you compile under Windows, note that you will need 26 exactly the same compiler your Perl itself was compiled 27 with! (This is also true for Unix, but rarely a problem.) 25 Module "Carp::Clan" version 5.0 or higher. 26 27 Note that in order to compile Perl modules which contain 28 C (and/or XS) code (such as this one), you always HAVE 29 to use the very same compiler your Perl itself was compiled 30 with. 31 32 Many vendors nowadays ship their operating system already 33 comprising a precompiled version of Perl. Many times the 34 compilers used to compile this version of Perl are not 35 available to or not usually used by the users of these 36 operating systems. 37 38 In such cases building this module (or any other Perl 39 module containing C and/or XS code) will not work. You 40 will either have to get the compiler which was used to 41 compile Perl itself (see for example the section "Compiler:" 42 in the output of the command "perl -V"), or to build 43 your own Perl with the compiler of your choice (which 44 also allows you to take advantage of the various compile- 45 time switches Perl offers). 46 47 Note that Sun Solaris and Red Hat Linux frequently were 48 reported to suffer from this kind of problem. 28 49 29 50 Moreover, you usually cannot build any modules under 30 Windows 95/98, the Win 95/98 command shell doesn't 31 grok the "&&" operator. You will need the Windows NT 32 command shell ("cmd.exe") or the "4DOS" shell. 51 Windows 95/98 since the Win 95/98 command shell doesn't 52 support the "&&" operator. You will need the Windows NT 53 command shell ("cmd.exe") or the "4DOS" shell to be 54 installed on your Windows 95/98 system first. Note that 55 Windows NT and Windows 2000 are not affected and just 56 work fine. I don't know about Windows XP, however. 33 57 34 58 Note that ActiveState provides precompiled binaries of 35 59 this module for their Win32 port of Perl ("ActivePerl") 36 on their web site at http://www.activestate.com/. 60 on their web site, which you should be able to install 61 simply by typing "ppm install Bit-Vector" in your MS-DOS 62 command shell (but note the "-" instead of "::" in the 63 package name!). This also works under Windows 95/98 (!). 64 65 If your firewall prevents "ppm" from downloading 66 this package, you can also download it manually from 67 http://www.activestate.com/ppmpackages/5.005/zips/ or 68 http://www.activestate.com/ppmpackages/5.6/zips/. 69 Follow the installation instructions included in 70 the "zip" archive. 37 71 38 72 … … 44 78 'VERSION_FROM' => 'Vector.pm', 45 79 to 46 'VERSION' => '6. 3',80 'VERSION' => '6.4', 47 81 48 82 Then edit the file "Vector.pm" and change the line … … 54 88 Also edit the file "t/00____version.t" and change the line 55 89 56 use Bit::Vector 6. 3;90 use Bit::Vector 6.4; 57 91 58 92 to … … 98 132 99 133 1) Change directory to the directory that has been created by unpacking this 100 package ("cd Bit-Vector-6. 3").134 package ("cd Bit-Vector-6.4"). 101 135 102 136 2) Type "perl Makefile.PL" (or whatever the name and path of your Perl 5 … … 183 217 t/28__chunklist.....ok 184 218 t/30_overloaded.....ok 219 t/40__auxiliary.....ok 185 220 All tests successful. 186 Files=2 0, Tests=67417, 22wallclock secs187 (1 3.72 cusr + 0.57 csys = 14.29CPU)221 Files=21, Tests=68151, 29 wallclock secs 222 (19.75 cusr + 0.73 csys = 20.48 CPU) 188 223 189 224 (Note that the exact number of tests will depend on the number of bits psad/trunk/Bit-Vector/MANIFEST
r1175 r2172 15 15 Vector.xs 16 16 examples/SetObject.pl 17 examples/benchmark.pl 17 examples/benchmk1.pl 18 examples/benchmk2.pl 19 examples/benchmk3.pl 18 20 examples/primes.pl 19 21 examples/test.c 20 22 lib/Bit/Vector/Overload.pm 21 23 lib/Bit/Vector/Overload.pod 22 lib/ Carp/Clan.pm23 lib/ Carp/Clan.pod24 lib/Bit/Vector/String.pm 25 lib/Bit/Vector/String.pod 24 26 t/00____version.t 25 27 t/01________new.t … … 42 44 t/28__chunklist.t 43 45 t/30_overloaded.t 46 t/40__auxiliary.t 44 47 typemap psad/trunk/Bit-Vector/Makefile.PL
r1175 r2172 3 3 ############################################################################### 4 4 ## ## 5 ## Copyright (c) 1995 - 200 2by Steffen Beyer. ##5 ## Copyright (c) 1995 - 2004 by Steffen Beyer. ## 6 6 ## All rights reserved. ## 7 7 ## ## … … 20 20 'NAME' => 'Bit::Vector', 21 21 'VERSION_FROM' => 'Vector.pm', 22 'PREREQ_PM' => { 'Carp::Clan' => 5.3 }, 22 23 'OBJECT' => '$(O_FILES)', 23 24 # ($] >= 5.005 ? psad/trunk/Bit-Vector/README.txt
r1175 r2172 1 1 ===================================== 2 Package "Bit::Vector" Version 6. 32 Package "Bit::Vector" Version 6.4 3 3 ===================================== 4 4 … … 31 31 32 32 33 What's new in version 6. 3:33 What's new in version 6.4: 34 34 -------------------------- 35 35 36 + Added "Create_List()" and "GCD2()" in "BitVector.c". 37 + "new()" now can optionally return a list of bit vectors. 38 + "GCD()" now can optionally return the two integer factors 39 "x" and "y" for the linear combination of its input values 40 "a" and "b" so that gcd(a,b) = x * a + y * b. 41 + Changed the test files "t/01________new.t" and "t/09_parameters.t" 42 as well as the documentation accordingly. 43 + Added a new test file "t/17________gcd.t". 44 + Further simplified the error handlers in "Vector.xs", making the 45 resulting object library file substantially smaller (about 20%!) 46 and thus faster to load. 36 + Added compiler directives for C++. 37 + Improved the method "Norm()". 38 + Removed "Carp::Clan" from the distribution (available separately). 39 + Added "Bit::Vector::String" for generic string import/export functions. 40 + Added a new test file "t/40__auxiliary.t" for "Bit::Vector::String". 41 + Fixed a bug in method "Copy()" concerning sign (MSB) extension. 47 42 48 43 … … 52 47 This package with all its parts is 53 48 54 Copyright (c) 1995 - 200 2by Steffen Beyer.49 Copyright (c) 1995 - 2004 by Steffen Beyer. 55 50 All rights reserved. 56 51 … … 72 67 Perl version 5.000 or higher, and an ANSI C compiler. (!) 73 68 ^^^^^^ 74 If you compile under Windows, note that you will need 75 exactly the same compiler your Perl itself was compiled 76 with! (This is also true for Unix, but rarely a problem.) 69 Module "Carp::Clan" version 5.0 or higher. 70 71 Note that in order to compile Perl modules which contain 72 C (and/or XS) code (such as this one), you always HAVE 73 to use the very same compiler your Perl itself was compiled 74 with. 75 76 Many vendors nowadays ship their operating system already 77 comprising a precompiled version of Perl. Many times the 78 compilers used to compile this version of Perl are not 79 available to or not usually used by the users of these 80 operating systems. 81 82 In such cases building this module (or any other Perl 83 module containing C and/or XS code) will not work. You 84 will either have to get the compiler which was used to 85 compile Perl itself (see for example the section "Compiler:" 86 in the output of the command "perl -V"), or to build 87 your own Perl with the compiler of your choice (which 88 also allows you to take advantage of the various compile- 89 time switches Perl offers). 90 91 Note that Sun Solaris and Red Hat Linux frequently were 92 reported to suffer from this kind of problem. 77 93 78 94 Moreover, you usually cannot build any modules under 79 Windows 95/98, the Win 95/98 command shell doesn't 80 grok the "&&" operator. You will need the Windows NT 81 command shell ("cmd.exe") or the "4DOS" shell. 95 Windows 95/98 since the Win 95/98 command shell doesn't 96 support the "&&" operator. You will need the Windows NT 97 command shell ("cmd.exe") or the "4DOS" shell to be 98 installed on your Windows 95/98 system first. Note that 99 Windows NT and Windows 2000 are not affected and just 100 work fine. I don't know about Windows XP, however. 82 101 83 102 Note that ActiveState provides precompiled binaries of … … 86 105 simply by typing "ppm install Bit-Vector" in your MS-DOS 87 106 command shell (but note the "-" instead of "::" in the 88 package name!). This also works under Windows 95/98 .107 package name!). This also works under Windows 95/98 (!). 89 108 90 109 If your firewall prevents "ppm" from downloading … … 99 118 --------------------- 100 119 101 After completion, version 6. 3of this module has already120 After completion, version 6.4 of this module has already 102 121 been tested successfully with the following configurations: 103 122 … … 109 128 Perl 5.7.2 - FreeBSD 4.1.1-RELEASE 110 129 Perl 5.8.0 - FreeBSD 4.1.1-RELEASE 111 Perl 5.005_03 - FreeBSD 4.6-STABLE 112 Perl 5.6.1 - FreeBSD 4.6-STABLE 113 Perl 5.005_03 - Windows NT 4.0 & MS VC++ 6.0 (native Perl build) 114 Perl 5.8.0 - Windows NT 4.0 & MS VC++ 6.0 (native Perl build) 115 Perl 5.6.1 - Windows NT 4.0 & ActivePerl 5.6.1.633 (multi-thread) 130 Perl 5.8.4 - FreeBSD 4.10-BETA 131 Perl 5.8.0 - Windows 2000 & MS VC++ 6.0 (native Perl build) 116 132 117 133 … … 152 168 Bit::Vector(3) 153 169 Bit::Vector::Overload(3) 154 Carp::Clan(3)170 Bit::Vector::String(3) 155 171 156 172 If Perl is not available on your system, you can also read the ".pod" … … 159 175 ./Vector.pod 160 176 ./lib/Bit/Vector/Overload.pod 161 ./lib/ Carp/Clan.pod177 ./lib/Bit/Vector/String.pod 162 178 163 179 directly. … … 167 183 ---------------- 168 184 169 This module implements bit vectors of arbitrary size and provides efficient185 This package implements bit vectors of arbitrary size and provides efficient 170 186 methods for handling them. 171 187 … … 173 189 vectors (compare with the method list below!). 174 190 175 Moreover, the C core of this module can be used "stand-alone" in other191 Moreover, the C core of this package can be used "stand-alone" in other 176 192 C applications; Perl is not necessarily required. 177 193 178 The m odule is intended to serve as a base class for other applications179 o r application classes, such as implementing sets or performing big180 integer arithmetic.194 The main module of this package is intended to serve as a base class for 195 other applications or application classes, such as implementing sets or 196 performing big integer arithmetic. 181 197 182 198 All methods are implemented in C internally for maximum performance. … … 189 205 module alone! 190 206 191 This module is useful for a large range of different tasks: 207 Another module, "Bit::Vector::String", offers additional methods 208 for generic string export and import (also Perl only). 209 210 This package is useful for a large range of different tasks: 192 211 193 212 - For example for implementing sets and performing set operations … … 198 217 "Sieve of Erathostenes" (for calculating prime numbers), 199 218 200 (The complexities of the methods in this module are usually either219 (The complexities of the methods in this package are usually either 201 220 O(1) or O(n/b), where "b" is the number of bits in a machine word 202 221 on your system.) … … 237 256 enumerations. 238 257 239 Note that this module is specifically designed for efficiency, which is258 Note that this package is specifically designed for efficiency, which is 240 259 also the reason why its methods are implemented in C. 241 260 242 To further increase execution speed, the module doesn't use bytes as its261 To further increase execution speed, the package doesn't use bytes as its 243 262 basic storage unit, but rather uses machine words, assuming that a machine 244 263 word is the most efficiently handled size of all scalar types on all … … 250 269 251 270 The greater the size of this basic storage unit, the better the complexity 252 (= execution speed) of the methods in this module, but also the greater the271 (= execution speed) of the methods in this package, but also the greater the 253 272 average waste of unused bits in the last word. 254 273 psad/trunk/Bit-Vector/ToolBox.h
r1175 r2172 2 2 #define MODULE_TOOLBOX 3 3 #ifdef __cplusplus 4 extern "C" { 4 extern "C" 5 { 5 6 #endif 6 7 /*****************************************************************************/ … … 116 117 117 118 /*****************************************************************************/ 118 /* VERSION: 5. 4*/119 /* VERSION: 5.5 */ 119 120 /*****************************************************************************/ 120 121 /* VERSION HISTORY: */ 121 122 /*****************************************************************************/ 122 123 /* */ 124 /* Version 5.5 03.10.04 Added compiler directives for C++. */ 123 125 /* Version 5.4 08.09.02 Added conditional changes for MacOS/MacPerl. */ 124 126 /* Version 5.3 12.05.98 Completed history. */ … … 145 147 /*****************************************************************************/ 146 148 /* */ 147 /* Copyright (c) 1995 - 200 2by Steffen Beyer. */149 /* Copyright (c) 1995 - 2004 by Steffen Beyer. */ 148 150 /* All rights reserved. */ 149 151 /* */ psad/trunk/Bit-Vector/VERSION
r1175 r2172 1 6. 31 6.4 psad/trunk/Bit-Vector/Vector.pm
r1175 r2172 2 2 ############################################################################### 3 3 ## ## 4 ## Copyright (c) 1995 - 200 2by Steffen Beyer. ##4 ## Copyright (c) 1995 - 2004 by Steffen Beyer. ## 5 5 ## All rights reserved. ## 6 6 ## ## … … 24 24 @EXPORT_OK = qw(); 25 25 26 $VERSION = '6. 3';26 $VERSION = '6.4'; 27 27 28 28 bootstrap Bit::Vector $VERSION; psad/trunk/Bit-Vector/Vector.pod
r1175 r2172 9 9 10 10 See L<Bit::Vector::Overload(3)>. 11 12 =head2 MORE STRING IMPORT/EXPORT 13 14 See L<Bit::Vector::String(3)>. 11 15 12 16 =head2 CLASS METHODS … … 343 347 Norm 344 348 $norm = $set->Norm(); 349 $norm = $set->Norm2(); 350 $norm = $set->Norm3(); 345 351 346 352 Min … … 504 510 See L<Bit::Vector::Overload(3)>. 505 511 512 =head2 MORE STRING IMPORT/EXPORT 513 514 See L<Bit::Vector::String(3)>. 515 506 516 =head2 CLASS METHODS 507 517 … … 590 600 all in one go. 591 601 592 The method i s more efficient than performing these two steps separately593 first because in this method, the memory area occupied by the new bit 594 vector is not initialized to zeros (which is pointless in this case), 595 and second because it saves you from the associated overhead of one 596 additional method invocation. 597 598 The method first calls the bit vector constructor method "C<new()>" 599 internally, and then passes the given string to the method "C<from_Hex()>".602 The method internally first calls the bit vector constructor method 603 "C<new()>" and then passes the given string to the method "C<from_Hex()>". 604 605 However, this method is more efficient than performing these two steps 606 separately: First because in this method, the memory area occupied by 607 the new bit vector is not initialized to zeros (which is pointless in 608 this case), and second because it saves you from the associated overhead 609 of one additional method invocation. 600 610 601 611 An exception will be raised if the necessary memory cannot be allocated … … 617 627 all in one go. 618 628 619 The method i s more efficient than performing these two steps separately620 first because in this method, the memory area occupied by the new bit 621 vector is not initialized to zeros (which is pointless in this case), 622 and second because it saves you from the associated overhead of one 623 additional method invocation. 624 625 The method first calls the bit vector constructor method "C<new()>" 626 internally, and then passes the given string to the method "C<from_Bin()>".629 The method internally first calls the bit vector constructor method 630 "C<new()>" and then passes the given string to the method "C<from_Bin()>". 631 632 However, this method is more efficient than performing these two steps 633 separately: First because in this method, the memory area occupied by 634 the new bit vector is not initialized to zeros (which is pointless in 635 this case), and second because it saves you from the associated overhead 636 of one additional method invocation. 627 637 628 638 An exception will be raised if the necessary memory cannot be allocated … … 643 653 all in one go. 644 654 645 The method is more efficient than performing these two steps separately 646 first because in this method, the memory area occupied by the new bit 647 vector is not initialized to zeros (which is pointless in this case), 655 The method internally first calls the bit vector constructor method 656 "C<new()>" and then passes the given string to the method "C<from_Dec()>". 657 658 However, this method is more efficient than performing these two steps 659 separately: First because in this method, "C<new()>" does not initialize 660 the memory area occupied by the new bit vector with zeros (which is 661 pointless in this case, because "C<from_Dec()>" will do it anyway), 648 662 and second because it saves you from the associated overhead of one 649 663 additional method invocation. 650 651 The method first calls the bit vector constructor method "C<new()>"652 internally, and then passes the given string to the method "C<from_Dec()>".653 664 654 665 An exception will be raised if the necessary memory cannot be allocated … … 669 680 all in one go. 670 681 671 The method is more efficient than performing these two steps separately 672 first because in this method, the memory area occupied by the new bit 673 vector is not initialized to zeros (which is pointless in this case), 682 The method internally first calls the bit vector constructor method 683 "C<new()>" and then passes the given string to the method "C<from_Enum()>". 684 685 However, this method is more efficient than performing these two steps 686 separately: First because in this method, "C<new()>" does not initialize 687 the memory area occupied by the new bit vector with zeros (which is 688 pointless in this case, because "C<from_Enum()>" will do it anyway), 674 689 and second because it saves you from the associated overhead of one 675 690 additional method invocation. 676 677 The method first calls the bit vector constructor method "C<new()>"678 internally, and then passes the given string to the method "C<from_Enum()>".679 691 680 692 An exception will be raised if the necessary memory cannot be allocated … … 2902 2914 set. 2903 2915 2916 Uses a byte lookup table for calculating the number of set bits 2917 per byte, and thus needs a time for evaluation (and a number of 2918 loops) linearly proportional to the length of the given bit vector 2919 (in bytes). 2920 2921 This should be the fastest algorithm on average. 2922 2923 =item * 2924 2925 C<$norm = $set-E<gt>Norm2();> 2926 2927 Returns the norm (number of bits which are set) of the given vector. 2928 2929 This is equivalent to the number of elements contained in the given 2930 set. 2931 2932 This does the same as the method "C<Norm()>" above, only with a 2933 different algorithm: 2934 2935 This method counts the number of set and cleared bits at the same 2936 time and will stop when either of them has been exhausted, thus 2937 needing at most half as many loops per machine word as the total 2938 number of bits in a machine word - in fact it will need a number 2939 of loops equal to the minimum of the number of set bits and the 2940 number of cleared bits. 2941 2942 This might be a faster algorithm than of the method "C<Norm()>" 2943 above on some systems, depending on the system's architecture 2944 and the compiler and optimisation used, for bit vectors with 2945 sparse set bits and for bit vectors with sparse cleared bits 2946 (i.e., predominantly set bits). 2947 2948 =item * 2949 2950 C<$norm = $set-E<gt>Norm3();> 2951 2952 Returns the norm (number of bits which are set) of the given vector. 2953 2954 This is equivalent to the number of elements contained in the given 2955 set. 2956 2957 This does the same as the two methods "C<Norm()>" and "C<Norm2()>" 2958 above, however with a different algorithm. 2959 2960 In fact this is the implementation of the method "C<Norm()>" used 2961 in previous versions of this module. 2962 2963 The method needs a number of loops per machine word equal to the 2964 number of set bits in that machine word. 2965 2966 Only for bit vectors with sparse set bits will this method be 2967 fast; it will depend on a system's architecture and compiler 2968 whether the method will be faster than any of the two methods 2969 above in such cases. 2970 2971 On average however, this is probably the slowest method of the 2972 three. 2973 2904 2974 =item * 2905 2975 … … 3054 3124 =head1 SEE ALSO 3055 3125 3056 Bit::Vector::Overload(3), Set::IntRange(3), 3057 Math::MatrixBool(3), Math::MatrixReal(3), 3058 DFA::Kleene(3), Math::Kleene(3), 3126 Bit::Vector::Overload(3), 3127 Bit::Vector::String(3). 3128 3129 Set::IntRange(3), 3130 Math::MatrixBool(3), 3131 Math::MatrixReal(3), 3132 DFA::Kleene(3), 3133 Math::Kleene(3), 3059 3134 Graph::Kruskal(3). 3060 3135 3061 perl(1), perlsub(1), perlmod(1), perlref(1),3062 perlobj(1), perlbot(1), perltoot(1), perlxs(1),3063 perlxstut(1), perlguts(1), overload(3).3064 3065
