NAME

Statistics::SparseVector - Perl extension for manipulating sparse bitvectors

SYNOPSIS

use Statistics::SparseVector;

# methods that create new bitvectors
$vec = Statistics::SparseVector->new($n);
$vec2 = $vec1->Clone();
$vec = Statistics::SparseVector->new_Enum($s);
$vec = Statistics::SparseVector->new_Bin($s);

# miscellaneous
$vec2->Substitute_Vector($vec1, $of22, $len2, $off1, $len1);
$vec->Size();
$vec->to_Enum();
$vec->to_Bin();
$vec->Fill();
$vec->Empty();
$vec->increment();

# manipulation on the bit level
$vec->Bit_Off($i);
$vec->Bit_On($i);
$vec->bit_flip($i);
$vec->bit_test($i);

# overloaded operators
# increment
$vec++;
# stringify
"$vec"

DESCRIPTION

This module implements sparse bitvectors. Several methods for manipulating bitvectors are implemented. On purpose the naming of the methods is identical to the Bit::Vector package by Stephen Beyer; if you find your vectors to be sparse (have little bits that are on) you can easily switch to a less memory consuming representation.

Creation of bitvectors

new
Clone
new_Enum
new_Bin

Vector-wide manipulation of bits

Substitute_Vector
Fill
Empty
increment
Bit_Off
Bit_On
bit_flip
bit_test

Miscellany

Size
to_Enum
to_Enum
to_Bin

Overloaded operators

++
Double quotes

Remarks about the implementation

  • Internally sparse vectors are represented by hashes.

  • Only a few methods from Bit::Vector are implemented. Maybe new ones will follow in the future.

  • Method Substitute_Vector is not thorougly debugged.

VERSION

Version 0.1.

AUTHOR

SEE ALSO

perl(1), Bit::Vector(3), Statistics::MaxEntropy(3), Statistics::ME.wrapper.pl(3), Statistics::Candidates(3).

COPYRIGHT

Statistics::MaxEntropy comes with ABSOLUTELY NO WARRANTY and may be copied only under the terms of the GNU Library General Public License (version 2, or later), which may be found in the distribution.