For example, I want a 2 row matrix, with a first row of length 1, and second row of length 2. I could do,
list1 = np.array([1])
list2 = np.array([2,3])
matrix = []
matrix.append(list1)
matrix.append(list2)
matrix = np.array(matrix)
I wonder if I could declare a matrix of this shape directly in the beginning of a program without going through the above procedure?
matrixis a list of lists with unequal lengths which is not a matrix (at least from my point of view). Matrices consist of rows with equal lengths. Therefore I doubt that one can declare thismatrixof this shape directly. What do you want to achieve with this shape? What are your further steps?matrix.