BDM (BDM v0.5.0)

View Source

Block Decomposition Method (BDM) implementation for approximating algorithmic complexity.

Summary

Functions

Computes the BDM complexity of a dataset.

Partitions 1D data into blocks according to boundary condition.

Partitions 2D data into blocks according to boundary condition.

Types

binary_matrix()

@type binary_matrix() :: [[0 | 1]] | Nx.Tensor.t()

binary_string()

@type binary_string() :: [0 | 1]

boundary_condition()

@type boundary_condition() :: :ignore | :correlated

t()

@type t() :: %BDM{
  backend: :ctm | :lzc,
  block_size: integer(),
  boundary: boundary_condition(),
  ctm_data: map(),
  ndim: 1 | 2,
  nsymbols: integer(),
  warn_missing: boolean()
}

Functions

compute(bdm, data)

@spec compute(t(), binary_string() | binary_matrix()) :: float()

Computes the BDM complexity of a dataset.

Parameters

  • bdm: BDM instance
  • data: Input data (list for 1D, Nx.Tensor or list of lists for 2D)

new(ndim, nsymbols, block_size, boundary \\ :ignore, backend \\ :ctm, ctm_data \\ nil, warn_missing \\ true)

@spec new(
  integer(),
  integer(),
  integer(),
  boundary_condition(),
  :ctm | :lzc,
  map() | nil,
  boolean()
) :: t()

Creates a new BDM instance.

Parameters

  • ndim: Dimensionality (1 for strings, 2 for matrices)
  • nsymbols: Number of symbols (2 for binary)
  • block_size: Size of blocks for decomposition
  • boundary: Boundary condition (:ignore, :correlated)
  • backend: CTM (default) or LZC
  • ctm_data: Optional custom CTM lookup table
  • warn_missing: Whether to warn about missing CTM values

Examples

iex> BDM.new(1, 2, 2)
%BDM{ndim: 1, nsymbols: 2, block_size: 2, ctm_data: ..., warn_missing: true}

partition_1d(data, block_size, atom)

@spec partition_1d(binary_string(), integer(), boundary_condition()) :: [
  binary_string()
]

Partitions 1D data into blocks according to boundary condition.

partition_2d(data, block_size, atom)

@spec partition_2d(binary_matrix(), integer(), boundary_condition()) :: [
  binary_matrix()
]

Partitions 2D data into blocks according to boundary condition.