るりまサーチ (Ruby 2.3.0)

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

別のキーワード

  1. _builtin to_r
  2. open3 pipeline_r
  3. matrix elements_to_r
  4. fileutils rm_r
  5. fileutils cp_r

キーワード

検索結果

<< 1 2 > >>

Vector#r -> Float (54310.0)

ベクトルの大きさ(ノルム)を返します。

...ベクトルの大きさ(ノルム)を返します。

//emlist[例][ruby]{
require 'matrix'
Vector[3, 4].norm # => 5.0
Vector[Complex(0, 1), 0].norm # => 1.0
//}

@see Vector#normalize...

Vector#cross_product(*vs) -> Vector (27607.0)

self とベクトル vs とのクロス積を返します。

...vs は n-2 個の
n次元ベクトルでなければなりません。

@param vs クロス積を取るベクトルの集合
@raise ExceptionForMatrix::ErrOperationNotDefined self の
次元が1以下であるときに発生します。
@raise ArgumentError vs のベクトルの個数が n-...

Matrix#lower_triangular? -> bool (27307.0)

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

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

Matrix#symmetric? -> bool (27307.0)

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

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

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

Matrix#upper_triangular? -> bool (27307.0)

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

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

絞り込み条件を変える

Matrix::EigenvalueDecomposition#eigenvector_matrix -> Matrix (27307.0)

右固有ベクトルを横に並べた行列を返します。

右固有ベクトルを横に並べた行列を返します。

Matrix::EigenvalueDecomposition#eigenvector_matrix_inv -> Matrix (27307.0)

左固有ベクトルを縦に並べた行列を返します。

...左固有ベクトルを縦に並べた行列を返します。

これは Matrix::EigenvalueDecomposition#v の逆行列です...

Vector::ZeroVectorError (27007.0)

