Changeset 2172

Show
Ignore:
Timestamp:
06/07/08 09:23:03 (6 months ago)
Author:
mbr
Message:

updated to version 6.4

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • psad/trunk/Bit-Vector/BitVector.c

    r1175 r2172  
    223223 
    224224N_int   Set_Norm             (wordptr addr);                    /* = | X |   */ 
     225N_int   Set_Norm2            (wordptr addr);                    /* = | X |   */ 
     226N_int   Set_Norm3            (wordptr addr);                    /* = | X |   */ 
    225227Z_long  Set_Min              (wordptr addr);                    /* = min(X)  */ 
    226228Z_long  Set_Max              (wordptr addr);                    /* = max(X)  */ 
     
    265267#define  ERRCODE_ZERO  "division by zero error" 
    266268#define  ERRCODE_OOPS  "unexpected internal error - please contact author" 
     269 
     270const 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}; 
    267305 
    268306/*****************************************************************************/ 
     
    573611charptr BitVector_Version(void) 
    574612{ 
    575     return((charptr)"6.3"); 
     613    return((charptr)"6.4"); 
    576614} 
    577615 
     
    780818        { 
    781819            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            } 
    783826            while ((sizeX > 0) and (sizeY > 0)) 
    784827            { 
     
    787830                sizeY--; 
    788831            } 
    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; 
    794833        } 
    795834        while (sizeX-- > 0) *X++ = fill; 
     
    34723511N_int Set_Norm(wordptr addr)                                /* = | X |       */ 
    34733512{ 
     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 
     3527N_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 
     3550N_int Set_Norm3(wordptr addr)                               /* = | X |       */ 
     3551{ 
    34743552    N_word  size  = size_(addr); 
    34753553    N_int   count = 0; 
     
    37383816 
    37393817/*****************************************************************************/ 
    3740 /*  VERSION:  6.3                                                            */ 
     3818/*  VERSION:  6.4                                                            */ 
    37413819/*****************************************************************************/ 
    37423820/*  VERSION HISTORY:                                                         */ 
    37433821/*****************************************************************************/ 
    37443822/*                                                                           */ 
     3823/*    Version 6.4  03.10.04  Added C++ comp. directives. Improved "Norm()".  */ 
    37453824/*    Version 6.3  28.09.02  Added "Create_List()" and "GCD2()".             */ 
    37463825/*    Version 6.2  15.09.02  Overhauled error handling. Fixed "GCD()".       */ 
     
    37803859/*****************************************************************************/ 
    37813860/*                                                                           */ 
    3782 /*    Copyright (c) 1995 - 2002 by Steffen Beyer.                            */ 
     3861/*    Copyright (c) 1995 - 2004 by Steffen Beyer.                            */ 
    37833862/*    All rights reserved.                                                   */ 
    37843863/*                                                                           */ 
  • psad/trunk/Bit-Vector/BitVector.h

    r1175 r2172  
    11#ifndef MODULE_BIT_VECTOR 
    22#define MODULE_BIT_VECTOR 
     3#ifdef __cplusplus 
     4extern "C" 
     5{ 
     6#endif 
    37/*****************************************************************************/ 
    48/*  MODULE NAME:  BitVector.h                           MODULE TYPE:  (adt)  */ 
     
    223227 
    224228N_int   Set_Norm             (wordptr addr);                    /* = | X |   */ 
     229N_int   Set_Norm2            (wordptr addr);                    /* = | X |   */ 
     230N_int   Set_Norm3            (wordptr addr);                    /* = | X |   */ 
    225231Z_long  Set_Min              (wordptr addr);                    /* = min(X)  */ 
    226232Z_long  Set_Max              (wordptr addr);                    /* = max(X)  */ 
     
    266272#define  ERRCODE_OOPS  "unexpected internal error - please contact author" 
    267273 
     274extern 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 
    268312/*****************************************************************************/ 
    269313/*  MODULE IMPLEMENTATION:                                                   */ 
     
    271315 
    272316/*****************************************************************************/ 
    273 /*  VERSION:  6.3                                                            */ 
     317/*  VERSION:  6.4                                                            */ 
    274318/*****************************************************************************/ 
    275319/*  VERSION HISTORY:                                                         */ 
    276320/*****************************************************************************/ 
    277321/*                                                                           */ 
     322/*    Version 6.4  03.10.04  Added C++ comp. directives. Improved "Norm()".  */ 
    278323/*    Version 6.3  28.09.02  Added "Create_List()" and "GCD2()".             */ 
    279324/*    Version 6.2  15.09.02  Overhauled error handling. Fixed "GCD()".       */ 
     
    313358/*****************************************************************************/ 
    314359/*                                                                           */ 
    315 /*    Copyright (c) 1995 - 2002 by Steffen Beyer.                            */ 
     360/*    Copyright (c) 1995 - 2004 by Steffen Beyer.                            */ 
    316361/*    All rights reserved.                                                   */ 
    317362/*                                                                           */ 
     
    338383/*                                                                           */ 
    339384/*****************************************************************************/ 
     385#ifdef __cplusplus 
     386} 
    340387#endif 
     388#endif 
  • psad/trunk/Bit-Vector/CHANGES.txt

    r1175 r2172  
    11                    ===================================== 
    2                       Package "Bit::Vector" Version 6.3 
     2                      Package "Bit::Vector" Version 6.4 
    33                    ===================================== 
    44 
    55 
    6                  Copyright (c) 1995 - 2002 by Steffen Beyer. 
     6                 Copyright (c) 1995 - 2004 by Steffen Beyer. 
    77                             All rights reserved. 
    88 
     
    1010Version history: 
    1111---------------- 
     12 
     13Version 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. 
    1221 
    1322Version 6.3   28.09.2002 
  • psad/trunk/Bit-Vector/CREDITS.txt

    r1175 r2172  
    11                    ===================================== 
    2                       Package "Bit::Vector" Version 6.3 
     2                      Package "Bit::Vector" Version 6.4 
    33                    ===================================== 
    44 
    55 
    6                  Copyright (c) 1995 - 2002 by Steffen Beyer. 
     6                 Copyright (c) 1995 - 2004 by Steffen Beyer. 
    77                             All rights reserved. 
    88 
     
    170170with C++ compilers. 
    171171 
     172Many thanks to Runip Gopisetty <Runip.Gopisetty@Procket.com> for sending 
     173a patch for adding functions for generic string import and export functions. 
     174However, I decided to realize these in Perl instead (at least for the time 
     175being); you can find them in the new module "Bit::Vector::String". This way 
     176even octal representation and enumerations are supported. 
    172177 
     178Many 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 
     181Speedup to Lookup Table", by Eyas El-Qawasmeh, Department of 
     182Computer Science and Information Systems, Jordan University of 
     183Science and Technology, cited from the Journal of Research and 
     184Practice in Information Technology, Vol. 32, No. 3/4, August/ 
     185November 2000, thus prompting my reconsideration of the 
     186implementation of the "Norm()" method in this module. 
     187 
     188See also his web pages, especially the pages about bit vectors, 
     189at: 
     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  
    11                    ===================================== 
    2                       Package "Bit::Vector" Version 6.3 
     2                      Package "Bit::Vector" Version 6.4 
    33                    ===================================== 
    44 
    55 
    6                  Copyright (c) 1995 - 2002 by Steffen Beyer. 
     6                 Copyright (c) 1995 - 2004 by Steffen Beyer. 
    77                             All rights reserved. 
    88 
     
    2323Perl version 5.000 or higher, and an ANSI C compiler. (!) 
    2424                                     ^^^^^^ 
    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.) 
     25Module "Carp::Clan" version 5.0 or higher. 
     26 
     27Note that in order to compile Perl modules which contain 
     28C (and/or XS) code (such as this one), you always HAVE 
     29to use the very same compiler your Perl itself was compiled 
     30with. 
     31 
     32Many vendors nowadays ship their operating system already 
     33comprising a precompiled version of Perl. Many times the 
     34compilers used to compile this version of Perl are not 
     35available to or not usually used by the users of these 
     36operating systems. 
     37 
     38In such cases building this module (or any other Perl 
     39module containing C and/or XS code) will not work. You 
     40will either have to get the compiler which was used to 
     41compile Perl itself (see for example the section "Compiler:" 
     42in the output of the command "perl -V"), or to build 
     43your own Perl with the compiler of your choice (which 
     44also allows you to take advantage of the various compile- 
     45time switches Perl offers). 
     46 
     47Note that Sun Solaris and Red Hat Linux frequently were 
     48reported to suffer from this kind of problem. 
    2849 
    2950Moreover, 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. 
     51Windows 95/98 since the Win 95/98 command shell doesn't 
     52support the "&&" operator. You will need the Windows NT 
     53command shell ("cmd.exe") or the "4DOS" shell to be 
     54installed on your Windows 95/98 system first. Note that 
     55Windows NT and Windows 2000 are not affected and just 
     56work fine. I don't know about Windows XP, however. 
    3357 
    3458Note that ActiveState provides precompiled binaries of 
    3559this module for their Win32 port of Perl ("ActivePerl") 
    36 on their web site at http://www.activestate.com/. 
     60on their web site, which you should be able to install 
     61simply by typing "ppm install Bit-Vector" in your MS-DOS 
     62command shell (but note the "-" instead of "::" in the 
     63package name!). This also works under Windows 95/98 (!). 
     64 
     65If your firewall prevents "ppm" from downloading 
     66this package, you can also download it manually from 
     67http://www.activestate.com/ppmpackages/5.005/zips/ or 
     68http://www.activestate.com/ppmpackages/5.6/zips/. 
     69Follow the installation instructions included in 
     70the "zip" archive. 
    3771 
    3872 
     
    4478    'VERSION_FROM'      => 'Vector.pm', 
    4579to 
    46     'VERSION'           => '6.3', 
     80    'VERSION'           => '6.4', 
    4781 
    4882Then edit the file "Vector.pm" and change the line 
     
    5488Also edit the file "t/00____version.t" and change the line 
    5589 
    56     use Bit::Vector 6.3
     90    use Bit::Vector 6.4
    5791 
    5892to 
     
    98132 
    99133 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"). 
    101135 
    102136 2) Type "perl Makefile.PL" (or whatever the name and path of your Perl 5 
     
    183217    t/28__chunklist.....ok 
    184218    t/30_overloaded.....ok 
     219    t/40__auxiliary.....ok 
    185220    All tests successful. 
    186     Files=20,  Tests=67417, 22 wallclock secs 
    187     (13.72 cusr +  0.57 csys = 14.29 CPU) 
     221    Files=21,  Tests=68151, 29 wallclock secs 
     222    (19.75 cusr +  0.73 csys = 20.48 CPU) 
    188223 
    189224    (Note that the exact number of tests will depend on the number of bits 
  • psad/trunk/Bit-Vector/MANIFEST

    r1175 r2172  
    1515Vector.xs 
    1616examples/SetObject.pl 
    17 examples/benchmark.pl 
     17examples/benchmk1.pl 
     18examples/benchmk2.pl 
     19examples/benchmk3.pl 
    1820examples/primes.pl 
    1921examples/test.c 
    2022lib/Bit/Vector/Overload.pm 
    2123lib/Bit/Vector/Overload.pod 
    22 lib/Carp/Clan.pm 
    23 lib/Carp/Clan.pod 
     24lib/Bit/Vector/String.pm 
     25lib/Bit/Vector/String.pod 
    2426t/00____version.t 
    2527t/01________new.t 
     
    4244t/28__chunklist.t 
    4345t/30_overloaded.t 
     46t/40__auxiliary.t 
    4447typemap 
  • psad/trunk/Bit-Vector/Makefile.PL

    r1175 r2172  
    33############################################################################### 
    44##                                                                           ## 
    5 ##    Copyright (c) 1995 - 2002 by Steffen Beyer.                            ## 
     5##    Copyright (c) 1995 - 2004 by Steffen Beyer.                            ## 
    66##    All rights reserved.                                                   ## 
    77##                                                                           ## 
     
    2020    'NAME'              => 'Bit::Vector', 
    2121    'VERSION_FROM'      => 'Vector.pm', 
     22    'PREREQ_PM'         => { 'Carp::Clan' => 5.3 }, 
    2223    'OBJECT'            => '$(O_FILES)', 
    2324#   ($] >= 5.005 ? 
  • psad/trunk/Bit-Vector/README.txt

    r1175 r2172  
    11                    ===================================== 
    2                       Package "Bit::Vector" Version 6.3 
     2                      Package "Bit::Vector" Version 6.4 
    33                    ===================================== 
    44 
     
    3131 
    3232 
    33 What's new in version 6.3
     33What's new in version 6.4
    3434-------------------------- 
    3535 
    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. 
    4742 
    4843 
     
    5247This package with all its parts is 
    5348 
    54 Copyright (c) 1995 - 2002 by Steffen Beyer. 
     49Copyright (c) 1995 - 2004 by Steffen Beyer. 
    5550All rights reserved. 
    5651 
     
    7267Perl version 5.000 or higher, and an ANSI C compiler. (!) 
    7368                                     ^^^^^^ 
    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.) 
     69Module "Carp::Clan" version 5.0 or higher. 
     70 
     71Note that in order to compile Perl modules which contain 
     72C (and/or XS) code (such as this one), you always HAVE 
     73to use the very same compiler your Perl itself was compiled 
     74with. 
     75 
     76Many vendors nowadays ship their operating system already 
     77comprising a precompiled version of Perl. Many times the 
     78compilers used to compile this version of Perl are not 
     79available to or not usually used by the users of these 
     80operating systems. 
     81 
     82In such cases building this module (or any other Perl 
     83module containing C and/or XS code) will not work. You 
     84will either have to get the compiler which was used to 
     85compile Perl itself (see for example the section "Compiler:" 
     86in the output of the command "perl -V"), or to build 
     87your own Perl with the compiler of your choice (which 
     88also allows you to take advantage of the various compile- 
     89time switches Perl offers). 
     90 
     91Note that Sun Solaris and Red Hat Linux frequently were 
     92reported to suffer from this kind of problem. 
    7793 
    7894Moreover, 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. 
     95Windows 95/98 since the Win 95/98 command shell doesn't 
     96support the "&&" operator. You will need the Windows NT 
     97command shell ("cmd.exe") or the "4DOS" shell to be 
     98installed on your Windows 95/98 system first. Note that 
     99Windows NT and Windows 2000 are not affected and just 
     100work fine. I don't know about Windows XP, however. 
    82101 
    83102Note that ActiveState provides precompiled binaries of 
     
    86105simply by typing "ppm install Bit-Vector" in your MS-DOS 
    87106command shell (but note the "-" instead of "::" in the 
    88 package name!). This also works under Windows 95/98
     107package name!). This also works under Windows 95/98 (!)
    89108 
    90109If your firewall prevents "ppm" from downloading 
     
    99118--------------------- 
    100119 
    101 After completion, version 6.3 of this module has already 
     120After completion, version 6.4 of this module has already 
    102121been tested successfully with the following configurations: 
    103122 
     
    109128  Perl 5.7.2     -  FreeBSD 4.1.1-RELEASE 
    110129  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) 
    116132 
    117133 
     
    152168    Bit::Vector(3) 
    153169    Bit::Vector::Overload(3) 
    154     Carp::Clan(3) 
     170    Bit::Vector::String(3) 
    155171 
    156172If Perl is not available on your system, you can also read the ".pod" 
     
    159175    ./Vector.pod 
    160176    ./lib/Bit/Vector/Overload.pod 
    161     ./lib/Carp/Clan.pod 
     177    ./lib/Bit/Vector/String.pod 
    162178 
    163179directly. 
     
    167183---------------- 
    168184 
    169 This module implements bit vectors of arbitrary size and provides efficient 
     185This package implements bit vectors of arbitrary size and provides efficient 
    170186methods for handling them. 
    171187 
     
    173189vectors (compare with the method list below!). 
    174190 
    175 Moreover, the C core of this module can be used "stand-alone" in other 
     191Moreover, the C core of this package can be used "stand-alone" in other 
    176192C applications; Perl is not necessarily required. 
    177193 
    178 The module is intended to serve as a base class for other applications 
    179 or application classes, such as implementing sets or performing big 
    180 integer arithmetic. 
     194The main module of this package is intended to serve as a base class for 
     195other applications or application classes, such as implementing sets or 
     196performing big integer arithmetic. 
    181197 
    182198All methods are implemented in C internally for maximum performance. 
     
    189205module alone! 
    190206 
    191 This module is useful for a large range of different tasks: 
     207Another module, "Bit::Vector::String", offers additional methods 
     208for generic string export and import (also Perl only). 
     209 
     210This package is useful for a large range of different tasks: 
    192211 
    193212  -  For example for implementing sets and performing set operations 
     
    198217     "Sieve of Erathostenes" (for calculating prime numbers), 
    199218 
    200      (The complexities of the methods in this module are usually either 
     219     (The complexities of the methods in this package are usually either 
    201220      O(1) or O(n/b), where "b" is the number of bits in a machine word 
    202221      on your system.) 
     
    237256enumerations. 
    238257 
    239 Note that this module is specifically designed for efficiency, which is 
     258Note that this package is specifically designed for efficiency, which is 
    240259also the reason why its methods are implemented in C. 
    241260 
    242 To further increase execution speed, the module doesn't use bytes as its 
     261To further increase execution speed, the package doesn't use bytes as its 
    243262basic storage unit, but rather uses machine words, assuming that a machine 
    244263word is the most efficiently handled size of all scalar types on all 
     
    250269 
    251270The 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 the 
     271(= execution speed) of the methods in this package, but also the greater the 
    253272average waste of unused bits in the last word. 
    254273 
  • psad/trunk/Bit-Vector/ToolBox.h

    r1175 r2172  
    22#define MODULE_TOOLBOX 
    33#ifdef __cplusplus 
    4 extern "C" { 
     4extern "C" 
     5
    56#endif 
    67/*****************************************************************************/ 
     
    116117 
    117118/*****************************************************************************/ 
    118 /*  VERSION:  5.4                                                            */ 
     119/*  VERSION:  5.5                                                            */ 
    119120/*****************************************************************************/ 
    120121/*  VERSION HISTORY:                                                         */ 
    121122/*****************************************************************************/ 
    122123/*                                                                           */ 
     124/*    Version 5.5   03.10.04  Added compiler directives for C++.             */ 
    123125/*    Version 5.4   08.09.02  Added conditional changes for MacOS/MacPerl.   */ 
    124126/*    Version 5.3   12.05.98  Completed history.                             */ 
     
    145147/*****************************************************************************/ 
    146148/*                                                                           */ 
    147 /*    Copyright (c) 1995 - 2002 by Steffen Beyer.                            */ 
     149/*    Copyright (c) 1995 - 2004 by Steffen Beyer.                            */ 
    148150/*    All rights reserved.                                                   */ 
    149151/*                                                                           */ 
  • psad/trunk/Bit-Vector/VERSION

    r1175 r2172  
    1 6.3 
     16.4 
  • psad/trunk/Bit-Vector/Vector.pm

    r1175 r2172  
    22############################################################################### 
    33##                                                                           ## 
    4 ##    Copyright (c) 1995 - 2002 by Steffen Beyer.                            ## 
     4##    Copyright (c) 1995 - 2004 by Steffen Beyer.                            ## 
    55##    All rights reserved.                                                   ## 
    66##                                                                           ## 
     
    2424@EXPORT_OK = qw(); 
    2525 
    26 $VERSION = '6.3'; 
     26$VERSION = '6.4'; 
    2727 
    2828bootstrap Bit::Vector $VERSION; 
  • psad/trunk/Bit-Vector/Vector.pod

    r1175 r2172  
    99 
    1010See L<Bit::Vector::Overload(3)>. 
     11 
     12=head2 MORE STRING IMPORT/EXPORT 
     13 
     14See L<Bit::Vector::String(3)>. 
    1115 
    1216=head2 CLASS METHODS 
     
    343347  Norm 
    344348      $norm = $set->Norm(); 
     349      $norm = $set->Norm2(); 
     350      $norm = $set->Norm3(); 
    345351 
    346352  Min 
     
    504510See L<Bit::Vector::Overload(3)>. 
    505511 
     512=head2 MORE STRING IMPORT/EXPORT 
     513 
     514See L<Bit::Vector::String(3)>. 
     515 
    506516=head2 CLASS METHODS 
    507517 
     
    590600all in one go. 
    591601 
    592 The method is more efficient than performing these two steps separately 
    593 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()>"
     602The 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 
     605However, this method is more efficient than performing these two steps 
     606separately: First because in this method, the memory area occupied by 
     607the new bit vector is not initialized to zeros (which is pointless in 
     608this case), and second because it saves you from the associated overhead 
     609of one additional method invocation
    600610 
    601611An exception will be raised if the necessary memory cannot be allocated 
     
    617627all in one go. 
    618628 
    619 The method is more efficient than performing these two steps separately 
    620 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()>"
     629The 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 
     632However, this method is more efficient than performing these two steps 
     633separately: First because in this method, the memory area occupied by 
     634the new bit vector is not initialized to zeros (which is pointless in 
     635this case), and second because it saves you from the associated overhead 
     636of one additional method invocation
    627637 
    628638An exception will be raised if the necessary memory cannot be allocated 
     
    643653all in one go. 
    644654 
    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), 
     655The 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 
     658However, this method is more efficient than performing these two steps 
     659separately: First because in this method, "C<new()>" does not initialize 
     660the memory area occupied by the new bit vector with zeros (which is 
     661pointless in this case, because "C<from_Dec()>" will do it anyway), 
    648662and second because it saves you from the associated overhead of one 
    649663additional 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()>". 
    653664 
    654665An exception will be raised if the necessary memory cannot be allocated 
     
    669680all in one go. 
    670681 
    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), 
     682The 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 
     685However, this method is more efficient than performing these two steps 
     686separately: First because in this method, "C<new()>" does not initialize 
     687the memory area occupied by the new bit vector with zeros (which is 
     688pointless in this case, because "C<from_Enum()>" will do it anyway), 
    674689and second because it saves you from the associated overhead of one 
    675690additional 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()>". 
    679691 
    680692An exception will be raised if the necessary memory cannot be allocated 
     
    29022914set. 
    29032915 
     2916Uses a byte lookup table for calculating the number of set bits 
     2917per byte, and thus needs a time for evaluation (and a number of 
     2918loops) linearly proportional to the length of the given bit vector 
     2919(in bytes). 
     2920 
     2921This should be the fastest algorithm on average. 
     2922 
     2923=item * 
     2924 
     2925C<$norm = $set-E<gt>Norm2();> 
     2926 
     2927Returns the norm (number of bits which are set) of the given vector. 
     2928 
     2929This is equivalent to the number of elements contained in the given 
     2930set. 
     2931 
     2932This does the same as the method "C<Norm()>" above, only with a 
     2933different algorithm: 
     2934 
     2935This method counts the number of set and cleared bits at the same 
     2936time and will stop when either of them has been exhausted, thus 
     2937needing at most half as many loops per machine word as the total 
     2938number of bits in a machine word - in fact it will need a number 
     2939of loops equal to the minimum of the number of set bits and the 
     2940number of cleared bits. 
     2941 
     2942This might be a faster algorithm than of the method "C<Norm()>" 
     2943above on some systems, depending on the system's architecture 
     2944and the compiler and optimisation used, for bit vectors with 
     2945sparse set bits and for bit vectors with sparse cleared bits 
     2946(i.e., predominantly set bits). 
     2947 
     2948=item * 
     2949 
     2950C<$norm = $set-E<gt>Norm3();> 
     2951 
     2952Returns the norm (number of bits which are set) of the given vector. 
     2953 
     2954This is equivalent to the number of elements contained in the given 
     2955set. 
     2956 
     2957This does the same as the two methods "C<Norm()>" and "C<Norm2()>" 
     2958above, however with a different algorithm. 
     2959 
     2960In fact this is the implementation of the method "C<Norm()>" used 
     2961in previous versions of this module. 
     2962 
     2963The method needs a number of loops per machine word equal to the 
     2964number of set bits in that machine word. 
     2965 
     2966Only for bit vectors with sparse set bits will this method be 
     2967fast; it will depend on a system's architecture and compiler 
     2968whether the method will be faster than any of the two methods 
     2969above in such cases. 
     2970 
     2971On average however, this is probably the slowest method of the 
     2972three. 
     2973 
    29042974=item * 
    29052975 
     
    30543124=head1 SEE ALSO 
    30553125 
    3056 Bit::Vector::Overload(3), Set::IntRange(3), 
    3057 Math::MatrixBool(3), Math::MatrixReal(3), 
    3058 DFA::Kleene(3), Math::Kleene(3), 
     3126Bit::Vector::Overload(3), 
     3127Bit::Vector::String(3). 
     3128 
     3129Set::IntRange(3), 
     3130Math::MatrixBool(3), 
     3131Math::MatrixReal(3), 
     3132DFA::Kleene(3), 
     3133Math::Kleene(3), 
    30593134Graph::Kruskal(3). 
    30603135 
    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