template<typename IndexType, typename MemorySpace>
class cusp::permutation_matrix< IndexType, MemorySpace >
Simple representation a permutation matrix.
- Template Parameters
-
| IndexType | Type used for matrix indices (e.g. int). |
| MemorySpace | A memory space (e.g. cusp::host_memory or cusp::device_memory) |
- Overview
- This matrix represents a row permutation of the identity matrix.
- Example
- The following code snippet demonstrates how to create a 3-by-3
permutation_matrix on the host with 3 nonzeros and permutes a coo_matrix by first by row and then by column.
int main()
{
typedef cusp::host_memory MemorySpace;
A.row_indices[0] = 0; A.column_indices[0] = 0; A.values[0] = 10;
A.row_indices[1] = 0; A.column_indices[1] = 1; A.values[1] = 20;
A.row_indices[2] = 0; A.column_indices[2] = 2; A.values[2] = 30;
A.row_indices[3] = 1; A.column_indices[3] = 0; A.values[3] = 40;
A.row_indices[4] = 1; A.column_indices[4] = 1; A.values[4] = 50;
A.row_indices[5] = 2; A.column_indices[5] = 0; A.values[5] = 60;
A.row_indices[6] = 2; A.column_indices[6] = 2; A.values[6] = 70;
}
The array1d class is a 1D vector container that may contain elements stored in "host" or "device" mem...
The array2d class is a 2D vector container that may contain elements stored in "host" or "device" mem...
Coordinate (COO) representation a sparse matrix.
Simple representation a permutation matrix.
permutation_array_type permutation
Coordinate matrix format.
void print(const Printable &p)
print a textual representation of an object
void multiply(const LinearOperator &A, const MatrixOrVector1 &B, MatrixOrVector2 &C)
Implements matrix-matrix and matrix-vector multiplication.
Print textual representation of an object.
Definition at line 108 of file permutation_matrix.h.