function [count,wc] = lpccompress(w,p,tol)
% w is the data vector, p is block size
% Checks if computed value vs. true value exceeds tolerance tol.
% If so, also sends true value; output wc is data to be sent
N = length(w);
A = lpcA(p,w);
Y = lpcY(p,w);
V = (A'*A)^(-1)*A'*Y;
f = lpcreconstruct(w(1:p),V',N);
e = (f(p+1:N)-w(p+1:N))';
wc(1:2*p) = [w(1:p) V'];
for k = 1:length(w)-p
    wc(k+2*p) = (abs(e(k)) >= tol)*Y(k);
    c(k) = (abs(e(k)) >= tol);
end
count = sum(c);
