(rontolisp) docs
← Functions

linalg:reshape

(linalg:reshape array shape)

Returns a fresh array with the given shape and the same elements in row-major order. shape is an integer for a vector or a list (rows cols) for a matrix, and its total size must match the input's linalg:size -- a mismatch signals an error. One extent may be -1 and is inferred from the element count (numpy's rule); a bare -1 shape flattens, and more than one -1 signals an error. linalg:flatten is the common special case of reshaping to a vector.