working matGradMultMat in C - too slow to be usefull