ベクトルが 0 でエラーとなる(Vector#normalize など)場合に 発生する例外です。

ベクトルが 0 でエラーとなる(Vector#normalize など)場合に
発生する例外です。

Vector#elements_to_r -> Vector (18646.0)

ベクトルの各成分をRationalに変換したベクトルを返します。

...の各成分をRationalに変換したベクトルを返します。

このメソッドは deprecated です。 map(&:to_r) を使ってください。

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

v = Vector.elements([2.5, 3.0, 5.75, 7])
p v.elements_to_r
# => Vector[(5/2), (3/1), (23/4), (7/1)]
//}...

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

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

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

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

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

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

絞り込み条件を変える

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

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

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

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

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

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

Matrix.row_vector(row) -> Matrix (18607.0)

要素がrowの(1,n)型の行列(行ベクトル)を生成します。

要素がrowの(1,n)型の行列(行ベクトル)を生成します。

@param row (1,n)型の行列として生成するVector Array オブジェクト

Matrix.rows(rows, copy = true) -> Matrix (18607.0)

引数 rows を行ベクトルの列とする行列を生成します。

...せん。

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

a1 = [1, 2, 3]
a2 = [10, 15, 20]

m = Matrix.rows([a1, a2], false) # 配列を複製せずに行列を生成
p m # => Matrix[[1, 2, 3], [10, 15, 20]]
a2[1] = 1000 # 配列のデータを変更
p m # => Matrix[[1, 2, 3], [10, 1000, 20]]
//}

@param ro...

Matrix.zero(row, column) -> Matrix (18607.0)

row × column の零行列(要素が全て 0 の行列)を生成して返します。

...row × column の零行列(要素が全て 0 の行列)を生成して返します。

//emlist[例][ruby]{
require 'matrix'
p Matrix.zero(2, 3) #=> Matrix[[0, 0, 0], [0, 0, 0]]
//}

@param row 生成する行列の行数
@param column 生成する行列の列数...

Matrix::EigenvalueDecomposition#eigenvalue_matrix -> Matrix (18607.0)

固有値を対角成分に並べた行列を返します。

固有値を対角成分に並べた行列を返します。

絞り込み条件を変える

Matrix#coerce(other) -> Array (18343.0)

他の数値オブジェクトとの変換を行います。

...クトをMatrix::Scalarのオブジェクトに変換し、selfとの組を配列として返します。

@param other 変換する数値オブジェクト

//emlist[例][ruby]{
require 'matrix'
a1 = [1, 2]
a2 = [-1.25, 2.2]
m = Matrix[a1, a2]
r = Rational(1, 2)
p m.coerce(r) #=> [#<Matrix::Scalar:...
...0x832df18 @value=(1/2)>, Matrix[[1, 2], [-1.25, 2.2]]]
//}...

Matrix#elements_to_r -> Matrix (18328.0)

各要素を有理数 Rational に変換した行列を返します。

各要素を有理数 Rational に変換した行列を返します。

このメソッドは deprecated です。 map(&:to_r) を使ってください。

Vector#norm -> Float (18310.0)

ベクトルの大きさ(ノルム)を返します。

...ベクトルの大きさ(ノルム)を返します。

//emlist[例][ruby]{
require 'matrix'
Vector[3, 4].norm # => 5.0
Vector[Complex(0, 1), 0].norm # => 1.0
//}

@see Vector#normalize...

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

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

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

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

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

Matrix#cofactor_expansion(row: nil, column: nil) -> object | Integer | Rational | Float (18307.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#column_vectors -> [Vector] (18307.0)

自分自身を列ベクトルの配列として返します。

...自分自身を列ベクトルの配列として返します。

//emlist[例][ruby]{
require 'matrix'
a1 = [ 1, 2, 3]
a2 = [10, 15, 20]
a3 = [-1, -2, 1.5]
m = Matrix[a1, a2, a3]

p m.column_vectors # => [Vector[1, 10, -1], Vector[2, 15, -2], Vector[3, 20, 1.5]]
//}...

Matrix#determinant -> Numeric (18307.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_e -> Rational | Float (18307.0)

このメソッドは deprecated です。 Matrix#determinant を代わりに使ってください。

...このメソッドは deprecated です。
Matrix
#determinant を代わりに使ってください。...

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

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

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

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

Matrix#hermitian? -> bool (18307.0)

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

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

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

絞り込み条件を変える

Matrix#imaginary -> Matrix (18307.0)

行列の虚部を返します。

...行列の虚部を返します。

//emlist[例][ruby]{
require 'matrix'
Matrix
[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]]
# => 1+2i i 0
# 1 2 3
Matrix
[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]].imaginary
# => 2i i 0
# 0 0 0
//}...

Matrix#inverse -> Matrix (18307.0)

逆行列を返します。

...逆行列を返します。

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

p Matrix[[2, 1], [3, 2]].inv #=> Matrix[[(2/1), (-1/1)], [(-3/1), (2/1)]]

p Matrix[[2.0, 1.0], [3.0, 2.0]].inv #=> Matrix[[2.0000000000000004, -1.0000000000000002], [-3.000000000000001, 2.0000000000000004]]
//}...

Matrix#minor(from_row, row_size, from_col, col_size) -> Matrix (18307.0)

selfの部分行列を返します。

...ram col_size 部分行列の列サイズ

//emlist[例][ruby]{
require 'matrix'
a1 = [ 1, 2, 3, 4, 5]
a2 = [11, 12, 13, 14, 15]
a3 = [21, 22, 23, 24, 25]
a4 = [31, 32, 33, 34, 35]
a5 = [51, 52, 53, 54, 55]
m = Matrix[a1, a2, a3, a4, a5]

p m.minor(0, 2, 1, 2) # => Matrix[[2, 3], [12, 13]]
//}...

Matrix#minor(from_row..to_row, from_col..to_col) -> Matrix (18307.0)

selfの部分行列を返します。

...ram col_size 部分行列の列サイズ

//emlist[例][ruby]{
require 'matrix'
a1 = [ 1, 2, 3, 4, 5]
a2 = [11, 12, 13, 14, 15]
a3 = [21, 22, 23, 24, 25]
a4 = [31, 32, 33, 34, 35]
a5 = [51, 52, 53, 54, 55]
m = Matrix[a1, a2, a3, a4, a5]

