Method: NMatrix#sorted_indices
- Defined in:
- lib/nmatrix/nmatrix.rb
#sorted_indices ⇒ Object
call-seq:
sorted_indices -> Array
Returns an array of the indices ordered by value sorted.
899 900 901 902 903 |
# File 'lib/nmatrix/nmatrix.rb', line 899 def sorted_indices return method_missing(:sorted_indices) unless vector? ary = self.to_flat_array ary.each_index.sort_by { |i| ary[i] } # from: http://stackoverflow.com/a/17841159/170300 end |