73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/mgmg/poly.rb', line 73
def inspect(fmt=->(r){"Rational(#{r.numerator}, #{r.denominator})"})
foo = []
(@mat.col_size-1).downto(0) do |c|
bar = []
(@mat.row_size-1).downto(0) do |s|
value = @mat.body[s][c]
bar << str(value, fmt)
end
buff = bar[0]
buff = "#{buff}*s+#{bar[1]}" if 1 < bar.length
2.upto(bar.length-1) do |i|
buff = "(#{buff})*s+#{bar[i]}"
end
foo << buff
end
ret = foo[0]
1.upto(foo.length-1) do |i|
ret = "(#{ret})*c+#{foo[i]}"
end
ret
end
|