Class: Okura::Matrix
- Inherits:
-
Object
- Object
- Okura::Matrix
- Defined in:
- lib/okura.rb
Instance Attribute Summary collapse
-
#lsize ⇒ Object
readonly
Returns the value of attribute lsize.
-
#rsize ⇒ Object
readonly
Returns the value of attribute rsize.
Instance Method Summary collapse
-
#cost(rid, lid) ⇒ Object
Feature.id -> Feature.id -> Int.
-
#initialize(rsize, lsize) ⇒ Matrix
constructor
A new instance of Matrix.
- #set(rid, lid, cost) ⇒ Object
Constructor Details
#initialize(rsize, lsize) ⇒ Matrix
Returns a new instance of Matrix.
374 375 376 377 |
# File 'lib/okura.rb', line 374 def initialize rsize,lsize @mat=[nil]*(lsize*rsize) @lsize,@rsize=lsize,rsize end |
Instance Attribute Details
#lsize ⇒ Object (readonly)
Returns the value of attribute lsize.
386 387 388 |
# File 'lib/okura.rb', line 386 def lsize @lsize end |
#rsize ⇒ Object (readonly)
Returns the value of attribute rsize.
385 386 387 |
# File 'lib/okura.rb', line 385 def rsize @rsize end |
Instance Method Details
#cost(rid, lid) ⇒ Object
Feature.id -> Feature.id -> Int
379 380 381 |
# File 'lib/okura.rb', line 379 def cost rid,lid @mat[rid*lsize+lid] end |
#set(rid, lid, cost) ⇒ Object
382 383 384 |
# File 'lib/okura.rb', line 382 def set(rid,lid,cost) @mat[rid*lsize+lid]=cost end |