Hypex v1.1.1 Hypex.Array View Source
This module provides a Hypex register implementation using an Erlang Array under the hood.
Using an Array switches out the memory efficiency of the Bitstring implementation for performance, operating at 10x the throughput of Bitstring on updates.
Even though this implementation uses higher amounts of memory, it’s still pretty low-cost and as such is the default register module for Hypex. Typically only those working in memory-constrained environments should consider the Bitstring register.
Link to this section Summary
Functions
Takes a list of bits and converts them to an Array
Returns a bit from the list of registers
Creates a new Array with a size of 2 ^ width
with all elements initialized to 0
Converts a list of registers into a provided accumulator
Sets a bit inside the list of registers
Converts an Array register implementation to a list of bits
Link to this section Types
Link to this section Functions
Takes a list of bits and converts them to an Array.
The Array has it’s size fixed before being returned just for some extra safety.
Returns a bit from the list of registers.
Creates a new Array with a size of 2 ^ width
with all elements initialized to 0.
Converts a list of registers into a provided accumulator.
Internally we pass everything to :array.foldl/3
, as there’s already a native
implementation for accumulation.
Sets a bit inside the list of registers.
Converts an Array register implementation to a list of bits.
We can just delegate to the internal Array implementation as it provides the functionality we need built in.