Support rectangular matrix and split into functions

Use arrayX/arrayY in most functions instead of just arraySize.
Moved the averaging and the loop to own functions
Threading!

Gives each thread a part of the array to compute.
Remove debug logging.
Update gitignore

Added codeblocks files to gitignore