p m.minor(0, 2, 1, 2) # => Matrix[[2, 3], [12, 13]]
//}...

Matrix#normal? -> bool (18307.0)

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

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

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

絞り込み条件を変える

Matrix#orthogonal? -> bool (18307.0)

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

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

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

Matrix#permutation? -> bool (18307.0)

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

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

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

Matrix#rank -> Integer (18307.0)

階数 (rank) を返します。

...め、誤った結果が生じる可能性があることに注意してください。
代わりに、Rational や BigDecimal などの正確なオブジェクトを使用することを検討してください。

//emlist[][ruby]{
require 'matrix'
m = Matrix[[2, 6], [1, 3]]
m.rank # => 1
//}...

Matrix#rank_e -> Integer (18307.0)

階数 (rank) を返します。

...階数 (rank) を返します。

このメソッドは deprecated です。
代わりに Matrix#rank を使ってください。...

Matrix#real -> Matrix (18307.0)

行列の実部を返します。

...行列の実部を返します。

//emlist[例][ruby]{
require 'matrix'
Matrix
[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]]
# => 1+2i i 0
# 1 2 3
Matrix
[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]].real
# => 1 0 0
# 1 2 3
//}...

絞り込み条件を変える

Matrix#real? -> bool (18307.0)

行列の全要素が実(Numeric#real?)であれば true を返します。

...が0でも偽を返します。

//emlist[例][ruby]{
require 'matrix'
Matrix
[[1, 0], [0, 1]].real? # => true
Matrix
[[Complex(0, 1), 0], [0, 1]].real? # => false
# 要素が実数であっても Complex オブジェクトなら偽を返す。
Matrix
[[Complex(1, 0), 0], [0, 1]].real? # => false
//}...

Matrix#rect -> [Matrix, Matrix] (18307.0)

行列を実部と虚部に分解したものを返します。

...行列を実部と虚部に分解したものを返します。


//emlist[例][ruby]{
m.rect == [m.real, m.imag] # ==> true for all matrices m
//}

@see Matrix#imaginary, Matrix#real...

Matrix#rectangular -> [Matrix, Matrix] (18307.0)

行列を実部と虚部に分解したものを返します。

...行列を実部と虚部に分解したものを返します。


//emlist[例][ruby]{
m.rect == [m.real, m.imag] # ==> true for all matrices m
//}

@see Matrix#imaginary, Matrix#real...

Matrix#regular? -> bool (18307.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#round(ndigits = 0) -> Matrix (18307.0)

行列の各要素を指定した桁数で丸めた行列を返します。

行列の各要素を指定した桁数で丸めた行列を返します。

@see Float#round

絞り込み条件を変える

Matrix#row(i) -> Vector | nil (18307.0)

i 番目の行を Vector オブジェクトで返します。 i 番目の行が存在しない場合は nil を返します。 ブロックが与えられた場合はその行の各要素についてブロックを繰り返します。

...す。
ブロックが与えられた場合はその行の各要素についてブロックを繰り返します。

Vector オブジェクトは Matrix オブジェクトとの演算の際には列ベクトルとして扱われることに注意してください。

@param i 行の位置を指定...
...のインデックスと見倣します。末尾の行が -1 番目になります。

//emlist[例][ruby]{
require 'matrix'
a1 = [1, 2, 3]
a2 = [10, 15, 20]
a3 = [-1, -2, 1.5]
m = Matrix[a1, a2, a3]

p m.row(1) # => Vector[10, 15, 20]

cnt = 0
m.row(0) { |x|
cnt = cnt + x
}
p cnt # => 6
//}...

Matrix#row(i) {|x| ... } -> self (18307.0)

i 番目の行を Vector オブジェクトで返します。 i 番目の行が存在しない場合は nil を返します。 ブロックが与えられた場合はその行の各要素についてブロックを繰り返します。

...す。
ブロックが与えられた場合はその行の各要素についてブロックを繰り返します。

Vector オブジェクトは Matrix オブジェクトとの演算の際には列ベクトルとして扱われることに注意してください。

@param i 行の位置を指定...
...のインデックスと見倣します。末尾の行が -1 番目になります。

//emlist[例][ruby]{
require 'matrix'
a1 = [1, 2, 3]
a2 = [10, 15, 20]
a3 = [-1, -2, 1.5]
m = Matrix[a1, a2, a3]

p m.row(1) # => Vector[10, 15, 20]

cnt = 0
m.row(0) { |x|
cnt = cnt + x
}
p cnt # => 6
//}...

Matrix#row_count -> Integer (18307.0)

行列の行数を返します。

行列の行数を返します。

Matrix#row_size -> Integer (18307.0)

行列の行数を返します。

行列の行数を返します。

Matrix#row_vectors -> [Vector] (18307.0)

自分自身を行ベクトルの配列として返します。

...自分自身を行ベクトルの配列として返します。

//emlist[例][ruby]{
require 'matrix'
a1 = [ 1, 2, 3]
a2 = [10, 15, 20]
a3 = [-1, -2, 1.5]
m = Matrix[a1, a2, a3]

p m.row_vectors # => [Vector[1, 2, 3], Vector[10, 15, 20], Vector[-1, -2, 1.5]]
//}...

絞り込み条件を変える

Matrix#singular? -> bool (18307.0)

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

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

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

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

Matrix#square? -> bool (18307.0)

正方行列であるなら、 true を返します。

正方行列であるなら、 true を返します。

Matrix#transpose -> Matrix (18307.0)

転置行列 (transpose matrix) を返します。

...転置行列 (transpose matrix) を返します。

self を Matrix のオブジェクトで、(m,n) 型行列としたとき a(j,i) を (i,j) 要素とする (n,m) 型行列を返します。...

Matrix#unitary? -> bool (18307.0)

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

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

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

Matrix#zero? -> bool (18307.0)

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

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

絞り込み条件を変える

Matrix.column_vector(column) -> Matrix (18307.0)

要素がcolumnの(n,1)型の行列(列ベクトル)を生成します。

要素がcolumnの(n,1)型の行列(列ベクトル)を生成します。

@param column (n,1)型の行列として生成するVector Array オブジェクト

Matrix.scalar(n, value) -> Matrix (18307.0)

対角要素が全てvalue(数)で、非対角要素が全て0であるようなn次の正方行列を生成します。

...角要素が全て0であるようなn次の正方行列を生成します。

@param n 生成する行列の次元
@param value 生成する行列の対角要素の値


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

m = Matrix.scalar(3, 2.5)
p m # => Matrix[[2.5, 0, 0], [0, 2.5, 0], [0, 0, 2.5]]
//}...

Matrix.zero(n) -> Matrix (18307.0)

n × n の零行列(要素が全て 0 の行列)を生成して返します。

...n × n の零行列(要素が全て 0 の行列)を生成して返します。

//emlist[例][ruby]{
require 'matrix'
p Matrix.zero(2) #=> Matrix[[0, 0], [0, 0]]
//}

@param n 生成する正方零行列の次数...

Matrix::EigenvalueDecomposition#eigenvectors -> [Vector] (18307.0)

右固有ベクトルを配列で返します。

右固有ベクトルを配列で返します。

Matrix::EigenvalueDecomposition#to_ary -> [Matrix, Matrix, Matrix] (18307.0)

Matrix::EigenvalueDecomposition#v, Matrix::EigenvalueDecomposition#d, Matrix::EigenvalueDecomposition#v_inv をこの順に並べた配列を返します。

...
Matrix
::EigenvalueDecomposition#v,
Matrix
::EigenvalueDecomposition#d,
Matrix
::EigenvalueDecomposition#v_inv
をこの順に並べた配列を返します。...

絞り込み条件を変える

Matrix::EigenvalueDecomposition#v -> Matrix (18307.0)

右固有ベクトルを横に並べた行列を返します。

右固有ベクトルを横に並べた行列を返します。

Matrix::EigenvalueDecomposition#v_inv -> Matrix (18307.0)

左固有ベクトルを縦に並べた行列を返します。

...左固有ベクトルを縦に並べた行列を返します。

これは Matrix::EigenvalueDecomposition#v の逆行列です...

Matrix::LUPDecomposition#determinant -> Numeric (18307.0)

元の行列の行列式の値を返します。 LUP 分解の結果を利用して計算します。

...元の行列の行列式の値を返します。
LUP 分解の結果を利用して計算します。

@see Matrix#determinant...

Matrix::LUPDecomposition#singular? -> bool (18307.0)

元の行列が正方で特異なら true を、正則なら false を返します。 LUP 分解の結果を利用して判定します。

...元の行列が正方で特異なら true を、正則なら false を返します。
LUP 分解の結果を利用して判定します。

@see Matrix#singular?...

Matrix::LUPDecomposition#to_ary -> [Matrix, Matrix, Matrix] (18307.0)

分解した行列を [下半行列, 上半行列, 置換行列] という3要素の配列で 返します。

分解した行列を [下半行列, 上半行列, 置換行列] という3要素の配列で
返します。

絞り込み条件を変える

Vector#covector -> Matrix (18307.0)

Matrix オブジェクトへ変換します。

...Matrix オブジェクトへ変換します。

列ベクトル (行列)、すなわち、(n, 1) 型の行列に変換します。
実際には Matrix.row_vector(self) を適用します。

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

v = Vector[2, 3, 5]
p v # => Vector[2, 3, 5]
m = v.covector
p m # => M...

Vector#cross(*vs) -> Vector (18307.0)

self とベクトル vs とのクロス積を返します。

...vs は n-2 個の
n次元ベクトルでなければなりません。

@param vs クロス積を取るベクトルの集合
@raise ExceptionForMatrix::ErrOperationNotDefined self の
次元が1以下であるときに発生します。
@raise ArgumentError vs のベクトルの個数が n-...

Vector#inner_product(v) -> Float (18307.0)

ベクトル v との内積を返します。

...ベクトル v との内積を返します。

@param v 内積を求めるベクトル

@raise ExceptionForMatrix::ErrDimensionMismatch 自分自身と引数のベクト
ルの要素の数(次元)が異なっていたときに発生します。...

Vector#normalize -> Vector (18307.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...

ExceptionForMatrix::ErrDimensionMismatch (18007.0)

行列/ベクトル計算時に次元が合わない場合に発生する例外です。

行列/ベクトル計算時に次元が合わない場合に発生する例外です。

絞り込み条件を変える

ExceptionForMatrix::ErrNotRegular (18007.0)

逆行列計算時に行列が正則でない場合に発生する例外です。

逆行列計算時に行列が正則でない場合に発生する例外です。

ExceptionForMatrix::ErrOperationNotDefined (18007.0)

演算時にクラスが適切でない場合に発生する例外です。

演算時にクラスが適切でない場合に発生する例外です。

Matrix (18007.0)

数Numericを要素とする行列を扱うクラスです。

...a(m-1,n-1) ]

