MCPcopy Create free account
hub / github.com/alandefreitas/matplotplusplus / gradient

Function gradient

source/matplot/util/common.cpp:503–512  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

501 }
502
503 vector_1d gradient(const vector_1d &z, double spacing) {
504 const size_t n = z.size();
505 vector_1d d(n);
506 d[0] = (z[1] - z[0]) / spacing;
507 d[n - 1] = (z[n - 1] - z[n - 2]) / spacing;
508 for (size_t i = 1; i < n - 1; ++i) {
509 d[i] = ((z[i] - z[i - 1]) + (z[i + 1] - z[i])) / spacing / 2.;
510 }
511 return d;
512 }
513
514 std::pair<vector_2d, vector_2d>
515 gradient(const vector_2d &z, double spacing_x, double spacing_y) {

Callers 5

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected