るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
13件ヒット [1-13件を表示] (0.028秒)

別のキーワード

  1. matrix find_index
  2. matrix []
  3. matrix map
  4. matrix *

クラス

キーワード

検索結果

Matrix#index(selector = :all) -> Enumerator (105433.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 (105433.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 (105433.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 (69433.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 (69433.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 (69433.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 (69403.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 (69403.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(which = :all) -> Enumerator (51115.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...

Matrix#each(which = :all) {|e| ... } -> self (51115.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...

絞り込み条件を変える

Vector#[]=(index, value) (24427.0)

index 番目の要素を 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...

Vector.basis(size:, index:) -> Vector (24412.0)

size 次元ベクトル空間の index 番目の標準基底を返します。

...size 次元ベクトル空間の index 番目の標準基底を返します。

//emlist[例][ruby]{
require 'matrix'
Vector.basis(size: 3, index: 1) # => Vector[0, 1, 0]
//}

@param size ベクトルの次元
@param index 標準基底の何番目か。0 origin...

Vector#[]=(range, v) (24112.0)

Range オブジェクト range の範囲にある要素を v の内容に置換します。

...を Range オブジェクトで指定します。
@param v range の範囲に設定したい要素を指定します。
Vector や 1行の Matrix での指定もできます。
@raise TypeError ベクトルの範囲外にある range を指定したときに、発生します。
@raise Argu...
...@raise Matrix::ErrDimensionMismatch v に Matrix を指定し、次元が合わないときに発生します。

//emlist[][ruby]{
require 'matrix'

v = Vector[0, 0, 0, 0, 0]

v[1..2] = 5
p v #=> Vector[0, 5, 5, 0, 0]

v[1..3] = Vector[2, 4, 8]
p v #=> Vector[0, 2, 4, 8, 0]

v[1..-2] = Matrix[[3, 6...