別のキーワード
クラス
- Matrix (22)
-
Matrix
:: LUPDecomposition (3) - Vector (9)
キーワード
- adjugate (1)
- cofactor (1)
-
cofactor
_ expansion (1) - collect (2)
- collect2 (2)
- det (1)
- determinant (1)
- each (2)
- each2 (2)
-
each
_ with _ index (2) - eigen (1)
- eigensystem (1)
- empty? (1)
- hstack (1)
-
laplace
_ expansion (1) - lup (1)
-
lup
_ decomposition (1) - magnitude (1)
- map (2)
- map2 (1)
- norm (1)
- normalize (1)
- r (1)
- rect (1)
- rectangular (1)
- round (1)
- singular? (1)
- vstack (1)
検索結果
先頭5件
- Matrix
# cofactor _ expansion(row: nil , column: nil) -> object | Integer | Rational | Float - Matrix
# laplace _ expansion(row: nil , column: nil) -> object | Integer | Rational | Float - Matrix
# cofactor(row , column) -> Integer | Rational | Float - Matrix
# hstack(*matrices) -> Matrix - Vector
# collect2(v) -> Enumerator
-
Matrix
# cofactor _ expansion(row: nil , column: nil) -> object | Integer | Rational | Float (118.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 (118.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
# cofactor(row , column) -> Integer | Rational | Float (100.0) -
(row, column)-余因子を返します。
...(row, column)-余因子を返します。
各要素の型によって返り値が変わります。
@param row 行
@param column 列
@raise ExceptionForMatrix::ErrDimensionMismatch 行列が正方でない場合に発生します。
@see Matrix#adjugate... -
Matrix
# hstack(*matrices) -> Matrix (82.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... -
Vector
# collect2(v) -> Enumerator (82.0) -
ベクトルの各要素と引数 v の要素との組に対してブロックを評価し、その結果を要素として持つ配列を返します。
...クを省略した場合は Enumerator を返します。
@param v ブロック内で評価される(ベクトル or 配列)
@raise ExceptionForMatrix::ErrDimensionMismatch 自分自身と引数のベクト
ルの要素の数(次元)が異なっていたときに発生します。
@see Vec... -
Vector
# collect2(v) {|x , y| . . . } -> Array (82.0) -
ベクトルの各要素と引数 v の要素との組に対してブロックを評価し、その結果を要素として持つ配列を返します。
...クを省略した場合は Enumerator を返します。
@param v ブロック内で評価される(ベクトル or 配列)
@raise ExceptionForMatrix::ErrDimensionMismatch 自分自身と引数のベクト
ルの要素の数(次元)が異なっていたときに発生します。
@see Vec... -
Vector
# each2(v) -> Enumerator (82.0) -
ベクトルの各要素と、それに対応するインデックスを持つ引数 v の要素との組に対して (2引数の) ブロックを繰返し評価します。
...ロックを省略した場合は Enumerator を返します。
@param v 各要素と組を取るためのオブジェクト
@raise ExceptionForMatrix::ErrDimensionMismatch 自分自身と引数のベクト
ルの要素の数(次元)が異なっていたときに発生します。
@see Array... -
Vector
# each2(v) {|x , y| . . . } -> self (82.0) -
ベクトルの各要素と、それに対応するインデックスを持つ引数 v の要素との組に対して (2引数の) ブロックを繰返し評価します。
...ロックを省略した場合は Enumerator を返します。
@param v 各要素と組を取るためのオブジェクト
@raise ExceptionForMatrix::ErrDimensionMismatch 自分自身と引数のベクト
ルの要素の数(次元)が異なっていたときに発生します。
@see Array... -
Vector
# map2(v) {|x , y| . . . } -> Vector (82.0) -
ベクトルの各要素と引数 v の要素との組に対してブロックを評価し、その結果を要素として持つベクトルを返します。
...クを省略した場合は Enumerator を返します。
@param v ブロック内で評価される(ベクトル or 配列)
@raise ExceptionForMatrix::ErrDimensionMismatch 自分自身と引数のベクト
ルの要素の数(次元)が異なっていたときに発生します。
@see Vec......t2
次の例は、2つのベクトルの要素毎の積を要素として持つベクトルを生成します。
//emlist[例][ruby]{
require 'matrix'
v1 = Vector[2, 3, 5]
v2 = Vector[7, 9, 11]
a = Array[7, 9, 11]
z = v1.map2(v2) { |x, y| x * y }
p z # => Vector[14, 27, 55]
z = v1.map2(a) { |... -
Matrix
# adjugate -> Matrix (64.0) -
余因子行列を返します。
...余因子行列を返します。
//emlist[例][ruby]{
require 'matrix'
Matrix[[7,6],[3,9]].adjugate # => Matrix[[9, -6], [-3, 7]]
//}
@raise ExceptionForMatrix::ErrDimensionMismatch 行列が正方でない場合に発生します。
@see Matrix#cofactor... -
Matrix
# each(which = :all) -> Enumerator (64.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 (64.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 _ with _ index(which = :all) -> Enumerator (64.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 (64.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
# eigen -> Matrix :: EigenvalueDecomposition (64.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 (64.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... -
Vector
# normalize -> Vector (64.0) -
自身を Vector#norm で正規化したベクトルを返します。
...たベクトルを返します。
@raise Vector::ZeroVectorError ベクトルが0である場合に発生します。
//emlist[例][ruby]{
require 'matrix'
v = Vector[2, 6, 9].normalize
# => Vector[0.18181818181818182, 0.5454545454545454, 0.8181818181818182]
v.norm # => 1.0
//}
@see Vector#norm... -
Matrix
# collect -> Enumerator (46.0) -
行列の各要素に対してブロックの適用を繰り返した結果を、要素として持つ行列を生成します。
...適用を繰り返した結果を、要素として持つ行列を生成します。
ブロックがない場合、 Enumerator を返します。
//emlist[例][ruby]{
require 'matrix'
m = Matrix[[1, 2], [3, 4]]
p m.map { |x| x + 100 } # => Matrix[[101, 102], [103, 104]]
//}
@see Matrix#each... -
Matrix
# collect {|x| . . . } -> Matrix (46.0) -
行列の各要素に対してブロックの適用を繰り返した結果を、要素として持つ行列を生成します。
...適用を繰り返した結果を、要素として持つ行列を生成します。
ブロックがない場合、 Enumerator を返します。
//emlist[例][ruby]{
require 'matrix'
m = Matrix[[1, 2], [3, 4]]
p m.map { |x| x + 100 } # => Matrix[[101, 102], [103, 104]]
//}
@see Matrix#each... -
Matrix
# empty? -> bool (46.0) -
行列が要素を持たないならば true を返します。
...行列が要素を持たないならば true を返します。
要素を持たないとは、行数か列数のいずれかが0であることを意味します。
@see Matrix.empty... -
Matrix
# lup -> Matrix :: LUPDecomposition (46.0) -
行列の 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 (46.0) -
行列の 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
# map -> Enumerator (46.0) -
行列の各要素に対してブロックの適用を繰り返した結果を、要素として持つ行列を生成します。
...適用を繰り返した結果を、要素として持つ行列を生成します。
ブロックがない場合、 Enumerator を返します。
//emlist[例][ruby]{
require 'matrix'
m = Matrix[[1, 2], [3, 4]]
p m.map { |x| x + 100 } # => Matrix[[101, 102], [103, 104]]
//}
@see Matrix#each... -
Matrix
# map {|x| . . . } -> Matrix (46.0) -
行列の各要素に対してブロックの適用を繰り返した結果を、要素として持つ行列を生成します。
...適用を繰り返した結果を、要素として持つ行列を生成します。
ブロックがない場合、 Enumerator を返します。
//emlist[例][ruby]{
require 'matrix'
m = Matrix[[1, 2], [3, 4]]
p m.map { |x| x + 100 } # => Matrix[[101, 102], [103, 104]]
//}
@see Matrix#each... -
Matrix
# rect -> [Matrix , Matrix] (46.0) -
行列を実部と虚部に分解したものを返します。
...行列を実部と虚部に分解したものを返します。
//emlist[例][ruby]{
m.rect == [m.real, m.imag] # ==> true for all matrices m
//}
@see Matrix#imaginary, Matrix#real... -
Matrix
# rectangular -> [Matrix , Matrix] (46.0) -
行列を実部と虚部に分解したものを返します。
...行列を実部と虚部に分解したものを返します。
//emlist[例][ruby]{
m.rect == [m.real, m.imag] # ==> true for all matrices m
//}
@see Matrix#imaginary, Matrix#real... -
Matrix
# round(ndigits = 0) -> Matrix (46.0) -
行列の各要素を指定した桁数で丸めた行列を返します。
行列の各要素を指定した桁数で丸めた行列を返します。
@see Float#round -
Matrix
# vstack -> Matrix (46.0) -
行列 self と matrices を縦に並べた行列を生成します。
...と matrices を縦に並べた行列を生成します。
Matrix.vstack(self, *matrices) と同じです。
//emlist[例][ruby]{
require 'matrix'
x = Matrix[[1, 2], [3, 4]]
y = Matrix[[5, 6], [7, 8]]
x.vstack(y) # => Matrix[[1, 2], [3, 4], [5, 6], [7, 8]]
//}
@see Matrix.vstack, Matrix#hstack... -
Matrix
:: LUPDecomposition # det -> Numeric (46.0) -
元の行列の行列式の値を返します。 LUP 分解の結果を利用して計算します。
...元の行列の行列式の値を返します。
LUP 分解の結果を利用して計算します。
@see Matrix#determinant... -
Matrix
:: LUPDecomposition # determinant -> Numeric (46.0) -
元の行列の行列式の値を返します。 LUP 分解の結果を利用して計算します。
...元の行列の行列式の値を返します。
LUP 分解の結果を利用して計算します。
@see Matrix#determinant... -
Matrix
:: LUPDecomposition # singular? -> bool (46.0) -
元の行列が正方で特異なら true を、正則なら false を返します。 LUP 分解の結果を利用して判定します。
...元の行列が正方で特異なら true を、正則なら false を返します。
LUP 分解の結果を利用して判定します。
@see Matrix#singular?... -
Vector
# magnitude -> Float (46.0) -
ベクトルの大きさ(ノルム)を返します。
...ベクトルの大きさ(ノルム)を返します。
//emlist[例][ruby]{
require 'matrix'
Vector[3, 4].norm # => 5.0
Vector[Complex(0, 1), 0].norm # => 1.0
//}
@see Vector#normalize... -
Vector
# norm -> Float (46.0) -
ベクトルの大きさ(ノルム)を返します。
...ベクトルの大きさ(ノルム)を返します。
//emlist[例][ruby]{
require 'matrix'
Vector[3, 4].norm # => 5.0
Vector[Complex(0, 1), 0].norm # => 1.0
//}
@see Vector#normalize... -
Vector
# r -> Float (46.0) -
ベクトルの大きさ(ノルム)を返します。
...ベクトルの大きさ(ノルム)を返します。
//emlist[例][ruby]{
require 'matrix'
Vector[3, 4].norm # => 5.0
Vector[Complex(0, 1), 0].norm # => 1.0
//}
@see Vector#normalize...