generating the source file as well as matrix generator code