Class: Mgmg::IR::Smith

Inherits:
Object
  • Object
show all
Defined in:
lib/mgmg/ir.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#coefObject

Returns the value of attribute coef.



27
28
29
# File 'lib/mgmg/ir.rb', line 27

def coef
  @coef
end

#denObject

Returns the value of attribute den.



27
28
29
# File 'lib/mgmg/ir.rb', line 27

def den
  @den
end

#saObject

Returns the value of attribute sa.



27
28
29
# File 'lib/mgmg/ir.rb', line 27

def sa
  @sa
end

#sub9Object

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_sObject



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