Similar versions for vectors filled with 1s: ones, ans 0s: zeros. Note that np.empty(shape=N) is different from np.empty(shape=(N, 1)). The former has x[N], while the latter x[N, 1].

To flatten a matrix m(Nx1) to a vector v(N):

Matrix (2D)

Initialization

Un-initialized matrix of size N x M:

Similar versions for vectors filled with 1s: ones, and 0s: zeros.