Ralf S. Engelschall > slice > Bit::Vector

Download:
slice-1.2.8.tar.gz

Dependencies

Annotate this POD

Related Modules

Math::BigInt
Date::Calc
Data::Dumper
Test::More
Math::BigFloat
Inline::C
Date::Manip
Rose::DB
Math::BigInt::GMP
XML::Parser
more...
By perlmonks.org

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 5.0   Source  

NAME ^

Bit::Vector - arbitrary length bit vectors base class

This module implements efficient methods for handling bit vectors.

It is intended to serve as a base class for other applications or application classes, such as implementing sets or performing big integer arithmetic, for example.

All methods are internally implemented in C for maximum performance.

The module also provides overloaded arithmetic and relational operators for maximum ease of use.

SYNOPSIS ^

CLASS METHODS (implemented in C)

  Version
      $version = Bit::Vector->Version();

  Word_Bits
      $bits = Bit::Vector->Word_Bits();  #  bits in a machine word

  Long_Bits
      $bits = Bit::Vector->Long_Bits();  #  bits in an unsigned long

  new
      $vector = Bit::Vector->new($bits);

OBJECT METHODS (implemented in C)

  new
      $vec2 = $vec1->new($bits);

  Shadow
      $vec2 = $vec1->Shadow();  #  new vector, same size but empty

  Clone
      $vec2 = $vec1->Clone();  #  new vector, exact copy

  Size
      $bits = $vector->Size();

  Resize
      $vector->Resize($bits);
      $vector->Resize($vector->Size()+5);
      $vector->Resize($vector->Size()-5);

  Copy
      $vec2->Copy($vec1);

  Empty
      $vector->Empty();

  Fill
      $vector->Fill();

  Flip
      $vector->Flip();

  Primes
      $vector->Primes();  #  Sieve of Erathostenes

  Interval_Empty
      $vector->Interval_Empty($min,$max);

  Interval_Fill
      $vector->Interval_Fill($min,$max);

  Interval_Flip
      $vector->Interval_Flip($min,$max);

  Interval_Scan_inc
      if (($min,$max) = $vector->Interval_Scan_inc($start))

  Interval_Scan_dec
      if (($min,$max) = $vector->Interval_Scan_dec($start))

  Interval_Copy
      $vec2->Interval_Copy($vec1,$offset2,$offset1,$length);

  Interval_Substitute
      $vec2->Interval_Substitute($vec1,$off2,$len2,$off1,$len1);

  is_empty
      if ($vector->is_empty())

  is_full
      if ($vector->is_full())

  equal
      if ($vec1->equal($vec2))

  Compare
      if ($vec1->Compare($vec2) == 0)  #  true if $vec1 == $vec2
      if ($vec1->Compare($vec2) != 0)  #  true if $vec1 != $vec2
      if ($vec1->Compare($vec2) <  0)  #  true if $vec1 <  $vec2
      if ($vec1->Compare($vec2) <= 0)  #  true if $vec1 <= $vec2
      if ($vec1->Compare($vec2) >  0)  #  true if $vec1 >  $vec2
      if ($vec1->Compare($vec2) >= 0)  #  true if $vec1 >= $vec2

  to_Hex
      $string = $vector->to_Hex();

  from_hex
      $ok = $vector->from_hex($string);

  to_Bin
      $string = $vector->to_Bin();

  from_bin
      $ok = $vector->from_bin($string);

  to_Dec
      $string = $vector->to_Dec();

  from_dec
      $ok = $vector->from_dec($string);

  to_Enum
      $string = $vector->to_Enum();  #  e.g. "2,3,5-7,11,13-19"

  from_enum
      $ok = $vector->from_enum($string);

  Bit_Off
      $vector->Bit_Off($index);

  Bit_On
      $vector->Bit_On($index);

  bit_flip
      $bit = $vector->bit_flip($index);

  bit_test, contains
      $bit = $vector->bit_test($index);
      $bit = $vector->contains($index);
      if ($vector->bit_test($index))
      if ($vector->contains($index))

  Bit_Copy
      $vector->Bit_Copy($index,$bit);

  lsb
      $bit = $vector->lsb();

  msb
      $bit = $vector->msb();

  rotate_left
      $carry = $vector->rotate_left();

  rotate_right
      $carry = $vector->rotate_right();

  shift_left
      $carry = $vector->shift_left($carry);

  shift_right
      $carry = $vector->shift_right($carry);

  Move_Left
      $vector->Move_Left($bits);  #  shift left "$bits" positions

  Move_Right
      $vector->Move_Right($bits);  #  shift right "$bits" positions

  Insert
      $vector->Insert($offset,$bits);

  Delete
      $vector->Delete($offset,$bits);

  increment
      $carry = $vector->increment();

  decrement
      $carry = $vector->decrement();

  add
      $carry = $vec3->add($vec1,$vec2,$carry);

  subtract
      $carry = $vec3->subtract($vec1,$vec2,$carry);

  Negate
      $vec2->Negate($vec1);

  Absolute
      $vec2->Absolute($vec1);

  Sign
      if ($vector->Sign() == 0)
      if ($vector->Sign() != 0)
      if ($vector->Sign() <  0)
      if ($vector->Sign() <= 0)
      if ($vector->Sign() >  0)
      if ($vector->Sign() >= 0)

  Multiply
      $vec3->Multiply($vec1,$vec2);

  Divide
      $quot->Divide($vec1,$vec2,$rest);

  GCD (Greatest Common Divisor)
      $vec3->GCD($vec1,$vec2);

  Block_Store
      $vector->Block_Store($buffer);

  Block_Read
      $buffer = $vector->Block_Read();

  Word_Size
      $size = $vector->Word_Size();  #  number of words in "$vector"

  Word_Store
      $vector->Word_Store($offset,$word);

  Word_Read
      $word = $vector->Word_Read($offset);

  Word_List_Store
      $vector->Word_List_Store(@words);

  Word_List_Read
      @words = $vector->Word_List_Read();

  Word_Insert
      $vector->Word_Insert($offset,$count);

  Word_Delete
      $vector->Word_Delete($offset,$count);

  Chunk_Store
      $vector->Chunk_Store($chunksize,$offset,$chunk);

  Chunk_Read
      $chunk = $vector->Chunk_Read($chunksize,$offset);

  Chunk_List_Store
      $vector->Chunk_List_Store($chunksize,@chunks);

  Chunk_List_Read
      @chunks = $vector->Chunk_List_Read($chunksize);

  Union
      $set3->Union($set1,$set2);

  Intersection
      $set3->Intersection($set1,$set2);

  Difference
      $set3->Difference($set1,$set2);

  ExclusiveOr
      $set3->ExclusiveOr($set1,$set2);

  Complement
      $set2->Complement($set1);

  subset
      if ($set1->subset($set2))  #  true if $set1 is subset of $set2

  Norm
      $norm = $set->Norm();

  Min
      $min = $set->Min();

  Max
      $max = $set->Max();

  Multiplication
      $matrix3->Multiplication($rows3,$cols3,
                      $matrix1,$rows1,$cols1,
                      $matrix2,$rows2,$cols2);

  Closure
      $matrix->Closure($rows,$cols);

  Transpose
      $matrix2->Transpose($rows2,$cols2,$matrix1,$rows1,$cols1);

