Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

35 lines (29 sloc) 0.692 kb
#include <string.h>
#include <math.h>
#include "bit.h"
#include "compression.h"
#include "dataStructures.h"
/**differentialCoding, increasing sequence of integers is assumed**/
void differentialCoding(vector* V){
word i;
for(i=1;i<V->size;i++){
V->elements[i] -= V->elements[i-1];
}
}
bitVector* psiCoding(vector* V){
differentialCoding(V);
bitVector* B = createBitVector(V->size*2);
unaryCoding(V,B);
/**Resize bitVector**/
/**Free Vector**/
freeVector(V);
return(B);
}
void unaryCoding(vector* V,bitVector* B){
word i;
word index = 0;
for(i=0;i<V->size;i++){
index += V->elements[i];
setBit(B,index);
}
}
Jump to Line
Something went wrong with that request. Please try again.