self * other -> Vector[permalink][rdoc][edit]-
selfの各要素に数otherを乗じたベクトルを返します。- [PARAM]
other: -
selfの各要素に掛ける Numeric オブジェクトを指定します。
require 'matrix' v1 = Vector[1, 2, 3.5, 100] p v1.*(2) # => Vector[2, 4, 7.0, 200] p v1.*(-1.5) # => Vector[-1.5, -3.0, -5.25, -150.0] - [PARAM]
self * m -> Matrix[permalink][rdoc][edit]-
selfを列ベクトル(行列)に変換して (実際にはMatrix.column_vector(self)を適用) から、行列mを右から乗じた行列 (Matrix クラス) を返します。- [PARAM]
m: - 右から乗算を行う行列
- [EXCEPTION]
ExceptionForMatrix::ErrDimensionMismatch: - 次元が合わない場合に発生します
注意
引数の行列
例mはselfを列ベクトルとした場合に乗算が定義できる行列である必要があります。require 'matrix' v = Vector[1, 2] a = [4, 5, 6] m = Matrix[a] p v * m # => Matrix[[4, 5, 6], [8, 10, 12]][SEE_ALSO] Matrix.column_vector
- [PARAM]