|
EllAlgo 1.6.13
|
Minimal flat-vector array class replacing xtensor for small optimization problems. More...
#include <cassert>#include <cmath>#include <cstdint>#include <initializer_list>#include <numeric>#include <utility>#include <vector>Go to the source code of this file.
Classes | |
| class | Arr |
| 1D or 2D array backed by std::vector<double> for small optimization problems More... | |
| struct | Range |
| Index range [start, end) with step for slicing views. More... | |
Functions | |
| Arr | view (const Arr &a, const Range &rows, const Range &cols) |
| Extract a submatrix view from a 2D array using Range for rows and cols. | |
| Arr | view (const Arr &a, const Range &rows) |
| Extract a subarray view (1D or 2D) using a single Range. | |
| Arr | zeros (size_t n) |
| Create zero-initialized 1D array of size n. | |
| Arr | zeros (size_t r, size_t c) |
| Create zero-initialized 2D array with r rows, c columns. | |
| Arr | ones (size_t r, size_t c) |
| Create 2D array of ones with r rows, c columns. | |
| Arr | linspace (double start, double end, size_t n) |
| Linearly spaced values from start to end, inclusive. | |
| Arr | arange (double start, double end) |
| Values from start to end-1 with step 1. | |
| Arr | make_same_shape (const Arr &a) |
| Create a zero-initialized Arr with the same shape as input. | |
| Arr | cos (const Arr &a) |
| Element-wise cosine. | |
| Arr | log (const Arr &a) |
| Element-wise natural logarithm. | |
| Arr | abs (const Arr &a) |
| Element-wise absolute value. | |
| Arr | exp (const Arr &a) |
| Element-wise exponential. | |
| Arr | sqrt (const Arr &a) |
| Element-wise square root. | |
| double | sum (const Arr &a) |
| Sum of all elements. | |
| std::vector< Arr > | where (const Arr &condition) |
| Find indices of non-zero elements. | |
| Arr | dot (const Arr &A, const Arr &x) |
| Matrix-vector multiplication. | |
| Arr | outer (const Arr &u, const Arr &v) |
| Outer product of two 1D vectors. | |
| Arr | concatenate (const Arr &a, const Arr &b, int=1) |
| Concatenate two 2D arrays along columns (axis=1) | |
| Arr | operator- (const Arr &a) |
| Unary negation (element-wise) | |
| Arr | operator+ (const Arr &a, const Arr &b) |
| Element-wise addition of two arrays. | |
| Arr | operator- (const Arr &a, const Arr &b) |
| Element-wise subtraction of two arrays. | |
| Arr | operator* (const Arr &a, const Arr &b) |
| Element-wise multiplication of two arrays. | |
| Arr | operator* (double s, const Arr &a) |
| Scalar multiplication (scalar × array) | |
| Arr | operator* (const Arr &a, double s) |
| Scalar multiplication (array × scalar) | |
| Arr | operator/ (const Arr &a, double s) |
| Scalar division (array / scalar) | |
| Arr | operator<= (const Arr &a, double s) |
| Element-wise less-than-or-equal-to comparison with scalar. | |
| Arr | operator>= (const Arr &a, double s) |
| Element-wise greater-than-or-equal-to comparison with scalar. | |
| Arr | operator< (const Arr &a, double s) |
| Element-wise less-than comparison with scalar. | |
| Arr | operator> (const Arr &a, double s) |
| Element-wise greater-than comparison with scalar. | |
| Arr | eval (Arr a) |
| Identity function for Arr (for API compatibility) | |
Variables | |
| constexpr size_t | ALL = Range::ALL |
| Convenience alias for Range::ALL. | |
Minimal flat-vector array class replacing xtensor for small optimization problems.
Supports 1D (vector) and 2D (row-major matrix) with operations needed by ellipsoid-method-based solvers. Not a general-purpose array library.
Values from start to end-1 with step 1.
Concatenate two 2D arrays along columns (axis=1)
| [in] | a | Left 2D array |
| [in] | b | Right 2D array |
Matrix-vector multiplication.
\[ y = A x, \qquad y_i = \sum_{j=1}^{n} A_{ij} x_j \]
| [in] | A | 2D matrix (m × n) |
| [in] | x | 1D vector (n) |
Linearly spaced values from start to end, inclusive.
\[ x_i = x_{\text{start}} + i \cdot \frac{x_{\text{end}} - x_{\text{start}}}{n - 1}, \qquad i = 0, \dots, n-1 \]
| [in] | start | First value |
| [in] | end | Last value |
| [in] | n | Number of points |
Create a zero-initialized Arr with the same shape as input.
Element-wise less-than comparison with scalar.
Element-wise less-than-or-equal-to comparison with scalar.
Element-wise greater-than comparison with scalar.
Element-wise greater-than-or-equal-to comparison with scalar.
Outer product of two 1D vectors.
\[ C = u \otimes v, \qquad C_{ij} = u_i v_j \]
| [in] | u | First 1D vector |
| [in] | v | Second 1D vector |
|
inline |
Find indices of non-zero elements.
| [in] | condition | Input 1D array (non-zero = true) |
Convenience alias for Range::ALL.