Simplified unions in math structs. Changed internal matrix indexing to the row/col ordering that is used in standard mathematics.