Documentation ¶
Overview ¶
Package circular provides sliding-window data structures which are frequently useful when iterating through sorted BAM/PAM/BED files.
Index ¶
- Constants
- func NextExp2(x int) int
- type Bitmap
- func (b *Bitmap) CheckPanic(tag string)
- func (b *Bitmap) Clear(pos, circPos bi.PosType, colIdx uint32)
- func (b *Bitmap) FirstPos() bi.PosType
- func (b *Bitmap) NCirc() bi.PosType
- func (b *Bitmap) NewRowScanner() (bitset.NonzeroWordScanner, int)
- func (b *Bitmap) Row(circPos bi.PosType) []uintptr
- func (b *Bitmap) Set(pos, circPos bi.PosType, colIdx uint32)
Constants ¶
const BitsPerWord = simd.BitsPerWord
BitsPerWord is the number of bits per machine word. (Don't want to import base/simd or base/bitset in files where we only need this constant.)
const FirstPosEmpty = bi.PosTypeMax
FirstPosEmpty is an empty-bitmap sentinel value. It must be larger than any real coordinate.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bitmap ¶
type Bitmap struct {
// contains filtered or unexported fields
}
Bitmap is a 2-dimensional bitmap, with circular major dimension. Variable and type names currently make the assumption that the major dimension corresponds to position; this can be abstracted out.
func (*Bitmap) CheckPanic ¶
CheckPanic verifies the following invariants for a Bitmap, panicking on failure:
- If either firstPos or lastPos is set to the "empty" value (FirstPosEmpty and -1, respectively), the other is as well.
- If the bitmap isn't empty:
- firstPos is in [lastPos, lastPos + nCirc).
- wordPops[firstPos & (nCirc - 1)] and wordPops[lastPos & (nCirc - 1)] are nonzero.
- For each i in [0, nCirc), wordPops[i] = # of nonzero words in Row(i).
func (*Bitmap) Clear ¶
Clear clears a single bit of the bitmap. (Nothing bad happens if the bit was already clear.)
func (*Bitmap) FirstPos ¶
FirstPos returns the position of the first table entry, or FirstPosEmpty when the table is empty.
func (*Bitmap) NewRowScanner ¶
func (b *Bitmap) NewRowScanner() (bitset.NonzeroWordScanner, int)
NewRowScanner returns a bitset.NonzeroWordScanner for the first nonempty table row, along with the position of the first set bit in the row. It is assumed that the row will be fully scanned before any other changes are made to the table.