Project

General

Profile

Actions

Feature #15869

closed

Add abs to Matrix

Feature #15869: Add abs to Matrix

Added by bonafernando (Fernando Wolf Bona) over 6 years ago. Updated almost 6 years ago.

Status:
Closed
Target version:
-
[ruby-core:92803]

Description

While I was studying Markov Chain I had to find the maximum absolute value of the Matrix to divide the matrix in numbers from 0 to 1 to be able to make further analysis. Like this:

q = Matrix[ ... ]
max = q.to_a.flatten.map { |e| e.abs }.max
q = q / max

So this is the first of two features that I would like to contribute.

  1. Matrix.abs
  2. Matrix.max

Updated by bonafernando (Fernando Wolf Bona) over 6 years ago Actions #1

  • Tracker changed from Bug to Feature
  • Backport deleted (2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN)

Updated by bonafernando (Fernando Wolf Bona) over 6 years ago Actions #2 [ruby-core:92804]

bonafernando (Fernando Wolf Bona) wrote:

While I was studying Markov Chain I had to find the maximum absolute value of the Matrix to divide the matrix in numbers from 0 to 1 to be able to make further analysis. Like this:

q = Matrix[ ... ]
max = q.to_a.flatten.map { |e| e.abs }.max
q = q / max

So this is the first of two features that I would like to contribute.

  1. Matrix.abs
  2. Matrix.max

PR: https://github.com/ruby/ruby/pull/2199

Updated by marcandre (Marc-Andre Lafortune) over 6 years ago Actions #3 [ruby-core:92805]

  • Assignee set to marcandre (Marc-Andre Lafortune)

Updated by shevegen (Robert A. Heiler) over 6 years ago Actions #4 [ruby-core:92806]

Interesting. Not sure if this has to do with Markov Chain per se, but for storing state
through automata (in bioinformatics), hidden markov models are also used. Perhaps
extending Matrix may be beneficial in general (for ruby as a larger ecosystem;
curiously enough, the third most often downloaded gem is diff-lcs, which is probably
useful in a variety of different applications; I came to it indirectly through Hamming
and Levensthein distances).

Updated by marcandre (Marc-Andre Lafortune) almost 6 years ago Actions #5

  • Status changed from Open to Closed
Actions

Also available in: PDF Atom