Replace if by a getattr.

Replace if condition (for the direction) with a getattr
to know when I am dealing with a gradient in the x-direction
or in the y-direction.
Replace the if by getattr() in Matrix's constructor

Instead of having a
if 'gradient' in name
elif 'laplacian' in name
I use getattr() to call the proper function.
Minor bug.