trace()
Returns the trace (sum of diagonal elements) of the matrix.
Matrix [[7,6], [3,9]].trace => 16
# File lib/matrix.rb, line 1260 def trace Matrix.Raise ErrDimensionMismatch unless square? (0...column_count).inject(0) do |tr, i| tr + @rows[i][i] end end
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル