MATLAB-like diff() function.
More...
#include <Eigen/Eigen>
Go to the source code of this file.
|
| template<typename Derived> |
| const Derived::PlainObject | sablib::Diff (const Eigen::MatrixBase< Derived > &m0, const int n=1, const Dir dir=Dir::RowWise) |
| | Calculates the n-th discrete difference along the given axis.
|
| template<typename Derived> |
| const Derived::PlainObject | sablib::Diff (const Eigen::SparseMatrixBase< Derived > &m0, const int n=1, const Dir dir=Dir::RowWise) |
| | Calculates the n-th discrete difference for sparse matrices along the given axis.
|
MATLAB-like diff() function.
- Author
- Izadori
Definition in file diff.h.
◆ Dir
Direction for difference calculation.
| Enumerator |
|---|
| RowWise | Calculates the difference along the rows (MATLAB-like).
|
| ColumnWise | Calculates the difference along the columns (Python-like).
|
Definition at line 17 of file diff.h.
◆ Diff() [1/2]
template<typename Derived>
| const Derived::PlainObject sablib::Diff |
( |
const Eigen::MatrixBase< Derived > & | m0, |
|
|
const int | n = 1, |
|
|
const Dir | dir = Dir::RowWise ) |
Calculates the n-th discrete difference along the given axis.
- Parameters
-
| m0 | The input matrix or vector. |
| n | The order of difference (default is 1). |
| dir | The direction to calculate the difference (RowWise or ColumnWise). |
- Returns
- The n-th discrete difference.
Definition at line 32 of file diff.h.
◆ Diff() [2/2]
template<typename Derived>
| const Derived::PlainObject sablib::Diff |
( |
const Eigen::SparseMatrixBase< Derived > & | m0, |
|
|
const int | n = 1, |
|
|
const Dir | dir = Dir::RowWise ) |
Calculates the n-th discrete difference for sparse matrices along the given axis.
- Parameters
-
| m0 | The input sparse matrix or vector. |
| n | The order of difference (default is 1). |
| dir | The direction to calculate the difference (RowWise or ColumnWise). |
- Returns
- The n-th discrete difference.
Definition at line 65 of file diff.h.