srush / annotated-s4

Implementation of https://srush.github.io/annotated-s4
https://srush.github.io/annotated-s4
MIT License
468 stars 60 forks source link

make_DPLR_HiPPO should be defined earlier? #73

Closed ratishsp closed 1 year ago

ratishsp commented 1 year ago

Thanks for this very helpful blogpost.

def test_gen_dplr(L=16, N=4):
    I = np.eye(4)

    # Create a DPLR A matrix and discretize
    Lambda, P, B, _ = make_DPLR_HiPPO(N)
...

The function make_DPLR_HiPPO is only defined later in the post. I was wondering if that was by design?

albertfgu commented 1 year ago

I think it's by design. That section of the blogpost focuses on the computational aspect of working with DPLR - abstracting away precise instantiations of DPLR matrices. The make_DPLR_HiPPO method is called only to provide a concrete DPLR matrix for testing; a randomly generated one would have worked just as well for the purposes of this testing function.

ratishsp commented 1 year ago

That helps, thanks!