Smart Arrays Compress

What the package can do for you

The compression algorithms provided by this package don't have anything to do with audio or video compression. Instead, their purpose is to reduce large arrays to a size suitable for fast interactive viewing on a screen by retaining significant aspects of the array data. For this purpose an array is fragmented into intervals (1D) or submatrices (2D). The minimum and maximum values in these regions constitue the compressed array. You would apply the algorithms to arrays with thousands, ten thousands or even millions of elements. The reduced size should, for example, be chosen to match display resolution if compression is applied for data viewing.

The major API functionalities

  • class CompressedArray1D

This example will compress the large specified 1D array to a size of 200 points:

CompressedArray1D c1d = CompressedArray1D.compress(array, 0, array.length - 1, false, 200);

The result is available in c1d.cArray.

  • class CompressedArray2D:

This example will compress the large specified 2D array to a size of 200 x 500 points:

CompressedArray2D c2d = CompressedArray2D();

c2d.compress(matrix, 0, matrix.length - 1, 0, matrix[0].length - 1, 200, 500, true);

The result is available in c2d.cvalsPos and c2d.cvalsNeg.

Detailed API

Please view the detailed API documentation in the API reference of this package (sidebar at the right of this page).

Using this package

You need Dart 2.0 or later.

Import the package using:

  • import 'package:smart_arrays_compress/smart_arrays.dart_compress';

smart_arrays_base: Basic functions for 1D and 2D arrays

Libraries

smart_arrays_compress