Creates a constant (immutable) Permutation matrix from a constant array.
Friends
class
EnablePolymorphicObject< Permutation, LinOp >
Detailed Description
template<typename IndexType = int32>
class gko::matrix::Permutation< IndexType >
Permutation is a matrix format that represents a permutation matrix, i.e.
a matrix where each row and column has exactly one entry. The matrix can only be applied to Dense inputs, where it represents a row permutation: means .
Composes this permutation with another permutation.
The resulting permutation fulfills result[i] = this[other[i]] or result = other * this from the matrix perspective, which is equivalent to first permuting by this and then by other: Combining permutations and with P = P_1.combine(P_2) performs the operation permute(A, P) = permute(permute(A, P_1), P_2).
If permutation_indices is not an rvalue, not an array of IndexType, or is on the wrong executor, an internal copy will be created, and the original array data will not be used in the matrix.
Creates a constant (immutable) Permutation matrix from a constant array.
Parameters
exec
the executor to create the matrix on
size
the size of the square matrix
perm_idxs
the permutation index array of the matrix
enabled_permute
the mask describing the type of permutation
Returns
A smart pointer to the constant matrix wrapping the input array (if it resides on the same executor as the matrix) or a copy of the array on the correct executor.
Creates a constant (immutable) Permutation matrix from a constant array.
Parameters
exec
the executor to create the matrix on
size
the size of the square matrix
perm_idxs
the permutation index array of the matrix
enabled_permute
the mask describing the type of permutation
Returns
A smart pointer to the constant matrix wrapping the input array (if it resides on the same executor as the matrix) or a copy of the array on the correct executor.
This is the constant version of the function, which can be significantly more memory efficient than the non-constant version, so always prefer this version.