Skip to main content

Reader and writer implementations for the file formats used by kameris-backend.

Project description

kameris-formats

Travis Codacy Codebeat Codeclimate

These are implementations of readers and writers for the file formats used by kameris-backend, for the following languages:

Language Location Notes
C++ cpp/ Header-only, requires libkameris
Python python/ On PyPI: PyPI version

File formats

There are two different file formats used to store program output. repr mode generates files with the extension .mm-repr and dist mode generates files with the extension .mm-dist.

Data is always stored in little-endian format. All header values except the signature are unsigned integers.

element_type is a common enum used to specify the type of the stored data. Its values are as follows:

Value Name Element size (bytes) Description
0 uint8 1 8-bit unsigned integer
1 uint16 2 16-bit unsigned integer
2 uint32 4 32-bit unsigned integer
3 uint64 8 64-bit unsigned integer
4 float32 4 IEEE 754 single-precision floating point
5 float64 8 IEEE 754 double-precision floating point

repr format (.mm-repr files)

Header

Start End Size (bytes) Name Description
0x00 0x05 6 signature File signature, always "MMREPR"
0x06 0x06 1 version Always 0
0x07 0x07 1 is_sparse Whether the matrices are sparse (0 or 1)
0x08 0x08 1 key_type The type of matrix keys as an element_type, unused if is_sparse is 0
0x09 0x09 1 value_type The type of matrix values as an element_type
0x0A 0x11 8 count Number of matrices
0x12 0x19 8 rows Number of rows for each matrix
0x1A 0x21 8 columns Number of columns for each matrix
0x22 8 * count sizes (Only if is_sparse is 1) Number of non-zero entries for each matrix

If the sparse flag is not set, the following count * rows * columns * (size for value_type) bytes are the entries, in row-major order, for each of the count matrices, one after the other.

If the sparse flag is set, each of the count matrices, one after the other, is stored as (the matrix size from sizes) * (size for key_type) * (size for value_type) bytes which are (the matrix size from sizes) pairs of key followed by value. The order of keys is unspecified.

dist format (.mm-dist files)

Header

Start End Size (bytes) Name Description
0x00 0x05 6 signature File signature, always "MMDIST"
0x06 0x06 1 version Always 0
0x07 0x07 1 value_type The type of matrix values as an element_type
0x08 0x0F 8 size Number of rows = columns of the matrix

The following (size * (size - 1)) / 2 * (size for value_type) bytes are the entries above the main diagonal, in row-major order, of the matrix. The matrix is assumed to be symmetric and have zeros on the main diagonal.


License License

The MIT License (MIT)

Copyright (c) 2017 Stephen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kameris-formats-1.0.6.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

kameris_formats-1.0.6-py2.py3-none-any.whl (7.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file kameris-formats-1.0.6.tar.gz.

File metadata

  • Download URL: kameris-formats-1.0.6.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.14

File hashes

Hashes for kameris-formats-1.0.6.tar.gz
Algorithm Hash digest
SHA256 88bb78afe79777224be6250b72ce0d57ac387a4640b33ea7b7ad98a0cbf2ef66
MD5 f249d75cf2f118e33988854b34467ee5
BLAKE2b-256 90f23dd8c9dd68f12e59b75a4d685fc87607bf60d2260d08ea76dc60491815b8

See more details on using hashes here.

File details

Details for the file kameris_formats-1.0.6-py2.py3-none-any.whl.

File metadata

  • Download URL: kameris_formats-1.0.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.14

File hashes

Hashes for kameris_formats-1.0.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 601f4d9dc7b841c49512940839fedf611b50f9d79f38f3a0b99987311c9cc05e
MD5 f64da9a1f057def233c65a35f3d5e0ef
BLAKE2b-256 2724f3bff0c31112ce7529c8b62fb04dc3c86ee6d37bc1c11dc2aa203c7096de

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page