comparison liboctave/Sparse.cc @ 10703:5eb420d92307

fix sort and nth_element when trailing singleton dim is specified
author Jaroslav Hajek <highegg@gmail.com>
date Mon, 14 Jun 2010 14:53:11 +0200
parents ec3cec8277df
children f7f26094021b
comparison
equal deleted inserted replaced
10702:c49911ab7ac7 10703:5eb420d92307
2048 Sparse<T> m = *this; 2048 Sparse<T> m = *this;
2049 2049
2050 octave_idx_type nr = m.rows (); 2050 octave_idx_type nr = m.rows ();
2051 octave_idx_type nc = m.columns (); 2051 octave_idx_type nc = m.columns ();
2052 2052
2053 if (m.length () < 1) 2053 if (m.length () < 1 || dim > 1)
2054 return m; 2054 return m;
2055 2055
2056 if (dim > 0) 2056 if (dim > 0)
2057 { 2057 {
2058 m = m.transpose (); 2058 m = m.transpose ();
2114 Sparse<T> m = *this; 2114 Sparse<T> m = *this;
2115 2115
2116 octave_idx_type nr = m.rows (); 2116 octave_idx_type nr = m.rows ();
2117 octave_idx_type nc = m.columns (); 2117 octave_idx_type nc = m.columns ();
2118 2118
2119 if (m.length () < 1) 2119 if (m.length () < 1 || dim > 1)
2120 { 2120 {
2121 sidx = Array<octave_idx_type> (dim_vector (nr, nc)); 2121 sidx = Array<octave_idx_type> (dim_vector (nr, nc), 1);
2122 return m; 2122 return m;
2123 } 2123 }
2124 2124
2125 if (dim > 0) 2125 if (dim > 0)
2126 { 2126 {