why z has 2 rows? Shouldn't it have one? Also, we normally use single-column matrices for 1D case, not single-row, e.g. ideally z should have (c.cols x 1) size.