るりまサーチ (Ruby 2.4.0)

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

別のキーワード

  1. _builtin *
  2. matrix *
  3. array *
  4. vector *
  5. bigdecimal *

クラス

キーワード

検索結果

Vector#*(m) -> Matrix (54328.0)

自分自身を列ベクトル(行列)に変換して (実際には Matrix.column_vector(self) を適用) から、行列 m を右から乗じた行列 (Matrix クラス) を返します。

...を列ベクトル(行列)に変換して (実際には Matrix.column_vector(self) を適用) から、行列 m を右から乗じた行列 (Matrix クラス) を返します。

@param m 右から乗算を行う行列
@raise ExceptionForMatrix::ErrDimensionMismatch 次元が合わない場合に発...
...生します

=== 注意

引数の行列 m は自分自身を列ベクトルとした場合に乗算が定義できる行列である必要があります。

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

v = Vector[1, 2]
a = [4, 5, 6]
m = Matrix[a]

p v * m # => Matrix[[4, 5, 6], [8, 10, 12]]
//}...

Vector#*(other) -> Vector (54313.0)

self の各要素に数 other を乗じたベクトルを返します。

...ルを返します。

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

//emlist[例][ruby]{
require 'matrix'
a = [1, 2, 3.5, 100]
v1 = Vector.elements(a)
p v1.*(2) # => Vector[2, 4, 7.0, 200]
p v1.*(-1.5) # => Vector[-1.5, -3.0, -5.25, -150.0]
//}...

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

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

...を返します。

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

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

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

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

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

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

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

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

self の n 乗を返します。

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

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

絞り込み条件を変える

Matrix#hstack(*matrices) -> Matrix (328.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#independent?(*vectors) -> bool (328.0)

self とベクトルの列 vectors が線形独立であれば true を返します。

...self とベクトルの列 vectors が線形独立であれば true を返します。

require 'matrix'
Vector.independent?(self, *vectors)

と同じです。

@param vectors 線形独立性を判定するベクトル列...

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

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

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

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

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

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

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

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

Matrix#each(which = :all) -> Enumerator (136.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 (136.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#eigen -> Matrix::EigenvalueDecomposition (82.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 (82.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#lup -> Matrix::LUPDecomposition (82.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 (82.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...

絞り込み条件を変える

Vector#collect2(v) -> Enumerator (46.0)

ベクトルの各要素と引数 v の要素との組に対してブロックを評価し、その結果を要素として持つ配列を返します。

...クを省略した場合は Enumerator を返します。

@param v ブロック内で評価される(ベクトル or 配列)

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

@see Vec...

Vector#collect2(v) {|x, y| ... } -> Array (46.0)

ベクトルの各要素と引数 v の要素との組に対してブロックを評価し、その結果を要素として持つ配列を返します。

...クを省略した場合は Enumerator を返します。

@param v ブロック内で評価される(ベクトル or 配列)

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

@see Vec...

Vector#map2(v) {|x, y| ... } -> Vector (46.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#vstack -> Matrix (28.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...

Vector#collect -> Enumerator (28.0)

ベクトルの各要素に対してブロックを評価した結果を、要素として持つベクトルを生成します。

...して持つベクトルを生成します。

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

//emlist[例][ruby]{
require 'matrix'
a = [1, 2, 3.5, -10]
v1 = Vector.elements(a)
p v1 # => Vector[1, 2, 3.5, -10]
v2 = v1.map{|x|
x * -1
}
p v2 # => Vector[-1, -2, -3.5, 10]
//}...

絞り込み条件を変える

Vector#collect {|x| ... } -> Vector (28.0)

ベクトルの各要素に対してブロックを評価した結果を、要素として持つベクトルを生成します。

...して持つベクトルを生成します。

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

//emlist[例][ruby]{
require 'matrix'
a = [1, 2, 3.5, -10]
v1 = Vector.elements(a)
p v1 # => Vector[1, 2, 3.5, -10]
v2 = v1.map{|x|
x * -1
}
p v2 # => Vector[-1, -2, -3.5, 10]
//}...

Vector#map -> Enumerator (28.0)

ベクトルの各要素に対してブロックを評価した結果を、要素として持つベクトルを生成します。

...して持つベクトルを生成します。

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

//emlist[例][ruby]{
require 'matrix'
a = [1, 2, 3.5, -10]
v1 = Vector.elements(a)
p v1 # => Vector[1, 2, 3.5, -10]
v2 = v1.map{|x|
x * -1
}
p v2 # => Vector[-1, -2, -3.5, 10]
//}...

Vector#map {|x| ... } -> Vector (28.0)

ベクトルの各要素に対してブロックを評価した結果を、要素として持つベクトルを生成します。

...して持つベクトルを生成します。

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

//emlist[例][ruby]{
require 'matrix'
a = [1, 2, 3.5, -10]
v1 = Vector.elements(a)
p v1 # => Vector[1, 2, 3.5, -10]
v2 = v1.map{|x|
x * -1
}
p v2 # => Vector[-1, -2, -3.5, 10]
//}...