Skip to content

Main content

Sparse Dense Cell Budget

Budget exact dense storage for explicit sparse matrix dimensions and bytes per cell without materializing a matrix; excludes allocator overhead.

Loading tool…

Description

Budget exact dense storage for explicit sparse matrix dimensions and bytes per cell without materializing a matrix; excludes allocator overhead.

A sparse matrix can be stored as coordinate triplets or as pointer/index/value arrays. Stored entries are not necessarily distinct numerical nonzeros: duplicates and explicit zeros can matter to representation checks. Row and column coordinates here are zero-based, and omitted entries are handled only as stated for the particular operation.

Budget exact dense storage for explicit sparse matrix dimensions and bytes per cell without materializing a matrix; excludes allocator overhead.

When to use this tool

Use this tool to budget exact dense storage for explicit sparse matrix dimensions and bytes per cell without materializing a matrix; excludes allocator overhead.

How to use the tool and how it works

  1. Enter rows, columns, bytesPerCell, budget using the field definitions below.
  2. Run the operation. Correct input errors before interpreting an output.
  3. Read result.cells, result.bytes, result.fits. Use the ordering, boundary rules and absence conditions described below.

Multiply rows × columns and bytesPerCell with exact integer arithmetic. Return decimal-string cell and byte counts and whether bytes are at most the nonnegative budget.1

Input fieldMeaning and unitsAccepted input
rowsDeclared row count; coordinate operations use 0–128, dense budgets allow larger integers.A finite safe integer within the operation’s stated bounds.
columnsDeclared column count; coordinate operations use 0–128, dense budgets allow larger integers.A finite safe integer within the operation’s stated bounds.
bytesPerCellPositive integer raw storage bytes per dense cell.A finite safe integer within the operation’s stated bounds.
budgetNonnegative exact byte budget as decimal integer text.Text, at most 8,192 UTF-16 code units; the operation’s grammar also applies.
Output fieldInterpretation
resultObject containing the named fields below.
result.cellsExact dense cell count as decimal text.
result.bytesExact raw dense byte estimate as decimal text.
result.fitsWhether the exact estimated byte count is at most budget.
json
{
  "input": {
    "rows": 100,
    "columns": 100,
    "bytesPerCell": 8,
    "budget": "1000"
  },
  "output": {
    "result": {
      "cells": "10000",
      "bytes": "80000",
      "fits": false
    }
  }
}

Limitations and assumptions

  • The estimate covers raw dense cells only, not allocator, object or sparse-format overhead.
  • Triplets are JSON records with row, column and value. Coordinate shapes are ordinarily bounded to 128 per axis; compressed major dimensions are limited to 127 for pointer-list capacity. The dense-budget operation has separate larger shape limits and returns exact counts as decimal text.
  • Every declared top-level input field is required and unexpected fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
  • Numeric outputs must be finite and no larger in absolute magnitude than the safe-integer limit; operations returning exact large integers use decimal text. Positions are zero-based and spans end exclusively unless the operation explicitly states a different convention.

Alternative or Complementary methods

Distinguish stored-record counts, coordinate-pattern checks and arithmetic matrix properties. Combine duplicates or prune zeros explicitly when required, and use a matrix library for numerical linear algebra.

References

  1. Tool behavior and example: Sparse Dense Cell Budget — tool.io

Similar or alternative tools

  • Sparse Coordinate Axis Offset

    Translate bounded COO coordinates into explicitly supplied target dimensions; out-of-target entries are rejected rather than clipped.

  • Sparse Coordinate Column Counts

    Count COO entry occurrences per column, including duplicate coordinates and explicit zero values; not dense nonzero support.