るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
37件ヒット [1-37件を表示] (0.019秒)
トップページ > バージョン:2.6.0[x] > クエリ:raise[x] > クラス:Matrix[x]

別のキーワード

  1. _builtin raise
  2. kernel raise
  3. fiber raise
  4. thread raise
  5. e2mmap raise

ライブラリ

検索結果

Matrix#/(m) -> Matrix (40.0)

self に行列 m の逆行列を右から乗じた行列を返します。

...@param m 逆行列を右から乗算する行列。可逆行列でselfと乗算可能な行列を指定します。

@raise ExceptionForMatrix::ErrDimensionMismatch 次元が合わない場合に発生します
@raise ExceptionForMatrix::ErrNotRegular m が正則でない場合に発生します...

Matrix#cofactor_expansion(row: nil, column: nil) -> object | Integer | Rational | Float (40.0)

row 行、もしくは column 列に関するラプラス展開をする。

...けです。かわりにMatrix#determinant を
利用すべきです。

変則的な形状の行列に対してはそれ以上の意味を持ちます。例えば
row行/column列が行列やベクトルである場合には

//emlist[例][ruby]{
require 'matrix'
# Matrix[[7,6], [3,9]].laplace_expa...
...=> 45
Matrix
[[Vector[1, 0], Vector[0, 1]], [2, 3]].laplace_expansion(row: 0) # => Vector[3, -2]
//}

@param row 行
@param column 列
@raise ArgumentError row と column を両方指定した、もしくは両方とも指定していない、場合に発生します
@raise ExceptionForMatrix::ErrD...
...imensionMismatch 行列が正方でない場合に発生します
@see Matrix#cofactor...

Matrix#laplace_expansion(row: nil, column: nil) -> object | Integer | Rational | Float (40.0)

row 行、もしくは column 列に関するラプラス展開をする。

...けです。かわりにMatrix#determinant を
利用すべきです。

変則的な形状の行列に対してはそれ以上の意味を持ちます。例えば
row行/column列が行列やベクトルである場合には

//emlist[例][ruby]{
require 'matrix'
# Matrix[[7,6], [3,9]].laplace_expa...
...=> 45
Matrix
[[Vector[1, 0], Vector[0, 1]], [2, 3]].laplace_expansion(row: 0) # => Vector[3, -2]
//}

@param row 行
@param column 列
@raise ArgumentError row と column を両方指定した、もしくは両方とも指定していない、場合に発生します
@raise ExceptionForMatrix::ErrD...
...imensionMismatch 行列が正方でない場合に発生します
@see Matrix#cofactor...

Matrix#regular? -> bool (40.0)

行列が正方で正則なら true を、特異なら false を返します。

...例外 ExceptionForMatrix::ErrDimensionMismatch を
発生させます。


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

a1 = [ 1, 2, 3]
a2 = [10, 15, 20]
a3 = [-1, -2, 1.5]
m = Matrix[a1, a2, a3]
p m.regular? # => true

a1 = [ 1, 2, 3]
a2 = [10, 15, 20]
a3 = [-1, -2, -3]
m = Matrix[a1, a2, a3]
p m.re...
...gular? # => false

a1 = [ 1, 2, 3]
a2 = [10, 15, 20]
a3 = [-1, -2, 1.5]
a4 = [1, 1, 1]
m = Matrix[a1, a2, a3, a4]
p m.regular? # => raise ExceptionForMatrix::ErrDimensionMismatch
//}

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

Matrix#*(m) -> Matrix | Vector (22.0)

self に行列またはベクトル m を右から乗じた行列を返します。

...を返します。

m が Vector オブジェクトなら返り値も Vector オブジェクトになります。

@param m 右からの乗算が定義可能な行列やベクトルを指定します。

@raise ExceptionForMatrix::ErrDimensionMismatch 次元が合わない場合に発生します...

絞り込み条件を変える

Matrix#**(n) -> Matrix (22.0)

self の n 乗を返します。

...self の n 乗を返します。

@param n べき数の指定
@raise ExceptionForMatrix::ErrNotRegular n が 0 以下で、行列が正則でない場合に発生します...

Matrix#+(m) -> Matrix (22.0)

self に行列 m を加算した行列を返します。 self の column_size が 1 なら Vector オブジェクトも指定出来ます。

...した行列を返します。
self の column_size が 1 なら Vector オブジェクトも指定出来ます。

@param m 加算する行列。加算可能な行列やベクトルを指定します。

