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;
}
Definition at line 108 of file permutation_matrix.h.
#include <permutation_matrix.h>
template<typename IndexType, typename MemorySpace>
template<typename IndexType, typename MemorySpace>
template<typename IndexType, typename MemorySpace>
template<typename MemorySpace2 >
Construct a permutation_matrix
from another matrix.
- Template Parameters
-
MemorySpace2 | Memory space of the input matrix |
- Parameters
-
matrix | Another sparse or dense matrix. |
Definition at line 160 of file permutation_matrix.h.
template<typename IndexType, typename MemorySpace>
template<typename ArrayType >
Construct a permutation_matrix
from another matrix.
- Template Parameters
-
ArrayType | permutation array type |
- Parameters
-
num_rows | Number of rows. |
permutation | Array containing the permutation indices. |
Definition at line 171 of file permutation_matrix.h.
template<typename IndexType, typename MemorySpace>
Resize matrix dimensions and underlying storage
- Parameters
-
template<typename IndexType, typename MemorySpace>
template<typename IndexType, typename MemorySpace>
template<typename MatrixType >
Permute rows and columns of matrix elements
- Template Parameters
-
MatrixType | Type of input matrix to permute |
- Parameters
-
matrix | Input matrix to apply symmetric permutation. |
template<typename IndexType, typename MemorySpace>