1
$\begingroup$

In http://mattmahoney.net/dc/dce.html#Section_32 Matt Mahoney states:

The simplest of these is the order 0 coder fpaq0.

in http://mattmahoney.net/dc/dce.html#Section_41 he states:

An order 0 model uses no context.

but in http://mattmahoney.net/dc/fpaq0.cpp the Predictor (model) is defined with a context:

class Predictor {
  int cxt;  // Context: last 0-8 bits with a leading 1
  int ct[512][2];  // 0 and 1 counts in context cxt
public:
  Predictor(): cxt(1) {
    memset(ct, 0, sizeof(ct));
  }

  // Assume a stationary order 0 stream of 9-bit symbols
  int p() const {
    return 4096*(ct[cxt][1]+1)/(ct[cxt][0]+ct[cxt][1]+2);
  }

  void update(int y) {
    if (++ct[cxt][y] > 65534) {
      ct[cxt][0] >>= 1;
      ct[cxt][1] >>= 1;
    }
    if ((cxt+=cxt+y) >= 512)
      cxt=1;
  }
};

Why is that?

$\endgroup$

1 Answer 1

1
$\begingroup$

From Matt Mahoney himself in an email:

"It is bytewise order 0, not bitwise. It models byte probabilities independently one bit at a time. The bit probabilities depend on previous bits."

$\endgroup$
1
  • $\begingroup$ Bravo for going straight to the source! $\endgroup$
    – John L.
    Apr 15, 2022 at 2:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.