Next: crunchrun, Previous: crosscorr, Up: Internal Routines [Contents][Index]
crunch, array, byte_slice, out
crunch(array,
byte_slice
, out)
Tries to compress array
and writes the result in array
out
, which must be predefined and large enough to contain
the result. byte_slice
specifies how many bits per number
are passed to out
without compression. If
byte_slice
is too small or too large, then less efficient
compression or even expansion may occur. Try three less than the
array’s entropy for byte_slice
.
Presently, only compression of byte
, word
, and (on some
platforms) long
arrays is supported. Associated system variables
are:
!crunch_slice
the last specified byte_slice
.
!crunch_bits
the number of bits the last compressed array needed.
!crunch_bpp
the number of bits per compressed element for the last compressed array.
If out
has insufficient room to hold the result, then
!crunch_bits
and !crunch_bpp
are set to 0. The subroutine
form then also generates an error; the function form does not, but
returns a 0. If there is sufficient room, then the function form
returns a 1. If other errors occur (e.g., when array
is
not a numerical array), then both forms generate error states.
Reverse: decrunch
See also: !crunch_bits, !crunch_bpp, !crunch_slice