【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.2.3.9.53 matrixbase::ReorderColWise
Contents
Description
rearrange the matrix in column-wise according to the given indices
Syntax
BOOL ReorderColWise( const vector<UINT> & vnIndices, int nR1 = 0, int nC2 = -1 )
Parameters
- vnIndices
- [input] array of column index to reorder
- nR1
- [input] 1st row index to reorder
- nC2
- [input] last row index to reorder, use -1 to indicate the last row in matrix
Return
Returns TRUE on successful exit or FALSE on failure.
Examples
EX1
void ReorderColWise_ex() { BOOL rc; matrix mat1 = { {1, 2, 6, 9}, {2, 5, 4, 11}, {3, 7, 2, 12}, {4, 0, 4, 8}, {5, 2, 3, 10}, {6, 1, 0, 7} }; vector<UINT> vOrders = {3, 0, 1, 2}; MatrixPage MatPg1; MatPg1.Create("Origin"); MatrixLayer MatLy1 = MatPg1.Layers(0); Matrix Mat1(MatLy1); Mat1 = mat1; printf(" Original matrix is %s.\n",Mat1.GetName()); MatrixPage MatPg2; MatPg2.Create("Origin"); MatrixLayer MatLy2 = MatPg2.Layers(0); Matrix Mat2(MatLy2); Mat2 = mat1; rc=Mat2.ReorderColWise(vOrders, 0, 1); //Reordering columns based on the vOrders vector, only reorder the first 2 rows if(!rc) printf(" Error: fail.\n"); else printf(" Reordered matrix is %s.\n",Mat2.GetName()); }
Remark
See Also
Header to Include
origin.h