Mentions légales du service

Skip to content

dimensions mismatch with lz.pad()

I try to pad a vector with:

lz.pad(lz.eye(6), (1, 1)) @ np.arange(6)

But I get a ValueError: dimensions must agree error.

Note that:

lz.pad(lz.eye(6), (1, 1)).toarray() @ np.arange(6)

is okay, and an equivalent lazy construction:

lpad = lambda n,prepend,append: lz.eye(n+prepend+append, n, -prepend)
lpad(6, 1, 1) @ np.arange(6)

also works.