Class: SparseMatrix::SparseVector
- Inherits:
-
Object
- Object
- SparseMatrix::SparseVector
- Defined in:
- lib/sparse_matrix.rb
Overview
clase para guardar vector de tuplas
Instance Attribute Summary collapse
-
#i ⇒ Object
Returns the value of attribute i.
-
#j ⇒ Object
Returns the value of attribute j.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(i = 0, j = 0, v = 0) ⇒ SparseVector
constructor
A new instance of SparseVector.
- #to_s ⇒ Object
Constructor Details
#initialize(i = 0, j = 0, v = 0) ⇒ SparseVector
Returns a new instance of SparseVector.
54 55 56 57 58 |
# File 'lib/sparse_matrix.rb', line 54 def initialize(i=0,j=0,v=0) @i = i @j = j @value = v end |
Instance Attribute Details
#i ⇒ Object
Returns the value of attribute i.
59 60 61 |
# File 'lib/sparse_matrix.rb', line 59 def i @i end |
#j ⇒ Object
Returns the value of attribute j.
59 60 61 |
# File 'lib/sparse_matrix.rb', line 59 def j @j end |
#value ⇒ Object
Returns the value of attribute value.
59 60 61 |
# File 'lib/sparse_matrix.rb', line 59 def value @value end |
Instance Method Details
#to_s ⇒ Object
61 62 63 |
# File 'lib/sparse_matrix.rb', line 61 def to_s "#{@i},#{@j},#{@value}" end |