Use resize instead of copying a new object for potentially large matrices

Change-Id: Ib693a311b793c2b966c64ff093e50d00305fe93f