matrix creation script