for the matrix routines, added conversion from data frames