Class: Math::Finance::CurrencyMatrix
- Defined in:
- lib/ruuuby/math/finance/currency_matrix.rb
Overview
@note: temporary implementation
‣ w/ n currencies there exists ‘n² - n` exchange rates
Instance Attribute Summary collapse
-
#cached_stats ⇒ Object
readonly
Returns the value of attribute cached_stats.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#labels ⇒ Object
readonly
Returns the value of attribute labels.
Instance Method Summary collapse
- #algo_🌴_arbitrage ⇒ Object
- #calc_arbitrage_multipliers ⇒ Array
-
#calc_karps_algo_values ⇒ Float, ...
karps algo will verify the best value but NOT which vertexes are involved to create that best value.
-
#initialize(labels, data, raw_ratios = true) ⇒ CurrencyMatrix
constructor
A new instance of CurrencyMatrix.
- #karps_algorithm(target_vertex) ⇒ Float
-
#η̂! ⇒ Matrix
Self (w/ each normalized via lnₑ).
Constructor Details
#initialize(labels, data, raw_ratios = true) ⇒ CurrencyMatrix
Returns a new instance of CurrencyMatrix.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ruuuby/math/finance/currency_matrix.rb', line 19 def initialize(labels, data, raw_ratios=true) |
Instance Attribute Details
#cached_stats ⇒ Object (readonly)
Returns the value of attribute cached_stats.
17 18 19 |
# File 'lib/ruuuby/math/finance/currency_matrix.rb', line 17 def cached_stats @cached_stats end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
17 18 19 |
# File 'lib/ruuuby/math/finance/currency_matrix.rb', line 17 def data @data end |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
17 18 19 |
# File 'lib/ruuuby/math/finance/currency_matrix.rb', line 17 def labels @labels end |
Instance Method Details
#algo_🌴_arbitrage ⇒ Object
48 49 50 51 52 |
# File 'lib/ruuuby/math/finance/currency_matrix.rb', line 48 def algo_ |
#calc_arbitrage_multipliers ⇒ Array
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/ruuuby/math/finance/currency_matrix.rb', line 55 def calc_arbitrage_multipliers |
#calc_karps_algo_values ⇒ Float, ...
karps algo will verify the best value but NOT which vertexes are involved to create that best value
101 102 103 104 105 106 107 |
# File 'lib/ruuuby/math/finance/currency_matrix.rb', line 101 def calc_karps_algo_values |
#karps_algorithm(target_vertex) ⇒ Float
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/ruuuby/math/finance/currency_matrix.rb', line 114 def karps_algorithm(target_vertex) identity_matrix = ::Array.new(@len, ::Float::INFINITY_NEGATIVE) identity_matrix[target_vertex] = 0.0 identity_matrix = ::Matrix.column_vector(identity_matrix) v |
#η̂! ⇒ Matrix
Returns self (w/ each normalized via lnₑ).
38 39 40 41 42 43 44 45 46 |
# File 'lib/ruuuby/math/finance/currency_matrix.rb', line 38 def |