title: Finding the index of the maximum element in c++ matrix?
body: <p>I am translating a python(sage) program into a C++ program.</p>
  
  <p>I need to write a function manipulates matrices, and I need to find the <strong>index</strong> of the largest element in the matrix.</p>
  
  <p>I want to do this as efficiently as possible, but the only thing I came up with so far seems quite inefficient.</p>
  
  <p>The pseudo-code for my algorithm is,</p>
  
  <ol>
  <li>Given a matrix, call max_element function in each row</li>
  <li>Create a vector and push_back the iterators returned from max_element</li>
  <li>Dereferencing the iterators, call max_element function once more</li>
  <li>Find the index of column</li>
  <li>Find the index of row</li>
  </ol>
  
  <p>This will be very messy and slow..
  Does anyone have a better algorithm to do this task?
  Thank you.</p>