のように、縦横の表にあらわしたものを(m,n)型の行列といいます。
m=nの行列をm次の正方行列(square matrix)といいます。
インデックスは 0 から始まることに注意してください。

上からi番目の横の数の並びを第i行(t...

Vector (18007.0)

数 Numeric を要素とするベクトルを扱うクラスです。 Vector オブジェクトは Matrix オブジェクトとの演算においては列ベクトルとして扱われます。

...数 Numeric を要素とするベクトルを扱うクラスです。
Vector オブジェクトは Matrix オブジェクトとの演算においては列ベクトルとして扱われます。

ベクトルの要素のインデックスは 0 から始まることに注意してください。...

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

row_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::EigenvalueDecomposition#to_a -> [Matrix, Matrix, Matrix] (9907.0)

Matrix::EigenvalueDecomposition#v, Matrix::EigenvalueDecomposition#d, Matrix::EigenvalueDecomposition#v_inv をこの順に並べた配列を返します。

...
Matrix
::EigenvalueDecomposition#v,
Matrix
::EigenvalueDecomposition#d,
Matrix
::EigenvalueDecomposition#v_inv
をこの順に並べた配列を返します。...

Matrix::LUPDecomposition#to_a -> [Matrix, Matrix, Matrix] (9907.0)

分解した行列を [下半行列, 上半行列, 置換行列] という3要素の配列で 返します。

分解した行列を [下半行列, 上半行列, 置換行列] という3要素の配列で
返します。

Matrix#find_index(selector = :all) -> Enumerator (9607.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#hstack(*matrices) -> Matrix (9607.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#index(selector = :all) -> Enumerator (9607.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.build(row_size, column_size = row_size) -> Enumerable (9607.0)

row_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.hstack(*matrices) -> Matrix (9607.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 (9607.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#*(m) -> Matrix | Vector (9307.0)

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

...を返します。

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

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

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

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

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

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

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

絞り込み条件を変える

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

self の n 乗を返します。

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

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

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

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

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

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

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

Matrix#-(m) -> Matrix (9307.0)

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

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

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

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

Matrix#-@ -> Matrix (9307.0)

単項 -。各要素の符号を反転させた行列を返します。

単項 -。各要素の符号を反転させた行列を返します。

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

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

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

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

絞り込み条件を変える

Matrix#/(other) -> Matrix (9307.0)

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

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

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

Matrix#==(other) -> bool (9307.0)

自分自身と other を比較し、同値であれば真(true)を返します。

自分自身と other を比較し、同値であれば真(true)を返します。

@param other 比較対象のオブジェクト

Matrix#adjugate -> Matrix (9307.0)

余因子行列を返します。

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

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

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

Matrix#clone -> Matrix (9307.0)

自分自身のコピーを返します。

自分自身のコピーを返します。

Matrix#collect -> Enumerator (9307.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 (9307.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#column(j) -> Vector | nil (9307.0)

j 番目の列を Vector オブジェクトで返します。 j 番目の列が存在しない場合は nil を返します。 ブロックが与えられた場合はその列の各要素についてブロックを繰り返します。

...ンデックスと見倣します。末尾の列が -1 番目になります。

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

a1 = [ 1, 2, 3]
a2 = [10, 15, 20]
a3 = [-1, -2, 1.5]
m = Matrix[a1, a2, a3]

p m.column(1) # => Vector[2, 15, -2]

cnt = 0
m.column(-1) { |x|
cnt = cnt + x
}
p cnt # => 24.5...

Matrix#column_count -> Integer (9307.0)

行列の列数を返します。

行列の列数を返します。

Matrix#column_size -> Integer (9307.0)

行列の列数を返します。

行列の列数を返します。

Matrix#conj -> Matrix (9307.0)

複素共役を取った行列を返します。

...複素共役を取った行列を返します。

//emlist[例][ruby]{
require 'matrix'
Matrix
[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]]
# => 1+2i i 0
# 1 2 3
Matrix
[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]].conjugate
# => 1-2i -i 0
# 1 2 3
//}...

絞り込み条件を変える

Matrix#conjugate -> Matrix (9307.0)

複素共役を取った行列を返します。

...複素共役を取った行列を返します。

//emlist[例][ruby]{
require 'matrix'
Matrix
[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]]
# => 1+2i i 0
# 1 2 3
Matrix
[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]].conjugate
# => 1-2i -i 0
# 1 2 3
//}...

Matrix#det -> Numeric (9307.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#det_e -> Rational | Float (9307.0)

このメソッドは deprecated です。 Matrix#determinant を代わりに使ってください。

...このメソッドは deprecated です。
Matrix
#determinant を代わりに使ってください。...

Matrix#each(which = :all) -> Enumerator (9307.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 (9307.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...

絞り込み条件を変える

<< 1 2 > >>