rows [MTL Home] Programmers Guide
  Contents | Index |  Search 


Category:containers Component type:function
Prototype
template<class Matrix>
rows_type<Matrix>::type rows(const Matrix& A) ;
Description
For matrix A, A[i] now gives you the ith row and A.begin() gives you an iterator over rows
Definition
matrix_implementation.h
Preconditions
Complexity
Example
In swap_rows.cc:
  typedef matrix< double,
                  rectangle<>, 
                  dense<external>,
                  column_major>::type Matrix; 
  const Matrix::size_type N = 3;
  Matrix::size_type large;
  double dA[] = { 1, 3, 2, 1.5, 2.5, 3.5, 4.5, 9.5, 5.5 };
  Matrix A(dA, N, N);
  //  Find the largest element in column 1.
  large = max_index(A[0]);
  // Swap the first row with the row containing the largest
  // element in column 1.
  swap( rows(A)[0] , rows(A)[large]);

Notes
See also

[MTL Home] Copyright © 1998,1999 University of Notre Dame. All Rights Reserved.