-scala code for matrices and vectors