added function for encoding and array as a sparse gamma gap file