Created
May 22, 2013 15:49
-
-
Save peddamat/5628641 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Matrix dx(Matrix A) { | |
int M = A.getRowDimension(); | |
int N = A.getColumnDimension(); | |
Matrix R = new Matrix(M, N); | |
for (int y = 0; y < M; y++) | |
for (int x = 1; x < N-1; x++) { | |
double d1 = A.get(y,x-1); | |
double d2 = A.get(y,x+1); | |
double r = (d2 - d1)/2.0; | |
R.set(y,x,r); | |
} | |
return R; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment