るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

クラス

キーワード

検索結果

<< 1 2 3 > >>

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

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

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

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

=== 注意

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

//emlist[例][ruby]{
r
equire '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 (21211.0)

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

...other を乗じたベクトルを返します。

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

//emlist[例][ruby]{
r
equire '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,...

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

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

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

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

//emlist[例][ruby]{
r
equire '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#each(which = :all) -> Enumerator (3151.0)

行列の各要素を引数としてブロックを呼び出します。

...ます。
*
:all - すべての要素(デフォルト)
*
:diagonal - 対角要素
*
:off_diagonal 対角要素以外
*
:lower 対角成分とそれより下側の部分
*
:upper対角成分とそれより上側の部分
*
:strict_lower 対角成分の下側
*
:strict_upper 対角成分...
...

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

//emlist[例][ruby]{
r
equire '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 (3133.0)

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

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

Matrix
::EigenvalueDecomposition は to_ary を定義しているため、
多重代入によって3つの行列(右固有ベクトル、固有値行列、左固有ベクトル)
を得ることがで...
...== V*D*W, V = W.inverse を満たします。
D のそれぞれの対角成分が行列の固有値です。

//emlist[例][ruby]{
r
equire '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
//}

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

絞り込み条件を変える

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

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

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

Matrix
::EigenvalueDecomposition は to_ary を定義しているため、
多重代入によって3つの行列(右固有ベクトル、固有値行列、左固有ベクトル)
を得ることがで...
...== V*D*W, V = W.inverse を満たします。
D のそれぞれの対角成分が行列の固有値です。

//emlist[例][ruby]{
r
equire '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
//}

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

Matrix#lup -> Matrix::LUPDecomposition (3133.0)

行列の LUP 分解を保持したオブジェクトを返します。

...

Matrix
::LUPDecomposition は to_ary を定義しているため、
多重代入によって3つの行列(下三角行列、上三角行列、置換行列)
を得ることができます。これを [L, U, P] と書くと、
L*U = P*self を満たします。

//emlist[例][ruby]{
r
equire '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 (3133.0)

行列の LUP 分解を保持したオブジェクトを返します。

...

Matrix
::LUPDecomposition は to_ary を定義しているため、
多重代入によって3つの行列(下三角行列、上三角行列、置換行列)
を得ることができます。これを [L, U, P] と書くと、
L*U = P*self を満たします。

//emlist[例][ruby]{
r
equire '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 (3121.0)

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

...or 配列)の要素との組に対して (2引数の) ブロックを評価し、その結果を要素として持つ配列を返します。

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

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

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

@see Vector#map2

次の例は、2つのベクトルの要素毎の積を要素とする配列を生成します。

//emlist[例][ruby]{
r
equire 'matrix'...
...v1 = Vector[2, 3, 5]
v2 = Vector[7, 9, 11]
a = Array[7, 9, 11]

z = v1.collect2(v2){ |x, y| x * y }
p z # => [14, 27, 55]

z = v1.collect2(a) { |x, y| x * y } # Array でも OK
p z # => [14, 27, 55]
//}...
<< 1 2 3 > >>