#include <Kokkos_Permutation.hpp>
Public Member Functions | |
Constructors/Destructor | |
Permutation (void) | |
Default constructor. | |
Permutation (OrdinalType length, const OrdinalType *indices) | |
Non-identity permutation constructor. | |
Permutation (const Permutation &source) | |
Copy constructor. | |
virtual | ~Permutation () |
Permutation Destructor. | |
Intialization methods | |
virtual int | initialize (OrdinalType length, const OrdinalType *indices) |
Defines a nontrivial permutation. | |
Computational methods | |
virtual int | apply (const Vector< OrdinalType, ScalarType > &x, Vector< OrdinalType, ScalarType > &y) const |
Returns the result of a Kokkos::Permutation applied to a vector x in y. | |
virtual int | apply (const MultiVector< OrdinalType, ScalarType > &x, MultiVector< OrdinalType, ScalarType > &y) const |
Returns the result of a Kokkos::Permutation applied to multiple vectors in x, results in y. | |
virtual int | applyInverse (const Vector< OrdinalType, ScalarType > &x, Vector< OrdinalType, ScalarType > &y) const |
Returns the result of a Kokkos::Permutation inverse applied to a vector x in y. | |
virtual int | applyInverse (const MultiVector< OrdinalType, ScalarType > &x, MultiVector< OrdinalType, ScalarType > &y) const |
Returns the result of a Kokkos::Permutation inverse applied to multiple vectors in x, results in y. | |
Permutation Attribute access methods | |
virtual OrdinalType | getLength () const |
Length (dimension) of permutation operator. | |
virtual OrdinalType * | getIndices () const |
Pointer to the array of indices, returns 0 if permutation is the identity. | |
virtual bool | getIsIdentity () const |
Returns true if the permutation is the identity, otherwise returns false. | |
Public Attributes | |
bool | isIdentity_ |
bool | dataInitialized_ |
OrdinalType | length_ |
OrdinalType * | indices_ |
The Kokkos::Permutation specifies the interface that any permutation class which is intended for use with the Kokkos::Vector and Kokkos::MultiVector classes must implement.
Formally a permutation is a rearrangement of the rows of the identity matrix. Permutations can applied to the left of a matrix or vector, rearranging the rows or entries, respectively. A permutation can also be applied on the right of a matrix (or a vector tranpose), thereby rearranging the columns of the matrix. Permutations also have the property that the inverse and the transpose are identical.
In this class, the default constructors builds an identity permutation (the identity matrix). Non-identity permutations require the specification of an integer array where the array indices will be interpreted as a left permutation by the apply() method such that if j = indices[i], then row j of the operand becomes row i of the result. They will be interpreted as a left inverse permutation by the applyInverse() methods, in which case row i gets mapped back to row j.
This class is most important as a way for a Kokkos::SparseOperation object to define a row, column or two-sided permutation of the matrix that presumably improves performance of the sparse operation. The Kokkos::SparseOperation object is responsible for producing the left and right permutations objects on demand. In turn, these permutation objects can be used to pre-permute vectors and multivectors so that their ordering is compatible with what is required for the sparse operation.
int Kokkos::Permutation< OrdinalType, ScalarType >::apply | ( | const MultiVector< OrdinalType, ScalarType > & | x, | |
MultiVector< OrdinalType, ScalarType > & | y | |||
) | const [inline, virtual] |
Returns the result of a Kokkos::Permutation applied to multiple vectors in x, results in y.
x | (In) A Kokkos::MultiVector to permute. | |
y | (Out) A Kokkos::MultiVector containing results. |
int Kokkos::Permutation< OrdinalType, ScalarType >::apply | ( | const Vector< OrdinalType, ScalarType > & | x, | |
Vector< OrdinalType, ScalarType > & | y | |||
) | const [inline, virtual] |
Returns the result of a Kokkos::Permutation applied to a vector x in y.
x | (In) A Kokkos::Vector to permute. | |
y | (Out) A Kokkos::Vector containing results. |
int Kokkos::Permutation< OrdinalType, ScalarType >::applyInverse | ( | const MultiVector< OrdinalType, ScalarType > & | x, | |
MultiVector< OrdinalType, ScalarType > & | y | |||
) | const [inline, virtual] |
Returns the result of a Kokkos::Permutation inverse applied to multiple vectors in x, results in y.
x | (In) A Kokkos::MultiVector to permute. | |
y | (Out) A Kokkos::MultiVector containing results. |
int Kokkos::Permutation< OrdinalType, ScalarType >::applyInverse | ( | const Vector< OrdinalType, ScalarType > & | x, | |
Vector< OrdinalType, ScalarType > & | y | |||
) | const [inline, virtual] |
Returns the result of a Kokkos::Permutation inverse applied to a vector x in y.
x | (In) A Kokkos::Vector to permute. | |
y | (Out) A Kokkos::Vector containing results. |
virtual int Kokkos::Permutation< OrdinalType, ScalarType >::initialize | ( | OrdinalType | length, | |
const OrdinalType * | indices | |||
) | [inline, virtual] |
Defines a nontrivial permutation.
Post-construction definition of the permutation. The array indices will be interpreted as a left permutation by the apply() method such that if j = indices[i], then row j of the operand becomes row i of the result.
length | (Out) Dimension of the permutation. | |
indices | (In) An array of OrdinalType values used to define the permutation. |