info > Bit::Vector

๐Ÿ“– NAME

Bit::Vector โ€” Efficient bit vector, set of integers and "big int" math library

๐Ÿš€ Quick Reference

Use CaseCommandDescription
๐Ÿ“ฆ Create a bit vectorBit::Vector->new($bits)Create a new bit vector of given size, all bits cleared
๐Ÿ”ข Create from hex stringBit::Vector->new_Hex($bits,$string)Create and initialize from hexadecimal string
๐Ÿ”ข Create from binary stringBit::Vector->new_Bin($bits,$string)Create and initialize from binary string
๐Ÿ”ข Create from decimal stringBit::Vector->new_Dec($bits,$string)Create and initialize from decimal string
๐Ÿ”ข Create from enumerationBit::Vector->new_Enum($bits,$string)Create and initialize from "2,3,5-7" style string
๐Ÿ“ Get size$vector->Size()Return number of bits in the vector
โœ‚๏ธ Resize$vector->Resize($bits)Change size, preserving lower bits
๐Ÿ“‹ Clone$vec2 = $vec1->Clone()Create exact duplicate
๐Ÿ“‹ Shadow$vec2 = $vec1->Shadow()Create same-size empty vector
๐Ÿ“ Copy$vec2->Copy($vec1)Copy contents (sign extension if larger)
๐Ÿงน Empty$vector->Empty()Clear all bits
๐Ÿงน Fill$vector->Fill()Set all bits
๐Ÿ”„ Flip$vector->Flip()Complement all bits
๐Ÿ” Test bit$vector->bit_test($index)Return 0/1 for bit at index
๐Ÿ” Contains$vector->contains($index)Same as bit_test
โœ๏ธ Set bit$vector->Bit_On($index)Set bit at index to 1
โœ๏ธ Clear bit$vector->Bit_Off($index)Set bit at index to 0
โœ๏ธ Flip bit$vector->bit_flip($index)Toggle bit, return new state
โœ๏ธ Copy bit$vector->Bit_Copy($index,$bit)Set bit to given boolean
๐Ÿ”ข Convert to hex$string = $vector->to_Hex()Return hexadecimal string
๐Ÿ”ข Import from hex$vector->from_Hex($string)Read from hex string
๐Ÿ”ข Convert to binary$string = $vector->to_Bin()Return binary string
๐Ÿ”ข Import from binary$vector->from_Bin($string)Read from binary string
๐Ÿ”ข Convert to decimal$string = $vector->to_Dec()Return decimal string (signed)
๐Ÿ”ข Import from decimal$vector->from_Dec($string)Read from decimal string
๐Ÿ”ข Convert to enumeration$string = $vector->to_Enum()Return "2,3,5-7" style string
๐Ÿ”ข Import from enumeration$vector->from_Enum($string)Read from enumeration string
โž• Increment$carry = $vector->increment()Add 1 to vector (unsigned)
โž– Decrement$carry = $vector->decrement()Subtract 1 (unsigned)
โž• Add$vec3->add($vec1,$vec2,$carry)Add with carry, returns (carry,overflow)
โž– Subtract$vec3->subtract($vec1,$vec2,$carry)Subtract with carry
โœ–๏ธ Multiply$vec3->Multiply($vec1,$vec2)Multiply (signed), result may be larger
โž— Divide$quot->Divide($vec1,$vec2,$rest)Divide, get quotient and remainder
๐Ÿ”ข Negate$vec2->Neg($vec1)Two's complement negation
๐Ÿ”ข Absolute$vec2->Abs($vec1)Absolute value
๐Ÿ”ข Compare (unsigned)$vec1->Lexicompare($vec2)Return -1,0,1
๐Ÿ”ข Compare (signed)$vec1->Compare($vec2)Return -1,0,1
๐Ÿ”ข Equality$vec1->equal($vec2)Return boolean
๐Ÿ”ข Is empty$vector->is_empty()True if all bits zero
๐Ÿ”ข Is full$vector->is_full()True if all bits one
๐Ÿ”ข Rotate left$carry = $vector->rotate_left()Circular shift left through carry
๐Ÿ”ข Rotate right$carry = $vector->rotate_right()Circular shift right through carry
๐Ÿ”ข Shift left$carry = $vector->shift_left($carry_in)Shift left, feed carry
๐Ÿ”ข Shift right$carry = $vector->shift_right($carry_in)Shift right, feed carry
๐Ÿ”ข Move left (multiple bits)$vector->Move_Left($bits)Shift left by $bits positions
๐Ÿ”ข Move right$vector->Move_Right($bits)Shift right by $bits positions
๐Ÿ”ข Insert bits$vector->Insert($offset,$bits)Insert cleared bits at offset, lose top bits
๐Ÿ”ข Delete bits$vector->Delete($offset,$bits)Remove bits at offset, zeros at top
๐Ÿ”ข Interval empty$vector->Interval_Empty($min,$max)Clear range of bits
๐Ÿ”ข Interval fill$vector->Interval_Fill($min,$max)Set range of bits
๐Ÿ”ข Interval flip$vector->Interval_Flip($min,$max)Complement range
๐Ÿ”ข Interval reverse$vector->Interval_Reverse($min,$max)Reverse bit order in range
๐Ÿ” Scan intervals (ascending)($min,$max) = $vector->Interval_Scan_inc($start)Find next block of set bits upward
๐Ÿ” Scan intervals (descending)($min,$max) = $vector->Interval_Scan_dec($start)Find next block of set bits downward
๐Ÿ“‹ Interval copy$vec2->Interval_Copy($vec1,$off2,$off1,$len)Copy a stretch of bits between vectors
๐Ÿ“‹ Interval substitute (splice)$vec2->Interval_Substitute($vec1,$off2,$len2,$off1,$len1)Replace/insert/delete bits, auto-resize
๐Ÿ”ข Block store (binary)$vector->Block_Store($buffer)Load vector from binary string (low byte first)
๐Ÿ”ข Block read$buffer = $vector->Block_Read()Export vector as binary string
๐Ÿ”ข Word store (machine-dependent)$vector->Word_Store($offset,$word)Store a machine word at given offset
๐Ÿ”ข Word read$word = $vector->Word_Read($offset)Read a machine word
๐Ÿ”ข Chunk store (portable)$vector->Chunk_Store($chunksize,$offset,$chunk)Store a chunk of bits (1 to Long_Bits)
๐Ÿ”ข Chunk read$chunk = $vector->Chunk_Read($chunksize,$offset)Read a chunk of bits
๐Ÿ”ข Prime sieve$vector->Primes()Set bits at prime indices
๐Ÿ”ข Reverse$vec2->Reverse($vec1)Reverse the order of all bits
๐Ÿ”ข Set operations (union)$vec3->Or($vec1,$vec2)Bitwise OR
๐Ÿ”ข Intersection$vec3->And($vec1,$vec2)Bitwise AND
๐Ÿ”ข Difference$vec3->AndNot($vec1,$vec2)Bitwise AND NOT
๐Ÿ”ข Symmetric difference$vec3->Xor($vec1,$vec2)Bitwise XOR
๐Ÿ”ข Complement$vec2->Not($vec1)Bitwise NOT
๐Ÿ”ข Subset test$set1->subset($set2)True if all bits of set1 are in set2
๐Ÿ”ข Norm (population count)$norm = $set->Norm()Number of set bits
๐Ÿ”ข Min/Max$min = $set->Min(); $max = $set->Max()Smallest/largest index with set bit
๐Ÿ”ข GCD$vecgcd->GCD($veca,$vecb)Greatest Common Divisor
๐Ÿ”ข Power$vec3->Power($vec1,$vec2)Exponentiation (base**exp)
๐Ÿ”ข Matrix multiplication (XOR)$m3->Multiplication(...)Boolean matrix multiplication (XOR sum)
๐Ÿ”ข Matrix product (OR)$m3->Product(...)Boolean matrix multiplication (OR sum)
๐Ÿ”ข Transitive closure$matrix->Closure($rows,$cols)Reflexive transitive closure (Kleene)
๐Ÿ”ข Transpose$matrix2->Transpose(...)Transpose a boolean matrix

