るりまサーチ

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

別のキーワード

  1. matrix []
  2. matrix *
  3. matrix map
  4. matrix each
  5. matrix index

キーワード

検索結果

<< 1 2 3 > >>

Matrix.I(n) -> Matrix (38308.0)

n次の単位行列を生成します。

n次の単位行列を生成します。

@param n 単位行列の次元

単位行列とは、対角要素が全て1で非対角要素が全て0であるような行列のことです。

Matrix.identity(n) -> Matrix (29308.0)

n次の単位行列を生成します。

n次の単位行列を生成します。

@param n 単位行列の次元

単位行列とは、対角要素が全て1で非対角要素が全て0であるような行列のことです。

Matrix.unit(n) -> Matrix (29308.0)

n次の単位行列を生成します。

n次の単位行列を生成します。

@param n 単位行列の次元

単位行列とは、対角要素が全て1で非対角要素が全て0であるような行列のことです。

Matrix.combine(*matrices) {|*elements| ... } -> Matrix (26457.0)

要素ごとにブロックを呼び出した結果を組み合わせた Matrix を返します。

...クを呼び出した結果を組み合わせた Matrix を返します。

//emlist[例][ruby]{
require 'matrix'
x = Matrix[[6, 6], [4, 4]]
y = Matrix[[1, 2], [3, 4]]
Matrix
.combine(x, y) {|a, b| a - b} # => Matrix[[5, 4], [1, 0]]
//}

@param matrices 並べる行列。すべての行列の行数...
...と列数が一致していなければならない
@raise ExceptionForMatrix::ErrDimensionMismatch 行や列の要素数が一致しない時に発生します
@see Matrix#combine...

Matrix.empty(row_size=0, column_size=0) -> Matrix (26441.0)

要素を持たない行列を返します。

...ize 、 column_size のいずれか一方は0である必要があります。

//emlist[例][ruby]{
require 'matrix'
m = Matrix.empty(2, 0)
m == Matrix[ [], [] ]
# => true
n = Matrix.empty(0, 3)
n == Matrix.columns([ [], [], [] ])
# => true
m * n
# => Matrix[[0, 0, 0], [0, 0, 0]]
//}

@param row_si...
...ze 行列の行数
@param column_size 行列の列数
@raise ArgumentError row_size, column_size が両方とも0でない場合に発生します...

絞り込み条件を変える

Matrix.hstack(*matrices) -> Matrix (26347.0)

行列 matrices を横に並べた行列を生成します。

...行列 matrices を横に並べた行列を生成します。

//emlist[例][ruby]{
require 'matrix'
x = Matrix[[1, 2], [3, 4]]
y = Matrix[[5, 6], [7, 8]]
Matrix
.hstack(x, y) # => Matrix[[1, 2, 5, 6], [3, 4, 7, 8]]
//}

@param matrices 並べる行列。すべての行列の行数が一致してい...
...なければならない
@raise ExceptionForMatrix::ErrDimensionMismatch 行数の異なる行列がある場合に発生します
@see Matrix.vstack, Matrix#hstack...

Matrix.vstack(*matrices) -> Matrix (26347.0)

行列 matrices を縦に並べた行列を生成します。

...行列 matrices を縦に並べた行列を生成します。

//emlist[例][ruby]{
require 'matrix'
x = Matrix[[1, 2], [3, 4]]
y = Matrix[[5, 6], [7, 8]]
Matrix
.vstack(x, y) # => Matrix[[1, 2], [3, 4], [5, 6], [7, 8]]
//}

@param matrices 並べる行列。すべての行列の列数が一致し...
...ていなければならない
@raise ExceptionForMatrix::ErrDimensionMismatch 列数の異なる行列がある場合に発生します
@see Matrix.hstack, Matrix#vstack...

Matrix.build(row_size, column_size = row_size) {|row, col| ... } -> Matrix (26335.0)

row_size×column_sizeの行列をブロックの返り値から生成します。

...w_size×column_sizeの行列をブロックの返り値から生成します。

行列の各要素の位置がブロックに渡され、それの返り値が行列の要素となります。

ブロックを省略した場合は Enumerator を返します。

//emlist[例][ruby]{
require 'matrix'...
...m = Matrix.build(2, 4) {|row, col| col - row }
# => Matrix[[0, 1, 2, 3], [-1, 0, 1, 2]]
m = Matrix.build(3) { rand }
# => a 3x3 matrix with random elements
//}

@param row_size 行列の行数
@param column_size 行列の列数...

Matrix.diagonal(*values) -> Matrix (26335.0)

対角要素がvaluesで、非対角要素が全て0であるような 正方行列を生成します。

...次元Arrayを1個指定すると、そのArrayを唯一の要素とした1×1の行列が生成されます。

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

m = Matrix.diagonal(1, 2, 3)
p m # => Matrix[[1, 0, 0], [0, 2, 0], [0, 0, 3]]
a = [1,2,3]
m = Matrix.diagonal(a)
p m # => Matrix[[[1, 2, 3]]]
//}...
<< 1 2 3 > >>