Skip to content
Novus Examples
mtx175 B

Intentionally Corrupt Matrix Market — Declared Count Exceeds the Entries (.mtx)

An intentionally corrupt Matrix Market file whose banner and size line are perfectly valid and whose entry block stops seven lines short of the declared count. A reader that preallocates from the declared count and never checks ends up with seven silent zeros.

Preview — first 9 linesmtx
%%MatrixMarket matrix coordinate real general
% Intentionally corrupt: the size line declares 12 entries and only 5 follow.
8 8 12
1 1 4.0
1 4 -1.5
2 2 3.25
2 5 0.75
3 1 -2.0

Specifications

Intentionally Corrupt
true
Declared Non Zeros
12
Actual Entry Lines
5
Banner Valid
true
Size Line Valid
true
Damage
the entry block stops seven lines early

Testing contract

Expected to fail
Scenario
Load the file and compare the number of entry lines actually read against the count declared on the size line.
Expected result
Five entries are read against a declared twelve, and the loader reports the mismatch explicitly rather than returning a matrix padded with seven zero entries.

What is a .mtx file?

Matrix Market (.mtx) is a plain-text exchange format for sparse and dense matrices from NIST. A banner line declares the object, format, field, and symmetry — for example `%%MatrixMarket matrix coordinate real general` — comment lines follow, and then a size line gives rows, columns, and the number of stored entries. Coordinate entries list a 1-based row, a 1-based column, and a value, with symmetric matrices storing only the lower triangle.

How to use this file

Use an example .mtx file to test sparse-matrix loaders and numerical pipelines, verifying 1-based to 0-based index conversion, correct expansion of symmetric and pattern matrices, and that the declared entry count matches the data.

How to use this file for testing

“Intentionally Corrupt Matrix Market — Declared Count Exceeds the Entries (.mtx)” is a deterministic Novus Examples fixture for Scientific data, Error handling, Editor testing. Citation catalogs (BibTeX, RIS), chemistry structures (MDL Molfile, PDB), and gridded binary data (NetCDF, FITS) — for testing reference managers, molecule viewers, and scientific-data loaders.

Documented properties for this file: damage: the entry block stops seven lines early · intentionally corrupt. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.

Scientific fixtures are small, valid, and fully synthetic — no real organism, patient, sample, or observation. Point your parser or loader at the file and check it reads the documented records, variables, or headers; binary formats ship a readable twin or metadata listing for comparison.

Generated by generation/scientific.py. Free for any use, no attribution required — license.