save -v7 problem

John W. Eaton jwe at octave.org
Fri May 15 10:34:48 CDT 2009


On 13-May-2009, David Bateman wrote:

|     // Create temporary copy of structure contents to avoid multiple
|     // calls of the contents method
|     std::vector<const octave_value *> elts (nf);
|     for (octave_idx_type i = 0; i < nf; i++)
|       elts[i] = m.contents (keys(i)).fortran_vec ();
| 
|     for (octave_idx_type j = 0; j < len; j++)
|       {
|         // write the data of each element
| 
|         // Iterating over the list of keys will preserve the order
|         // of the fields.
|         for (octave_idx_type i = 0; i < nf; i++)
|           {
|         bool retval2 = save_mat5_binary_element (os, elts[i][j], "",
|                              mark_as_global,
|                              false,
|                              save_as_floats);
|         if (! retval2)
|           goto error_cleanup;
|           }
|       }
| 
| basically doubles the speed, but the O(n^2) speed remains. I used a 
| const octave_value* vector to avoid any potential issues with boundary 
| checking in the above.. For the life of me I can't see where the remain 
| O(n^2) dependency is in the above code.. Maybe someone else might see 
| where the issue is..

I checked in the following change, which I think mostly solves the
problem.

  http://hg.savannah.gnu.org/hgweb/octave/rev/a542fc158175

Thanks,

jwe


More information about the Bug-octave mailing list