add check of matrix_type to from_json
fix merge conflict
Merge pull request #455 from teravest/from_json

add check of matrix_type to from_json