Ruby 2.5.0 リファレンスマニュアル > ライブラリ一覧 > matrixライブラリ > Vectorクラス > elements_to_f

instance method Vector#elements_to_f

elements_to_f -> Vector[permalink][rdoc]

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

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



require 'matrix'

v = Vector.elements([2, 3, 5, 7, 9])
p v.elements_to_f
# => Vector[2.0, 3.0, 5.0, 7.0, 9.0]