CLASS METHODS (implemented in Perl)

  Configuration
      $config = Bit::Vector->Configuration();
      Bit::Vector->Configuration($config);
      $config = Bit::Vector->Configuration($config);

OVERLOADED OPERATORS (implemented in Perl)

(under construction)

IMPORTANT NOTES ^

DESCRIPTION ^

(under construction)

SEE ALSO ^

Set::IntegerFast(3), Set::IntegerRange(3), Math::MatrixBool(3), Math::MatrixReal(3), DFA::Kleene(3), Math::Kleene(3), Graph::Kruskal(3).

perl(1), perlsub(1), perlmod(1), perlref(1), perlobj(1), perlbot(1), perltoot(1), perlxs(1), perlxstut(1), perlguts(1), overload(3).

VERSION ^

This man page documents "Bit::Vector" version 5.0.

AUTHOR ^

Steffen Beyer <sb@sdm.de>.

COPYRIGHT ^

Copyright (c) 1995, 1996, 1997 by Steffen Beyer. All rights reserved.

LICENSE ^

You may freely use (and modify) this package and its parts for your personal and any non-profit use.

This package or its parts may not be included into any commercial product whatsoever, nor may it be used to provide services to customers against payment, without prior written consent from its author, Steffen Beyer.

You may also freely redistribute VERBATIM copies of this package provided that you don't charge for them.

(Shareware CD etc. publishers please contact the author first; you will usually get permission to include this package on CD etc. free of charges provided that the costs of the CD (or the like) for the final customer will be within reasonable limits.)

Modified versions of this package or parts thereof may not be redistributed without prior written permission from its author.

Patches in form of UNIX "diff" files or from equivalent programs do not require such a permission and remain the property of their respective author(s).

DISCLAIMER ^

This package is provided "as is", without any warranty, neither express nor implied, including, but not limited to, the implied warranty of merchantability, regarding the fitness of this package or any of its parts for any particular purpose or the accuracy of its documentation.

In no event will the author be liable for any damage that may result from the use (or non-use) of or inability to use this package and its documentation, even if the author has been advised of the possibility of such damage.

syntax highlighting: