wrapper around malloc clears the allocated memory to 0 terminates the program if malloc fails
| 84 | // clears the allocated memory to 0 |
| 85 | // terminates the program if malloc fails |
| 86 | void *xmalloc(size_t size) |
| 87 | { |
| 88 | void *ptr = malloc(size); |
| 89 | if (ptr == NULL) { |
| 90 | printf("> ERROR: malloc for size %zu failed..\n", size); |
| 91 | exit(EXIT_FAILURE); |
| 92 | } |
| 93 | memset(ptr, 0, size); |
| 94 | return ptr; |
| 95 | } |
| 96 | |
| 97 | // initalize identity matrix |
| 98 | void initIdentityMatrix(DATA_TYPE *mat) |