@raise ExceptionForMatrix::ErrDimensionMismatch 次元が合わない場合に発生します...

Matrix#-(m) -> Matrix (22.0)

self から行列mを減算した行列を返します。 self の column_size が 1 なら Vector オブジェクトも指定出来ます。

...した行列を返します。
self の column_size が 1 なら Vector オブジェクトも指定出来ます。

@param m 減算する行列。減算可能な行列やベクトルを指定します。

@raise ExceptionForMatrix::ErrDimensionMismatch 次元が合わない場合に発生します...

Matrix#adjugate -> Matrix (22.0)

余因子行列を返します。

...余因子行列を返します。

//emlist[例][ruby]{
require 'matrix'
Matrix
[[7,6],[3,9]].adjugate # => Matrix[[9, -6], [-3, 7]]
//}

@raise ExceptionForMatrix::ErrDimensionMismatch 行列が正方でない場合に発生します。
@see Matrix#cofactor...

Matrix#antisymmetric? -> bool (22.0)

行列が反対称行列 (交代行列、歪〔わい〕対称行列とも) ならば true を返します。

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

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

Matrix
[[0, -2, Complex(1, 3)], [2, 0, 5], [-Complex(1, 3), -5, 0]].antisymmetric? # => true
Matrix
.empty.antisymmetric? # => true

Matrix
[[1, 2, 3], [4, 5, 6]...
..., [7, 8, 9]].antisymmetric? # => false
# 対角要素が違う
Matrix
[[1, -2, 3], [2, 0, 6], [-3, -6, 0]].antisymmetric? # => false
# 符号が違う
Matrix
[[0, 2, -3], [2, 0, 6], [-3, 6, 0]].antisymmetric? # => false
//}...

絞り込み条件を変える

Matrix#cofactor(row, column) -> Integer | Rational | Float (22.0)

(row, column)-余因子を返します。

...(row, column)-余因子を返します。

各要素の型によって返り値が変わります。

@param row 行
@param column 列
@raise ExceptionForMatrix::ErrDimensionMismatch 行列が正方でない場合に発生します。
@see Matrix#adjugate...

Matrix#det -> Numeric (22.0)

行列式 (determinant) の値を返します。

...オブジェクトを使用することを検討してください。

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

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

p Matrix[[2, 1], [-1, 2]].det #=> 5
p Matrix[[2.0, 1.0], [-1.0, 2.0]].det #=> 5.0
//}...

Matrix#determinant -> Numeric (22.0)

行列式 (determinant) の値を返します。

...オブジェクトを使用することを検討してください。

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

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

p Matrix[[2, 1], [-1, 2]].det #=> 5
p Matrix[[2.0, 1.0], [-1.0, 2.0]].det #=> 5.0
//}...

Matrix#diagonal? -> bool (22.0)

行列が対角行列ならば true を返します。

...行列が対角行列ならば true を返します。

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

Matrix#eigen -> Matrix::EigenvalueDecomposition (22.0)

行列の固有値と左右の固有ベクトルを保持したオブジェクトを返します。

...行列の固有値と左右の固有ベクトルを保持したオブジェクトを返します。

