Get the values of a matrix row and assign them to a vector.
BOOL GetRow( vectorbase & vb, UINT wIndexRow )
Returns TRUE on success and FALSE on failure.
EX1
// Get a vector from a matrix row void matrixbase_GetRow_ex1() { matrix<double> mat1 = { {1, 1, 1, 1}, {2, 4, 6, 8}, {3, 6, 9, 12} }; MatrixPage MatPg1; MatPg1.Create("Origin"); MatrixLayer MatLy1 = MatPg1.Layers(0); Matrix Mat1(MatLy1); Mat1 = mat1; printf(" The input matrix is %s.\n",Mat1.GetName()); vector v; int ii; int rc=Mat1.GetRow(v, 1); // Get 2nd row(as the index starts 0) of Mat1 into v if(!rc) printf(" Error: GetRow failed.\n"); else { printf(" The gotten vector from 2nd row is:\n"); for(ii = 0; ii < v.GetSize(); ii++) // Output cast elements of vectors printf("\t%g",v[ii]); printf("\n"); } }
Get the values of a matrix row and assign them to a vector. The row is specified by a 0 based row index. If the matrix row and vector do not have the same size then the vector is dynamically resized.
matrixbase::SetRow, matrixbase::GetColumn, matrixbase::SetColumn, matrixbase::GetAsVector, matrixbase::SetByVector
origin.h