Janus 2.0.0
High-performance C++20 dual-mode numerical framework
Loading...
Searching...
No Matches
Calculus.hpp File Reference

Numerical differentiation and integration (gradient, trapz, cumtrapz, diff). More...

#include "janus/core/JanusConcepts.hpp"
#include "janus/core/JanusError.hpp"
#include "janus/math/Arithmetic.hpp"
#include <Eigen/Dense>
#include <optional>
#include <type_traits>
#include <utility>
Include dependency graph for Calculus.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  janus

Functions

template<typename Derived>
auto janus::diff (const Eigen::MatrixBase< Derived > &v)
 Computes adjacent differences of a vector Returns a vector of size N-1 where out[i] = v[i+1] - v[i].
template<typename DerivedY, typename DerivedX>
auto janus::trapz (const Eigen::MatrixBase< DerivedY > &y, const Eigen::MatrixBase< DerivedX > &x)
 Computes trapezoidal integration Approximation of integral of y(x) using trapezoidal rule.
template<typename DerivedY, typename DerivedX>
auto janus::cumtrapz (const Eigen::MatrixBase< DerivedY > &y, const Eigen::MatrixBase< DerivedX > &x)
 Computes the cumulative trapezoidal integral.
template<typename DerivedY, JanusScalar Spacing = double>
auto janus::cumtrapz (const Eigen::MatrixBase< DerivedY > &y, const Spacing &dx=1.0)
 Computes the cumulative trapezoidal integral with uniform spacing.
template<typename DerivedY, typename DerivedX>
auto janus::gradient_1d (const Eigen::MatrixBase< DerivedY > &y, const Eigen::MatrixBase< DerivedX > &x)
 Computes gradient of 1D data using central differences.
template<typename DerivedF, typename Spacing = double>
auto janus::gradient (const Eigen::MatrixBase< DerivedF > &f, const Spacing &dx=1.0, int edge_order=1, int n=1)
 Computes gradient using second-order accurate central differences.
template<typename DerivedF, typename Spacing = double, typename Period>
auto janus::gradient_periodic (const Eigen::MatrixBase< DerivedF > &f, const Spacing &dx, const Period &period, int edge_order=1, int n=1)
 Computes gradient with periodic boundary conditions.

Detailed Description

Numerical differentiation and integration (gradient, trapz, cumtrapz, diff).

See also
FiniteDifference.hpp, IntegrateDiscrete.hpp