Added constructor taking dimensions for matrices