copy a matrix