Project

General

Profile

Feature #2831

Matrix: each, all?, none?, each_with_index, ....

Added by marcandre (Marc-Andre Lafortune) over 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Target version:
[ruby-core:28400]

Description

=begin
There is Matrix#collect, but it would be useful to have Matrix#each and include Enumerable.

All methods that return anything else than an array are completely natural: Matrix#all?, Matrix#any?, Matrix#count, Matrix#none?, etc...

Others can be left alone or undefined (#sort, #drop, ...)

Matrix#each_with_index should go over all values, and yield value, row and column

Currently, some basic operations are quite a bit more difficult than they could be. An example: to check if a matrix is composed of Integer:

# Currently, need to build an intermediate array
m = Matrix[...]
integral = m.row_vectors.all? do |row|
row.all? &:integer?
end
# Could be
integral = m.all? &:integer?

I'll gladly provide precisions on each method and make a patch.
=end

History

#1

Updated by marcandre (Marc-Andre Lafortune) over 9 years ago

  • Assignee changed from keiju (Keiju Ishitsuka) to marcandre (Marc-Andre Lafortune)

=begin

=end

#2

Updated by marcandre (Marc-Andre Lafortune) over 9 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r27158.
Marc-Andre, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Also available in: Atom PDF