るりまサーチ

最速Rubyリファレンスマニュアル検索!
99件ヒット [1-99件を表示] (0.086秒)
トップページ > クエリ:l[x] > クエリ:>[x] > クエリ:permutation[x]

別のキーワード

  1. lupdecomposition l
  2. kernel $-l
  3. matrix l
  4. _builtin $-l
  5. l matrix

ライブラリ

クラス

キーワード

検索結果

Array#permutation(n = self.length) { |p| block } -> self (18456.0)

サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。

...合に発生します。

//emlist[例][ruby]{
a = [1, 2, 3]
a.permutation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(1).to_a #=> [[1],[2],[3]]
a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3...
....to_a #=> [[]]: one permutation of length 0
a.permutation(4).to_a #=> [] : no permutations of length 4
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a...
....permutation(2) {|e| result << e} # => [1,2,3]
result # => [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
//}

@see Array#combination, Array#repeated_permutation...

Array#permutation(n = self.length) -> Enumerator (18356.0)

サイズ n の順列をすべて生成し,それを引数としてブロックを実行します。

...合に発生します。

//emlist[例][ruby]{
a = [1, 2, 3]
a.permutation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]
a.permutation(1).to_a #=> [[1],[2],[3]]
a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3...
....to_a #=> [[]]: one permutation of length 0
a.permutation(4).to_a #=> [] : no permutations of length 4
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a...
....permutation(2) {|e| result << e} # => [1,2,3]
result # => [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]
//}

@see Array#combination, Array#repeated_permutation...

Array#repeated_permutation(n) { |p| ... } -> self (6344.0)

サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。

...mlist[例][ruby]{
a = [1, 2]
a.repeated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permutation...
...#=> [[]] # one permutation of length 0
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result #=> [[...
...1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
//}

@see Array#repeated_combination, Array#permutation...

Matrix#lup -> Matrix::LUPDecomposition (6336.0)

行列の LUP 分解を保持したオブジェクトを返します。

... LUP 分解を保持したオブジェクトを返します。

Matrix::LUPDecomposition は to_ary を定義しているため、
多重代入によって3つの行列(下三角行列、上三角行列、置換行列)
を得ることができます。これを [L, U, P] と書くと、
L
*U = P*self...
...します。

//emlist[例][ruby]{
require 'matrix'
a = Matrix[[1, 2], [3, 4]]
l
, u, p = a.lup
l
.lower_triangular? # => true
u.upper_triangular? # => true
p.permutation? # => true
l
* u == p * a # => true
a.lup.solve([2, 5]) # => Vector[(1/1), (1/2)]
//}

@see Matrix::LUPDecomposition...

Matrix#lup_decomposition -> Matrix::LUPDecomposition (6336.0)

行列の LUP 分解を保持したオブジェクトを返します。

... LUP 分解を保持したオブジェクトを返します。

Matrix::LUPDecomposition は to_ary を定義しているため、
多重代入によって3つの行列(下三角行列、上三角行列、置換行列)
を得ることができます。これを [L, U, P] と書くと、
L
*U = P*self...
...します。

//emlist[例][ruby]{
require 'matrix'
a = Matrix[[1, 2], [3, 4]]
l
, u, p = a.lup
l
.lower_triangular? # => true
u.upper_triangular? # => true
p.permutation? # => true
l
* u == p * a # => true
a.lup.solve([2, 5]) # => Vector[(1/1), (1/2)]
//}

@see Matrix::LUPDecomposition...

絞り込み条件を変える

Matrix#permutation? -> bool (6301.0)

行列が置換行列ならば true を返します。

行列が置換行列ならば true を返します。

@raise ExceptionForMatrix::ErrDimensionMismatch 行列が正方行列でない場合に発生します

Array#combination(n) {|c| block } -> self (206.0)

サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。

...emlist[例][ruby]{
a = [1, 2, 3, 4]
a.combination(1).to_a #=> [[1],[2],[3],[4]]
a.combination(2).to_a #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
a.combination(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
a.combination(4).to_a #=> [[1,2,3,4]]
a.combination(0).to_a #=> [[]]: one combination of le...
...#=> [] : no combinations of length 5
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3, 4]
result = []
a.combination(2) {|e| result << e} # => [1,2,3,4]
result #=> [[1...
...,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
//}

@see Array#permutation, Array#repeated_combination...

Array#repeated_combination(n) { |c| ... } -> self (206.0)

サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。

...指定した場合に発生します。

//emlist[例][ruby]{
a = [1, 2, 3]
a.repeated_combination(1).to_a #=> [[1], [2], [3]]
a.repeated_combination(2).to_a #=> [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]
a.repeated_combination(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],...
...#=> [[1,1,1,1],[1,1,1,2],[1,1,1,3],[1,1,2,2],[1,1,2,3],
# [1,1,3,3],[1,2,2,2],[1,2,2,3],[1,2,3,3],[1,3,3,3],
# [2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]]
a.repeated_combination(0).to_a #=> [[]] # one combination of leng...
...行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.repeated_combination(3) {|e| result << e} # => [1,2,3]
result #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],
# [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]
//}

@see Array#repeated_permutation, Array#combinat...

Enumerator#size -> Integer | Float::INFINITY | nil (206.0)

self の要素数を返します。

...self の要素数を返します。

要素数が無限の場合は Float::INFINITY を返します。
Enumerator.new に Proc オブジェクトを指定していた場合はその
実行結果を返します。呼び出した時に要素数が不明であった場合は nil を返し
ます。

/...
.../emlist[例][ruby]{
(1..100).to_a.permutation(4).size # => 94109400
l
oop.size # => Float::INFINITY
(1..100).drop_while.size # => nil
//}

@see Enumerator.new...