Skip to content

Instantly share code, notes, and snippets.

@peddamat
Created May 22, 2013 15:48
Show Gist options
  • Save peddamat/5628637 to your computer and use it in GitHub Desktop.
Save peddamat/5628637 to your computer and use it in GitHub Desktop.
Matrix dy(Matrix A) {
int M = A.getRowDimension();
int N = A.getColumnDimension();
Matrix R = new Matrix(M, N);
for (int y = 1; y < M-1; y++)
for (int x = 0; x < N; x++) {
double d1 = A.get(y-1,x);
double d2 = A.get(y+1,x);
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