Compress - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


ArrayTools

  

Compress

  

compress a byte sequence

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

Compress(data, opts)

Parameters

data

-

ByteArray or list of integers

opts

-

(optional) equation of the form format = value

Options

• 

format = one of bzip2, gzip, zip, or zlib

  

This option allows a compression format to be specified explicitly. Options are bzip2, gzip, zip, or zlib. The default is zlib.

Description

• 

The Compress(A) command takes the given byte array or list and compresses it into a lossless, more compact format. The return value is a ByteArray.

• 

If A is a list, its contents must be integers between -128 and 127.

Examples

Generate a ByteArray of number-theoretic data and compress it.

Compare the size of the original with the compressed result.

(1)

Generate random data from a discrete uniform statistical distribution between -10 and 10 and compress it with zip format.

Compute the compression ratio for this example.

(2)

Convert a string to a ByteArray and compress it using gzip.

Compute the compression ratio for this example.

(3)

Compatibility

• 

The ArrayTools[Compress] command was introduced in Maple 2015.

• 

For more information on Maple 2015 changes, see Updates in Maple 2015.

• 

The ArrayTools[Compress] command was updated in Maple 2018.

• 

The format option was updated in Maple 2018.

See Also

ArrayTools

ArrayTools[Uncompress]

copyright

FileTools[Compressed]

StringTools[Compress]

type/ByteArray

 


Download Help Document