|
| | PIMathMatrix (const uint cols=0, const uint rows=0, const Type &f=Type()) |
| | Constructor of class PIMathMatrix, which creates a matrix. More...
|
| |
| | PIMathMatrix (const uint cols, const uint rows, const PIVector< Type > &val) |
| | Constructor of class PIMathMatrix, which creates a matrix. More...
|
| |
| | PIMathMatrix (const PIVector< PIVector< Type > > &val) |
| | Constructor of class PIMathMatrix, which creates a matrix. More...
|
| |
| | PIMathMatrix (const PIVector2D< Type > &val) |
| | Constructor of class PIMathMatrix, which creates a matrix. More...
|
| |
| PIMathMatrix< Type > & | setCol (uint index, const PIMathVector< Type > &v) |
| | Set the selected column in matrix. More...
|
| |
| PIMathMatrix< Type > & | setRow (uint index, const PIMathVector< Type > &v) |
| | Set the selected row in matrix. More...
|
| |
| PIMathMatrix< Type > & | swapCols (uint r0, uint r1) |
| | Method which swaps selected columns in a matrix. More...
|
| |
| PIMathMatrix< Type > & | swapRows (uint c0, uint c1) |
| | Method which replace selected rows in a matrix. More...
|
| |
| PIMathMatrix< Type > & | fill (const Type &v) |
| | Method which fills the matrix with selected value. More...
|
| |
| bool | isSquare () const |
| | Method which checks if matrix is square. More...
|
| |
| bool | isIdentity () const |
| | Method which checks if main diagonal of matrix consists of ones and another elements are zeros. More...
|
| |
| bool | isNull () const |
| | Method which checks if every elements of matrix are zeros. More...
|
| |
| bool | isValid () const |
| | Method which checks if matrix is empty. More...
|
| |
| void | operator+= (const PIMathMatrix< Type > &sm) |
| | Addition assignment with matrix sm. More...
|
| |
| void | operator-= (const PIMathMatrix< Type > &sm) |
| | Subtraction assignment with matrix sm. More...
|
| |
| void | operator*= (const Type &v) |
| | Multiplication assignment with value v. More...
|
| |
| void | operator/= (const Type &v) |
| | Division assignment with value v. More...
|
| |
| PIMathMatrix< Type > | operator- () const |
| | Negation operation. More...
|
| |
| PIMathMatrix< Type > | operator+ (const PIMathMatrix< Type > &sm) const |
| | Matrix addition. More...
|
| |
| PIMathMatrix< Type > | operator- (const PIMathMatrix< Type > &sm) const |
| | Matrix substraction. More...
|
| |
| PIMathMatrix< Type > | operator* (const Type &v) const |
| | Matrix multiplication. More...
|
| |
| PIMathMatrix< Type > | operator/ (const Type &v) const |
| | Matrix division. More...
|
| |
| Type | determinant (bool *ok=0) const |
| | ​Calculate Determinant of the matrix. More...
|
| |
| Type | trace () const |
| | Calculate the trace of a matrix. More...
|
| |
| PIMathMatrix< Type > & | toUpperTriangular (bool *ok=0) |
| | Transforming matrix to upper triangular. More...
|
| |
| PIMathMatrix< Type > & | invert (bool *ok=0, PIMathVector< Type > *sv=0) |
| | Matrix inversion operation. More...
|
| |
| PIMathMatrix< Type > | inverted (bool *ok=0) const |
| | Matrix inversion operation. More...
|
| |
| PIMathMatrix< Type > | transposed () const |
| | Matrix transposition operation. More...
|
| |
| | PIVector2D () |
| | Constructs an empty 2D array. No memory is allocated. After this constructor, rows() and cols() return 0, and isEmpty() returns true. More...
|
| |
| | PIVector2D (size_t rows, size_t cols, const Type &f=Type()) |
| | Constructs a 2D array with the given dimensions, filled with copies of f. The underlying storage is a single contiguous block of memory of size rows * cols. All elements are initialized with the value f. More...
|
| |
| | PIVector2D (size_t rows, size_t cols, const PIVector< Type > &v) |
| | Constructs a 2D array from an existing 1D vector, reshaping it. The constructor copies the data from v into the internal flat vector. If v is larger than rows * cols, the excess elements are ignored (the vector is truncated). If v is smaller, other values filled whith default cunstructor T() More...
|
| |
| | PIVector2D (size_t rows, size_t cols, PIVector< Type > &&v) |
| | Move constructs a 2D array from an existing 1D vector, reshaping it. The data is moved from v into the internal flat vector, avoiding a copy. After construction, v is left in a valid but unspecified state. More...
|
| |
|
| PIVector2D (const PIVector< PIVector< Type > > &v) |
| | Constructs a 2D array from a vector of vectors (jagged array). Assumes all inner vectors have the same size. If the input is empty, the constructed array is also empty. Otherwise, the number of columns is taken from the size of the first inner vector. All inner vectors are concatenated in the internal flat storage.
|
| |
| size_t | rows () const |
| | Returns the number of rows in the 2D array. The result is always non-negative. If the array is empty, returns 0. More...
|
| |
| size_t | cols () const |
| | Returns the number of columns in the 2D array. The result is always non-negative. If the array is empty, returns 0. More...
|
| |
| size_t | size () const |
| | Returns the total number of elements (rows * cols). This is equivalent to the size of the underlying flat vector. More...
|
| |
| ssize_t | size_s () const |
| | Returns the total number of elements as a signed value. More...
|
| |
| size_t | length () const |
| | Returns the total number of elements (same as size()). More...
|
| |
|
size_t | capacity () const |
| | Returns the number of elements that the underlying container has currently allocated space for. This value may be larger than size(). It indicates how many elements can be added before a reallocation is needed.
|
| |
| bool | isEmpty () const |
| | Checks if the array has no elements. An empty array has both rows and columns equal to 0. More...
|
| |
| bool | isNotEmpty () const |
| | Checks if the array has at least one element. More...
|
| |
| Type & | element (size_t row, size_t col) |
| | Returns a reference to the element at the given row and column. No bounds checking is performed. More...
|
| |
|
const Type & | element (size_t row, size_t col) const |
| | Returns a const reference to the element at the given row and column.
|
| |
|
Type & | element (const Index &idx) |
| | Returns a reference to the element at the given Index.
|
| |
|
const Type & | element (const Index &idx) const |
| | Returns a const reference to the element at the given Index.
|
| |
|
const Type & | at (size_t row, size_t col) const |
| | Returns a const reference to the element at the given row and column No bounds checking is performed.
|
| |
|
const Type & | at (const Index &idx) const |
| | Returns a const reference to the element at the given Index (bounds-checked only in debug).
|
| |
|
Type & | operator[] (const Index &idx) |
| | Returns a reference to the element at the given Index.
|
| |
|
const Type & | operator[] (const Index &idx) const |
| | Returns a const reference to the element at the given Index.
|
| |
| Row | operator[] (size_t index) |
| | Returns a proxy object for the row at the given index for modification. More...
|
| |
|
RowConst | operator[] (size_t index) const |
| | Returns a proxy object for the row at the given index for read-only access.
|
| |
| Type * | data (size_t index=0) |
| | Returns a pointer to the underlying flat data starting at an optional offset. More...
|
| |
|
const Type * | data (size_t index=0) const |
| | Returns a const pointer to the underlying flat data starting at an optional offset.
|
| |
| Row | row (size_t index) |
| | Returns a proxy object for the row at the given index for modification. More...
|
| |
|
RowConst | row (size_t index) const |
| | Returns a proxy object for the row at the given index for read-only access.
|
| |
| Col | col (size_t index) |
| | Returns a proxy object for the column at the given index for modification. More...
|
| |
|
ColConst | col (size_t index) const |
| | Returns a proxy object for the column at the given index for read-only access.
|
| |
|
PIVector2D< Type > & | setRow (size_t row, const RowConst &other) |
| | Replaces a row with the contents of a read-only RowConst object.
|
| |
|
PIVector2D< Type > & | setRow (size_t row, const PIVector< Type > &other) |
| | Replaces a row with the contents of a PIVector.
|
| |
| PIVector2D< Type > & | addRow (const RowConst &other) |
| | Appends a new row to the bottom of the array from another Row object. If the array was empty, its column count is set to the size of the source row. Otherwise, only min(cols(), other.size()) elements are copied; the rest of the new row is default-initialized. More...
|
| |
|
PIVector2D< Type > & | addRow (const PIVector< Type > &other) |
| | Appends a new row to the bottom of the array from a PIVector.
|
| |
| PIVector2D< Type > & | appendRows (size_t count, const Type &f=Type()) |
| | Appends count new empty rows to the bottom of the array, filled with value f. If the array was empty (no columns defined), the column count is set to 1. The new rows are filled with the default value f. More...
|
| |
| PIVector2D< Type > & | appendColumns (size_t count, const Type &f=Type()) |
| | Appends count new empty columns to the end of each row of the array. If the array was empty (rows not defined), the array becomes a single row with count columns. If the array already has rows, new elements are inserted at the end of each existing row. More...
|
| |
| PIVector2D< Type > & | deleteRows (size_t row_start, size_t count) |
| | Deletes count rows starting from the specified row index. Removes the specified rows from the array and updates the row count. If all elements are deleted (array becomes empty), both rows and columns are set to 0. More...
|
| |
| PIVector2D< Type > & | deleteColumns (size_t col_start, size_t count) |
| | Removes the specified columns from the array and updates the column count. Removes count columns starting from col_start. If col_start is out of range or count is 0, the function does nothing. If count extends beyond the last column, only available columns are deleted. More...
|
| |
|
PIVector2D< Type > & | addColumn (const ColConst &other) |
| | Appends a new column to the right of the array from a ColConst.
|
| |
|
PIVector2D< Type > & | addColumn (const PIVector< Type > &other) |
| | Appends a new column to the right of the array from a PIVector.
|
| |
| PIVector2D< Type > & | resize (size_t rows, size_t cols, const Type &f=Type()) |
| | Resizes the 2D array to new dimensions. If the new dimensions are larger, new elements are appended and filled with copies of f. If they are smaller, the array is truncated (excess elements are destroyed). The underlying memory may be reallocated. More...
|
| |
| bool | operator== (const PIVector2D< Type > &t) const |
| | Equality operator. More...
|
| |
|
bool | operator!= (const PIVector2D< Type > &t) const |
| | Inequality operator.
|
| |
| PIVector< PIVector< Type > > | toVectors () const |
| | Converts the 2D array to a vector of vectors (PIVector<PIVector<T>>). Each row vector is a copy of the corresponding row. More...
|
| |
|
const PIVector< Type > & | asPlainVector () const |
| | Returns a const reference to the underlying flat PIVector.
|
| |
|
PIVector< Type > & | asPlainVector () |
| | Returns a reference to the underlying flat PIVector.
|
| |
|
PIVector< Type > | toPlainVector () const |
| | Returns a copy of the underlying flat PIVector.
|
| |
| void | swap (PIVector2D< Type > &other) |
| | Swaps this 2D array with another. Swaps the flat vectors and the dimension members. Very fast, no memory allocation. More...
|
| |
| void | clear () |
| | Clears the array, removing all elements and setting dimensions to 0. The capacity of the underlying flat vector may remain unchanged. More...
|
| |
| bool | contains (const Type &e) const |
| | Checks if the underlying flat vector contains the element e. More...
|
| |
| int | entries (const Type &e) const |
| | Counts occurrences of e in the underlying flat vector. More...
|
| |
| int | entries (std::function< bool(const Type &e)> test) const |
| | Counts elements in the flat vector that pass the test. More...
|
| |
| Index | indexOf (const Type &e) const |
| | Returns the first index (row, col) of e in the 2D array. More...
|
| |
| Index | indexWhere (std::function< bool(const Type &e)> test, ssize_t start=0) const |
| | Returns the first index (row, col) in the 2D array that passes the test. More...
|
| |
| Index | lastIndexOf (const Type &e, ssize_t start=-1) const |
| | Returns the last index (row, col) of e in the 2D array. More...
|
| |
| Index | lastIndexWhere (std::function< bool(const Type &e)> test, ssize_t start=-1) const |
| | Returns the last index (row, col) in the 2D array that passes the test. More...
|
| |
| bool | any (std::function< bool(const Type &e)> test) const |
| | Tests if any element in the flat vector passes the test. More...
|
| |
| bool | every (std::function< bool(const Type &e)> test) const |
| | Tests if all elements in the flat vector pass the test. More...
|
| |
| PIVector2D< Type > & | fill (const Type &e=Type()) |
| | Fills the entire 2D array with copies of e. More...
|
| |
| PIVector2D< Type > & | fill (std::function< Type(size_t i)> f) |
| | Fills the entire 2D array using a generator function f based on flat index. More...
|
| |
|
PIVector2D< Type > & | assign (const Type &e=Type()) |
| | Same as fill().
|
| |
| PIVector2D< Type > & | assign (size_t rows, size_t cols, const Type &f=Type()) |
| | Assigns new size and fills with value. More...
|
| |
|
PIVector2D< Type > | transposed () const |
| | Returns a transposed 2D array (rows become columns and vice versa). The element at (r, c) in the original becomes at (c, r) in the result.
|
| |
| PIVector2D< Type > & | reverseRows () |
| | Reverses the order of rows in place. More...
|
| |
| PIVector2D< Type > & | reverseColumns () |
| | Reverses the order of columns in each row in place. More...
|
| |
| PIVector2D< Type > | getRange (size_t rowStart, size_t rowCount, size_t colStart, size_t colCount) const |
| | Returns a sub-2D array (a range of rows and columns). If the range exceeds the array boundaries, it is clipped. If rowCount or colCount is 0, an empty array is returned. More...
|
| |
| PIVector2D< ST > | map (std::function< ST(const Type &e)> f) const |
| | Applies a function to each element and returns a new 2D array of a different type. The original array is not modified. More...
|
| |
| PIVector2D< ST > | mapIndexed (std::function< ST(size_t row, size_t col, const Type &e)> f) const |
| | Applies a function (with row and col indices) to each element and returns a new 2D array. More...
|
| |
| PIVector2D< Type > & | forEachRow (std::function< void(Row)> f) |
| | Applies a function to each row (modifiable). More...
|
| |
|
void | forEachRow (std::function< void(RowConst)> f) const |
| | Applies a function to each row (read-only).
|
| |
|
PIVector2D< Type > & | forEachColumn (std::function< void(Col)> f) |
| | Applies a function to each column (modifiable).
|
| |
|
void | forEachColumn (std::function< void(ColConst)> f) const |
| | Applies a function to each column (read-only).
|
| |
| ST | reduce (std::function< ST(const Type &e, const ST &acc)> f, const ST &initial=ST()) const |
| | Accumulates a value across all elements. More...
|
| |
| ST | reduceIndexed (std::function< ST(size_t row, size_t col, const Type &e, const ST &acc)> f, const ST &initial=ST()) const |
| | Accumulates a value across all elements with indices. More...
|
| |
| PIVector2D< Type > & | removeRow (size_t row) |
| | Removes a row from the 2D array. If the last row is removed and the array becomes empty, cols() is set to 0. More...
|
| |
| PIVector2D< Type > & | removeColumn (size_t col) |
| | Removes a column from the 2D array. This operation is more expensive than removing a row because elements must be moved. More...
|
| |
| PIVector2D< Type > & | removeRowsWhere (std::function< bool(const RowConst &)> test) |
| | Removes all rows that satisfy a condition. Rows are removed from the bottom to avoid index shifting issues. More...
|
| |
| PIVector2D< Type > & | removeColumnsWhere (std::function< bool(const ColConst &)> test) |
| | Removes all columns that satisfy a condition. More...
|
| |
| PIVector2D< Type > | filterRows (std::function< bool(const RowConst &)> test) const |
| | Returns a new 2D array containing only the rows that pass the test. More...
|
| |
| PIVector2D< Type > | filterColumns (std::function< bool(const ColConst &)> test) const |
| | Returns a new 2D array containing only the columns that pass the test. More...
|
| |