Class: Mgmg::IR::Smith
- Inherits:
-
Object
- Object
- Mgmg::IR::Smith
- Defined in:
- lib/mgmg/ir.rb
Instance Attribute Summary collapse
-
#coef ⇒ Object
Returns the value of attribute coef.
-
#den ⇒ Object
Returns the value of attribute den.
-
#sa ⇒ Object
Returns the value of attribute sa.
-
#sub9 ⇒ Object
Returns the value of attribute sub9.
Instance Method Summary collapse
- #evaluate(s, c) ⇒ Object
- #evaluate3(s, a, c) ⇒ Object
-
#initialize(sub9, coef, den, sa = nil) ⇒ Smith
constructor
A new instance of Smith.
- #initialize_copy(other) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(sub9, coef, den, sa = nil) ⇒ Smith
Returns a new instance of Smith.
24 25 26 |
# File 'lib/mgmg/ir.rb', line 24 def initialize(sub9, coef, den, sa=nil) @sub9, @coef, @den, @sa = sub9, coef, den, sa end |
Instance Attribute Details
#coef ⇒ Object
Returns the value of attribute coef.
27 28 29 |
# File 'lib/mgmg/ir.rb', line 27 def coef @coef end |
#den ⇒ Object
Returns the value of attribute den.
27 28 29 |
# File 'lib/mgmg/ir.rb', line 27 def den @den end |
#sa ⇒ Object
Returns the value of attribute sa.
27 28 29 |
# File 'lib/mgmg/ir.rb', line 27 def sa @sa end |
#sub9 ⇒ Object
Returns the value of attribute sub9.
27 28 29 |
# File 'lib/mgmg/ir.rb', line 27 def sub9 @sub9 end |
Instance Method Details
#evaluate(s, c) ⇒ Object
31 32 33 |
# File 'lib/mgmg/ir.rb', line 31 def evaluate(s, c) ((s+@sub9)*@coef).div(@den) end |
#evaluate3(s, a, c) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/mgmg/ir.rb', line 34 def evaluate3(s, a, c) if @sa==:a ((a+@sub9)*@coef).div(@den) else ((s+@sub9)*@coef).div(@den) end end |
#initialize_copy(other) ⇒ Object
28 29 30 |
# File 'lib/mgmg/ir.rb', line 28 def initialize_copy(other) @sub9, @coef, @den, @sa = other.sub9, other.coef, other.den, other.sa end |
#to_s ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/mgmg/ir.rb', line 41 def to_s if sa==:a "[#{@coef}(a+#{@sub9})/#{den}]" else "[#{@coef}(s+#{@sub9})/#{den}]" end end |