๐Ÿ“‹ SYNOPSIS

๐Ÿ”€ OVERLOADED OPERATORS

See Bit::Vector::Overload(3).

๐Ÿ“ฅ MORE STRING IMPORT/EXPORT

See Bit::Vector::String(3).

๐Ÿท๏ธ CLASS METHODS

๐Ÿ”ง OBJECT METHODS

โš ๏ธ IMPORTANT NOTES

๐Ÿ“– DESCRIPTION

๐Ÿ”€ OVERLOADED OPERATORS

See Bit::Vector::Overload(3).

๐Ÿ“ฅ MORE STRING IMPORT/EXPORT

See Bit::Vector::String(3).

๐Ÿท๏ธ CLASS METHODS

๐Ÿ”ง OBJECT METHODS

๐Ÿ“š SEE ALSO

Bit::Vector::Overload(3), Bit::Vector::String(3), Storable(3).

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

๐Ÿ“Œ VERSION

This document describes Bit::Vector version 7.4.

๐Ÿ‘ค AUTHOR

Steffen Beyer
STBEY@cpan.org
http://www.engelschall.com/u/sb/download/

ยฉ๏ธ COPYRIGHT

Copyright (c) 1995 - 2013 by Steffen Beyer. All rights reserved.

๐Ÿ“„ LICENSE

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, i.e., under the terms of the "Artistic License" or the "GNU General Public License".

The C library at the core of this Perl module can additionally be redistributed and/or modified under the terms of the "GNU Library General Public License".

โš ๏ธ DISCLAIMER

This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Bit::Vector
๐Ÿ“– NAME ๐Ÿš€ Quick Reference ๐Ÿ“‹ SYNOPSIS
๐Ÿ”€ OVERLOADED OPERATORS ๐Ÿ“ฅ MORE STRING IMPORT/EXPORT ๐Ÿท๏ธ CLASS METHODS ๐Ÿ”ง OBJECT METHODS
โš ๏ธ IMPORTANT NOTES ๐Ÿ“– DESCRIPTION
๐Ÿ”€ OVERLOADED OPERATORS ๐Ÿ“ฅ MORE STRING IMPORT/EXPORT ๐Ÿท๏ธ CLASS METHODS ๐Ÿ”ง OBJECT METHODS
๐Ÿ“š SEE ALSO ๐Ÿ“Œ VERSION ๐Ÿ‘ค AUTHOR ยฉ๏ธ COPYRIGHT ๐Ÿ“„ LICENSE โš ๏ธ DISCLAIMER

Generated by phpman v4.9.26-1-g511901d Author: Che Dong Under GNU General Public License
2026-08-09 09:21 @2600:1f28:365:80b0:50b3:453e:ff52:20f7
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format