Matrix
::EigenvalueDecomposition は to_ary を定義しているため、
多重代入によって3つの行列(右固有ベクトル、固有値行列、左固有ベクトル)
を得ることがで...
...ruby]{
require 'matrix'
m = Matrix[[1, 2], [3, 4]]
v, d, v_inv = m.eigensystem
d.diagonal? # => true
v.inv == v_inv # => true
(v * d * v_inv).round(5) == m # => true
//}

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

絞り込み条件を変える

Matrix#eigensystem -> Matrix::EigenvalueDecomposition (22.0)

行列の固有値と左右の固有ベクトルを保持したオブジェクトを返します。

...行列の固有値と左右の固有ベクトルを保持したオブジェクトを返します。

Matrix
::EigenvalueDecomposition は to_ary を定義しているため、
多重代入によって3つの行列(右固有ベクトル、固有値行列、左固有ベクトル)
を得ることがで...
...ruby]{
require 'matrix'
m = Matrix[[1, 2], [3, 4]]
v, d, v_inv = m.eigensystem
d.diagonal? # => true
v.inv == v_inv # => true
(v * d * v_inv).round(5) == m # => true
//}

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

Matrix#entrywise_product(m) -> Matrix (22.0)

アダマール積(要素ごとの積)を返します。

...ダマール積(要素ごとの積)を返します。

@raise ExceptionForMatrix::ErrDimensionMismatch 行や列の要素数が一致しない時に発生します。

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

Matrix
[[1,2], [3,4]].hadamard_product(Matrix[[1,2], [3,2]]) # => Matrix[[1, 4], [9, 8]]
//}...

Matrix#first_minor(row, column) -> Matrix (22.0)

self から第 row 行と第 column 列を取り除いた行列を返します。

self から第 row 行と第 column 列を取り除いた行列を返します。

@param row 行
@param column 列
@raise ArgumentError row, column が行列の行数/列数を越えている場合に発生します。

Matrix#hadamard_product(m) -> Matrix (22.0)

アダマール積(要素ごとの積)を返します。

...ダマール積(要素ごとの積)を返します。

@raise ExceptionForMatrix::ErrDimensionMismatch 行や列の要素数が一致しない時に発生します。

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

Matrix
[[1,2], [3,4]].hadamard_product(Matrix[[1,2], [3,2]]) # => Matrix[[1, 4], [9, 8]]
//}...

Matrix#hermitian? -> bool (22.0)

行列がエルミートならば true を返します。

...行列がエルミートならば true を返します。

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

絞り込み条件を変える

Matrix#hstack(*matrices) -> Matrix (22.0)

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

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

Matrix
.hstack(self, *matrices) と同じです。

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

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

@see Matrix.hstack, Matrix#vstack...

Matrix#normal? -> bool (22.0)

行列が正規行列ならば true を返します。

...行列が正規行列ならば true を返します。

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

Matrix#orthogonal? -> bool (22.0)

行列が直交行列ならば true を返します。

...行列が直交行列ならば true を返します。

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

Matrix#permutation? -> bool (22.0)

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

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

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

Matrix#singular? -> bool (22.0)

行列が正方で特異なら true を、正則なら false を返します。

...るとは、正則でないことです。
行列式が0であること同値です。

正方行列でない場合には例外 ExceptionForMatrix::ErrDimensionMismatch を
発生させます。

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

絞り込み条件を変える

Matrix#skew_symmetric? -> bool (22.0)

行列が反対称行列 (交代行列、歪〔わい〕対称行列とも) ならば true を返します。

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

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

Matrix
[[0, -2, Complex(1, 3)], [2, 0, 5], [-Complex(1, 3), -5, 0]].antisymmetric? # => true
Matrix
.empty.antisymmetric? # => true

Matrix
[[1, 2, 3], [4, 5, 6]...
..., [7, 8, 9]].antisymmetric? # => false
# 対角要素が違う
Matrix
[[1, -2, 3], [2, 0, 6], [-3, -6, 0]].antisymmetric? # => false
# 符号が違う
Matrix
[[0, 2, -3], [2, 0, 6], [-3, 6, 0]].antisymmetric? # => false
//}...

Matrix#symmetric? -> bool (22.0)

行列が対称ならば true を返します。

...行列が対称ならば true を返します。

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

Matrix#tr -> Integer | Float | Rational | Complex (22.0)

トレース (trace) を返します。

...列のトレース (trace) とは、対角要素の和です。

//emlist[例][ruby]{
require 'matrix'
Matrix
[[7,6], [3,9]].trace # => 16
//}

trace は正方行列でのみ定義されます。

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

Matrix#trace -> Integer | Float | Rational | Complex (22.0)

トレース (trace) を返します。

...列のトレース (trace) とは、対角要素の和です。

//emlist[例][ruby]{
require 'matrix'
Matrix
[[7,6], [3,9]].trace # => 16
//}

trace は正方行列でのみ定義されます。

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

Matrix#unitary? -> bool (22.0)

行列がユニタリならば true を返します。

...行列がユニタリならば true を返します。

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

絞り込み条件を変える

Matrix.combine(*matrices) -> Enumerator (22.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.combine(*matrices) {|*elements| ... } -> Matrix (22.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 (22.0)

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

...一方は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_size 行列の行数
@param column_si...

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

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

...[例][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 (22.0)

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

...][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#/(other) -> Matrix (10.0)

self の各成分を数 other で割った行列を返します。

self の各成分を数 other で割った行列を返します。

@param other self の各成分を割る Numeric オブジェクトを指定します。

Matrix#*(other) -> Matrix (7.0)

self の各成分に数 other を掛けた行列を返します。

self の各成分に数 other を掛けた行列を返します。

@param other self の各成分に掛ける Numeric オブジェクトを指定します。