キーワード
- []= (12)
- each (22)
-
each
_ with _ index (22) -
find
_ index (33)
検索結果
先頭5件
- Matrix
# index(selector = :all) -> Enumerator - Matrix
# index(selector = :all) {|e| . . . } -> [Integer , Integer] | nil - Matrix
# index(value , selector = :all) -> [Integer , Integer] | nil - Matrix
# find _ index(selector = :all) -> Enumerator - Matrix
# find _ index(selector = :all) {|e| . . . } -> [Integer , Integer] | nil
-
Matrix
# index(selector = :all) -> Enumerator (18121.0) -
指定した値と一致する要素の位置を [row, column] という配列で返します。 ブロックを与えた場合は各要素を引数としてブロックを呼び出し、 返り値が真であった要素の位置を返します。
...どの部分を探すかを指定します。この引数の意味は
Matrix#each を参照してください。
//emlist[例][ruby]{
require 'matrix'
Matrix[ [1,2], [3,4] ].index(&:even?) # => [0, 1]
Matrix[ [1,1], [1,1] ].index(1, :strict_lower) # => [1, 0]
//}
value を指定せず、さらに... -
Matrix
# index(selector = :all) {|e| . . . } -> [Integer , Integer] | nil (18121.0) -
指定した値と一致する要素の位置を [row, column] という配列で返します。 ブロックを与えた場合は各要素を引数としてブロックを呼び出し、 返り値が真であった要素の位置を返します。
...どの部分を探すかを指定します。この引数の意味は
Matrix#each を参照してください。
//emlist[例][ruby]{
require 'matrix'
Matrix[ [1,2], [3,4] ].index(&:even?) # => [0, 1]
Matrix[ [1,1], [1,1] ].index(1, :strict_lower) # => [1, 0]
//}
value を指定せず、さらに... -
Matrix
# index(value , selector = :all) -> [Integer , Integer] | nil (18121.0) -
指定した値と一致する要素の位置を [row, column] という配列で返します。 ブロックを与えた場合は各要素を引数としてブロックを呼び出し、 返り値が真であった要素の位置を返します。
...どの部分を探すかを指定します。この引数の意味は
Matrix#each を参照してください。
//emlist[例][ruby]{
require 'matrix'
Matrix[ [1,2], [3,4] ].index(&:even?) # => [0, 1]
Matrix[ [1,1], [1,1] ].index(1, :strict_lower) # => [1, 0]
//}
value を指定せず、さらに... -
Matrix
# find _ index(selector = :all) -> Enumerator (6121.0) -
指定した値と一致する要素の位置を [row, column] という配列で返します。 ブロックを与えた場合は各要素を引数としてブロックを呼び出し、 返り値が真であった要素の位置を返します。
...どの部分を探すかを指定します。この引数の意味は
Matrix#each を参照してください。
//emlist[例][ruby]{
require 'matrix'
Matrix[ [1,2], [3,4] ].index(&:even?) # => [0, 1]
Matrix[ [1,1], [1,1] ].index(1, :strict_lower) # => [1, 0]
//}
value を指定せず、さらに... -
Matrix
# find _ index(selector = :all) {|e| . . . } -> [Integer , Integer] | nil (6121.0) -
指定した値と一致する要素の位置を [row, column] という配列で返します。 ブロックを与えた場合は各要素を引数としてブロックを呼び出し、 返り値が真であった要素の位置を返します。
...どの部分を探すかを指定します。この引数の意味は
Matrix#each を参照してください。
//emlist[例][ruby]{
require 'matrix'
Matrix[ [1,2], [3,4] ].index(&:even?) # => [0, 1]
Matrix[ [1,1], [1,1] ].index(1, :strict_lower) # => [1, 0]
//}
value を指定せず、さらに... -
Matrix
# find _ index(value , selector = :all) -> [Integer , Integer] | nil (6121.0) -
指定した値と一致する要素の位置を [row, column] という配列で返します。 ブロックを与えた場合は各要素を引数としてブロックを呼び出し、 返り値が真であった要素の位置を返します。
...どの部分を探すかを指定します。この引数の意味は
Matrix#each を参照してください。
//emlist[例][ruby]{
require 'matrix'
Matrix[ [1,2], [3,4] ].index(&:even?) # => [0, 1]
Matrix[ [1,1], [1,1] ].index(1, :strict_lower) # => [1, 0]
//}
value を指定せず、さらに... -
Matrix
# each _ with _ index(which = :all) -> Enumerator (6111.0) -
行列の各要素をその位置とともに引数としてブロックを呼び出します。
...囲を指定することができます。
Matrix#each と同じなのでそちらを参照してください。
ブロックを省略した場合、 Enumerator を返します。
//emlist[例][ruby]{
require 'matrix'
Matrix[ [1,2], [3,4] ].each_with_index do |e, row, col|
puts "#{e} at #{row},......#{col}"
end
# => 1 at 0, 0
# => 2 at 0, 1
# => 3 at 1, 0
# => 4 at 1, 1
//}
@param which どの要素に対してブロックを呼び出すのかを Symbol で指定します
@see Matrix#each... -
Matrix
# each _ with _ index(which = :all) {|e , row , col| . . . } -> self (6111.0) -
行列の各要素をその位置とともに引数としてブロックを呼び出します。
...囲を指定することができます。
Matrix#each と同じなのでそちらを参照してください。
ブロックを省略した場合、 Enumerator を返します。
//emlist[例][ruby]{
require 'matrix'
Matrix[ [1,2], [3,4] ].each_with_index do |e, row, col|
puts "#{e} at #{row},......#{col}"
end
# => 1 at 0, 0
# => 2 at 0, 1
# => 3 at 1, 0
# => 4 at 1, 1
//}
@param which どの要素に対してブロックを呼び出すのかを Symbol で指定します
@see Matrix#each... -
Vector
# []=(index , value) (132.0) -
index 番目の要素を value に変更します。
...
index 番目の要素を value に変更します。
@param index インデックスを整数で指定します。
@param value 設定したい要素の値を指定します。
@raise TypeError ベクトルの範囲外にある整数を指定したときに、発生します。
//emlist[][ruby]{......require 'matrix'
v = Vector[0, 0, 0, 0, 0]
v[1] = 2
p v #=> Vector[0, 2, 0, 0, 0]
v[-1] = 3
p v #=> Vector[0, 2, 0, 0, 3]
v[99] = 100
# IndexError: given index 99 is outside of -5...5
//}... -
Matrix
# each(which = :all) -> Enumerator (9.0) -
行列の各要素を引数としてブロックを呼び出します。
...uby]{
require 'matrix'
Matrix[ [1,2], [3,4] ].each { |e| puts e }
# => prints the numbers 1 to 4
Matrix[ [1,2], [3,4] ].each(:strict_lower).to_a # => [3]
//}
@param which どの要素に対してブロックを呼び出すのかを Symbol で指定します
@see Matrix#each_with_index, Matrix#map...