Skip to main content

Compressed Row-Access Matrix file format.

Goal : Simple and Efficient storage of 2d sparse matrices for memory efficient access of rows columns and ranges.

File Structure:

  1. Header Section:

    • Describes the overall file metadata.
    • Fixed size for simplicity.
  2. Index Section:

    • Row Index
      • Maps rows to their corresponding data offsets in the file.
  3. Data Section:

    • Row Data
      • Contains the actual sparse matrix data in a compressed Row Format. along with the column number

Detailed Layout

1. Header Section

Description: File identifiers and general fine info
Size: 40 bytes

Field Type Size (Bytes) Description
Magic Number ASCII 4 File identifier - CRAM
Version Integer 2 File format version
Rows Integer 4 Number of rows in the matrix
Columns Integer 4 Number of columns in the matrix
Non-Zero Count Integer 8 Total number of non-zero entries
Index Offset Integer 8 Byte offset to the index section
Data Offset Integer 8 Byte offset to the data section

2. Index Section

Description: Maps Rows to their corresponding data offsets
Size: 16 bytes

Field Type Size (Bytes) Description
Row ID Integer 4 Row ID
Offset Integer 8 Byte offset in the data section
Non-Zero Count Integer 4 Number of non-zero entries

3. Data Section

Description: Data elements of the
Size: 8

Field Type Size (Bytes) Description
Column Index Integer 4 Column index of the value
Value Float 4 The matrix value

Installation

To install the package

pip install sparse-CRAM

Usage:

cram_path = '/path/to/cram_file.cram'
fileparser = CRAM.FileParser(cram_path)
headers = fileparser.parse_headers()

Metadata

Release files for sparse-CRAM 0.1.6.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sparse-CRAM 0.1.6.3
File Size Uploaded
sparse_cram-0.1.6.3.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sparse-CRAM 0.1.6.3
File Interpreter ABI Platform
sparse_cram-0.1.6.3-py3-none-any.whl Python 3 none any Details

Total release size: 9.5 kB

Release files / sparse_cram-0.1.6.3.tar.gz

Download URL sparse_cram-0.1.6.3.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ae5570d74d2a74929ba946a5e1afdc56202de517080bca8f2cf8fae13011274a
BLAKE2b-256 checksum
How to use checksums
42bfccb56f95a1d723248e2c8791fbf76dce3ffd994c34a0e349aa0f852273c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.13.0 Darwin/22.6.0

Release files / sparse_cram-0.1.6.3-py3-none-any.whl

Download URL sparse_cram-0.1.6.3-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6ce84eea4a463ef793f4de3e1efc4d0ca076858b7d3cdf8cfdc503b5e02abee
BLAKE2b-256 checksum
How to use checksums
2bce3bf32e4e4e855323e9dff3eff9d312e16807e6b7f16f389fb38a028f9841
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.13.0 Darwin/22.6.0

Release history Release notifications | RSS feed

This release

0.1.6.3 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page