convert_helpers function

Helper functions to convert between formula and matrix interface